aboutsummaryrefslogtreecommitdiffstats
path: root/admin/themes/default/template/picture_modify.tpl
diff options
context:
space:
mode:
authormistic100 <mistic@piwigo.org>2014-05-26 22:03:57 +0000
committermistic100 <mistic@piwigo.org>2014-05-26 22:03:57 +0000
commita5b2cf82007ac1b2461ba86b79c48e43c2640053 (patch)
tree9cc97025f60101372081320a1fe9f56a8b69451e /admin/themes/default/template/picture_modify.tpl
parentb97c45b941170247107445ce4a8fffbae8267c1e (diff)
feature 3077 : factorize code for categories cache (TODO for other collections) + fix incorrect categories list for dissociation
git-svn-id: http://piwigo.org/svn/trunk@28542 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/themes/default/template/picture_modify.tpl39
1 files changed, 10 insertions, 29 deletions
diff --git a/admin/themes/default/template/picture_modify.tpl b/admin/themes/default/template/picture_modify.tpl
index 3688d92ff..454a06428 100644
--- a/admin/themes/default/template/picture_modify.tpl
+++ b/admin/themes/default/template/picture_modify.tpl
@@ -10,37 +10,18 @@
{footer_script}
(function(){
{* <!-- CATEGORIES --> *}
-var categoriesCache = new LocalStorageCache({
- key: 'categoriesAdminList',
+var categoriesCache = new CategoriesCache({
serverKey: '{$CACHE_KEYS.categories}',
serverId: '{$CACHE_KEYS._hash}',
-
- loader: function(callback) {
- jQuery.getJSON('{$ROOT_URL}ws.php?format=json&method=pwg.categories.getAdminList', function(data) {
- callback(data.result.categories);
- });
- }
-});
-
-jQuery('[data-selectize=categories]').selectize({
- valueField: 'id',
- labelField: 'fullname',
- sortField: 'global_rank',
- searchField: ['fullname'],
- plugins: ['remove_button']
+ rootUrl: '{$ROOT_URL}'
});
-categoriesCache.get(function(categories) {
- jQuery('[data-selectize=categories]').each(function() {
- this.selectize.load(function(callback) {
- callback(categories);
- });
-
- jQuery.each(jQuery(this).data('value'), jQuery.proxy(function(i, id) {
- this.selectize.addItem(id);
- }, this));
- });
-});
+categoriesCache.selectize(jQuery('[data-selectize=categories]'), { {if $STORAGE_ALBUM}
+ filter: function(categories, options) {
+ options.default = (this.name == 'associate[]') ? {$STORAGE_ALBUM} : undefined;
+ return categories;
+ }
+{/if} });
{* <!-- TAGS --> *}
var tagsCache = new LocalStorageCache({
@@ -157,14 +138,14 @@ jQuery(function(){ {* <!-- onLoad needed to wait localization loads --> *}
<p>
<strong>{'Linked albums'|@translate}</strong>
<br>
- <select data-selectize="categories" data-value="{$associate_options_selected|@json_encode|escape:html}"
+ <select data-selectize="categories" data-value="{$associated_albums|@json_encode|escape:html}"
name="associate[]" multiple style="width:600px;" ></select>
</p>
<p>
<strong>{'Representation of albums'|@translate}</strong>
<br>
- <select data-selectize="categories" data-value="{$represent_options_selected|@json_encode|escape:html}"
+ <select data-selectize="categories" data-value="{$represented_albums|@json_encode|escape:html}"
name="represent[]" multiple style="width:600px;" ></select>
</p>