From 40fa9b3cdb1a30a53d99c0ff2a268ed78f32e98e Mon Sep 17 00:00:00 2001 From: mistic100 Date: Sun, 18 May 2014 15:15:25 +0000 Subject: feature 3077 : use Selectize on batch_manager_global git-svn-id: http://piwigo.org/svn/trunk@28502 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/batch_manager_global.php | 8 +- .../default/template/batch_manager_global.tpl | 114 +++++++++++++-------- 2 files changed, 72 insertions(+), 50 deletions(-) (limited to 'admin') diff --git a/admin/batch_manager_global.php b/admin/batch_manager_global.php index c8bc38dad..57cb2acdf 100644 --- a/admin/batch_manager_global.php +++ b/admin/batch_manager_global.php @@ -554,13 +554,7 @@ SELECT if (count($page['cat_elements_id']) > 0) { // remove tags - $tags = get_common_tags($page['cat_elements_id'], -1); - - $template->assign( - array( - 'DEL_TAG_SELECTION' => get_html_tag_selection($tags, 'del_tags'), - ) - ); + $template->assign('associated_tags', get_common_tags($page['cat_elements_id'], -1)); } // creation date diff --git a/admin/themes/default/template/batch_manager_global.tpl b/admin/themes/default/template/batch_manager_global.tpl index 631a00f0d..3e22edb02 100644 --- a/admin/themes/default/template/batch_manager_global.tpl +++ b/admin/themes/default/template/batch_manager_global.tpl @@ -4,9 +4,18 @@ {include file='include/add_album.inc.tpl'} {combine_script id='common' load='footer' path='admin/themes/default/js/common.js'} + {combine_script id='jquery.ui.slider' require='jquery.ui' load='footer' path='themes/default/js/ui/minified/jquery.ui.slider.min.js'} {combine_css path="themes/default/js/ui/theme/jquery.ui.slider.css"} +{combine_script id='LocalStorageCache' load='footer' path='admin/themes/default/js/LocalStorageCache.js'} + +{combine_script id='jquery.selectize' load='footer' path='themes/default/js/plugins/selectize.min.js'} +{combine_css id='jquery.selectize' path="themes/default/js/plugins/selectize.default.css"} + +{combine_script id='jquery.progressBar' load='footer' path='themes/default/js/plugins/jquery.progressbar.min.js'} +{combine_script id='jquery.ajaxmanager' load='footer' path='themes/default/js/plugins/jquery.ajaxmanager.js'} + {footer_script}{literal} /* Shift-click: select all photos between the click and the shift+click */ jQuery(document).ready(function() { @@ -51,49 +60,66 @@ jQuery(document).ready(function() { } $('ul.thumbnails').enableShiftClick(); }); -{/literal}{/footer_script} - -{combine_css path='themes/default/js/plugins/jquery.tokeninput.css'} -{combine_script id='jquery.tokeninput' load='footer' require='jquery' path='themes/default/js/plugins/jquery.tokeninput.js'} -{combine_script id='jquery.progressBar' load='footer' path='themes/default/js/plugins/jquery.progressbar.min.js'} -{combine_script id='jquery.ajaxmanager' load='footer' path='themes/default/js/plugins/jquery.ajaxmanager.js'} +{/literal} -{footer_script require='jquery.tokeninput'} jQuery(document).ready(function() {ldelim} jQuery('[data-datepicker]').pwgDatepicker({ showTimepicker: true }); jQuery("a.preview-box").colorbox(); - var tag_src = [{foreach from=$tags item=tag name=tags}{ldelim}name:"{$tag.name|@escape:'javascript'}",id:"{$tag.id}"{rdelim}{if !$smarty.foreach.tags.last},{/if}{/foreach}]; - jQuery("#tags").tokenInput( - tag_src, - {ldelim} - hintText: '{'Type in a search term'|@translate}', - noResultsText: '{'No results'|@translate}', - searchingText: '{'Searching...'|@translate}', - newText: ' ({'new'|@translate})', - animateDropdown: false, - preventDuplicates: true, - allowFreeTagging: true - } - ); - - jQuery("#tagsFilter").tokenInput( - tag_src, - {ldelim} - hintText: '{'Type in a search term'|@translate}', - noResultsText: '{'No results'|@translate}', - searchingText: '{'Searching...'|@translate}', - animateDropdown: false, - preventDuplicates: true, - allowFreeTagging: false + {* *} + var tagsCache = new LocalStorageCache('tagsAdminList', 5*60, function(callback) { + jQuery.getJSON('{$ROOT_URL}ws.php?format=json&method=pwg.tags.getAdminList', function(data) { + var tags = data.result.tags; + + for (var i=0, l=tags.length; i + if (jQuery.isEmptyObject(this.options)) { + callback(tags); + } + }); + if (jQuery(this).data('value')) { + jQuery.each(jQuery(this).data('value'), jQuery.proxy(function(i, tag) { + this.selectize.addItem(tag.id); + }, this)); + } + }); + }); }); -{/footer_script} -{footer_script} var nb_thumbs_page = {$nb_thumbs_page}; var nb_thumbs_set = {$nb_thumbs_set}; var are_you_sure = "{'Are you sure?'|@translate|@escape:'javascript'}"; @@ -606,11 +632,8 @@ $(document).ready(function() { [x] {'Tags'|@translate} - + @@ -670,7 +693,7 @@ $(document).ready(function() { {'Search'|@translate} {combine_script id='core.scripts' load='async' path='themes/default/js/scripts.js'} - + @@ -782,7 +805,7 @@ UL.thumbnails SPAN.wrap2 {ldelim} {/if} - {if !empty($DEL_TAG_SELECTION)} + {if !empty($associated_tags)} {/if} @@ -836,13 +859,18 @@ UL.thumbnails SPAN.wrap2 {ldelim}
- +
-{if !empty($DEL_TAG_SELECTION)}{$DEL_TAG_SELECTION}{/if} +{if !empty($associated_tags)} + +{/if}
-- cgit v1.2.3