Sha256: b8b7beca5f2ec60f716f6241cfce0f491ba29f4b4a5939c2357482e660957b7a

Contents?: true

Size: 1.89 KB

Versions: 18

Compression:

Stored size: 1.89 KB

Contents

module KirguduBase
	module DynamicPages
		class PageTabBuilder < ::KirguduBase::DynamicPages::PageElementBuilder

			def initialize(name, &block)
				self.builder_options.merge!({
					                            is_active: :false,
					                            lazy_select: :false,
					                            label: :nil,
				                                elements: []
				                            })

				super(name, &block)
			end

			def label(value)
				self.validate_empty_parameter('label', value)
				self.builder_options[:label] = value
			end

			def is_active(value)
				self.validate_empty_parameter('is_active', value)
				self.builder_options[:is_active] = value
			end

			def lazy_select(value)
				self.validate_empty_parameter('lazy_select', value)
				self.builder_options[:lazy_select] = value
			end


			def form(name, &block)
				raise "Cannot create empty Form" unless block_given?
				self.builder_options[:elements] << ::KirguduBase::DynamicPages::FormBuilder.new(name, &block).to_element
			end

			def list(name, &block)
				raise "Cannot create empty List" unless block_given?
				self.builder_options[:elements] << ::KirguduBase::DynamicPages::ListBuilder.new(name, &block).to_element

			end

			def group(name, &block)
				raise "Cannot create empty Group" unless block_given?
				self.builder_options[:elements] << ::KirguduBase::DynamicPages::GroupBuilder.new(name, ::KirguduBase::DynamicPages::Enums::ELEMENTS_FOR_PAGE_TAB, &block).to_element
			end


			def entry(name, &block)
				#raise "Error from List. List Name: #{name}"
				raise "Cannot create empty Entry" unless block_given?
				self.builder_options[:elements] << ::KirguduBase::DynamicPages::EntryBuilder.new(name, &block).to_element
			end

			def to_element
				element = ::KirguduBase::DynamicPages::PageTab.new
				self.build_element(element)
				self.validate_generated_element(element)
				element
			end

		end
	end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
kirgudu_base-0.0.21 app/models/kirgudu_base/dynamic_pages/page_tab_builder.rb
kirgudu_base-0.0.19 app/models/kirgudu_base/dynamic_pages/page_tab_builder.rb
kirgudu_base-0.0.18 app/models/kirgudu_base/dynamic_pages/page_tab_builder.rb
kirgudu_base-0.0.17 app/models/kirgudu_base/dynamic_pages/page_tab_builder.rb
kirgudu_base-0.0.16 app/models/kirgudu_base/dynamic_pages/page_tab_builder.rb
kirgudu_base-0.0.15 app/models/kirgudu_base/dynamic_pages/page_tab_builder.rb
kirgudu_base-0.0.14 app/models/kirgudu_base/dynamic_pages/page_tab_builder.rb
kirgudu_base-0.0.13 app/models/kirgudu_base/dynamic_pages/page_tab_builder.rb
kirgudu_base-0.0.12 app/models/kirgudu_base/dynamic_pages/page_tab_builder.rb
kirgudu_base-0.0.11 app/models/kirgudu_base/dynamic_pages/page_tab_builder.rb
kirgudu_base-0.0.10 app/models/kirgudu_base/dynamic_pages/page_tab_builder.rb
kirgudu_base-0.0.9 app/models/kirgudu_base/dynamic_pages/page_tab_builder.rb
kirgudu_base-0.0.8 app/models/kirgudu_base/dynamic_pages/page_tab_builder.rb
kirgudu_base-0.0.7 app/models/kirgudu_base/dynamic_pages/page_tab_builder.rb
kirgudu_base-0.0.6 app/models/kirgudu_base/dynamic_pages/page_tab_builder.rb
kirgudu_base-0.0.5 app/models/kirgudu_base/dynamic_pages/page_tab_builder.rb
kirgudu_base-0.0.4 app/models/kirgudu_base/dynamic_pages/page_tab_builder.rb
kirgudu_base-0.0.3 app/models/kirgudu_base/dynamic_pages/page_tab_builder.rb