Sha256: 7b5ef48cdd9d8eb0365d35f43fc533035a8b85e138403fafbcc5c1b6a6e6c09e

Contents?: true

Size: 922 Bytes

Versions: 5

Compression:

Stored size: 922 Bytes

Contents

module HungryForm
  module Elements
    # 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
    class Page < Base::Group
      attr_accessor :title

      hashable :title

      def initialize(name, parent, resolver, attributes = {}, &block)
        super
        self.title ||= label
      end

      def to_s
        self.name
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
hungryform-0.0.10 lib/hungryform/elements/page.rb
hungryform-0.0.9 lib/hungryform/elements/page.rb
hungryform-0.0.8 lib/hungryform/elements/page.rb
hungryform-0.0.7 lib/hungryform/elements/page.rb
hungryform-0.0.6 lib/hungryform/elements/page.rb