Class: HungryForm::Elements::Page
- Inherits:
-
Base::Group
- Object
- Base::Element
- Base::Group
- HungryForm::Elements::Page
- Defined in:
- lib/hungryform/elements/page.rb
Overview
Page is a main element of a form. Each page can include a page structure, defined in the block
A sample page could look like this:
page :about do
html :before, value: "Please fill out the following fields"
text_field :first_name
text_field :last_name
end
The only required argument of a page is its name. You can specify a title and a label in the attributes like this:
page :about, title: “About me”, label: “About”
If there is no title or label specified, they will be created from the :name argument
Instance Attribute Summary collapse
-
#title ⇒ Object
Returns the value of attribute title.
Attributes inherited from Base::Group
Attributes inherited from Base::Element
#attributes, #dependency, #label, #name, #placeholders, #resolver, #visible
Instance Method Summary collapse
-
#initialize(name, parent, resolver, attributes = {}, &block) ⇒ Page
constructor
A new instance of Page.
- #to_s ⇒ Object
Methods inherited from Base::Group
#invalid?, #method_missing, #respond_to_missing?, #to_hash, #valid?
Methods inherited from Base::Element
#configuration, #dependency_json
Methods included from Base::Hashable
Constructor Details
#initialize(name, parent, resolver, attributes = {}, &block) ⇒ Page
Returns a new instance of Page.
25 26 27 28 |
# File 'lib/hungryform/elements/page.rb', line 25 def initialize(name, parent, resolver, attributes = {}, &block) super self.title = attributes[:title] || label end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class HungryForm::Elements::Base::Group
Instance Attribute Details
#title ⇒ Object
Returns the value of attribute title.
21 22 23 |
# File 'lib/hungryform/elements/page.rb', line 21 def title @title end |
Instance Method Details
#to_s ⇒ Object
30 31 32 |
# File 'lib/hungryform/elements/page.rb', line 30 def to_s self.name end |