- Timestamp:
- May 27, 2014, 12:03:57 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/themes/default/template/photos_add_direct.tpl
r28540 r28542 17 17 {footer_script} 18 18 {* <!-- CATEGORIES --> *} 19 var categoriesCache = new LocalStorageCache({ 20 key: 'categoriesAdminList', 19 var categoriesCache = new CategoriesCache({ 21 20 serverKey: '{$CACHE_KEYS.categories}', 22 21 serverId: '{$CACHE_KEYS._hash}', 23 24 loader: function(callback) { 25 jQuery.getJSON('{$ROOT_URL}ws.php?format=json&method=pwg.categories.getAdminList', function(data) { 26 callback(data.result.categories); 27 }); 22 rootUrl: '{$ROOT_URL}' 23 }); 24 25 categoriesCache.selectize(jQuery('[data-selectize=categories]'), { 26 filter: function(categories, options) { 27 if (categories.length > 0) { 28 jQuery("#albumSelection").show(); 29 options.default = categories[0].id; 30 } 31 32 return categories; 28 33 } 29 });30 31 jQuery('[data-selectize=categories]').selectize({32 valueField: 'id',33 labelField: 'fullname',34 sortField: 'global_rank',35 searchField: ['fullname'],36 plugins: ['remove_button']37 });38 39 categoriesCache.get(function(categories) {40 if (categories.length > 0) {41 jQuery("#albumSelection").show();42 }43 44 jQuery('[data-selectize=categories]').each(function() {45 this.selectize.load(function(callback) {46 callback(categories);47 });48 49 if (jQuery(this).data('value')) {50 this.selectize.setValue(jQuery(this).data('value')[0]);51 }52 53 // prevent empty value54 if (this.selectize.getValue() == '') {55 this.selectize.setValue(categories[0].id);56 }57 this.selectize.on('dropdown_close', function() {58 if (this.getValue() == '') {59 this.setValue(categories[0].id);60 }61 });62 });63 34 }); 64 35
Note: See TracChangeset
for help on using the changeset viewer.