Changeset 28555 for trunk/admin/themes
- Timestamp:
- May 28, 2014, 9:04:40 PM (11 years ago)
- Location:
- trunk/admin/themes/default
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/themes/default/js/LocalStorageCache.js
r28550 r28555 85 85 /* 86 86 * Load Selectize with cache content 87 * @param $target {jQuery} 88 * @param options {object} 87 * @param $target {jQuery} may have some data attributes (create, default, value) 88 * @param options {object} 89 * - value (optional) list of preselected items (ids, or objects with "id" attribute") 89 90 * - default (optional) default value which will be forced if the select is emptyed 91 * - create (optional) allow item user creation 90 92 * - filter (optional) function called for each select before applying the data 91 93 * takes two parameters: cache data, options 92 94 * must return new data 93 95 */ 94 AbstractSelectizer.prototype._selectize = function($target, options) {96 AbstractSelectizer.prototype._selectize = function($target, globalOptions) { 95 97 this.get(function(data) { 96 98 $target.each(function() { 97 var filtered, value; 99 var filtered, value, defaultValue, 100 options = $.extend({}, globalOptions); 98 101 99 102 // apply filter function … … 106 109 107 110 // active creation mode 108 if (this.hasAttribute('data-selectize-create')) { 109 this.selectize.settings.create = true; 110 } 111 111 if (this.hasAttribute('data-create')) { 112 options.create = true; 113 } 114 this.selectize.settings.create = !!options.create; 115 112 116 // load options 113 117 this.selectize.load(function(callback) { … … 119 123 // load items 120 124 if ((value = $(this).data('value'))) { 125 options.value = value; 126 } 127 if (options.value != undefined) { 121 128 $.each(value, $.proxy(function(i, cat) { 122 129 if ($.isNumeric(cat)) … … 125 132 this.selectize.addItem(cat.id); 126 133 }, this)); 134 } 135 136 // set default 137 if ((defaultValue = $(this).data('default'))) { 138 options.default = defaultValue; 139 } 140 if (options.default == 'first') { 141 options.default = filtered[0] ? filtered[0].id : undefined; 127 142 } 128 143 -
trunk/admin/themes/default/js/addAlbum.js
r28552 r28555 5 5 6 6 var $popup = jQuery('#addAlbumForm'); 7 if (!$popup.data('init')) { 8 $popup.find('[name="category_parent"]').selectize({ 9 valueField: 'id', 10 labelField: 'fullname', 11 sortField: 'global_rank', 12 searchField: ['fullname'], 13 plugins: ['remove_button'], 14 onInitialize: function() { 15 this.on('dropdown_close', function() { 16 if (this.getValue() == '') { 17 this.setValue(0); 18 } 7 8 function init() { 9 if ($popup.data('init')) { 10 return; 11 } 12 $popup.data('init', true); 13 14 options.cache.selectize($popup.find('[name="category_parent"]'), { 15 'default': 0, 16 'filter': function(categories) { 17 categories.push({ 18 id: 0, 19 fullname: '------------', 20 global_rank: 0 19 21 }); 22 23 return categories; 20 24 } 21 25 }); … … 48 52 49 53 var newAlbum = data.result.id, 50 newAlbum_name = ''; 54 newAlbum_name = '', 55 newAlbum_rank = '0'; 51 56 52 57 if (parent_id != 0) { 53 58 newAlbum_name = albumParent[0].selectize.options[parent_id].fullname +' / '; 59 newAlbum_rank = albumParent[0].selectize.options[parent_id].global_rank +'.1'; 54 60 } 55 61 newAlbum_name+= name; … … 75 81 // target is selectize 76 82 else { 77 $albumSelect[0].selectize.addOption({ 78 id: newAlbum, 79 fullname: newAlbum_name 80 }); 83 var selectize = $albumSelect[0].selectize; 81 84 82 $albumSelect[0].selectize.setValue(newAlbum); 85 if (jQuery.isEmptyObject(selectize.options)) { 86 options.cache.clear(); 87 options.cache.selectize($albumSelect, { 88 'default': newAlbum, 89 'value': newAlbum 90 }); 91 } 92 else { 93 $albumSelect[0].selectize.addOption({ 94 id: newAlbum, 95 fullname: newAlbum_name, 96 global_rank: newAlbum_rank 97 }); 98 99 $albumSelect[0].selectize.setValue(newAlbum); 100 } 83 101 } 84 102 … … 99 117 width: 350, height: 300, 100 118 onComplete: function() { 101 var albumParent = $popup.find('[name="category_parent"]')[0]; 102 119 init(); 103 120 $popup.data('target', jQuery(this).data('addAlbum')); 104 105 albumParent.selectize.clearOptions(); 106 107 options.cache.get(function(categories) { 108 categories.push({ 109 id: 0, 110 fullname: '------------', 111 global_rank: 0 112 }); 113 114 albumParent.selectize.load(function(callback) { 115 callback(categories); 116 }); 117 118 albumParent.selectize.setValue(0); 119 }); 121 $popup.find('[name=category_name]').focus(); 120 122 } 121 123 }); -
trunk/admin/themes/default/template/batch_manager_global.tpl
r28550 r28555 99 99 } 100 100 else { 101 options.default = categories[0].id;102 101 return categories; 103 102 } … … 604 603 {'Album'|@translate} 605 604 <select data-selectize="categories" data-value="{$filter_category_selected|@json_encode|escape:html}" 606 name="filter_category" style="width:400px"></select>605 data-default="first" name="filter_category" style="width:400px"></select> 607 606 <label><input type="checkbox" name="filter_category_recursive" {if isset($filter.category_recursive)}checked="checked"{/if}> {'include child albums'|@translate}</label> 608 607 </li> … … 613 612 {'Tags'|@translate} 614 613 <select data-selectize="tags" data-value="{$filter_tags|@json_encode|escape:html}" 614 placeholder="{'Type in a search term'|translate}" 615 615 name="filter_tags[]" multiple style="width:400px;"></select> 616 616 <label><span><input type="radio" name="tag_mode" value="AND" {if !isset($filter.tag_mode) or $filter.tag_mode eq 'AND'}checked="checked"{/if}> {'All tags'|@translate}</span></label> … … 812 812 <!-- associate --> 813 813 <div id="action_associate" class="bulkAction"> 814 <select data-selectize="categories" name="associate" style="width:400px"></select>814 <select data-selectize="categories" data-default="first" name="associate" style="width:400px"></select> 815 815 <br>{'... or '|@translate} 816 816 <a href="#" data-add-album="associate" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a> … … 819 819 <!-- move --> 820 820 <div id="action_move" class="bulkAction"> 821 <select data-selectize="categories" name="move" style="width:400px"></select>821 <select data-selectize="categories" data-default="first" name="move" style="width:400px"></select> 822 822 <br>{'... or '|@translate} 823 823 <a href="#" data-add-album="move" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a> … … 827 827 <!-- dissociate --> 828 828 <div id="action_dissociate" class="bulkAction albumDissociate" style="display:none"> 829 <select data-selectize="categories" name="dissociate" style="width:400px"></select> 829 <select data-selectize="categories" placeholder="{'Type in a search term'|translate}" 830 name="dissociate" style="width:400px"></select> 830 831 </div> 831 832 … … 833 834 <!-- add_tags --> 834 835 <div id="action_add_tags" class="bulkAction"> 835 <select data-selectize="tags" data-selectize-create name="add_tags[]" multiple style="width:400px;"></select> 836 <select data-selectize="tags" data-create="true" placeholder="{'Type in a search term'|translate}" 837 name="add_tags[]" multiple style="width:400px;"></select> 836 838 </div> 837 839 … … 839 841 <div id="action_del_tags" class="bulkAction"> 840 842 {if !empty($associated_tags)} 841 <select data-selectize="tags" name="del_tags[]" multiple style="width:400px;"> 843 <select data-selectize="tags" name="del_tags[]" multiple style="width:400px;" 844 placeholder="{'Type in a search term'|translate}"> 842 845 {foreach from=$associated_tags item=tag} 843 846 <option value="{$tag.id}">{$tag.name}</option> -
trunk/admin/themes/default/template/batch_manager_unit.tpl
r28550 r28555 99 99 <td> 100 100 <select data-selectize="tags" data-value="{$element.TAGS|@json_encode|escape:html}" 101 name="tags-{$element.id}[]" multiple style="width:500px;" data-selectize-create></select> 101 placeholder="{'Type in a search term'|translate}" 102 data-create="true" name="tags-{$element.id}[]" multiple style="width:500px;"></select> 102 103 </td> 103 104 </tr> -
trunk/admin/themes/default/template/cat_perm.tpl
r28550 r28555 73 73 <br> 74 74 <select data-selectize="groups" data-value="{$groups_selected|@json_encode|escape:html}" 75 name="groups[]" multiple style="width:600px;"></select> 75 placeholder="{'Type in a search term'|translate}" 76 name="groups[]" multiple style="width:600px;"></select> 76 77 {else} 77 78 {'There is no group in this gallery.'|@translate} <a href="admin.php?page=group_list" class="externalLink">{'Group management'|@translate}</a> … … 83 84 <br> 84 85 <select data-selectize="users" data-value="{$users_selected|@json_encode|escape:html}" 85 name="users[]" multiple style="width:600px;"></select> 86 placeholder="{'Type in a search term'|translate}" 87 name="users[]" multiple style="width:600px;"></select> 86 88 </p> 87 89 -
trunk/admin/themes/default/template/photos_add_direct.tpl
r28554 r28555 28 28 if (categories.length > 0) { 29 29 jQuery("#albumSelection, .selectFiles, .showFieldset").show(); 30 options.default = categories[0].id;31 30 } 32 31 … … 202 201 <span id="albumSelection" style="display:none"> 203 202 <select data-selectize="categories" data-value="{$selected_category|@json_encode|escape:html}" 204 name="category" style="width:400px"></select>203 data-default="first" name="category" style="width:400px"></select> 205 204 <br>{'... or '|@translate}</span> 206 205 <a href="#" data-add-album="category" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a> -
trunk/admin/themes/default/template/picture_modify.tpl
r28550 r28555 17 17 }); 18 18 19 categoriesCache.selectize(jQuery('[data-selectize=categories]'), { {if $STORAGE_ALBUM} 20 filter: function(categories, options) { 21 options.default = (this.name == 'associate[]') ? {$STORAGE_ALBUM} : undefined; 22 return categories; 23 } 24 {/if} }); 19 categoriesCache.selectize(jQuery('[data-selectize=categories]')); 25 20 26 21 {* <!-- TAGS --> *} … … 110 105 <br> 111 106 <select data-selectize="categories" data-value="{$associated_albums|@json_encode|escape:html}" 112 name="associate[]" multiple style="width:600px;"></select> 107 placeholder="{'Type in a search term'|translate}" 108 data-default="{$STORAGE_ALBUM}" name="associate[]" multiple style="width:600px;"></select> 113 109 </p> 114 110 … … 117 113 <br> 118 114 <select data-selectize="categories" data-value="{$represented_albums|@json_encode|escape:html}" 115 placeholder="{'Type in a search term'|translate}" 119 116 name="represent[]" multiple style="width:600px;"></select> 120 117 </p> … … 124 121 <br> 125 122 <select data-selectize="tags" data-value="{$tag_selection|@json_encode|escape:html}" 126 name="tags[]" multiple style="width:600px;" data-selectize-create></select> 123 placeholder="{'Type in a search term'|translate}" 124 data-create="true" name="tags[]" multiple style="width:600px;"</select> 127 125 </p> 128 126 -
trunk/admin/themes/default/template/user_list.tpl
r28501 r28555 1105 1105 1106 1106 <div class="userProperty"><strong>{'Groups'|translate}</strong><br> 1107 <select data-selectize="groups" name="group_id[]" multiple style="width:340px;"></select> 1107 <select data-selectize="groups" placeholder="{'Type in a search term'|translate}" 1108 name="group_id[]" multiple style="width:340px;"></select> 1108 1109 </div> 1109 1110 </div>
Note: See TracChangeset
for help on using the changeset viewer.