class Para::FormBuilder::Tabs::Tab

Attributes

active[RW]
builder[R]
content[R]
icon[R]
identifier[R]
index[R]
object[R]
template[R]

Public Class Methods

new(template, object, builder, identifier, options, index, &content_block) click to toggle source
# File lib/para/form_builder/tabs.rb, line 63
def initialize(template, object, builder, identifier, options, index, &content_block)
  @template = template
  @object = object
  @builder = builder
  @identifier = identifier
  @content = capture { content_block.call }
  @icon = options[:icon]
  @active = options[:active]
  @index = index
end

Public Instance Methods

active?() click to toggle source
# File lib/para/form_builder/tabs.rb, line 97
def active?
  active == true || (active == nil && index == 0)
end
dom_id() click to toggle source
# File lib/para/form_builder/tabs.rb, line 82
def dom_id
  @dom_id = [
    'form-tab',
    object_name,
    builder.nested_resource_dom_id.presence,
    identifier.to_s.parameterize
  ].compact.join('-')
end
object_name() click to toggle source
# File lib/para/form_builder/tabs.rb, line 91
def object_name
  if (name = builder.object_name.presence)
    name.to_s.parameterize
  end
end
title() click to toggle source
# File lib/para/form_builder/tabs.rb, line 74
def title
  if Symbol === identifier
    ::I18n.t("forms.tabs.#{ object.class.model_name.i18n_key }.#{ identifier }")
  else
    identifier
  end
end