1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 22:10:45 +02:00

[ticket/10271] Added comments to AJAX callbacks.

PHPBB3-10271
This commit is contained in:
Callum Macrae
2011-10-22 16:16:15 +01:00
committed by Igor Wiedler
parent 7f33897154
commit 1c5b1ede1c
3 changed files with 48 additions and 8 deletions

View File

@@ -1,7 +1,12 @@
(function($) { // Avoid conflicts with other libraries
/**
* The following callbacks are for reording forums in acp_forums. forum_down
* is triggered when a forum is moved down, and forum_up is triggered when
* a forum is moved up. It moves the row up or down, and deactivates /
* activates any up / down icons that require it (the ones at the top or bottom).
*/
phpbb.add_ajax_callback('forum_down', function(el) {
var tr = $(el).parents('tr');
if (tr.is(':first-child'))
@@ -32,7 +37,14 @@ phpbb.add_ajax_callback('forum_down', function(el) {
tr.next().find('.up').html('<a href="' + tr.data('up') + '"><img src="./images/icon_up.gif" alt="Move up" title="Move up" /></a>');
phpbb.ajaxify({selector: tr.next().find('.up').children('a')}, false, 'forum_up');
}
}).add_ajax_callback('act_deact', function(el, res) {
});
/**
* This callback replaces activate links with deactivate links and vice versa.
* It does this by replacing the text, and replacing all instances of "activate"
* in the href with "deactivate", and vice versa.
*/
phpbb.add_ajax_callback('act_deact', function(el, res) {
$(el).text(res.text);
var new_href = $(el).attr('href');
if (new_href.indexOf('deactivate') !== -1)
@@ -44,7 +56,13 @@ phpbb.add_ajax_callback('forum_down', function(el) {
new_href = new_href.replace('activate', 'deactivate')
}
$(el).attr('href', new_href);
}).add_ajax_callback('row_delete', function(el) {
});
/**
* The removes the parent row of the link or form that triggered the callback,
* and is good for stuff like the removal of forums.
*/
phpbb.add_ajax_callback('row_delete', function(el) {
var tr = $(el).parents('tr');
tr.remove();
});