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/js/admin.js

42 lines
1.1 KiB

/* Copyright 2012, Martin Zimmermann <info@posativ.org>. All rights reserved.
* License: BSD Style, 2 clauses. See isso/__init__.py.
*/
var isso = isso || {};
function initialize() {
$('div.buttons > a').forEach(function(item) {
var node = $(item).parent().parent().parent().parent()[0],
id = node.getAttribute("data-id");
isso.path = node.getAttribute("data-path");
if (item.text == 'Approve') {
$(item).on('click', function(event) {
isso.approve(id, function(status, rv) {
$(node).prependTo($('#approved'));
$('.approve', node).remove();
});
event.stop();
});
} else {
$(item).on('click', function(event) {
if (confirm("RLY?") == true) {
isso.remove(id, function(status, rv) {
$(node).remove()
});
};
event.stop();
});
};
});
};
$.domReady(function() {
initialize();
});