40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/netzke/basepack/action_column.rb', line 40
def initial_columns(with_excluded = false)
orig_columns = super
action_column_names = column_actions.map{ |action| action[:column] }.uniq
action_columns = orig_columns.select{ |c| action_column_names.include? c[:name] }
if action_columns.empty? && !config[:columns]
action_columns = [{:name => "actions"}.merge(config[:override_columns].try(:fetch, :actions, nil) || {})]
orig_columns += action_columns
end
action_columns.each do |c|
c[:xtype] = :netzkeactioncolumn
c[:getter] = lambda do |r|
self.class.registered_column_actions.select{ |action_name| self.send("#{action_name}_column_action")[:column] == c[:name] }.map{ |action_name| self.send("#{action_name}_column_action", r) }.to_nifty_json
end
end
orig_columns
end
|