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