diff options
author | mistic100 <mistic@piwigo.org> | 2014-05-17 15:33:37 +0000 |
---|---|---|
committer | mistic100 <mistic@piwigo.org> | 2014-05-17 15:33:37 +0000 |
commit | ce8a29810abe6f7fdf82043b32ca87ba0f14220c (patch) | |
tree | 55ea5b0bd160530ac8b1f9ebc0fe65247a5d138d /admin/themes/default/template/picture_modify.tpl | |
parent | 703a997f6ae9c884b82a11dfc102de65936501c0 (diff) |
feature 3077 : use Selectize with AJAX load/cache on cat_perm and batch_manager_unit
git-svn-id: http://piwigo.org/svn/trunk@28496 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | admin/themes/default/template/picture_modify.tpl | 40 |
1 files changed, 14 insertions, 26 deletions
diff --git a/admin/themes/default/template/picture_modify.tpl b/admin/themes/default/template/picture_modify.tpl index dd49fbd86..50392f7ab 100644 --- a/admin/themes/default/template/picture_modify.tpl +++ b/admin/themes/default/template/picture_modify.tpl @@ -10,7 +10,7 @@ {footer_script} (function(){ {* <!-- CATEGORIES --> *} -var categoriesCache = new LocalStorageCache('categoriesAdminList', 60, function(callback) { +var categoriesCache = new LocalStorageCache('categoriesAdminList', 5*60, function(callback) { jQuery.getJSON('{$ROOT_URL}ws.php?format=json&method=pwg.categories.getAdminList', function(data) { callback(data.result.categories); }); @@ -24,25 +24,19 @@ jQuery('[data-selectize=categories]').selectize({ }); categoriesCache.get(function(categories) { - var selects = jQuery('[data-selectize=categories]'); - - jQuery.each(categories, function(i, category) { - selects.each(function() { - this.selectize.addOption(category); + jQuery('[data-selectize=categories]').each(function() { + this.selectize.load(function(callback) { + callback(categories); }); - }); - - selects.each(function() { - var that = this; - jQuery.each(jQuery(this).data('value'), function(i, id) { - that.selectize.addItem(id); - }); + jQuery.each(jQuery(this).data('value'), jQuery.proxy(function(i, id) { + this.selectize.addItem(id); + }, this)); }); }); {* <!-- TAGS --> *} -var tagsCache = new LocalStorageCache('tagsAdminList', 60, function(callback) { +var tagsCache = new LocalStorageCache('tagsAdminList', 5*60, function(callback) { jQuery.getJSON('{$ROOT_URL}ws.php?format=json&method=pwg.tags.getAdminList', function(data) { var tags = data.result.tags; @@ -70,20 +64,14 @@ jQuery('[data-selectize=tags]').selectize({ }); tagsCache.get(function(tags) { - var selects = jQuery('[data-selectize=tags]'); - - jQuery.each(tags, function(i, tag) { - selects.each(function() { - this.selectize.addOption(tag); + jQuery('[data-selectize=tags]').each(function() { + this.selectize.load(function(callback) { + callback(tags); }); - }); - - selects.each(function() { - var that = this; - jQuery.each(jQuery(this).data('value'), function(i, tag) { - that.selectize.addItem(tag.id); - }); + jQuery.each(jQuery(this).data('value'), jQuery.proxy(function(i, tag) { + this.selectize.addItem(tag.id); + }, this)); }); }); |