Skip to content

Commit

Permalink
Merge pull request #138 from ReedFamily/v2.0.6-DEV
Browse files Browse the repository at this point in the history
V2.0.6 dev
  • Loading branch information
JRSofty authored Sep 3, 2023
2 parents 74ef864 + bb4160a commit 28913e2
Show file tree
Hide file tree
Showing 18 changed files with 373 additions and 228 deletions.
7 changes: 7 additions & 0 deletions admin/css/simplemde.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions admin/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script type="text/javascript" src="../js/jquery-3.6.0/jquery.min.js"></script>
<script type="text/javascript" src="../js/bootstrap/bootstrap.min.js"></script>
<script type="text/javascript" src="js/simplemde.min.js"></script>
<script type="text/javascript" src="js/dto.js?v=GIT_HASH"></script>
<script type="text/javascript" src="js/users.js?v=GIT_HASH"></script>
<script type="text/javascript" src="js/instructors.js?v=GIT_HASH"></script>
Expand All @@ -23,6 +24,7 @@
<script type="text/javascript" src="js/site.js?v=GIT_HASH"></script>
<script src="../js/friconix/friconix.js?v=GIT_HASH"></script>
<link rel="stylesheet" href="../css/bootstrap/bootstrap.min.css" />
<link rel="stylesheet" href="css/simplemde.min.css" />
<link rel="stylesheet" href="css/site.css" />
</head>

Expand Down Expand Up @@ -65,6 +67,14 @@ <h5 class="modal-title" id="alert-editor-title">Alert bearbeitung</h5>
</div>
</div>
</div>
<div class="row">
<div class="form-group col-12">
<label for="alertLoc" class="dialog-form-label">Loc</label>
<select name="alertLoc" id="alertLoc">

</select>
</div>
</div>
<div class="row">
<div class="col-12 flex-grow-1">
<textarea class="form-control h-100" name="alertContent" id="alertContent"></textarea>
Expand Down Expand Up @@ -464,6 +474,14 @@ <h1>Fehler ...</h1>
sendDeleteAlert(id);
});
$("body").on("click", "#logout-link", logoutEvent);
var alertEditor = new SimpleMDE({ element: $("#alertContent")[0], autofocus: true, spellChecker: false, forceSync: true, autoDownloadFontAwesome: false, toolbar: false });
$("#edit-alert-dialog").on("shown.bs.modal", function () {
alertEditor.codemirror.refresh();
});
var faqEditor = new SimpleMDE({ element: $("#faqMessage")[0], autofocus: true, spellChecker: false, forceSync: true, autoDownloadFontAwesome: false, toolbar: false });
$("#edit-faq-dialog").on("shown.bs.modal", function () {
faqEditor.codemirror.refresh();
});
loadApp();
</script>

Expand Down
17 changes: 11 additions & 6 deletions admin/js/alerts.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const displayAlerts = function (response) {
);

$("#add-new-alert-button").click(function (event) {
//alertEditor.value("");
$("#alert-editor-title").text("Neue Alert");
let uname = getCookieByName("uname");
$("#alert-edit-form").trigger("reset");
Expand All @@ -65,16 +66,18 @@ const newAlertEvent = function (event) {
try {
validateAlertEditorForm(true);
} catch (e) {
console.log(e);
let item = e.err;
$(item).addClass("erroredFormControl");
return;
}
var data = new Object();
data.createdBy = $("#alertCreatedBy").val();
data.createdDate = new Date().toISOString().slice(0, 19).replace("T", " ");
data.level = $("input[name='alertLevel']:checked").val();
data.location = "home";
data.location = $("#alertLoc").val();
data.permanent = 1;
data.message = $("#alertContent").val();
data.message = alertEditor.value(); // $("#alertContent").val();

var url = "../backend/rest.php?apiFunc=newMsg";

Expand Down Expand Up @@ -107,7 +110,7 @@ const validateAlertEditorForm = function (isNew) {
if (isEmpty(uname)) {
throw { err: "#alertCreatedBy" };
}
var content = $("#alertContent").val();
var content = alertEditor.value();
if (isEmpty(content)) {
throw { err: "#alertContent" };
}
Expand All @@ -131,9 +134,9 @@ const updateAlertEvent = function (event) {
data.createdBy = $("#alertCreatedBy").val();
data.createdDate = $("#alertCreatedDate").val();
data.level = $("input[name='alertLevel']:checked").val();
data.location = "home";
data.location = $("#alertLoc").val();
data.permanent = 1;
data.message = $("#alertContent").val();
data.message = alertEditor.value();

var url = "../backend/rest.php?apiFunc=modMsg";
$.post(url, data, function (res) {
Expand Down Expand Up @@ -210,12 +213,14 @@ const editMessage = function (lnk) {
$("#alert-edit-form").trigger("reset");
$("#alertId").val(res.message.id);
$("#alertCreatedBy").val(res.message.createdBy);
$("#alertContent").val(res.message.message);
alertEditor.value(res.message.message);
//$("#alertContent").val(res.message.message);
$("#alertCreatedDate").val(res.message.createdDate);
var key = "#alert-" + res.message.level;
$(key).prop("checked", true).trigger("change");
$("#alert-editor-title").text("Bearbeitung Alert");
$("#edit-alert-dialog").modal("show");
$("#alertLoc").val(res.message.location).change();
} else {
console.log(res);
}
Expand Down
Loading

0 comments on commit 28913e2

Please sign in to comment.