Changeset 28613


Ignore:
Timestamp:
Jun 2, 2014, 11:56:54 PM (6 years ago)
Author:
mistic100
Message:

redefine selectize templates without escaping + translate "Add"

Location:
trunk/admin/themes/default
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/themes/default/js/LocalStorageCache.js

    r28555 r28613  
    171171    });
    172172  };
     173 
     174  // redefine Selectize templates without escape
     175  AbstractSelectizer.getRender = function(field_label, lang) {
     176    lang = lang || { 'Add': 'Add' };
     177
     178        return {
     179      'option': function(data, escape) {
     180        return '<div class="option">' + data[field_label] + '</div>';
     181      },
     182      'item': function(data, escape) {
     183        return '<div class="item">' + data[field_label] + '</div>';
     184      },
     185      'option_create': function(data, escape) {
     186        return '<div class="create">' + lang['Add'] + ' <strong>' + data.input + '</strong>&hellip;</div>';
     187      }
     188    };
     189  };
    173190
    174191
     
    207224      sortField: 'global_rank',
    208225      searchField: ['fullname'],
    209       plugins: ['remove_button']
     226      plugins: ['remove_button'],
     227      render: AbstractSelectizer.getRender('fullname', options.lang)
    210228    });
    211229   
     
    254272      sortField: 'name',
    255273      searchField: ['name'],
    256       plugins: ['remove_button']
     274      plugins: ['remove_button'],
     275      render: AbstractSelectizer.getRender('name', options.lang)
    257276    });
    258277   
     
    295314      sortField: 'name',
    296315      searchField: ['name'],
    297       plugins: ['remove_button']
     316      plugins: ['remove_button'],
     317      render: AbstractSelectizer.getRender('name', options.lang)
    298318    });
    299319   
     
    348368      sortField: 'username',
    349369      searchField: ['username'],
    350       plugins: ['remove_button']
     370      plugins: ['remove_button'],
     371      render: AbstractSelectizer.getRender('username', options.lang)
    351372    });
    352373   
  • trunk/admin/themes/default/template/batch_manager_global.tpl

    r28555 r28613  
    7575  });
    7676
    77   tagsCache.selectize(jQuery('[data-selectize=tags]'));
     77  tagsCache.selectize(jQuery('[data-selectize=tags]'), { lang: {
     78    'Add': '{'Create'|translate}'
     79  }});
    7880 
    7981  {* <!-- CATEGORIES --> *}
  • trunk/admin/themes/default/template/batch_manager_unit.tpl

    r28563 r28613  
    1717});
    1818
    19 tagsCache.selectize(jQuery('[data-selectize=tags]'));
     19tagsCache.selectize(jQuery('[data-selectize=tags]'), { lang: {
     20  'Add': '{'Create'|translate}'
     21}});
    2022
    2123{* <!-- DATEPICKER --> *}
  • trunk/admin/themes/default/template/picture_modify.tpl

    r28555 r28613  
    2626});
    2727
    28 tagsCache.selectize(jQuery('[data-selectize=tags]'));
     28tagsCache.selectize(jQuery('[data-selectize=tags]'), { lang: {
     29  'Add': '{'Create'|translate}'
     30}});
    2931
    3032{* <!-- DATEPICKER --> *}
Note: See TracChangeset for help on using the changeset viewer.