From 8a0d8c0a84e119121bc9bd69c757aa4776d42acb Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Wed, 8 Feb 2012 20:38:23 +0100 Subject: [PATCH] [feature/ajax] Do not hard-code sorting images of acp_forums ordering PHPBB3-10270 --- phpBB/adm/style/acp_forums.html | 8 +++++ phpBB/adm/style/admin.css | 4 +++ phpBB/adm/style/ajax.js | 39 ++++++++++++++++++++----- phpBB/styles/prosilver/theme/common.css | 4 +++ 4 files changed, 47 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 @@ + + 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('Move up'); - tr.next().find('.up').html('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('Move down'); - tr.prev().find('.down').html('Move down'); + 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('Move down'); - tr.prev().find('.down').html('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('Move up'); - tr.next().find('.up').html('Move up'); + 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' diff --git a/phpBB/styles/prosilver/theme/common.css b/phpBB/styles/prosilver/theme/common.css index d1fc1fa3e3..3b0e7899cb 100644 --- a/phpBB/styles/prosilver/theme/common.css +++ b/phpBB/styles/prosilver/theme/common.css @@ -702,3 +702,7 @@ p.rules a { line-height: 1px; background: transparent; } + +.hidden { + display: none; +}