Sha256: 796de40a80c8e55b0eea27b43381be5724e5956630eedbf37dbdc41b192f66cc

Contents?: true

Size: 1.4 KB

Versions: 13

Compression:

Stored size: 1.4 KB

Contents

module ExpressAdmin
  class IconLink < ExpressTemplates::Components::Configurable

    tag :a

    has_argument :id, "The name of the ionic icon withouth the ion- prefix. See http://ionicons.com/cheatsheet.html",
                     as: :icon_name,
                     type: [:symbol, :string]

    has_option :text,    "Link text to accompany the icon."

    has_option :right,   "Aligns the icon to the right of the text.",
                         default: false
    has_option :href,    "Link path, URL or anchor.",
                         default: '#', attribute: true
    has_option :title,   "Title text for accessibility; appears on mouse hover.",
                         attribute: true
    has_option :confirm, "Should trigger a confirm message.",
                         type: :boolean
    has_option :delete,  "Should perform a delete action.",
                         type: :boolean
    has_option :target,  "The link target attribute. Set to open in a new window or tab.",
                         attribute: true

    before_build -> {
      set_attribute 'data-delete', config[:delete] if config[:delete]
      set_attribute 'data-confirm', config[:confirm] if config[:confirm]
    }

    contains -> {
      if config[:right]
        text_node config[:text]
        icon(config[:icon_name].to_sym)
      else
        icon(config[:icon_name].to_sym)
        text_node config[:text]
      end
    }

  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
express_admin-1.6.3 app/components/express_admin/icon_link.rb
express_admin-1.6.2 app/components/express_admin/icon_link.rb
express_admin-1.6.1 app/components/express_admin/icon_link.rb
express_admin-1.6.0 app/components/express_admin/icon_link.rb
express_admin-1.5.0 app/components/express_admin/icon_link.rb
express_admin-1.4.11 app/components/express_admin/icon_link.rb
express_admin-1.4.10 app/components/express_admin/icon_link.rb
express_admin-1.4.9 app/components/express_admin/icon_link.rb
express_admin-1.4.8 app/components/express_admin/icon_link.rb
express_admin-1.4.7 app/components/express_admin/icon_link.rb
express_admin-1.4.6 app/components/express_admin/icon_link.rb
express_admin-1.4.5 app/components/express_admin/icon_link.rb
express_admin-1.4.4 app/components/express_admin/icon_link.rb