diff options
author | mistic100 <mistic@piwigo.org> | 2014-05-27 21:47:57 +0000 |
---|---|---|
committer | mistic100 <mistic@piwigo.org> | 2014-05-27 21:47:57 +0000 |
commit | 82b52dd0c0b33c67ac10d44d4f1411da2838ba29 (patch) | |
tree | 3bcd0d72898b6921d4430b148eb9b316629a98d4 /admin/themes/default/template/picture_modify.tpl | |
parent | af740fa3e4e5217539b3f2826fba0b453ba2c66b (diff) |
feature 3077 : factorize code for cache/selectize
git-svn-id: http://piwigo.org/svn/trunk@28550 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'admin/themes/default/template/picture_modify.tpl')
-rw-r--r-- | admin/themes/default/template/picture_modify.tpl | 42 |
1 files changed, 6 insertions, 36 deletions
diff --git a/admin/themes/default/template/picture_modify.tpl b/admin/themes/default/template/picture_modify.tpl index 454a06428..60c98140d 100644 --- a/admin/themes/default/template/picture_modify.tpl +++ b/admin/themes/default/template/picture_modify.tpl @@ -24,43 +24,13 @@ categoriesCache.selectize(jQuery('[data-selectize=categories]'), { {if $STORAGE_ {/if} }); {* <!-- TAGS --> *} -var tagsCache = new LocalStorageCache({ - key: 'tagsAdminList', +var tagsCache = new TagsCache({ serverKey: '{$CACHE_KEYS.tags}', serverId: '{$CACHE_KEYS._hash}', - - loader: function(callback) { - jQuery.getJSON('{$ROOT_URL}ws.php?format=json&method=pwg.tags.getAdminList', function(data) { - var tags = data.result.tags; - - for (var i=0, l=tags.length; i<l; i++) { - tags[i].id = '~~' + tags[i].id + '~~'; - } - - callback(tags); - }); - } -}); - -jQuery('[data-selectize=tags]').selectize({ - valueField: 'id', - labelField: 'name', - searchField: ['name'], - plugins: ['remove_button'], - create: true + rootUrl: '{$ROOT_URL}' }); -tagsCache.get(function(tags) { - jQuery('[data-selectize=tags]').each(function() { - this.selectize.load(function(callback) { - callback(tags); - }); - - jQuery.each(jQuery(this).data('value'), jQuery.proxy(function(i, tag) { - this.selectize.addItem(tag.id); - }, this)); - }); -}); +tagsCache.selectize(jQuery('[data-selectize=tags]')); {* <!-- DATEPICKER --> *} jQuery(function(){ {* <!-- onLoad needed to wait localization loads --> *} @@ -139,21 +109,21 @@ jQuery(function(){ {* <!-- onLoad needed to wait localization loads --> *} <strong>{'Linked albums'|@translate}</strong> <br> <select data-selectize="categories" data-value="{$associated_albums|@json_encode|escape:html}" - name="associate[]" multiple style="width:600px;" ></select> + name="associate[]" multiple style="width:600px;"></select> </p> <p> <strong>{'Representation of albums'|@translate}</strong> <br> <select data-selectize="categories" data-value="{$represented_albums|@json_encode|escape:html}" - name="represent[]" multiple style="width:600px;" ></select> + name="represent[]" multiple style="width:600px;"></select> </p> <p> <strong>{'Tags'|@translate}</strong> <br> <select data-selectize="tags" data-value="{$tag_selection|@json_encode|escape:html}" - name="tags[]" multiple style="width:600px;" ></select> + name="tags[]" multiple style="width:600px;" data-selectize-create></select> </p> <p> |