Module: Iconly::PackagesHelper
- Defined in:
- app/helpers/iconly/packages_helper.rb
Instance Method Summary collapse
- #icon_svg(icon, project_icons = nil) ⇒ Object
- #link_to_share(package) ⇒ Object
- #my_package?(package) ⇒ Boolean
Instance Method Details
#icon_svg(icon, project_icons = nil) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'app/helpers/iconly/packages_helper.rb', line 18 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 |
#link_to_share(package) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'app/helpers/iconly/packages_helper.rb', line 7 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 |
#my_package?(package) ⇒ Boolean
3 4 5 |
# File 'app/helpers/iconly/packages_helper.rb', line 3 def my_package?(package) current_user && package.user == current_user end |