Sha256: 272798eb88a2a2f15485f72868ba5fd6c51f6f51f7433b155c1531350d438693

Contents?: true

Size: 1.55 KB

Versions: 12

Compression:

Stored size: 1.55 KB

Contents

<%= @sm %>.on('selectionchange', function(){
  var n = <%= @sm %>.getSelected();
  var btns = <%= @tbar %>.items.map;

   if(!n){
    btns.remove.disable();
    btns.edit.disable();
     return;
  } else {
    btns.remove.enable();
    btns.edit.enable();
    return;
   }
});

function add(){
  Backend.app.load('<%= @new_path.blank? ? "#{@base_path}/new" : @new_path %>');
}

function edit(){
  Backend.app.load('<%= @edit_path || @base_path %>/'+<%= @sm %>.getSelected().id+'/edit');
}

function remove(){
  Ext.Msg.confirm(Backend.locale.messages.confirm.title, String.format(Backend.locale.messages.confirm.message, <%= @sm %>.getCount()), function(btn, text){
    if (btn == 'yes'){
      <%= @sm %>.each(function(r){
        Backend.app.mask();
        Ext.Ajax.request({
          url: '<%= @destroy_path || @base_path %>/'+r.id,
          method: 'DELETE',
          params: {<%= @forgery_protection_token %>: '<%= @authenticity_token %>'},
          success: function(result, request){
            Backend.app.unmask();
            var resultValue = Ext.decode(result.responseText); 
            if (resultValue.success == true){
              <%= @store %>.remove(r);
            } else { 
              Ext.MessageBox.alert(Backend.locale.messages.alert.title, resultValue.msg);
              return;
            }
          },                
          failure: function(result, request) {
            Backend.app.unmask();
            Ext.Msg.alert(Backend.locale.messages.alert.title, Backend.locale.messages.alert.message);
          }
        });
      })
    }
  });
}

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
lipsiadmin-3.1 lib/view/helpers/ext/templates/grid_functions.js.erb
lipsiadmin-2.9 lib/view/helpers/ext/templates/grid_functions.js.erb
lipsiadmin-3.3.1 lib/view/helpers/ext/templates/grid_functions.js.erb
lipsiadmin-3.0 lib/view/helpers/ext/templates/grid_functions.js.erb
lipsiadmin-3.2 lib/view/helpers/ext/templates/grid_functions.js.erb
lipsiadmin-3.3.3 lib/view/helpers/ext/templates/grid_functions.js.erb
lipsiadmin-3.3.2 lib/view/helpers/ext/templates/grid_functions.js.erb
lipsiadmin-3.4.1 lib/view/helpers/ext/templates/grid_functions.js.erb
lipsiadmin-3.3 lib/view/helpers/ext/templates/grid_functions.js.erb
lipsiadmin-3.3.4 lib/view/helpers/ext/templates/grid_functions.js.erb
lipsiadmin-3.4.0 lib/view/helpers/ext/templates/grid_functions.js.erb
lipsiadmin-3.4.2 lib/view/helpers/ext/templates/grid_functions.js.erb