- Timestamp:
- May 27, 2014, 12:03:57 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/themes/default/template/batch_manager_global.tpl
r28540 r28542 120 120 121 121 {* <!-- CATEGORIES --> *} 122 var categoriesCache = new LocalStorageCache({ 123 key: 'categoriesAdminList', 122 var categoriesCache = new CategoriesCache({ 124 123 serverKey: '{$CACHE_KEYS.categories}', 125 124 serverId: '{$CACHE_KEYS._hash}', 126 127 loader: function(callback) { 128 jQuery.getJSON('{$ROOT_URL}ws.php?format=json&method=pwg.categories.getAdminList', function(data) { 129 callback(data.result.categories); 130 }); 131 } 125 rootUrl: '{$ROOT_URL}' 132 126 }); 133 127 134 jQuery('[data-selectize=categories]').selectize({ 135 valueField: 'id', 136 labelField: 'fullname', 137 sortField: 'global_rank', 138 searchField: ['fullname'], 139 plugins: ['remove_button'] 140 }); 141 142 categoriesCache.get(function(categories) { 143 jQuery('[data-selectize=categories]').each(function() { 144 this.selectize.load(function(callback) { 145 callback(categories); 146 }); 147 148 if (jQuery(this).data('value')) { 149 this.selectize.setValue(jQuery(this).data('value')[0]); 128 categoriesCache.selectize(jQuery('[data-selectize=categories]'), { 129 filter: function(categories, options) { 130 if (this.name == 'dissociate') { 131 var filtered = jQuery.grep(categories, function(cat) { 132 return !cat.dir; 133 }); 134 135 if (filtered.length > 0) { 136 jQuery('.albumDissociate').show(); 137 options.default = filtered[0].id; 138 } 139 140 return filtered; 150 141 } 151 152 // prevent empty value 153 if (this.selectize.getValue() == '') { 154 this.selectize.setValue(categories[0].id); 142 else { 143 options.default = categories[0].id; 144 return categories; 155 145 } 156 this.selectize.on('dropdown_close', function() { 157 if (this.getValue() == '') { 158 this.setValue(categories[0].id); 159 } 160 }); 161 }); 146 } 162 147 }); 163 148 … … 838 823 <option value="associate">{'Associate to album'|@translate}</option> 839 824 <option value="move">{'Move to album'|@translate}</option> 840 {if !empty($dissociate_options)} 841 <option value="dissociate">{'Dissociate from album'|@translate}</option> 842 {/if} 825 <option value="dissociate" class="albumDissociate" style="display:none">{'Dissociate from album'|@translate}</option> 843 826 <option value="add_tags">{'Add tags'|@translate}</option> 844 827 {if !empty($associated_tags)} … … 885 868 886 869 <!-- dissociate --> 887 <div id="action_dissociate" class="bulkAction ">870 <div id="action_dissociate" class="bulkAction albumDissociate" style="display:none"> 888 871 <select data-selectize="categories" name="dissociate" style="width:400px"></select> 889 872 </div>
Note: See TracChangeset
for help on using the changeset viewer.