Class: Voom::Presenters::DSL::Components::Event
Constant Summary
collapse
- EVENT_MAP =
{focus: :focusin, blur: :focusout, onload: :after_init}
Instance Attribute Summary collapse
Attributes inherited from Base
#attributes, #css_class, #draggable, #drop_zone, #id, #tag, #type
Instance Method Summary
collapse
-
#<<(comp) ⇒ Object
-
#autocomplete(path, **params, &block) ⇒ Object
-
#clear(*ids, **params, &block) ⇒ Object
(also: #clears)
Clears or blanks out a control or form.
-
#close_dialog(component_id, **params, &block) ⇒ Object
-
#deletes(path, input_tag: nil, headers: nil, **params, &block) ⇒ Object
-
#dialog(dialog_id, **params, &block) ⇒ Object
-
#hide(component_id, **params, &block) ⇒ Object
-
#initialize(**attribs_, &block) ⇒ Event
constructor
-
#loads(presenter = nil, path: nil, target: nil, input_tag: nil, wait_for_download: nil, **params, &block) ⇒ Object
-
#navigates(direction, **params, &block) ⇒ Object
(also: #navigate)
-
#post_message(msg, **params, &block) ⇒ Object
-
#posts(path, input_tag: nil, headers: nil, **params, &block) ⇒ Object
(also: #creates)
Method can be one of :post, :put, :delete or :patch.
-
#prompt_if_dirty(dialog_id, input_tag: nil, **params, &block) ⇒ Object
-
#remove(*ids, **params, &block) ⇒ Object
(also: #removes)
Removes the component and all its children Takes either an id or a list of ids.
-
#replaces(target, presenter, input_tag: nil, ignore_input_values: [], **params, &block) ⇒ Object
-
#show(component_id, **params, &block) ⇒ Object
-
#snackbar(text, **params, &block) ⇒ Object
-
#stepper(navigate, **params, &block) ⇒ Object
-
#toggle_disabled(component_id, **params, &block) ⇒ Object
-
#toggle_visibility(component_id, **params, &block) ⇒ Object
-
#updates(path, input_tag: nil, headers: nil, **params, &block) ⇒ Object
#last_response
Methods inherited from Base
#expand!
Methods included from Pluggable
#include_plugins, #plugin, #plugin_module
#yield_to
Methods included from Serializer
#to_hash
Methods included from Lockable
#locked?
Constructor Details
#initialize(**attribs_, &block) ⇒ Event
Returns a new instance of Event.
10
11
12
13
14
15
|
# File 'lib/voom/presenters/dsl/components/event.rb', line 10
def initialize(**attribs_, &block)
super(type: :event, **attribs_, &block)
@event = alias_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
#<<(comp) ⇒ Object
17
18
19
|
# File 'lib/voom/presenters/dsl/components/event.rb', line 17
def <<(comp)
@actions << comp
end
|
#autocomplete(path, **params, &block) ⇒ Object
118
119
120
121
122
123
124
|
# File 'lib/voom/presenters/dsl/components/event.rb', line 118
def autocomplete(path, **params, &block)
@actions << Actions::Autocomplete.new(parent: self,
type: :autocomplete,
path: path,
target: "#{parent(:text_field).id}-list",
params: params, &block)
end
|
#clear(*ids, **params, &block) ⇒ Object
Also known as:
clears
Clears or blanks out a control or form. Takes either an id or a list of ids. If the id is that of a form then all the clearable inputs on the form will be cleared.
136
137
138
139
|
# File 'lib/voom/presenters/dsl/components/event.rb', line 136
def clear(*ids, **params, &block)
self << Actions::Clear.new(parent: self,
params: params.merge(ids: ids), &block)
end
|
#close_dialog(component_id, **params, &block) ⇒ Object
142
143
144
145
146
|
# File 'lib/voom/presenters/dsl/components/event.rb', line 142
def close_dialog(component_id, **params, &block)
self << Actions::CloseDialog.new(parent: self,
target: component_id,
params: params, &block)
end
|
#deletes(path, input_tag: nil, headers: nil, **params, &block) ⇒ Object
59
60
61
62
63
64
65
|
# File 'lib/voom/presenters/dsl/components/event.rb', line 59
def deletes(path, input_tag: nil, headers: nil, **params, &block)
self << Actions::Deletes.new(parent: self,
path: path,
input_tag: input_tag,
headers: ,
params: params, &block)
end
|
#dialog(dialog_id, **params, &block) ⇒ Object
67
68
69
70
71
|
# File 'lib/voom/presenters/dsl/components/event.rb', line 67
def dialog(dialog_id, **params, &block)
self << Actions::Dialog.new(parent: self,
target: dialog_id,
params: params, &block)
end
|
#hide(component_id, **params, &block) ⇒ Object
107
108
109
110
111
|
# File 'lib/voom/presenters/dsl/components/event.rb', line 107
def hide(component_id, **params, &block)
self << Actions::ToggleVisibility.new(parent: self,
target: component_id,
params: params.merge(action: :hide), &block)
end
|
#loads(presenter = nil, path: nil, target: nil, input_tag: nil, wait_for_download: nil, **params, &block) ⇒ Object
21
22
23
24
25
26
27
28
29
|
# File 'lib/voom/presenters/dsl/components/event.rb', line 21
def loads(presenter = nil, path: nil, target: nil, input_tag: nil, wait_for_download: nil, **params, &block)
self << Actions::Loads.new(parent: self,
presenter: presenter,
path: path,
target: target,
input_tag: input_tag,
wait_for_download: wait_for_download,
params: params, &block)
end
|
#navigates(direction, **params, &block) ⇒ Object
Also known as:
navigate
126
127
128
129
|
# File 'lib/voom/presenters/dsl/components/event.rb', line 126
def navigates(direction, **params, &block)
self << Actions::Navigates.new(parent: self,
params: params.merge(direction: direction), &block)
end
|
#post_message(msg, **params, &block) ⇒ Object
148
149
150
151
|
# File 'lib/voom/presenters/dsl/components/event.rb', line 148
def post_message(msg, **params, &block)
self << Actions::PostMessage.new(parent: self,
params: params.merge(message: msg), &block)
end
|
#posts(path, input_tag: nil, headers: nil, **params, &block) ⇒ Object
Also known as:
creates
Method can be one of :post, :put, :delete or :patch
41
42
43
44
45
46
47
|
# File 'lib/voom/presenters/dsl/components/event.rb', line 41
def posts(path, input_tag: nil, headers: nil, **params, &block)
self << Actions::Posts.new(parent: self,
path: path,
input_tag: input_tag,
headers: ,
params: params, &block)
end
|
#prompt_if_dirty(dialog_id, input_tag: nil, **params, &block) ⇒ Object
85
86
87
88
89
90
|
# File 'lib/voom/presenters/dsl/components/event.rb', line 85
def prompt_if_dirty(dialog_id, input_tag: nil, **params, &block)
self << Actions::PromptIfDirty.new(parent: self,
target: dialog_id,
input_tag: input_tag,
params: params, &block)
end
|
#remove(*ids, **params, &block) ⇒ Object
Also known as:
removes
Removes the component and all its children Takes either an id or a list of ids.
94
95
96
97
|
# File 'lib/voom/presenters/dsl/components/event.rb', line 94
def remove(*ids, **params, &block)
self << Actions::Remove.new(parent: self,
params: params.merge(ids: ids), &block)
end
|
#replaces(target, presenter, input_tag: nil, ignore_input_values: [], **params, &block) ⇒ Object
31
32
33
34
35
36
37
38
|
# File 'lib/voom/presenters/dsl/components/event.rb', line 31
def replaces(target, presenter, input_tag: nil, ignore_input_values: [], **params, &block)
self << Actions::Replaces.new(parent: self,
target: target,
presenter: presenter,
input_tag: input_tag,
ignore_input_values: Array(ignore_input_values),
params: params, &block)
end
|
#show(component_id, **params, &block) ⇒ Object
101
102
103
104
105
|
# File 'lib/voom/presenters/dsl/components/event.rb', line 101
def show(component_id, **params, &block)
self << Actions::ToggleVisibility.new(parent: self,
target: component_id,
params: params.merge(action: :show), &block)
end
|
#snackbar(text, **params, &block) ⇒ Object
113
114
115
116
|
# File 'lib/voom/presenters/dsl/components/event.rb', line 113
def snackbar(text, **params, &block)
self << Actions::Snackbar.new(parent: self,
params: params.merge(text: text), &block)
end
|
#stepper(navigate, **params, &block) ⇒ Object
153
154
155
156
|
# File 'lib/voom/presenters/dsl/components/event.rb', line 153
def stepper(navigate, **params, &block)
self << Actions::Stepper.new(parent: self,
params: params.merge(navigate: navigate, stepper_id: parent(:stepper).id), &block)
end
|
#toggle_disabled(component_id, **params, &block) ⇒ Object
79
80
81
82
83
|
# File 'lib/voom/presenters/dsl/components/event.rb', line 79
def toggle_disabled(component_id, **params, &block)
self << Actions::ToggleDisabled.new(parent: self,
target: component_id,
params: params, &block)
end
|
#toggle_visibility(component_id, **params, &block) ⇒ Object
73
74
75
76
77
|
# File 'lib/voom/presenters/dsl/components/event.rb', line 73
def toggle_visibility(component_id, **params, &block)
self << Actions::ToggleVisibility.new(parent: self,
target: component_id,
params: params, &block)
end
|
#updates(path, input_tag: nil, headers: nil, **params, &block) ⇒ Object
51
52
53
54
55
56
57
|
# File 'lib/voom/presenters/dsl/components/event.rb', line 51
def updates(path, input_tag: nil, headers: nil, **params, &block)
self << Actions::Updates.new(parent: self,
path: path,
input_tag: input_tag,
headers: ,
params: params, &block)
end
|