Class: Matestack::Ui::VueJs::Components::Action
- Inherits:
-
Vue
- Object
- Vue
- Matestack::Ui::VueJs::Components::Action
show all
- Defined in:
- lib/matestack/ui/vue_js/components/action.rb
Instance Method Summary
collapse
Methods inherited from Vue
#base_vue_props, #component_attributes, #component_id, #component_uid, #create_children, inherited, #initialize, #matestack_ui_vuejs_ref, #vue_component, vue_name, #vue_name
Instance Method Details
#action_method ⇒ Object
38
39
40
|
# File 'lib/matestack/ui/vue_js/components/action.rb', line 38
def action_method
@action_method ||= options.delete(:method)
end
|
#attributes ⇒ Object
16
17
18
19
20
21
|
# File 'lib/matestack/ui/vue_js/components/action.rb', line 16
def attributes
{
href: ctx.path,
'v-on:click.prevent': 'vc.perform'
}.merge(options)
end
|
#response ⇒ Object
10
11
12
13
14
|
# File 'lib/matestack/ui/vue_js/components/action.rb', line 10
def response
a attributes do
yield
end
end
|
#vue_props ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/matestack/ui/vue_js/components/action.rb', line 23
def vue_props
{}.tap do |conf|
conf[:action_path] = ctx.path
conf[:method] = action_method
conf[:success] = ctx.success
conf[:failure] = ctx.failure
conf[:notify] = true if ctx.notify.nil?
conf[:confirm] = ctx.confirm
conf[:confirm_text] = ctx.confirm.try(:[], :text) || 'Are you sure?'
conf[:data] = ctx.data
conf[:delay] = ctx.delay
conf[:emit] = ctx.emit
end
end
|