Class: Administrate::Page::Form
- Defined in:
- lib/administrate/page/form.rb
Instance Attribute Summary collapse
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
Instance Method Summary collapse
- #attributes(action = nil) ⇒ Object
-
#initialize(dashboard, resource) ⇒ Form
constructor
A new instance of Form.
- #page_title ⇒ Object
Methods inherited from Base
#collection_includes, #item_associations, #item_includes, #resource_name, #resource_path
Constructor Details
#initialize(dashboard, resource) ⇒ Form
Returns a new instance of Form.
6 7 8 9 |
# File 'lib/administrate/page/form.rb', line 6 def initialize(dashboard, resource) super(dashboard) @resource = resource end |
Instance Attribute Details
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
11 12 13 |
# File 'lib/administrate/page/form.rb', line 11 def resource @resource end |
Instance Method Details
#attributes(action = nil) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/administrate/page/form.rb', line 13 def attributes(action = nil) action = case action when "update" then "edit" when "create" then "new" else action end dashboard.form_attributes(action).map do |attribute| attribute_field(dashboard, resource, attribute, :form) end end |
#page_title ⇒ Object
26 27 28 |
# File 'lib/administrate/page/form.rb', line 26 def page_title dashboard.display_resource(resource) end |