class Matestack::Ui::VueJs::Components::Action

Public Instance Methods

action_method() click to toggle source
# File lib/matestack/ui/vue_js/components/action.rb, line 38
def action_method
  @action_method ||= options.delete(:method)
end
attributes() click to toggle source
# File lib/matestack/ui/vue_js/components/action.rb, line 16
def attributes
  {
    href: ctx.path,
    '@click.prevent': 'perform',
  }.merge(options)
end
response() { || ... } click to toggle source
# File lib/matestack/ui/vue_js/components/action.rb, line 10
def response
  a attributes do
    yield
  end
end
vue_props() click to toggle source
# 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