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



20
21
22
# File 'lib/active_scaffold/data_structures/action_columns.rb', line 20

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



23
24
25
26
27
28
29
30
# 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_classObject



15
16
17
# File 'lib/active_scaffold/data_structures/action_columns.rb', line 15

def css_class
  @label.to_s.underscore
end

#include?(item) ⇒ Boolean

Returns:

  • (Boolean)


32
33
34
35
36
37
38
# 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

#namesObject



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

def names
  self.collect(&:name)
end

#names_without_auth_checkObject



44
45
46
# File 'lib/active_scaffold/data_structures/action_columns.rb', line 44

def names_without_auth_check
  Array(@set)
end