Changeset 28501


Ignore:
Timestamp:
05/18/14 13:57:18 (5 years ago)
Author:
mistic100
Message:

feature 3077 : use Selectize on user_list

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/themes/default/template/user_list.tpl

    r28039 r28501  
    44{combine_css path="themes/default/js/plugins/datatables/css/jquery.dataTables.css"} 
    55 
    6 {combine_script id='jquery.chosen' load='footer' path='themes/default/js/plugins/chosen.jquery.min.js'} 
    7 {combine_css path="themes/default/js/plugins/chosen.css"} 
     6{combine_script id='jquery.selectize' load='footer' path='themes/default/js/plugins/selectize.min.js'} 
     7{combine_css id='jquery.selectize' path="themes/default/js/plugins/selectize.default.css"} 
    88 
    99{combine_script id='jquery.underscore' load='footer' path='themes/default/js/plugins/underscore.js'} 
     
    275275          jQuery("#user"+userId).append(template(user)); 
    276276 
    277           jQuery(".chzn-select").chosen(); 
     277          /* groups select */ 
     278          jQuery('[data-selectize=groups]').selectize({ 
     279            valueField: 'value', 
     280            labelField: 'label', 
     281            searchField: ['label'], 
     282            plugins: ['remove_button'] 
     283          }); 
     284 
     285          var groupSelectize = jQuery('[data-selectize=groups]')[0].selectize; 
     286 
     287          groupSelectize.load(function(callback) { 
     288            callback(user.groupOptions); 
     289          }); 
     290 
     291          jQuery.each(jQuery.grep(user.groupOptions, function(group) { 
     292            return group.isSelected; 
     293          }), function(i, group) { 
     294            groupSelectize.addItem(group.value); 
     295          }); 
    278296 
    279297          /* nb_image_page slider */ 
     
    10871105 
    10881106      <div class="userProperty"><strong>{'Groups'|translate}</strong><br> 
    1089         <select multiple class="chzn-select" style="width:340px;" name="group_id[]"> 
    1090 <% _.each( user.groupOptions, function( option ){ %> 
    1091           <option value="<%- option.value%>" <% if (option.isSelected) { %>selected="selected"<% } %>><%- option.label %></option> 
    1092 <% }); %> 
    1093         </select> 
     1107        <select data-selectize="groups" name="group_id[]" multiple style="width:340px;"></select> 
    10941108      </div> 
    10951109    </div> 
Note: See TracChangeset for help on using the changeset viewer.