Class: Trestle::Tab
- Inherits:
-
Object
- Object
- Trestle::Tab
- Includes:
- ActionView::Helpers::TagHelper
- Defined in:
- lib/trestle/tab.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #badge ⇒ Object
- #id(tag = nil) ⇒ Object
-
#initialize(name, **options) ⇒ Tab
constructor
A new instance of Tab.
- #label ⇒ Object
Constructor Details
#initialize(name, **options) ⇒ Tab
Returns a new instance of Tab.
9 10 11 |
# File 'lib/trestle/tab.rb', line 9 def initialize(name, **) @name, @options = name, end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/trestle/tab.rb', line 7 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/trestle/tab.rb', line 7 def @options end |
Instance Method Details
#badge ⇒ Object
21 22 23 |
# File 'lib/trestle/tab.rb', line 21 def badge tag.span([:badge], class: "badge") if [:badge] end |
#id(tag = nil) ⇒ Object
13 14 15 |
# File 'lib/trestle/tab.rb', line 13 def id(tag=nil) ["tab", tag, name].compact.join("-") end |
#label ⇒ Object
17 18 19 |
# File 'lib/trestle/tab.rb', line 17 def label safe_join([[:label] || I18n.t("admin.tabs.#{name}", default: name.to_s.titleize), badge].compact, " ") end |