GitLab wird am Donnerstag, den 27. Januar, zwischen 08:00 und 12:00 Uhr wegen wichtigen Wartungsarbeiten nicht zur Verfügung stehen.

Commit d96bbc85 authored by Marlon Georg Lindner's avatar Marlon Georg Lindner
Browse files

adjusted motd html; added confirm modal to delete motds

parent 0f4f93c8
......@@ -2234,7 +2234,11 @@
"editPreview": "Vorschau",
"editSave": "Speichern",
"errorText": "Bitte alle Pflichtfelder * ausfüllen!",
"mandatory": "Pflichtfelder *"
"mandatory": "* Pflichtfelder ",
"confirmDeleteTitle": "Nachricht löschen",
"confirmDeleteBody": "Willst du die Nachricht wirklich löschen? Dies kann nicht rückgängig gemacht werden.",
"confirmDeleteConfirm": "Bestätigen",
"confirmDeleteDismiss": "Abbrechen"
}
},
"access-denied": {
......
<template name="admin_messageOfTheDay">
{{> motdsPreviewModal}}
{{> motdAddAndEdit}}
{{> confirmDeleteMessage}}
<div class="content-header">
<h1>
{{_ "admin.messageOfTheDay"}}
......@@ -10,7 +11,7 @@
{{_ "admin.motd.create"}}
</button>
<div class="content reactive-table">
<table class="table">
<table class="table table-striped">
<tr>
<th>{{_ "admin.motd.title"}}</th>
<th>{{_ "admin.motd.location"}}</th>
......@@ -27,8 +28,8 @@
<td>{{this.dateCreated}}</td>
<td>{{this.publishDate}}</td>
<td>{{this.expirationDate}}</td>
<td><span id="deleteMessage"><i class='fas fa-ban'></i></span>
<span id="editMessage"><i class="fas fa-edit"></i></span>
<td><span id="editMessage"><i class="fas fa-edit"></i></span>
<span id="deleteMessage"><i class='fas fa-ban'></i></span>
</td>
</tr>
{{/each}}
......@@ -90,7 +91,7 @@
<div id="subject" class="col-lg-6 cardtext editorElement">
<form class="form-group subjectEditor">
<input value="{{getTitle}}" required class="form-control" id="subjectEditor" name="content"
placeholder="{{_ "admin.motd.editInputTitle"}}*"
placeholder="*{{_ "admin.motd.editInputTitle"}}"
tabindex="1"></form>
<br>
</div>
......@@ -100,7 +101,7 @@
<div id="markdeepEditorContent">
<form>
<textarea value="{{getContent}}" required id="contentEditor" class="card" name="content"
placeholder="{{_ "admin.motd.editInputText"}}*"
placeholder="*{{_ "admin.motd.editInputText"}}"
data-provide="markdown" rows="10" tabindex="4"></textarea>
</form>
</div>
......@@ -112,7 +113,7 @@
<input type="date" class="form-group subjectEditor" id="publishDate"
placeholder="Von" value="{{getPublishDate}}">
<br>
<label>{{_ "admin.motd.editExpiration"}}*</label>
<label>*{{_ "admin.motd.editExpiration"}}</label>
<input type="date" class="form-group subjectEditor" required id="expirationDate"
placeholder="Bis" value="{{getExpirationDate}}">
<br>
......@@ -141,3 +142,34 @@
</div>
<!-- /.modal -->
</template>
<template name="confirmDeleteMessage">
<div class="modal fade" id="confirmDeleteMessage" tabindex="-1" role="dialog"
aria-labelledby="confirmDeleteMessage">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<span class="modal-icon">
<i class="fas fa-exclamation"></i>
</span>
{{> mainModalItemCloseIcon}}
<h4 id="confirmDeleteMessageTitle" class="modal-title">{{_ "admin.motd.confirmDeleteTitle"}}
</h4>
</div>
<div class="modal-body">
{{_ "admin.motd.confirmDeleteBody"}}
</div>
<div class="modal-footer">
<button id="confirmDeleteConfirm" class="btn btn-raised btn-danger pull-right">{{_
"admin.motd.confirmDeleteConfirm"}}</button>
<button id="confirmDeleteDismiss" class="btn btn-raised btn-default pull-left"
data-dismiss="modal">{{_
"admin.motd.confirmDeleteDismiss"}}</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
</template>
......@@ -2,6 +2,7 @@ import "./messageOfTheDay.html";
import "./messageOfTheDay.scss";
import {MessageOfTheDay} from "../../../api/subscriptions/messageOfTheDay";
import {ReactiveDict} from 'meteor/reactive-dict';
import {Session} from "meteor/session";
let message = new ReactiveDict();
let isEdit;
......@@ -52,8 +53,8 @@ Template.admin_messageOfTheDay.helpers({
});
Template.admin_messageOfTheDay.events({
'click #deleteMessage': function () {
document.getElementById(this._id).remove();
Meteor.call('removeMessageOfTheDay', this._id);
Session.set('deleteMessageId', this._id);
$('#confirmDeleteMessage').modal('show');
},
'click #editMessage': function () {
isEdit = true;
......@@ -75,6 +76,14 @@ Template.admin_messageOfTheDay.events({
}
});
Template.confirmDeleteMessage.events({
'click #confirmDeleteConfirm': function () {
document.getElementById(Session.get('deleteMessageId')).remove();
Meteor.call('removeMessageOfTheDay', Session.get('deleteMessageId'));
$('#confirmDeleteMessage').modal('hide');
}
});
Template.motdAddAndEdit.helpers({
getTitle: function () {
return message.get('subject');
......
......@@ -17,7 +17,7 @@ tr {
}
#modalFooter {
height: 10px;
height: 40px;
}
#modalContent {
......
......@@ -13,13 +13,13 @@
</div>
<div class="modal-body" id="modalContent">
<table class="table">
<table class="table table-striped">
<tbody>
{{#each getMessages}}
<tr id="{{this._id}}">
<td>
<h4>{{#markdeep}}{{this.subject}}{{/markdeep}}</h4>
<h2>{{#markdeep}}{{this.subject}}{{/markdeep}}</h2>
<p>{{#markdeep}}{{this.content}}{{/markdeep}}</p>
<button type="button" id="acceptButton" class="button btn-success btn btn-lg btn-raised">{{_ "messageOfTheDay.confirm"}}</button>
</td>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment