Sha256: 1631e1b5abe64bcaaf0471f698d5cf0d54448de7020e5049fdd9b7110f80c451

Contents?: true

Size: 1.52 KB

Versions: 9

Compression:

Stored size: 1.52 KB

Contents

module Netzke
  class MasqueradeSelector < TabPanel
    
    def items
      @items ||= [{
          :name              => "roles",
          :active            => true,
          :widget_class_name => "GridPanel",
          :data_class_name   => 'Role',
          :columns           => [:id, :name],
          :ext_config => {
            :header        => false,
            :bbar => ['search']
          }
        },{
          :name                 => "users",
          :preloaded            => true,
          :widget_class_name    => "GridPanel", 
          :data_class_name      => 'User', 
          :ext_config           => {
            :header        => false,
            :rows_per_page => 10,
            :bbar => ['search']
          },
          :columns => [:id, :login]
      }]
    end

    def self.js_extend_properties
      {
        :after_constructor => <<-END_OF_JAVASCRIPT.l,
          function(){
            this.items.each(function(tab){
              tab.on('add', function(ct, cmp){
                cmp.on('rowclick', this.rowclickHandler, this);
              }, this);
            }, this);
          }
        END_OF_JAVASCRIPT
        
        :rowclick_handler => <<-END_OF_JAVASCRIPT.l
          function(grid, rowIndex, e){
            var mode = grid.id.split("__").pop();
            var normMode = mode === 'users' ? 'user' : 'role';
            this.masquerade = {};
            this.masquerade[normMode] = grid.store.getAt(rowIndex).get('id');
          }
        END_OF_JAVASCRIPT
      }
    end
    
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
skozlov-netzke-basepack-0.5.1 lib/netzke/masquerade_selector.rb
skozlov-netzke-basepack-0.5.2 lib/netzke/masquerade_selector.rb
netzke-basepack-0.5.6 lib/netzke/masquerade_selector.rb
netzke-basepack-0.5.5.1 lib/netzke/masquerade_selector.rb
netzke-basepack-0.5.5 lib/netzke/masquerade_selector.rb
netzke-basepack-0.5.4 lib/netzke/masquerade_selector.rb
netzke-basepack-0.5.3 lib/netzke/masquerade_selector.rb
netzke-basepack-0.5.1 lib/netzke/masquerade_selector.rb
netzke-basepack-0.5.2 lib/netzke/masquerade_selector.rb