Class: ActionLink::Base

Inherits:
ApplicationComponent show all
Defined in:
app/components/action_link/base.rb

Overview

A component that every action link inherits from. It adds the API that all action links have in common.

Direct Known Subclasses

Destroy, Edit, New, Show

Instance Method Summary collapse

Methods inherited from ApplicationComponent

#initialize

Constructor Details

This class inherits a constructor from ActionLink::ApplicationComponent

Instance Method Details

#icon?Boolean

Allows you to turn off the icon.

Returns:

  • (Boolean)


31
32
33
# File 'app/components/action_link/base.rb', line 31

def icon?
  icon != false
end

#icon_tag(name) ⇒ Object



35
36
37
38
# File 'app/components/action_link/base.rb', line 35

def icon_tag(name)
  helpers. :i, nil,
                      class: "o-acticon o-acticon--#{name}"
end

#optionsObject



40
41
42
43
44
45
46
47
48
# File 'app/components/action_link/base.rb', line 40

def options
  {
    title: _title,
    class: _class,
    data: _data,
    target: _target,
    method: http_method
  }
end

#permission?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'app/components/action_link/base.rb', line 26

def permission?
  _policy.public_send(:"#{_action}?")
end