mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-11 05:48:51 +00:00
[feature/ajax] Do not hard-code sorting images of acp_forums ordering
PHPBB3-10270
This commit is contained in:
parent
7ed2cbef75
commit
8a0d8c0a84
4 changed files with 47 additions and 8 deletions
|
@ -500,6 +500,14 @@
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</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 -->
|
<!-- ENDIF -->
|
||||||
|
|
||||||
<!-- INCLUDE overall_footer.html -->
|
<!-- INCLUDE overall_footer.html -->
|
||||||
|
|
|
@ -101,6 +101,10 @@ hr {
|
||||||
font-size: 0.85em;
|
font-size: 0.85em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
/* General links */
|
/* General links */
|
||||||
a:link, a:visited {
|
a:link, a:visited {
|
||||||
color: #105289;
|
color: #105289;
|
||||||
|
|
|
@ -2,6 +2,13 @@
|
||||||
|
|
||||||
"use strict";
|
"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
|
* 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
|
* 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'))
|
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>');
|
var up_img = img_templates.up.clone().attr('href', tr.attr('data-up'));
|
||||||
tr.next().find('.up').html('<img src="./images/icon_up_disabled.gif" alt="Move up" title="Move up" />');
|
el.parents('span').siblings('.up').html(up_img);
|
||||||
|
|
||||||
|
tr.next().find('.up').html(img_templates.up_disabled);
|
||||||
|
|
||||||
phpbb.ajaxify({
|
phpbb.ajaxify({
|
||||||
selector: el.parents('span').siblings('.up').children('a'),
|
selector: el.parents('span').siblings('.up').children('a'),
|
||||||
callback: 'forum_up'
|
callback: 'forum_up'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
tr.insertAfter(tr.next());
|
tr.insertAfter(tr.next());
|
||||||
|
|
||||||
if (tr.is(':last-child'))
|
if (tr.is(':last-child'))
|
||||||
{
|
{
|
||||||
el.html('<img src="./images/icon_down_disabled.gif" alt="Move down" title="Move down" />');
|
el.replaceWith(img_templates.down_disabled);
|
||||||
tr.prev().find('.down').html('<a href="' + tr.attr('data-down') + '"><img src="./images/icon_down.gif" alt="Move down" title="Move down" /></a>');
|
|
||||||
|
var down_img = img_templates.down.clone().attr('href', tr.attr('data-down'));
|
||||||
|
tr.prev().find('.down').html(down_img);
|
||||||
|
|
||||||
phpbb.ajaxify({
|
phpbb.ajaxify({
|
||||||
selector: tr.prev().find('.down').children('a'),
|
selector: tr.prev().find('.down').children('a'),
|
||||||
callback: 'forum_down'
|
callback: 'forum_down'
|
||||||
|
@ -39,18 +54,26 @@ phpbb.add_ajax_callback('forum_up', function() {
|
||||||
|
|
||||||
if (tr.is(':last-child'))
|
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>');
|
var down_img = img_templates.down.clone().attr('href', tr.attr('data-down'));
|
||||||
tr.prev().find('.down').html('<img src="./images/icon_down_disabled.gif" alt="Move down" title="Move down" />');
|
el.parents('span').siblings('.down').html(down_img);
|
||||||
|
|
||||||
|
tr.prev().find('.down').html(img_templates.down_disabled);
|
||||||
|
|
||||||
phpbb.ajaxify({
|
phpbb.ajaxify({
|
||||||
selector: el.parents('span').siblings('.down').children('a'),
|
selector: el.parents('span').siblings('.down').children('a'),
|
||||||
callback: 'forum_down'
|
callback: 'forum_down'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
tr.insertBefore(tr.prev());
|
tr.insertBefore(tr.prev());
|
||||||
|
|
||||||
if (tr.is(':first-child'))
|
if (tr.is(':first-child'))
|
||||||
{
|
{
|
||||||
el.html('<img src="./images/icon_up_disabled.gif" alt="Move up" title="Move up" />');
|
el.replaceWith(img_templates.up_disabled);
|
||||||
tr.next().find('.up').html('<a href="' + tr.attr('data-up') + '"><img src="./images/icon_up.gif" alt="Move up" title="Move up" /></a>');
|
|
||||||
|
var up_img = img_templates.up.clone().attr('href', tr.attr('data-up'));
|
||||||
|
tr.next().find('.up').html(up_img);
|
||||||
|
|
||||||
phpbb.ajaxify({
|
phpbb.ajaxify({
|
||||||
selector: tr.next().find('.up').children('a'),
|
selector: tr.next().find('.up').children('a'),
|
||||||
callback: 'forum_up'
|
callback: 'forum_up'
|
||||||
|
|
|
@ -702,3 +702,7 @@ p.rules a {
|
||||||
line-height: 1px;
|
line-height: 1px;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue