Class: Edgar::PopupHelper::PopupField
- Inherits:
-
Object
- Object
- Edgar::PopupHelper::PopupField
- Defined in:
- app/helpers/edgar/popup_helper.rb
Overview
handle popup related fields to simplify params[] passing from browser to server.
SEE ALSO
- Edgar.Popup.Field
-
same logic at js side
Instance Attribute Summary (collapse)
-
- (Object) clear_link
, :name_target.
-
- (Object) id_target
, :name_target.
-
- (Object) label_target
, :name_target.
Class Method Summary (collapse)
-
+ (Object) new_builder(f, col_name)
new from FormBuilder and col_name.
Instance Method Summary (collapse)
-
- (PopupField) initialize(id_target)
constructor
A new instance of PopupField.
Constructor Details
- (PopupField) initialize(id_target)
A new instance of PopupField
17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/helpers/edgar/popup_helper.rb', line 17 def initialize(id_target) @id_target = id_target || '__unknown__' # Using id_target as suffix rather than prefix is to avoid # DOM-id conflict. For example, if id_target is 'author_id' and # use it as prefix, then label_target would be something like # 'author_id_label_target' and it would be conflict with actual # author.id_label_target DB column. @label_target = '__edgar_label_target_for_' + @id_target @clear_link = @label_target + '_clear_link' end |
Instance Attribute Details
- (Object) clear_link
, :name_target
10 11 12 |
# File 'app/helpers/edgar/popup_helper.rb', line 10 def clear_link @clear_link end |
- (Object) id_target
, :name_target
10 11 12 |
# File 'app/helpers/edgar/popup_helper.rb', line 10 def id_target @id_target end |
- (Object) label_target
, :name_target
10 11 12 |
# File 'app/helpers/edgar/popup_helper.rb', line 10 def label_target @label_target end |
Class Method Details
+ (Object) new_builder(f, col_name)
new from FormBuilder and col_name
13 14 15 |
# File 'app/helpers/edgar/popup_helper.rb', line 13 def self.new_builder(f, col_name) new(f.object_name.to_s + '_' + col_name.to_s) end |