diff options
author | mistic100 <mistic@piwigo.org> | 2012-01-10 20:50:25 +0000 |
---|---|---|
committer | mistic100 <mistic@piwigo.org> | 2012-01-10 20:50:25 +0000 |
commit | e349749d423b042afe7ce6f8dc006544d9e6710a (patch) | |
tree | ec408aa525b52dc181e37f1341be6763693d2c5b /admin/themes/default/template/configuration.tpl | |
parent | 758f9dd195e025c4140eab7d4c0fd8f8ba28711a (diff) |
bug:2540 When default photos order is only by rank, failure outside albums
define a default order_by + some javascript for limit number of fields
git-svn-id: http://piwigo.org/svn/trunk@12872 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | admin/themes/default/template/configuration.tpl | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/admin/themes/default/template/configuration.tpl b/admin/themes/default/template/configuration.tpl index f426eaca9..982e20357 100644 --- a/admin/themes/default/template/configuration.tpl +++ b/admin/themes/default/template/configuration.tpl @@ -115,24 +115,44 @@ </li> {if !$ORDER_BY_IS_CUSTOM} -{footer_script require='jquery'}{literal} +{footer_script require='jquery'} +// counters for displaying of addFilter link +fields = {$main.order_by|@count}; max_fields = {$main.order_field_options|@count}; max_fields--; + +{literal} +function updateAddFilterLink() { + if (fields >= max_fields) { + $('.addFilter').css('display', 'none'); + } else { + $('.addFilter').css('display', ''); + } +} + +function updateRemoveFilterTrigger() { + $(".removeFilter").click(function () { + $(this).parent('span.filter').remove(); + fields--; + updateAddFilterLink(); + }); +} + jQuery(document).ready(function () { $('.addFilter').click(function() { rel = $(this).attr('rel'); $(this).prev('span.filter').clone().insertBefore($(this)); $(this).prev('span.filter').children('select[name="order_by_field[]"]').val(''); $(this).prev('span.filter').children('select[name="order_by_direction[]"]').val('ASC'); - - $(".removeFilter").click(function () { - $(this).parent('span.filter').remove(); - }); + + fields++; + updateAddFilterLink(); + updateRemoveFilterTrigger(); }); - $(".removeFilter").click(function () { - $(this).parent('span.filter').remove(); - }); + updateRemoveFilterTrigger(); + updateAddFilterLink(); }); -{/literal}{/footer_script} +{/literal} +{/footer_script} {/if} </ul> </fieldset> |