Class: ActiveScaffold::Config::Form
- Defined in:
- lib/active_scaffold/config/form.rb
Constant Summary collapse
- @@persistent =
false
- @@refresh_list =
false
Instance Attribute Summary collapse
-
#label ⇒ Object
writeonly
the label for this Form action.
-
#link ⇒ Object
the ActionLink for this action.
-
#multipart ⇒ Object
writeonly
whether the form should be multipart.
-
#persistent ⇒ Object
whether the form stays open after a create or not.
-
#refresh_list ⇒ Object
whether we should refresh list after create or not.
-
#show_unauthorized_columns ⇒ Object
show value of unauthorized columns instead of skip them.
Attributes inherited from Base
Instance Method Summary collapse
-
#columns ⇒ Object
provides access to the list of columns specifically meant for the Form to use.
-
#initialize(core_config) ⇒ Form
constructor
A new instance of Form.
- #multipart? ⇒ Boolean
Methods inherited from Base
#crud_type, #formats, #formats=, inherited, #label
Methods included from ActiveScaffold::Configurable
Constructor Details
#initialize(core_config) ⇒ Form
Returns a new instance of Form.
3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/active_scaffold/config/form.rb', line 3 def initialize(core_config) super # start with the ActionLink defined globally @link = self.class.link.clone unless self.class.link.nil? @show_unauthorized_columns = self.class. @refresh_list = self.class.refresh_list @persistent = self.class.persistent # no global setting here because multipart should only be set for specific forms @multipart = false end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ActiveScaffold::Configurable
Instance Attribute Details
#label=(value) ⇒ Object (writeonly)
the label for this Form action. used for the header.
38 39 40 |
# File 'lib/active_scaffold/config/form.rb', line 38 def label=(value) @label = value end |
#link ⇒ Object
the ActionLink for this action
35 36 37 |
# File 'lib/active_scaffold/config/form.rb', line 35 def link @link end |
#multipart=(value) ⇒ Object (writeonly)
whether the form should be multipart
59 60 61 |
# File 'lib/active_scaffold/config/form.rb', line 59 def multipart=(value) @multipart = value end |
#persistent ⇒ Object
whether the form stays open after a create or not
41 42 43 |
# File 'lib/active_scaffold/config/form.rb', line 41 def persistent @persistent end |
#refresh_list ⇒ Object
whether we should refresh list after create or not
44 45 46 |
# File 'lib/active_scaffold/config/form.rb', line 44 def refresh_list @refresh_list end |
#show_unauthorized_columns ⇒ Object
show value of unauthorized columns instead of skip them
32 33 34 |
# File 'lib/active_scaffold/config/form.rb', line 32 def @show_unauthorized_columns end |
Instance Method Details
#columns ⇒ Object
provides access to the list of columns specifically meant for the Form to use
47 48 49 50 51 52 53 54 |
# File 'lib/active_scaffold/config/form.rb', line 47 def columns unless @columns # lazy evaluation self.columns = @core.columns._inheritable self.columns.exclude :created_on, :created_at, :updated_on, :updated_at, :as_marked self.columns.exclude *@core.columns.collect{|c| c.name if c.polymorphic_association?}.compact end @columns end |
#multipart? ⇒ Boolean
60 61 62 |
# File 'lib/active_scaffold/config/form.rb', line 60 def multipart? @multipart ? true : false end |