[feature/ajax] Do not hard-code sorting images of acp_forums ordering

PHPBB3-10270
This commit is contained in:
Igor Wiedler 2012-02-08 20:38:23 +01:00
parent 7ed2cbef75
commit 8a0d8c0a84
4 changed files with 47 additions and 8 deletions

View file

@ -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 -->

View file

@ -101,6 +101,10 @@ hr {
font-size: 0.85em;
}
.hidden {
display: none;
}
/* General links */
a:link, a:visited {
color: #105289;

View file

@ -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'

View file

@ -702,3 +702,7 @@ p.rules a {
line-height: 1px;
background: transparent;
}
.hidden {
display: none;
}