diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2012-11-15 18:21:38 +0100 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2012-11-15 18:21:38 +0100 |
commit | 4db6ded8f0bccdd8684bd869d4779bd98bff69de (patch) | |
tree | f9e5c48403a186c95be64ef284efe07a0d91678a /phpBB/adm | |
parent | 60d831c392a78fceb4ae737a3141573c4b2427d8 (diff) | |
parent | ceae276cd6fb82ed2b4403cea0cb54f3be5a5b6d (diff) | |
download | forums-4db6ded8f0bccdd8684bd869d4779bd98bff69de.tar forums-4db6ded8f0bccdd8684bd869d4779bd98bff69de.tar.gz forums-4db6ded8f0bccdd8684bd869d4779bd98bff69de.tar.bz2 forums-4db6ded8f0bccdd8684bd869d4779bd98bff69de.tar.xz forums-4db6ded8f0bccdd8684bd869d4779bd98bff69de.zip |
Merge branch 'develop' of https://github.com/phpbb/phpbb3 into ticket/10411-2
* 'develop' of https://github.com/phpbb/phpbb3:
[ticket/11198] Remove additional asterix as /** is doc-block only
[ticket/11200] Add a reminder comment.
[ticket/11200] Make cache available during container construction
[ticket/11199] Match cache purge container files against container_*
[ticket/11199] Purge dumped container correctly on cache purge.
[ticket/11199] Revert merge of 'marc1706/ticket/11199' into develop
[ticket/11199] Cache purge does not remove dumped container
[ticket/11198] Store the swapping partners in vars and simplify the logic
[ticket/11198] Correctly set links after an item is moved up/down with AJAX
[ticket/11197] Prefix the css classes for the small arrow with "arrow"
[ticket/10879] Remove arrow icon from attachment link in editor
[ticket/11195] Condense logic, remove improperly formatted if()
[ticket/11194] Service tag data is stored in an array so access it correctly
[ticket/11193] Instantiate a single collection_pass for all collections
[ticket/11190-develop] Functional tests purge cache before running.
[ticket/11190] Functional tests purge cache before running.
Diffstat (limited to 'phpBB/adm')
-rw-r--r-- | phpBB/adm/style/acp_forums.html | 8 | ||||
-rw-r--r-- | phpBB/adm/style/ajax.js | 84 |
2 files changed, 57 insertions, 35 deletions
diff --git a/phpBB/adm/style/acp_forums.html b/phpBB/adm/style/acp_forums.html index cb9cae6c0d..9a3706c2f0 100644 --- a/phpBB/adm/style/acp_forums.html +++ b/phpBB/adm/style/acp_forums.html @@ -454,12 +454,12 @@ <td style="vertical-align: top; width: 100px; text-align: right; white-space: nowrap;"> <!-- IF forums.S_FIRST_ROW && not forums.S_LAST_ROW --> <span class="up">{ICON_MOVE_UP_DISABLED}</span> - <span class="down"><a href="{forums.U_MOVE_DOWN}" data-ajax="forum_down" data-overlay="false">{ICON_MOVE_DOWN}</a></span> + <span class="down"><a href="{forums.U_MOVE_DOWN}" data-ajax="row_down" data-overlay="false">{ICON_MOVE_DOWN}</a></span> <!-- ELSEIF not forums.S_FIRST_ROW && not forums.S_LAST_ROW --> - <span class="up"><a href="{forums.U_MOVE_UP}" data-ajax="forum_up" data-overlay="false">{ICON_MOVE_UP}</a></span> - <span class="down"><a href="{forums.U_MOVE_DOWN}" data-ajax="forum_down" data-overlay="false">{ICON_MOVE_DOWN}</a></span> + <span class="up"><a href="{forums.U_MOVE_UP}" data-ajax="row_up" data-overlay="false">{ICON_MOVE_UP}</a></span> + <span class="down"><a href="{forums.U_MOVE_DOWN}" data-ajax="row_down" data-overlay="false">{ICON_MOVE_DOWN}</a></span> <!-- ELSEIF forums.S_LAST_ROW && not forums.S_FIRST_ROW --> - <span class="up"><a href="{forums.U_MOVE_UP}" data-ajax="forum_up" data-overlay="false">{ICON_MOVE_UP}</a></span> + <span class="up"><a href="{forums.U_MOVE_UP}" data-ajax="row_up" data-overlay="false">{ICON_MOVE_UP}</a></span> <span class="down">{ICON_MOVE_DOWN_DISABLED}</span> <!-- ELSE --> <span class="up">{ICON_MOVE_UP_DISABLED}</span> diff --git a/phpBB/adm/style/ajax.js b/phpBB/adm/style/ajax.js index 12541cb057..a3a77df89b 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); } - 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); - 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); } - 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); - 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 }); } |