Sha256: 0a6b4274eea507d08de2fceb5f603e704b5f7fa94ee395a2efa4000bb0702d0e

Contents?: true

Size: 1.32 KB

Versions: 9

Compression:

Stored size: 1.32 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, class: "simple-has-tip",
                             data: { tooltip: true, disable_hover: false, click_open: false },
                             title: title) do
            icon(icon_name)
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
decidim-admin-0.9.3 app/helpers/decidim/admin/icon_link_helper.rb
decidim-admin-0.9.2 app/helpers/decidim/admin/icon_link_helper.rb
decidim-admin-0.9.1 app/helpers/decidim/admin/icon_link_helper.rb
decidim-admin-0.9.0 app/helpers/decidim/admin/icon_link_helper.rb
decidim-admin-0.8.4 app/helpers/decidim/admin/icon_link_helper.rb
decidim-admin-0.8.3 app/helpers/decidim/admin/icon_link_helper.rb
decidim-admin-0.8.2 app/helpers/decidim/admin/icon_link_helper.rb
decidim-admin-0.8.1 app/helpers/decidim/admin/icon_link_helper.rb
decidim-admin-0.8.0 app/helpers/decidim/admin/icon_link_helper.rb