You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
isso/isso/templates/admin.js

37 lines
1.0 KiB

function initialize() {
$('div.buttons > a').forEach(function(item) {
var node = $(item).parent().parent().parent().parent()[0]
var path = node.getAttribute("data-path");
var id = node.getAttribute("data-id");
if (item.text == 'Approve') {
$(item).on('click', function(event) {
$.ajax('PUT', '/1.0/' + encodeURIComponent(path) + '/' + id + '/approve')
.then(function(status, rv) {
// $(node).detach();
$('h2.recent + span').after(node);
});
event.stop();
});
} else {
$(item).on('click', function(event) {
if (confirm("RLY?") == true) {
$.ajax('DELETE', '/1.0/' + encodeURIComponent(path) + '/' + id)
.then(function() {
$(node).remove()
});
};
event.stop();
});
};
});
};
$.domReady(function() {
initialize();
});