From 2a147ffd968a81a93acba059750355c6648f6208 Mon Sep 17 00:00:00 2001 From: pvincent Date: Wed, 26 Jun 2024 02:28:11 +0400 Subject: [PATCH] rename fa_icon_helper --- app/helpers/{icon_helper.rb => fa_icon_helper.rb} | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename app/helpers/{icon_helper.rb => fa_icon_helper.rb} (62%) diff --git a/app/helpers/icon_helper.rb b/app/helpers/fa_icon_helper.rb similarity index 62% rename from app/helpers/icon_helper.rb rename to app/helpers/fa_icon_helper.rb index c2738a7..6c5d99b 100644 --- a/app/helpers/icon_helper.rb +++ b/app/helpers/fa_icon_helper.rb @@ -1,12 +1,12 @@ # Font Awesome Helper -module IconHelper +module FaIconHelper # accept name without 'fa-' prefix, style: (solid by default), size:, class: and 'aria-hidden': def fa_icon(name, html_options = {}) html_options[:style] ||= :solid html_options['aria-hidden'] ||= true - content_class = "fa-#{unsymbolize(html_options[:style])} fa-#{unsymbolize(name)}" - content_class << " fa-#{unsymbolize(html_options[:size])}" if html_options.key? :size + content_class = "fa-#{to_dash(html_options[:style])} fa-#{to_dash(name)}" + content_class << " fa-#{to_dash(html_options[:size])}" if html_options.key? :size content_class << " #{html_options[:class]}" if html_options.key? :class tag.i(class: content_class, 'aria-hidden': html_options['aria-hidden']) @@ -14,5 +14,5 @@ module IconHelper private - def unsymbolize(symbol) = symbol.to_s.dasherize + def to_dash(symbol) = symbol.to_s.dasherize end