Class: Netzke::MasqueradeSelector

Inherits:
TabPanel
  • Object
show all
Defined in:
lib/netzke/masquerade_selector.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from TabPanel

#api_activate_tab, #fit_panels, #get_active_tab, #initial_aggregatees, #initialize, js_base_class, #js_config

Constructor Details

This class inherits a constructor from Netzke::TabPanel

Class Method Details

.js_extend_propertiesObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/netzke/masquerade_selector.rb', line 29

def self.js_extend_properties
  {
    :after_constructor => <<-END_OF_JAVASCRIPT.l,
    
    :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

Instance Method Details

#itemsObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/netzke/masquerade_selector.rb', line 4

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