diff options
author | mistic100 <mistic@piwigo.org> | 2014-06-02 21:56:54 +0000 |
---|---|---|
committer | mistic100 <mistic@piwigo.org> | 2014-06-02 21:56:54 +0000 |
commit | 4c1066c8f6dd05ca589ae89d48c54c95fdf7a2f7 (patch) | |
tree | e3428b6cab115cf041bf0857cb1f8725c7e9bd91 /admin/themes/default/js | |
parent | 30291228bf7e1ade216dc90b6c49ec42233bb13d (diff) |
redefine selectize templates without escaping + translate "Add"
git-svn-id: http://piwigo.org/svn/trunk@28613 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'admin/themes/default/js')
-rw-r--r-- | admin/themes/default/js/LocalStorageCache.js | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/admin/themes/default/js/LocalStorageCache.js b/admin/themes/default/js/LocalStorageCache.js index 67e804062..214a4ffcd 100644 --- a/admin/themes/default/js/LocalStorageCache.js +++ b/admin/themes/default/js/LocalStorageCache.js @@ -170,6 +170,23 @@ }); }); }; + + // redefine Selectize templates without escape + AbstractSelectizer.getRender = function(field_label, lang) { + lang = lang || { 'Add': 'Add' }; + + return { + 'option': function(data, escape) { + return '<div class="option">' + data[field_label] + '</div>'; + }, + 'item': function(data, escape) { + return '<div class="item">' + data[field_label] + '</div>'; + }, + 'option_create': function(data, escape) { + return '<div class="create">' + lang['Add'] + ' <strong>' + data.input + '</strong>…</div>'; + } + }; + }; /** @@ -206,7 +223,8 @@ labelField: 'fullname', sortField: 'global_rank', searchField: ['fullname'], - plugins: ['remove_button'] + plugins: ['remove_button'], + render: AbstractSelectizer.getRender('fullname', options.lang) }); this._selectize($target, options); @@ -253,7 +271,8 @@ labelField: 'name', sortField: 'name', searchField: ['name'], - plugins: ['remove_button'] + plugins: ['remove_button'], + render: AbstractSelectizer.getRender('name', options.lang) }); this._selectize($target, options); @@ -294,7 +313,8 @@ labelField: 'name', sortField: 'name', searchField: ['name'], - plugins: ['remove_button'] + plugins: ['remove_button'], + render: AbstractSelectizer.getRender('name', options.lang) }); this._selectize($target, options); @@ -347,7 +367,8 @@ labelField: 'username', sortField: 'username', searchField: ['username'], - plugins: ['remove_button'] + plugins: ['remove_button'], + render: AbstractSelectizer.getRender('username', options.lang) }); this._selectize($target, options); |