Class: Voom::Presenters::DSL::Components::Header
- Defined in:
- lib/voom/presenters/dsl/components/header.rb
Constant Summary collapse
- VALID_PLACEMENTS =
%i[static fixed].freeze
Instance Attribute Summary collapse
-
#image ⇒ Object
Returns the value of attribute image.
-
#placement ⇒ Object
Returns the value of attribute placement.
-
#title(*text, **attribs, &block) ⇒ Object
Returns the value of attribute title.
Attributes inherited from Base
#attributes, #css_class, #draggable, #drop_zone, #id, #tag, #type
Instance Method Summary collapse
- #button(icon = nil, **attributes, &block) ⇒ Object
-
#initialize(**attribs_, &block) ⇒ Header
constructor
A new instance of Header.
- #menu(**attribs, &block) ⇒ Object
- #nav(**attribs, &block) ⇒ Object
Methods inherited from Base
Methods included from Pluggable
#include_plugins, #plugin, #plugin_module
Methods included from Mixins::YieldTo
Methods included from Serializer
Methods included from Lockable
Constructor Details
#initialize(**attribs_, &block) ⇒ Header
Returns a new instance of Header.
10 11 12 13 14 15 16 17 |
# File 'lib/voom/presenters/dsl/components/header.rb', line 10 def initialize(**attribs_, &block) super(type: :header, **attribs_, &block) self.title(attribs.delete(:title)) if attribs.key?(:title) @image = attribs.delete(:image) @placement = validate_placement(attribs.delete(:placement) { :static }) end |
Instance Attribute Details
#image ⇒ Object
Returns the value of attribute image.
6 7 8 |
# File 'lib/voom/presenters/dsl/components/header.rb', line 6 def image @image end |
#placement ⇒ Object
Returns the value of attribute placement.
6 7 8 |
# File 'lib/voom/presenters/dsl/components/header.rb', line 6 def placement @placement end |
#title(*text, **attribs, &block) ⇒ Object
Returns the value of attribute title.
6 7 8 |
# File 'lib/voom/presenters/dsl/components/header.rb', line 6 def title @title end |
Instance Method Details
#button(icon = nil, **attributes, &block) ⇒ Object
19 20 21 22 |
# File 'lib/voom/presenters/dsl/components/header.rb', line 19 def (icon=nil, **attributes, &block) return @button if locked? @button = Components::Button.new(icon: icon, parent: self, **attributes, &block) end |
#menu(**attribs, &block) ⇒ Object
24 25 26 27 28 |
# File 'lib/voom/presenters/dsl/components/header.rb', line 24 def (**attribs, &block) return @menu if locked? @menu = Components::Menu.new(parent: self, **attribs, &block) end |
#nav(**attribs, &block) ⇒ Object
30 31 32 33 34 |
# File 'lib/voom/presenters/dsl/components/header.rb', line 30 def nav(**attribs, &block) return @nav if locked? @nav = Components::Menu.new(parent: self, **attribs, &block) end |