Module: ActiveScaffold::Helpers::IdHelpers

Included in:
ControllerHelpers, ViewHelpers
Defined in:
lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/id_helpers.rb

Overview

A bunch of helper methods to produce the common view ids

Instance Method Summary collapse

Instance Method Details

#action_iframe_id(options) ⇒ Object



117
118
119
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/id_helpers.rb', line 117

def action_iframe_id(options)
  "#{controller_id}-#{options[:action]}-#{options[:id]}-iframe"
end


53
54
55
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/id_helpers.rb', line 53

def action_link_id(link_action,link_id)
  "#{controller_id}-#{link_action}-#{link_id}-link"
end

#active_scaffold_calculations_idObject



29
30
31
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/id_helpers.rb', line 29

def active_scaffold_calculations_id
  "#{controller_id}-calculations"
end

#active_scaffold_column_header_id(column) ⇒ Object



57
58
59
60
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/id_helpers.rb', line 57

def active_scaffold_column_header_id(column)
  name = column.respond_to?(:name) ? column.name : column.to_s
  clean_id "#{controller_id}-#{name}-column"
end

#active_scaffold_content_idObject



17
18
19
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/id_helpers.rb', line 17

def active_scaffold_content_id
  "#{controller_id}-content"
end

#active_scaffold_idObject



13
14
15
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/id_helpers.rb', line 13

def active_scaffold_id
  "#{controller_id}-active-scaffold"
end

#active_scaffold_messages_idObject



25
26
27
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/id_helpers.rb', line 25

def active_scaffold_messages_id
  "#{controller_id}-messages"
end

#active_scaffold_tbody_idObject



21
22
23
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/id_helpers.rb', line 21

def active_scaffold_tbody_id
  "#{controller_id}-tbody"
end

#active_scaffold_tools_form_columns_to_ignore(column) ⇒ Object



135
136
137
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/id_helpers.rb', line 135

def active_scaffold_tools_form_columns_to_ignore(column)
  @form_column_names.nil? ? false : !@form_column_names.include?(column.name)
end

#active_scaffold_tools_list_columnsObject



131
132
133
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/id_helpers.rb', line 131

def active_scaffold_tools_list_columns
  @list_columns || active_scaffold_config.list.columns.collect
end

#association_subform_id(column) ⇒ Object



84
85
86
87
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/id_helpers.rb', line 84

def association_subform_id(column)
  klass = column.association.klass.to_s.underscore
  clean_id "#{controller_id}-associated-#{klass}"
end

#before_header_idObject



37
38
39
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/id_helpers.rb', line 37

def before_header_id
  "#{controller_id}-search-container"
end

#controller_idObject



9
10
11
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/id_helpers.rb', line 9

def controller_id
  @controller_id ||= 'as_' + id_from_controller(params[:eid] || params[:parent_controller] || params[:controller])
end

#customize_form_idObject

AST Begin



122
123
124
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/id_helpers.rb', line 122

def customize_form_id
  "#{controller_id}-customize-form"
end

#element_cell_id(options = {}) ⇒ Object



69
70
71
72
73
74
75
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/id_helpers.rb', line 69

def element_cell_id(options = {})
  options[:action] ||= params[:action]
  options[:id] ||= params[:id]
  options[:id] ||= params[:parent_id]
  options[:name] ||= params[:name]
  clean_id "#{controller_id}-#{options[:action]}-#{options[:id]}-#{options[:name]}-cell"
end

#element_form_id(options = {}) ⇒ Object



77
78
79
80
81
82
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/id_helpers.rb', line 77

def element_form_id(options = {})
  options[:action] ||= params[:action]
  options[:id] ||= params[:id]
  options[:id] ||= params[:parent_id]
  clean_id "#{controller_id}-#{options[:action]}-#{options[:id]}-form"
end

#element_messages_id(options = {}) ⇒ Object



110
111
112
113
114
115
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/id_helpers.rb', line 110

def element_messages_id(options = {})
  options[:action] ||= params[:action]
  options[:id] ||= params[:id]
  options[:id] ||= params[:parent_id]
  clean_id "#{controller_id}-#{options[:action]}-#{options[:id]}-messages"
end

#element_row_id(options = {}) ⇒ Object



62
63
64
65
66
67
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/id_helpers.rb', line 62

def element_row_id(options = {})
  options[:action] ||= params[:action]
  options[:id] ||= params[:id]
  options[:id] ||= params[:parent_id]
  clean_id "#{controller_id}-#{options[:action]}-#{options[:id]}-row"
end

#empty_message_idObject



33
34
35
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/id_helpers.rb', line 33

def empty_message_id
  "#{controller_id}-empty-message"
end

#field_error_id(column) ⇒ Object



139
140
141
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/id_helpers.rb', line 139

def field_error_id(column)
  "field_error_#{column.name}_#{params[:eid] || params[:id]}"
end

#id_from_controller(controller) ⇒ Object



5
6
7
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/id_helpers.rb', line 5

def id_from_controller(controller)
  controller.gsub("/", "__")
end

#loading_indicator_id(options = {}) ⇒ Object



89
90
91
92
93
94
95
96
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/id_helpers.rb', line 89

def loading_indicator_id(options = {})
  options[:action] ||= params[:action]
  unless options[:id]
    clean_id "#{controller_id}-#{options[:action]}-loading-indicator"
  else
    clean_id "#{controller_id}-#{options[:action]}-#{options[:id]}-loading-indicator"
  end
end

#nested_id(options = {}) ⇒ Object



126
127
128
129
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/id_helpers.rb', line 126

def nested_id(options = {})
  options[:action] = :nested
  element_row_id(options)
end

#search_form_idObject



41
42
43
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/id_helpers.rb', line 41

def search_form_id
  "#{controller_id}-search-form"
end

#search_input_idObject



45
46
47
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/id_helpers.rb', line 45

def search_input_id
  "#{controller_id}-search-input"
end

#sub_form_id(options = {}) ⇒ Object



98
99
100
101
102
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/id_helpers.rb', line 98

def sub_form_id(options = {})
  options[:id] ||= params[:id]
  options[:id] ||= params[:parent_id]
  clean_id "#{controller_id}-#{options[:id]}-#{options[:association]}-subform"
end

#sub_form_list_id(options = {}) ⇒ Object



104
105
106
107
108
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/id_helpers.rb', line 104

def sub_form_list_id(options = {})
  options[:id] ||= params[:id]
  options[:id] ||= params[:parent_id]
  clean_id "#{controller_id}-#{options[:id]}-#{options[:association]}-subform-list"
end

#table_action_id(name) ⇒ Object



49
50
51
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/id_helpers.rb', line 49

def table_action_id(name)
  "#{controller_id}-action-table-#{name}"
end