Class: Voom::Presenters::DSL::Components::Event
- Inherits:
-
Base
- Object
- Base
- Voom::Presenters::DSL::Components::Event
show all
- Defined in:
- lib/voom/presenters/dsl/components/event.rb
Instance Attribute Summary collapse
Attributes inherited from Base
#attributes, #context, #id, #type
Instance Method Summary
collapse
-
#autocomplete(path, **params, &block) ⇒ Object
-
#deletes(path, **params, &block) ⇒ Object
-
#dialog(dialog_id, **params, &block) ⇒ Object
-
#initialize(**attribs_, &block) ⇒ Event
constructor
-
#loads(presenter = nil, path: nil, **params, &block) ⇒ Object
-
#navigates(direction, **params, &block) ⇒ Object
(also: #navigate)
-
#posts(path, **params, &block) ⇒ Object
(also: #creates)
Method can be one of :post, :put, :delete or :patch.
-
#replaces(target, presenter, **params, &block) ⇒ Object
-
#selects(input_name = nil, **params, &block) ⇒ Object
-
#snackbar(text, **params, &block) ⇒ Object
-
#toggle_visiblity(component_id, **params, &block) ⇒ Object
-
#updates(path, **params, &block) ⇒ Object
Methods inherited from Base
#expand!
#yield_to
Methods included from Serializer
#to_hash
Methods included from Lockable
#lock!, #locked?
Constructor Details
#initialize(**attribs_, &block) ⇒ Event
Returns a new instance of Event.
8
9
10
11
12
13
|
# File 'lib/voom/presenters/dsl/components/event.rb', line 8
def initialize(**attribs_, &block)
super(type: :event, **attribs_, &block)
@event = attribs.delete(:event)
@actions = []
expand!
end
|
Instance Attribute Details
#actions ⇒ Object
Returns the value of attribute actions.
6
7
8
|
# File 'lib/voom/presenters/dsl/components/event.rb', line 6
def actions
@actions
end
|
#event ⇒ Object
Returns the value of attribute event.
6
7
8
|
# File 'lib/voom/presenters/dsl/components/event.rb', line 6
def event
@event
end
|
Instance Method Details
#autocomplete(path, **params, &block) ⇒ Object
82
83
84
85
86
87
88
|
# File 'lib/voom/presenters/dsl/components/event.rb', line 82
def autocomplete(path, **params, &block)
@actions << Components::Action.new(parent: self,
type: :autocomplete,
path: path,
target: "#{parent(:text_field).id}-list",
params: params, &block)
end
|
#deletes(path, **params, &block) ⇒ Object
48
49
50
51
52
53
|
# File 'lib/voom/presenters/dsl/components/event.rb', line 48
def deletes(path, **params, &block)
@actions << Components::Action.new(parent: self,
type: :delete,
path: path,
params: params, &block)
end
|
#dialog(dialog_id, **params, &block) ⇒ Object
55
56
57
58
59
60
|
# File 'lib/voom/presenters/dsl/components/event.rb', line 55
def dialog(dialog_id, **params, &block)
@actions << Components::Action.new(parent: self,
type: :dialog,
target: dialog_id,
params: params, &block)
end
|
#loads(presenter = nil, path: nil, **params, &block) ⇒ Object
15
16
17
18
19
20
21
|
# File 'lib/voom/presenters/dsl/components/event.rb', line 15
def loads(presenter=nil, path: nil, **params, &block)
@actions << Components::Action.new(parent: self,
type: :loads,
presenter: presenter,
path: path,
params: params, &block)
end
|
#navigates(direction, **params, &block) ⇒ Object
Also known as:
navigate
90
91
92
93
94
95
|
# File 'lib/voom/presenters/dsl/components/event.rb', line 90
def navigates(direction, **params, &block)
@actions << Components::Action.new(parent: self,
type: :navigates,
direction: direction,
params: params, &block)
end
|
#posts(path, **params, &block) ⇒ Object
Also known as:
creates
Method can be one of :post, :put, :delete or :patch
32
33
34
35
36
37
|
# File 'lib/voom/presenters/dsl/components/event.rb', line 32
def posts(path, **params, &block)
@actions << Components::Action.new(parent: self,
type: :post,
path: path,
params: params, &block)
end
|
#replaces(target, presenter, **params, &block) ⇒ Object
23
24
25
26
27
28
29
|
# File 'lib/voom/presenters/dsl/components/event.rb', line 23
def replaces(target, presenter, **params, &block)
@actions << Components::Action.new(parent: self,
type: :replaces,
target: target,
presenter: presenter,
params: params, &block)
end
|
#selects(input_name = nil, **params, &block) ⇒ Object
69
70
71
72
73
74
|
# File 'lib/voom/presenters/dsl/components/event.rb', line 69
def selects(input_name=nil, **params, &block)
@actions << Components::Action.new(parent: self,
type: :selects,
target: input_name,
params: params, &block)
end
|
#snackbar(text, **params, &block) ⇒ Object
76
77
78
79
80
|
# File 'lib/voom/presenters/dsl/components/event.rb', line 76
def snackbar(text, **params, &block)
@actions << Components::Action.new(parent: self,
type: :snackbar,
params: params.merge(text: text), &block)
end
|
#toggle_visiblity(component_id, **params, &block) ⇒ Object
62
63
64
65
66
67
|
# File 'lib/voom/presenters/dsl/components/event.rb', line 62
def toggle_visiblity(component_id, **params, &block)
@actions << Components::Action.new(parent: self,
type: :toggle_visibility,
target: component_id,
params: params, &block)
end
|
#updates(path, **params, &block) ⇒ Object
41
42
43
44
45
46
|
# File 'lib/voom/presenters/dsl/components/event.rb', line 41
def updates(path, **params, &block)
@actions << Components::Action.new(parent: self,
type: :update,
path: path,
params: params, &block)
end
|