diff options
author | Igor Wiedler <igor@wiedler.ch> | 2012-02-08 20:38:23 +0100 |
---|---|---|
committer | Igor Wiedler <igor@wiedler.ch> | 2012-03-31 02:09:25 +0200 |
commit | 8a0d8c0a84e119121bc9bd69c757aa4776d42acb (patch) | |
tree | eac54c4235a73d055451c0974ea45de78e8ef2a0 /phpBB/adm/style | |
parent | 7ed2cbef75e2e3e561dec00cad26870684968a3a (diff) | |
download | forums-8a0d8c0a84e119121bc9bd69c757aa4776d42acb.tar forums-8a0d8c0a84e119121bc9bd69c757aa4776d42acb.tar.gz forums-8a0d8c0a84e119121bc9bd69c757aa4776d42acb.tar.bz2 forums-8a0d8c0a84e119121bc9bd69c757aa4776d42acb.tar.xz forums-8a0d8c0a84e119121bc9bd69c757aa4776d42acb.zip |
[feature/ajax] Do not hard-code sorting images of acp_forums ordering
PHPBB3-10270
Diffstat (limited to 'phpBB/adm/style')
-rw-r--r-- | phpBB/adm/style/acp_forums.html | 8 | ||||
-rw-r--r-- | phpBB/adm/style/admin.css | 4 | ||||
-rw-r--r-- | phpBB/adm/style/ajax.js | 39 |
3 files changed, 43 insertions, 8 deletions
diff --git a/phpBB/adm/style/acp_forums.html b/phpBB/adm/style/acp_forums.html index b2b3ad6d40..048a24a328 100644 --- a/phpBB/adm/style/acp_forums.html +++ b/phpBB/adm/style/acp_forums.html @@ -500,6 +500,14 @@ </fieldset> </form> + <div class="hidden"> + <a class="template-up-img" href="#">{ICON_MOVE_UP}</a> + <span class="template-up-img-disabled">{ICON_MOVE_UP_DISABLED}</span> + + <a class="template-down-img" href="#">{ICON_MOVE_DOWN}</a> + <span class="template-down-img-disabled">{ICON_MOVE_DOWN_DISABLED}</span> + </div> + <!-- ENDIF --> <!-- INCLUDE overall_footer.html --> diff --git a/phpBB/adm/style/admin.css b/phpBB/adm/style/admin.css index 01af071766..a162d44f9d 100644 --- a/phpBB/adm/style/admin.css +++ b/phpBB/adm/style/admin.css @@ -101,6 +101,10 @@ hr { font-size: 0.85em; } +.hidden { + display: none; +} + /* General links */ a:link, a:visited { color: #105289; diff --git a/phpBB/adm/style/ajax.js b/phpBB/adm/style/ajax.js index b4385b2740..0c00efee1b 100644 --- a/phpBB/adm/style/ajax.js +++ b/phpBB/adm/style/ajax.js @@ -2,6 +2,13 @@ "use strict"; +var img_templates = { + up: $('.template-up-img'), + up_disabled: $('.template-up-img-disabled'), + down: $('.template-down-img'), + down_disabled: $('.template-down-img-disabled') +}; + /** * 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 @@ -14,18 +21,26 @@ phpbb.add_ajax_callback('forum_down', function() { if (tr.is(':first-child')) { - el.parents('span').siblings('.up').html('<a href="' + tr.attr('data-up') + '"><img src="./images/icon_up.gif" alt="Move up" title="Move up" /></a>'); - tr.next().find('.up').html('<img src="./images/icon_up_disabled.gif" alt="Move up" title="Move up" />'); + 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); + phpbb.ajaxify({ selector: el.parents('span').siblings('.up').children('a'), callback: 'forum_up' }); } + tr.insertAfter(tr.next()); + if (tr.is(':last-child')) { - el.html('<img src="./images/icon_down_disabled.gif" alt="Move down" title="Move down" />'); - tr.prev().find('.down').html('<a href="' + tr.attr('data-down') + '"><img src="./images/icon_down.gif" alt="Move down" title="Move down" /></a>'); + el.replaceWith(img_templates.down_disabled); + + var down_img = img_templates.down.clone().attr('href', tr.attr('data-down')); + tr.prev().find('.down').html(down_img); + phpbb.ajaxify({ selector: tr.prev().find('.down').children('a'), callback: 'forum_down' @@ -39,18 +54,26 @@ phpbb.add_ajax_callback('forum_up', function() { if (tr.is(':last-child')) { - el.parents('span').siblings('.down').html('<a href="' + tr.attr('data-down') + '"><img src="./images/icon_down.gif" alt="Move down" title="Move down" /></a>'); - tr.prev().find('.down').html('<img src="./images/icon_down_disabled.gif" alt="Move down" title="Move down" />'); + 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); + phpbb.ajaxify({ selector: el.parents('span').siblings('.down').children('a'), callback: 'forum_down' }); } + tr.insertBefore(tr.prev()); + if (tr.is(':first-child')) { - el.html('<img src="./images/icon_up_disabled.gif" alt="Move up" title="Move up" />'); - tr.next().find('.up').html('<a href="' + tr.attr('data-up') + '"><img src="./images/icon_up.gif" alt="Move up" title="Move up" /></a>'); + el.replaceWith(img_templates.up_disabled); + + var up_img = img_templates.up.clone().attr('href', tr.attr('data-up')); + tr.next().find('.up').html(up_img); + phpbb.ajaxify({ selector: tr.next().find('.up').children('a'), callback: 'forum_up' |