Sha256: 24f65690092757283af711fead1dbbc687abfad81f25bdb8f06ca70bdda83cac

Contents?: true

Size: 1.3 KB

Versions: 46

Compression:

Stored size: 1.3 KB

Contents

# frozen_string_literal: true

module Decidim
  module Admin
    module IconLinkHelper
      # This helper adds the necessary boilerplate for the admin icon links.
      #
      # icon_name - A String representing the icon name from Iconic
      #             http://useiconic.com/open
      # link      - The path or url where the link should point to.
      # title     - A String that will be shown when hovering the icon.
      # options   - An optional Hash containing extra data for the link:
      #             method - Symbol of HTTP verb. Supported verbs are :post, :get, :delete, :patch, and :put.
      #             class  - Any extra class that will be added to the link.
      #             data   - This option can be used to add custom data attributes.
      #
      def icon_link_to(icon_name, link, title, options = {})
        link_to(link,
                method: options[:method],
                class: "action-icon #{options[:class]}",
                data: options[:data] || {},
                title: title,
                target: options[:target]) do
          content_tag(:span, data: { tooltip: true, disable_hover: false, click_open: false },
                             title: title) do
            icon(icon_name, aria_label: title, role: "img")
          end
        end
      end
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
decidim-admin-0.27.9 app/helpers/decidim/admin/icon_link_helper.rb
decidim-admin-0.27.8 app/helpers/decidim/admin/icon_link_helper.rb
decidim-admin-0.27.7 app/helpers/decidim/admin/icon_link_helper.rb
decidim-admin-0.27.6 app/helpers/decidim/admin/icon_link_helper.rb
decidim-admin-0.26.10 app/helpers/decidim/admin/icon_link_helper.rb
decidim-admin-0.26.9 app/helpers/decidim/admin/icon_link_helper.rb
decidim-admin-0.27.5 app/helpers/decidim/admin/icon_link_helper.rb
decidim-admin-0.26.8 app/helpers/decidim/admin/icon_link_helper.rb
decidim-admin-0.27.4 app/helpers/decidim/admin/icon_link_helper.rb
decidim-admin-0.27.3 app/helpers/decidim/admin/icon_link_helper.rb
decidim-admin-0.26.7 app/helpers/decidim/admin/icon_link_helper.rb
decidim-admin-0.26.5 app/helpers/decidim/admin/icon_link_helper.rb
decidim-admin-0.27.2 app/helpers/decidim/admin/icon_link_helper.rb
decidim-admin-0.27.1 app/helpers/decidim/admin/icon_link_helper.rb
decidim-admin-0.26.4 app/helpers/decidim/admin/icon_link_helper.rb
decidim-admin-0.27.0 app/helpers/decidim/admin/icon_link_helper.rb
decidim-admin-0.26.3 app/helpers/decidim/admin/icon_link_helper.rb
decidim-admin-0.27.0.rc2 app/helpers/decidim/admin/icon_link_helper.rb
decidim-admin-0.27.0.rc1 app/helpers/decidim/admin/icon_link_helper.rb
decidim-admin-0.26.2 app/helpers/decidim/admin/icon_link_helper.rb