Class: ActiveScaffold::DataStructures::ActionColumns

Inherits:
Set
  • Object
show all
Includes:
Configurable
Defined in:
lib/active_scaffold/data_structures/action_columns.rb

Overview

A set of columns. These structures can be nested for organization.

Defined Under Namespace

Modules: AfterConfiguration

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Configurable

#configure, #method_missing

Methods inherited from Set

#add, #each, #empty?, #exclude, #find_by_name, #find_by_names, #initialize, #length

Constructor Details

This class inherits a constructor from ActiveScaffold::DataStructures::Set

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ActiveScaffold::Configurable

Instance Attribute Details

#actionObject

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.



8
9
10
# File 'lib/active_scaffold/data_structures/action_columns.rb', line 8

def action
  @action
end

#collapsedObject

Whether this column set is collapsed by default in contexts where collapsing is supported



17
18
19
# File 'lib/active_scaffold/data_structures/action_columns.rb', line 17

def collapsed
  @collapsed
end

#labelObject



12
13
14
# File 'lib/active_scaffold/data_structures/action_columns.rb', line 12

def label
  as_(@label) if @label
end

Instance Method Details

#add_subgroup(label, &proc) ⇒ Object

nests a subgroup in the column set



20
21
22
23
24
25
26
27
# File 'lib/active_scaffold/data_structures/action_columns.rb', line 20

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

#include?(item) ⇒ Boolean

Returns:

  • (Boolean)


29
30
31
32
33
34
35
# File 'lib/active_scaffold/data_structures/action_columns.rb', line 29

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

#namesObject



37
38
39
# File 'lib/active_scaffold/data_structures/action_columns.rb', line 37

def names
  self.collect(&:name)
end

#names_without_auth_checkObject



41
42
43
# File 'lib/active_scaffold/data_structures/action_columns.rb', line 41

def names_without_auth_check
  Array(@set)
end