- Timestamp:
- May 24, 2014, 6:24:52 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/themes/default/template/photos_add_direct.tpl
r25929 r28533 10 10 {include file='include/add_album.inc.tpl'} 11 11 12 {footer_script}{literal} 12 {combine_script id='LocalStorageCache' load='footer' path='admin/themes/default/js/LocalStorageCache.js'} 13 14 {combine_script id='jquery.selectize' load='footer' path='themes/default/js/plugins/selectize.min.js'} 15 {combine_css id='jquery.selectize' path="themes/default/js/plugins/selectize.default.css"} 16 17 {footer_script} 18 {* <!-- CATEGORIES --> *} 19 var categoriesCache = new LocalStorageCache({ 20 key: 'categoriesAdminList', 21 serverKey: '{$CACHE_KEYS.categories}', 22 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 }); 28 } 29 }); 30 31 jQuery('[data-selectize=categories]').selectize({ 32 valueField: 'id', 33 labelField: 'fullname', 34 sortField: 'fullname', 35 searchField: ['fullname'], 36 plugins: ['remove_button'] 37 }); 38 39 categoriesCache.get(function(categories) { 40 categories.sort(function(a, b) { 41 return a.fullname.localeCompare(b.fullname); 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 value 54 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 }); 64 65 jQuery('[data-add-album]').pwgAddAlbum({ cache: categoriesCache }); 66 67 68 {literal} 13 69 jQuery(document).ready(function(){ 14 70 function checkUploadStart() { … … 17 73 jQuery("#formErrors li").hide(); 18 74 19 if (jQuery(" #albumSelect option:selected").length == 0) {75 if (jQuery("select[name=category]").val() == '') { 20 76 jQuery("#formErrors #noAlbum").show(); 21 77 nbErrors++; … … 197 253 'postData', 198 254 { 199 'category_id' : jQuery("select[name=category] option:selected").val(),255 'category_id' : jQuery("select[name=category]").val(), 200 256 'level' : jQuery("select[name=level] option:selected").val(), 201 257 'upload_id' : upload_id, … … 281 337 282 338 <span id="albumSelection"{if count($category_options) == 0} style="display:none"{/if}> 283 <select id="albumSelect" name="category"> 284 {html_options options=$category_options selected=$category_options_selected} 285 </select> 286 <br>{'... or '|@translate}</span><a href="#" class="addAlbumOpen" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a> 287 339 <select data-selectize="categories" data-value="{$selected_category|@json_encode|escape:html}" 340 name="category" style="width:400px"></select> 341 <br>{'... or '|@translate}</span> 342 <a href="#" data-add-album="category" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a> 288 343 </fieldset> 289 344
Note: See TracChangeset
for help on using the changeset viewer.