Sha256: d14cd80e7f27ce5fa324a62423900a6dc0979d8fe58898649d3fd5e9b0dcf9e7

Contents?: true

Size: 919 Bytes

Versions: 1

Compression:

Stored size: 919 Bytes

Contents

module Iconly
  module PackagesHelper
    def my_package?(package)
      current_user && package.user == current_user
    end

    def link_to_share(package)
      classes = %w(iconly-earth text-sm mr-1)
      classes << 'shared' if package.shared?
      link_to(share_package_path(package),
              class: classes.join(' '),
              title: 'Make public',
              data: { action: 'share-package', toggle: 'iconly-tooltip' }) do
        content_tag :span, '', class: 'text-pale'
      end
    end

    def icon_svg(icon, project_icons = nil)
      css_class = %w(btn btn-svg float-left)
      css_class << 'selected' if project_icons && project_icons.include?(icon.id)
      data = {
        id:     icon.id,
        action: 'add-to-project',
        toggle: 'iconly-tooltip'
      }
      content_tag :div, icon.markup, class: css_class.join(' '), data: data, title: icon.human_name
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
iconly-1.0.0 app/helpers/iconly/packages_helper.rb