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.
7 8 9 |
# File 'lib/trestle/tab.rb', line 7 def initialize(name, ={}) @name, @options = name, end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/trestle/tab.rb', line 5 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/trestle/tab.rb', line 5 def @options end |
Instance Method Details
#badge ⇒ Object
19 20 21 |
# File 'lib/trestle/tab.rb', line 19 def badge content_tag(:span, [:badge], class: "badge") if [:badge] end |
#id(tag = nil) ⇒ Object
11 12 13 |
# File 'lib/trestle/tab.rb', line 11 def id(tag=nil) ["tab", tag, name].compact.join("-") end |
#label ⇒ Object
15 16 17 |
# File 'lib/trestle/tab.rb', line 15 def label safe_join([[:label] || I18n.t("admin.tabs.#{name}", default: name.to_s.titleize), badge].compact, " ") end |