Skip to content

Commit

Permalink
Update ActionColumn to work with latest Core
Browse files Browse the repository at this point in the history
  • Loading branch information
nomadcoder committed Jan 10, 2013
1 parent 2708bd4 commit cd77c43
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions lib/netzke/communitypack/action_column.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,27 @@ module ActionColumn
def augment_column_config(c)
if c[:type] == :action
c.xtype = :netzkeactioncolumn
c[:getter] = lambda do |r|
c.actions.map do |a|
a = {name: a} if a.is_a?(Symbol)
a.tap do |a|
a[:tooltip] ||= a[:name].to_s.humanize
a[:icon] ||= a[:name].to_sym
a[:handler] ||= "on_#{a[:name]}"

a[:icon] = "#{Netzke::Core.icons_uri}/#{a[:icon]}.png" if a[:icon].is_a?(Symbol)
end
end.to_nifty_json
c[:getter] = lambda do |r|
c.actions.map {|a| build_action_config(a)}.netzke_jsonify.to_json
end
end

super
end

private

def build_action_config(a)
a = {name: a} if a.is_a?(Symbol)
a.tap do |a|
a[:tooltip] ||= a[:name].to_s.humanize
a[:icon] ||= a[:name].to_sym
a[:handler] ||= "on_#{a[:name]}"

a[:icon] = "#{Netzke::Core.icons_uri}/#{a[:icon]}.png" if a[:icon].is_a?(Symbol)
end
end
end
end
end

0 comments on commit cd77c43

Please sign in to comment.