Changeset 28533 for trunk/admin/themes/default/template/cat_modify.tpl
- Timestamp:
- May 24, 2014, 6:24:52 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/themes/default/template/cat_modify.tpl
r25748 r28533 1 {combine_script id='LocalStorageCache' load='footer' path='admin/themes/default/js/LocalStorageCache.js'} 2 3 {combine_script id='jquery.selectize' load='footer' path='themes/default/js/plugins/selectize.min.js'} 4 {combine_css id='jquery.selectize' path="themes/default/js/plugins/selectize.default.css"} 5 6 {footer_script} 7 {* <!-- CATEGORIES --> *} 8 var categoriesCache = new LocalStorageCache({ 9 key: 'categoriesAdminList', 10 serverKey: '{$CACHE_KEYS.categories}', 11 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 } 18 }); 19 20 jQuery('[data-selectize=categories]').selectize({ 21 valueField: 'id', 22 labelField: 'fullname', 23 sortField: 'fullname', 24 searchField: ['fullname'], 25 plugins: ['remove_button'] 26 }); 27 28 categoriesCache.get(function(categories) { 29 categories.push({ 30 id: 0, 31 fullname: '------------' 32 }); 33 34 // remove itself and children 35 categories = jQuery.grep(categories, function(cat) { 36 return !(/\b{$CAT_ID}\b/.test(cat.uppercats)); 37 }); 38 39 categories.sort(function(a, b) { 40 return a.fullname.localeCompare(b.fullname); 41 }); 42 43 jQuery('[data-selectize=categories]').each(function() { 44 this.selectize.load(function(callback) { 45 callback(categories); 46 }); 47 48 if (jQuery(this).data('value')) { 49 this.selectize.setValue(jQuery(this).data('value')[0]); 50 } 51 52 // prevent empty value 53 if (this.selectize.getValue() == '') { 54 this.selectize.setValue(categories[0].id); 55 } 56 this.selectize.on('dropdown_close', function() { 57 if (this.getValue() == '') { 58 this.setValue(categories[0].id); 59 } 60 }); 61 }); 62 }); 63 {/footer_script} 64 65 1 66 <div class="titrePage"> 2 67 <h2><span style="letter-spacing:0">{$CATEGORIES_NAV}</span> › {'Edit album'|@translate} {$TABSHEET_TITLE}</h2> … … 72 137 </p> 73 138 74 {if isset($ move_cat_options) }139 {if isset($parent_category) } 75 140 <p> 76 141 <strong>{'Parent album'|@translate}</strong> 77 142 <br> 78 <select class="categoryDropDown" name="parent"> 79 <option value="0">------------</option> 80 {html_options options=$move_cat_options selected=$move_cat_options_selected } 81 </select> 143 <select data-selectize="categories" data-value="{$parent_category|@json_encode|escape:html}" 144 name="parent" style="width:400px"></select> 82 145 </p> 83 146 {/if}
Note: See TracChangeset
for help on using the changeset viewer.