Class: Para::FormBuilder::Tabs::Tab

Inherits:
Object
  • Object
show all
Defined in:
lib/para/form_builder/tabs.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(template, object, identifier, options, &content_block) ⇒ Tab

Returns a new instance of Tab.



34
35
36
37
38
39
40
# File 'lib/para/form_builder/tabs.rb', line 34

def initialize(template, object, identifier, options, &content_block)
  @template = template
  @object = object
  @identifier = identifier
  @content = capture { content_block.call }
  @icon = options[:icon]
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



30
31
32
# File 'lib/para/form_builder/tabs.rb', line 30

def content
  @content
end

#iconObject (readonly)

Returns the value of attribute icon.



30
31
32
# File 'lib/para/form_builder/tabs.rb', line 30

def icon
  @icon
end

#identifierObject (readonly)

Returns the value of attribute identifier.



30
31
32
# File 'lib/para/form_builder/tabs.rb', line 30

def identifier
  @identifier
end

#objectObject (readonly)

Returns the value of attribute object.



30
31
32
# File 'lib/para/form_builder/tabs.rb', line 30

def object
  @object
end

#templateObject (readonly)

Returns the value of attribute template.



30
31
32
# File 'lib/para/form_builder/tabs.rb', line 30

def template
  @template
end

Instance Method Details

#dom_idObject



50
51
52
# File 'lib/para/form_builder/tabs.rb', line 50

def dom_id
  @dom_id = identifier.to_s.parameterize
end

#titleObject



42
43
44
45
46
47
48
# File 'lib/para/form_builder/tabs.rb', line 42

def title
  if Symbol === identifier
    ::I18n.t("forms.tabs.#{ object.class.model_name.i18n_key }.#{ identifier }")
  else
    identifier
  end
end