123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- const CreateMsgRouter = {
- template: `
- <div class="card om-card">
- <h4>Neue Nachricht erstellen</h4>
- <form class="new-msg-form" @submit.prevent=createMsg>
- <div class="form-group bmd-form-group">
- <label class="bmd-label-floating">Betreff</label>
- <input type="text" class="form-control" id="subject" value="WICHTIG!">
- </div>
- <div class="form-group bmd-form-group">
- <label class="bmd-label-floating">Tags</label>
- <input type="text" class="form-control" id="tag" value="#efi">
- </div>
- <div class="form-group">
- <label class="bmd-label-floating">Nachricht</label>
- <textarea class="form-control" id="message" rows="5">Nachricht</textarea>
- </div>
- <div class="form-group">
- <label class="bmd-label-floating">User</label>
- <input type="text" class="form-control" id="user" value="Dito27">
- </div>
- <button class="btn btn-default"><a @click="$router.go(-1)">ABBRECHEN </a></button>
- <button type="submit" class="btn btn-raised om-btn">SENDEN</button>
- </form>
- </div>
- `,
- data: function () {
- return {};
- },
- methods: {
- createMsg: function() {
- var subject=$("#subject").val();
- var message=$("#message").val();
- var tag=$("#tag").val();
- var user=$("#user").val();
- console.log ("Message Created: "+tag+" "+message+" "+user);
- $.ajax ({ url: "api/createMsg", data: {sub: subject, mess: message, use: user, ta: tag}, method: "POST" }) .done (have_result) .fail (have_error);
- function have_result (res) {
- console.log (res);
- }
- function have_error (err) {
- console.log ("error: " + err.responseText);
- console.log (err);
- }
- },
- },
- mounted: function() {
- if ($(this).bootstrapMaterialDesign)
- $(this).bootstrapMaterialDesign();
- },
- };
|