Class: EasyAdmin::Layouts::Nodes::Tab
- Inherits:
-
BaseNode
- Object
- BaseNode
- EasyAdmin::Layouts::Nodes::Tab
show all
- Defined in:
- lib/easy_admin/layouts/nodes/tab.rb
Overview
Individual tab within a tabs container
Instance Attribute Summary
Attributes inherited from BaseNode
#attributes, #children, #metadata, #visible_if
Instance Method Summary
collapse
Methods inherited from BaseNode
#[], #[]=, #accept, #add_child, #children?, #node_type, #visible?
Constructor Details
#initialize(name, attributes = {}) ⇒ Tab
Returns a new instance of Tab.
6
7
8
9
10
11
12
|
# File 'lib/easy_admin/layouts/nodes/tab.rb', line 6
def initialize(name, attributes = {})
super(attributes)
@attributes[:name] = name.to_s
@attributes[:label] ||= name.to_s.humanize
@attributes[:icon] ||= nil
@attributes[:badge] ||= nil
end
|
Instance Method Details
#badge ⇒ Object
26
27
28
|
# File 'lib/easy_admin/layouts/nodes/tab.rb', line 26
def badge
@attributes[:badge]
end
|
#icon ⇒ Object
22
23
24
|
# File 'lib/easy_admin/layouts/nodes/tab.rb', line 22
def icon
@attributes[:icon]
end
|
#label ⇒ Object
18
19
20
|
# File 'lib/easy_admin/layouts/nodes/tab.rb', line 18
def label
@attributes[:label]
end
|
#name ⇒ Object
14
15
16
|
# File 'lib/easy_admin/layouts/nodes/tab.rb', line 14
def name
@attributes[:name]
end
|
#panel_id ⇒ Object
34
35
36
|
# File 'lib/easy_admin/layouts/nodes/tab.rb', line 34
def panel_id
"panel-#{name.parameterize}"
end
|
#tab_id ⇒ Object
30
31
32
|
# File 'lib/easy_admin/layouts/nodes/tab.rb', line 30
def tab_id
"tab-#{name.parameterize}"
end
|