class ActiveScaffold::DataStructures::ActionColumns
A set of columns. These structures can be nested for organization.
Attributes
action[RW]
this lets us refer back to the action responsible for this link, if it exists. the immediate need here is to get the crud_type so we can dynamically filter columns from the set.
collapsed[RW]
Whether this column set is collapsed by default in contexts where collapsing is supported
label[W]
labels are useful for the Create/Update forms, when we display columns in a grouped fashion and want to name them separately
Public Instance Methods
add_subgroup(label, &proc)
click to toggle source
nests a subgroup in the column set
# File lib/active_scaffold/data_structures/action_columns.rb, line 23 def add_subgroup(label, &proc) columns = ActiveScaffold::DataStructures::ActionColumns.new columns.label = label columns.action = self.action columns.configure &proc self.exclude columns.collect_columns self.add columns end
css_class()
click to toggle source
# File lib/active_scaffold/data_structures/action_columns.rb, line 15 def css_class @label.to_s.underscore end
include?(item)
click to toggle source
# File lib/active_scaffold/data_structures/action_columns.rb, line 32 def include?(item) @set.each do |c| return true if !c.is_a? Symbol and c.include? item return true if c == item.to_sym end return false end
label()
click to toggle source
# File lib/active_scaffold/data_structures/action_columns.rb, line 12 def label as_(@label) if @label end
names()
click to toggle source
# File lib/active_scaffold/data_structures/action_columns.rb, line 40 def names self.collect(&:name) end
names_without_auth_check()
click to toggle source
# File lib/active_scaffold/data_structures/action_columns.rb, line 44 def names_without_auth_check Array(@set) end
Protected Instance Methods
collect_columns()
click to toggle source
# File lib/active_scaffold/data_structures/action_columns.rb, line 50 def collect_columns @set.collect {|col| col.is_a?(ActiveScaffold::DataStructures::ActionColumns) ? col.collect_columns : col} end
initialize_copy(from)
click to toggle source
called during clone or dup. makes the clone/dup deeper.
# File lib/active_scaffold/data_structures/action_columns.rb, line 55 def initialize_copy(from) @set = from.instance_variable_get('@set').clone end