aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/adm/style/ajax.js
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2012-12-20 22:51:38 +0100
committerJoas Schilling <nickvergessen@gmx.de>2012-12-20 22:51:38 +0100
commite34b8ed094affdaedbf457406c98b29c125e5d8b (patch)
tree7cc51ba4ead71cb48a76747770edf622f8fe85f9 /phpBB/adm/style/ajax.js
parent70a409d4b5411bf9e50a70d1cf3855b686304bbe (diff)
parentd11829567603e6ac37170b919efc4659b2be20cb (diff)
downloadforums-e34b8ed094affdaedbf457406c98b29c125e5d8b.tar
forums-e34b8ed094affdaedbf457406c98b29c125e5d8b.tar.gz
forums-e34b8ed094affdaedbf457406c98b29c125e5d8b.tar.bz2
forums-e34b8ed094affdaedbf457406c98b29c125e5d8b.tar.xz
forums-e34b8ed094affdaedbf457406c98b29c125e5d8b.zip
Merge branch 'develop' of https://github.com/phpbb/phpbb3 into feature/softdelete-1-permission-rebase
* 'develop' of https://github.com/phpbb/phpbb3: (544 commits) [feature/events] Fix improperly named event in documentation [feature/events] Fix alphabetization of events [feature/events] Put events in alphabetical order [feature/events] Make EVENTS.md lowercase [ticket/11285] Use more granularity in dependency checks in compress test [ticket/10880] The m_approve permisson no longer implies f_noapprove. [ticket/10803] Show failure message until user dismisses it [ticket/10954] Add missing semi-colon [ticket/10954] Make sure to mark subforums unread and add small fixes [feature/events] Use ` to escape HTML tags in markdown [feature/events] Remove HTML tags from markdown so they don't get parsed [ticket/10954] Miscellaneous coding fixes [feature/events] Remove extraneous space [feature/events] Add markdown template event documentation file [feature/events] forumlist_body_last_post_title_after -> _prepend (subsilver2) [feature/events] Fix overall_footer_end -> overall_footer_after (subsilver2) [feature/events] Fix typo in event name [ticket/10763] Use self when calling get_extension() in filespec class [feature/events] Fix more subsilver2 events [feature/events] Fix some subsilver2 events ... Conflicts: phpBB/install/database_update.php phpBB/posting.php
Diffstat (limited to 'phpBB/adm/style/ajax.js')
-rw-r--r--phpBB/adm/style/ajax.js84
1 files changed, 53 insertions, 31 deletions
diff --git a/phpBB/adm/style/ajax.js b/phpBB/adm/style/ajax.js
index 12541cb057..3ccb368665 100644
--- a/phpBB/adm/style/ajax.js
+++ b/phpBB/adm/style/ajax.js
@@ -10,76 +10,98 @@ var img_templates = {
};
/**
- * 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 /
+ * The following callbacks are for reording items. row_down
+ * is triggered when an item is moved down, and row_up is triggered when
+ * an item 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() {
+phpbb.add_ajax_callback('row_down', function() {
var el = $(this),
- tr = el.parents('tr');
-
+ tr = el.parents('tr'),
+ tr_swap = tr.next();
+
+ /*
+ * If the element was the first one, we have to:
+ * - Add the up-link to the row we moved
+ * - Remove the up-link on the next row
+ */
if (tr.is(':first-child'))
{
var up_img = img_templates.up.clone().attr('href', tr.attr('data-up'));
- el.parents('span').siblings('.up').html(up_img);
-
- tr.next().find('.up').html(img_templates.up_disabled);
+ tr.find('.up').html(up_img);
phpbb.ajaxify({
- selector: el.parents('span').siblings('.up').children('a'),
- callback: 'forum_up',
+ selector: tr.find('.up').children('a'),
+ callback: 'row_up',
overlay: false
});
+
+ tr_swap.find('.up').html(img_templates.up_disabled.clone());
}
- tr.insertAfter(tr.next());
+ tr.insertAfter(tr_swap);
+ /*
+ * As well as:
+ * - Remove the down-link on the moved row, if it is now the last row
+ * - Add the down-link to the next row, if it was the last row
+ */
if (tr.is(':last-child'))
{
- el.replaceWith(img_templates.down_disabled);
+ tr.find('.down').html(img_templates.down_disabled.clone());
- var down_img = img_templates.down.clone().attr('href', tr.attr('data-down'));
- tr.prev().find('.down').html(down_img);
+ var down_img = img_templates.down.clone().attr('href', tr_swap.attr('data-down'));
+ tr_swap.find('.down').html(down_img);
phpbb.ajaxify({
- selector: tr.prev().find('.down').children('a'),
- callback: 'forum_down',
+ selector: tr_swap.find('.down').children('a'),
+ callback: 'row_down',
overlay: false
});
}
});
-phpbb.add_ajax_callback('forum_up', function() {
+phpbb.add_ajax_callback('row_up', function() {
var el = $(this),
- tr = el.parents('tr');
-
+ tr = el.parents('tr'),
+ tr_swap = tr.prev();
+
+ /*
+ * If the element was the last one, we have to:
+ * - Add the down-link to the row we moved
+ * - Remove the down-link on the next row
+ */
if (tr.is(':last-child'))
{
var down_img = img_templates.down.clone().attr('href', tr.attr('data-down'));
- el.parents('span').siblings('.down').html(down_img);
-
- tr.prev().find('.down').html(img_templates.down_disabled);
+ tr.find('.down').html(down_img);
phpbb.ajaxify({
- selector: el.parents('span').siblings('.down').children('a'),
- callback: 'forum_down',
+ selector: tr.find('.down').children('a'),
+ callback: 'row_down',
overlay: false
});
+
+ tr_swap.find('.down').html(img_templates.down_disabled.clone());
}
- tr.insertBefore(tr.prev());
+ tr.insertBefore(tr_swap);
+ /*
+ * As well as:
+ * - Remove the up-link on the moved row, if it is now the first row
+ * - Add the up-link to the previous row, if it was the first row
+ */
if (tr.is(':first-child'))
{
- el.replaceWith(img_templates.up_disabled);
+ tr.find('.up').html(img_templates.up_disabled.clone());
- var up_img = img_templates.up.clone().attr('href', tr.attr('data-up'));
- tr.next().find('.up').html(up_img);
+ var up_img = img_templates.up.clone().attr('href', tr_swap.attr('data-up'));
+ tr_swap.find('.up').html(up_img);
phpbb.ajaxify({
- selector: tr.next().find('.up').children('a'),
- callback: 'forum_up',
+ selector: tr_swap.find('.up').children('a'),
+ callback: 'row_up',
overlay: false
});
}