Sha256: 10089c8dee7c0dcc889b971dbcf8896fa77ba84bcd34f53f8c3c31c6e84667e6

Contents?: true

Size: 1.58 KB

Versions: 8

Compression:

Stored size: 1.58 KB

Contents

module ExpressAdmin
  module Components
    module Navigation

      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
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
express_admin-1.6.13 app/components/express_admin/icon_link.rb
express_admin-1.6.12 app/components/express_admin/icon_link.rb
express_admin-1.6.11 app/components/express_admin/icon_link.rb
express_admin-1.6.10 app/components/express_admin/icon_link.rb
express_admin-1.6.9 app/components/express_admin/icon_link.rb
express_admin-1.6.8 app/components/express_admin/icon_link.rb
express_admin-1.6.7 app/components/express_admin/icon_link.rb
express_admin-1.6.4 app/components/express_admin/icon_link.rb