aboutsummaryrefslogtreecommitdiffstats
path: root/admin/themes
diff options
context:
space:
mode:
authorpatdenice <patdenice@piwigo.org>2011-03-10 11:36:14 +0000
committerpatdenice <patdenice@piwigo.org>2011-03-10 11:36:14 +0000
commitcefb33dffe06b35760b3e8b22345df742e2de255 (patch)
treebbe70d4972ce3f735f3db89f3c481affa1424545 /admin/themes
parent59b87ac06b92aafaee841ec8fdabb3cef8afb956 (diff)
feature:2219
Sort available plugins without reloading the whole page git-svn-id: http://piwigo.org/svn/trunk@9598 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'admin/themes')
-rw-r--r--admin/themes/default/template/plugins_new.tpl28
1 files changed, 24 insertions, 4 deletions
diff --git a/admin/themes/default/template/plugins_new.tpl b/admin/themes/default/template/plugins_new.tpl
index 425c8338a..f4ac1ab45 100644
--- a/admin/themes/default/template/plugins_new.tpl
+++ b/admin/themes/default/template/plugins_new.tpl
@@ -1,4 +1,16 @@
-{footer_script require='jquery.effects.blind'}{literal}
+{combine_script id='jquery.sort' path='themes/default/js/plugins/jquery.sort.js'}
+
+{footer_script require='jquery.effects.blind,jquery.sort'}{literal}
+var sortOrder = 'date';
+var sortPlugins = (function(a, b) {
+ if (sortOrder == 'downloads' || sortOrder == 'revision' || sortOrder == 'date')
+ return parseInt($(a).find('input[name="'+sortOrder+'"]').val())
+ < parseInt($(b).find('input[name="'+sortOrder+'"]').val()) ? 1 : -1;
+ else
+ return $(a).find('input[name="'+sortOrder+'"]').val().toLowerCase()
+ > $(b).find('input[name="'+sortOrder+'"]').val().toLowerCase() ? 1 : -1;
+});
+
jQuery(document).ready(function(){
jQuery("td[id^='desc_']").click(function() {
id = this.id.split('_');
@@ -13,15 +25,18 @@ jQuery(document).ready(function(){
jQuery(this).toggleClass('bigdesc');
return false;
});
+
+ jQuery('select[name="selectOrder"]').change(function() {
+ sortOrder = this.value;
+ $('.pluginBox').sortElements(sortPlugins);
+ });
});
{/literal}{/footer_script}
<div class="titrePage">
<span class="sort">
{'Sort order'|@translate} :
- <select onchange="document.location = this.options[this.selectedIndex].value;">
- {html_options options=$order_options selected=$order_selected}
- </select>
+{html_options name="selectOrder" options=$order_options selected=$order_selected}
</span>
<h2>{'Plugins'|@translate}</h2>
</div>
@@ -32,6 +47,11 @@ jQuery(document).ready(function(){
<legend></legend>
{foreach from=$plugins item=plugin name=plugins_loop}
<div class="pluginBox" id="plugin_{$plugin.ID}">
+<input type="hidden" name="date" value="{$plugin.ID}">
+<input type="hidden" name="name" value="{$plugin.EXT_NAME}">
+<input type="hidden" name="revision" value="{$plugin.REVISION_DATE}">
+<input type="hidden" name="downloads" value="{$plugin.DOWNLOADS}">
+<input type="hidden" name="author" value="{$plugin.AUTHOR}">
<table>
<tr>
<td class="pluginBoxNameCell">{$plugin.EXT_NAME}</td>