Class: Voom::Presenters::DSL::Components::Lists::Line
- Inherits:
-
EventBase
- Object
- Base
- EventBase
- Voom::Presenters::DSL::Components::Lists::Line
show all
- Defined in:
- lib/voom/presenters/dsl/components/lists/line.rb
Instance Attribute Summary collapse
Attributes inherited from EventBase
#event_parent_id
#events
Attributes inherited from Base
#attributes, #context, #id, #type
Instance Method Summary
collapse
-
#action(**attribs, &block) ⇒ Object
-
#avatar(avatar = nil, **attribs, &block) ⇒ Object
-
#body(*text, **attribs, &block) ⇒ Object
-
#checkbox(**attributes, &block) ⇒ Object
-
#icon(icon = nil, **attribs, &block) ⇒ Object
-
#info(*text, **attribs, &block) ⇒ Object
-
#initialize(context:, **attribs_, &block) ⇒ Line
constructor
-
#menu(**attributes, &block) ⇒ Object
-
#subtitle(*text, **attribs, &block) ⇒ Object
-
#text(*text, **attribs, &block) ⇒ Object
#event
Methods inherited from Base
#expand!
#yield_to
Methods included from Serializer
#to_hash
Methods included from Lockable
#lock!, #locked?
Constructor Details
#initialize(context:, **attribs_, &block) ⇒ Line
Returns a new instance of Line.
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/voom/presenters/dsl/components/lists/line.rb', line 15
def initialize(context:, **attribs_, &block)
super(type: :line, context: context, **attribs_, &block)
@selected = attribs.delete(:selected)
self.text(attribs.delete(:text)) if attribs.key?(:text)
self.subtitle(attribs.delete(:subtitle)) if attribs.key?(:subtitle)
self.info(attribs.delete(:info)) if attribs.key?(:info)
self.body(attribs.delete(:body)) if attribs.key?(:body)
self.avatar(attribs.delete(:avatar)) if attribs.key?(:avatar)
self.icon(attribs.delete(:icon)) if attribs.key?(:icon)
self.checkbox(attribs.delete(:ccheckbox)) if attribs.key?(:checkbox)
@actions = []
expand!
end
|
Instance Attribute Details
#actions ⇒ Object
Returns the value of attribute actions.
13
14
15
|
# File 'lib/voom/presenters/dsl/components/lists/line.rb', line 13
def actions
@actions
end
|
#selected ⇒ Object
Returns the value of attribute selected.
13
14
15
|
# File 'lib/voom/presenters/dsl/components/lists/line.rb', line 13
def selected
@selected
end
|
Instance Method Details
#action(**attribs, &block) ⇒ Object
74
75
76
77
|
# File 'lib/voom/presenters/dsl/components/lists/line.rb', line 74
def action(**attribs, &block)
@actions << Lists::Action.new(parent: self,
**attribs, &block)
end
|
#avatar(avatar = nil, **attribs, &block) ⇒ Object
50
51
52
53
54
55
|
# File 'lib/voom/presenters/dsl/components/lists/line.rb', line 50
def avatar(avatar = nil, **attribs, &block)
return @avatar if locked?
@avatar = Avatar.new(parent: self, avatar: avatar,
context: context,
**attribs, &block)
end
|
#body(*text, **attribs, &block) ⇒ Object
45
46
47
48
|
# File 'lib/voom/presenters/dsl/components/lists/line.rb', line 45
def body(*text, **attribs, &block)
return @body if locked?
@body = Components::Typography.new(parent: self, type: :body, text: text, context: context, **attribs, &block)
end
|
#checkbox(**attributes, &block) ⇒ Object
64
65
66
67
|
# File 'lib/voom/presenters/dsl/components/lists/line.rb', line 64
def checkbox(**attributes, &block)
return @checkbox if locked?
@checkbox = Components::Checkbox.new(parent: self, context: context, **attributes, &block)
end
|
#icon(icon = nil, **attribs, &block) ⇒ Object
57
58
59
60
61
62
|
# File 'lib/voom/presenters/dsl/components/lists/line.rb', line 57
def icon(icon=nil, **attribs, &block)
return @icon if locked?
@icon = Icon.new(parent: self, icon: icon,
context: context,
**attribs, &block)
end
|
#info(*text, **attribs, &block) ⇒ Object
40
41
42
43
|
# File 'lib/voom/presenters/dsl/components/lists/line.rb', line 40
def info(*text, **attribs, &block)
return @info if locked?
@info = Components::Typography.new(parent: self, type: :info, text: text, context: context, **attribs, &block)
end
|
69
70
71
72
|
# File 'lib/voom/presenters/dsl/components/lists/line.rb', line 69
def (**attributes, &block)
return @menu if locked?
@menu = Components::Menu.new(parent: self, context: context, **attributes, &block)
end
|
#subtitle(*text, **attribs, &block) ⇒ Object
35
36
37
38
|
# File 'lib/voom/presenters/dsl/components/lists/line.rb', line 35
def subtitle(*text, **attribs, &block)
return @subtitle if locked?
@subtitle = Components::Typography.new(parent: self, type: :subtitle, text: text, context: context, **attribs, &block)
end
|
#text(*text, **attribs, &block) ⇒ Object
30
31
32
33
|
# File 'lib/voom/presenters/dsl/components/lists/line.rb', line 30
def text(*text, **attribs, &block)
return @text if locked?
@text = Components::Typography.new(parent: self, type: :text, text: text, context: context, **attribs, &block)
end
|