Changes of the last few months including restructuring system from using only ranks to permissions
This commit is contained in:
27
assets/js/admin_users.js
Normal file
27
assets/js/admin_users.js
Normal file
@@ -0,0 +1,27 @@
|
||||
function showDeleteModal(userID, username) {
|
||||
const modal = $(`
|
||||
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalLabel">Bestätigung</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<b>Bist du dir sicher, dass du den Account von ${username} löschen möchtest?</b>
|
||||
Die Account-Daten werden für eine gewisse Zeit noch auf dem Server gespeichert, allerdings wird der Nutzer nicht mehr dazu in der Lage sein, sich in seinen Account einzuloggen, und somit auch keine Posts, Kommentare etc. verfassen können.
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary">Account löschen</button>
|
||||
<button type="button" class="btn btn-primary" data-dismiss="modal">Abbruch</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
$('body').append(modal);
|
||||
|
||||
modal.modal('show');
|
||||
}
|
@@ -219,6 +219,26 @@ $(function () {
|
||||
});
|
||||
});
|
||||
|
||||
Number.prototype.pad = function(size) {
|
||||
let s = String(this);
|
||||
while(s.length < (size || 2)) s = "0" + s;
|
||||
return s;
|
||||
};
|
||||
|
||||
function convertDate(dbDate) {
|
||||
const date = new Date(dbDate);
|
||||
console.log(date);
|
||||
|
||||
const day = date.getDate().pad();
|
||||
const month = (date.getMonth() + 1).pad();
|
||||
const year = date.getFullYear();
|
||||
|
||||
const hour = date.getHours().pad();
|
||||
const minutes = date.getMinutes().pad();
|
||||
|
||||
return `${day}.${month}.${year} ${hour}:${minutes}`;
|
||||
}
|
||||
|
||||
function getPostData() {
|
||||
const postID = $('#postID').val();
|
||||
$.ajax({
|
||||
@@ -234,7 +254,9 @@ function getPostData() {
|
||||
$('#postUrl').val(result.postData.postUrl);
|
||||
$('#postCategory').val(result.postData.postCategoryID);
|
||||
switchCategory();
|
||||
$('#postPublishDate').val(result.postData.postPublishDate);
|
||||
|
||||
$('#postPublishDate').data('DateTimePicker').setValue(convertDate(result.postData.postPublishDate));
|
||||
// $('#postPublishDate').val(convertDate(result.postData.postPublishDate));
|
||||
$('#uploadedImage').val(result.postData.postImage);
|
||||
$('.img-container').css('background-image', 'url(' + result.postData.postImage + ')');
|
||||
|
||||
|
@@ -90,4 +90,16 @@ $(function () {
|
||||
}
|
||||
`)
|
||||
});
|
||||
});
|
||||
|
||||
const chk = $('input[type="checkbox"]');
|
||||
|
||||
chk.each(function () {
|
||||
const v = $(this).is(':checked');
|
||||
$(this).after(`<input type="hidden" name="${$(this).attr('rel')}" value="${v.toString()}" />`);
|
||||
});
|
||||
|
||||
chk.change(function () {
|
||||
const v = $(this).is(':checked');
|
||||
$(this).next('input[type="hidden"]').val(v.toString());
|
||||
});
|
28
assets/js/user-edit.js
Normal file
28
assets/js/user-edit.js
Normal file
@@ -0,0 +1,28 @@
|
||||
$('.group-all').change(function () {
|
||||
const v = $(this).is(':checked');
|
||||
|
||||
const items = $(this).parent().next('ul').children();
|
||||
items.each(function () {
|
||||
$(this).find('input[type=checkbox]').prop('checked', v);
|
||||
});
|
||||
});
|
||||
|
||||
$('input[type=checkbox]:not(.group-all)').change(function () {
|
||||
const groupAll = $(this).parent().parent().prev('h4').find('.group-all');
|
||||
if(!$(this).is(':checked')) {
|
||||
groupAll.prop('checked', false);
|
||||
} else {
|
||||
const siblings = $(this).parent().siblings().find('input[type=checkbox]:not(:checked)');
|
||||
if(siblings.length === 0) {
|
||||
groupAll.prop('checked', true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function checkSiblings() {
|
||||
|
||||
}
|
||||
|
||||
$(function () {
|
||||
|
||||
});
|
Reference in New Issue
Block a user