diff options
author | gfyoung <gfyoung17@gmail.com> | 2018-08-18 04:19:57 -0700 |
---|---|---|
committer | gfyoung <gfyoung17@gmail.com> | 2018-09-06 17:33:46 -0700 |
commit | 1993a4449a5be44acfa5a9e1a94842e05da5edd5 (patch) | |
tree | 80a38bd0b427a5baf7ca36a3a71f8eb75c9d912f /app/helpers/icons_helper.rb | |
parent | 07d5ee361a438fcfff28fe184bbec2aa98ce5d14 (diff) | |
download | gitlab-ce-1993a4449a5be44acfa5a9e1a94842e05da5edd5.tar.gz |
Enable frozen string for app/helpers/**/*.rb
Partially addresses #47424.
Diffstat (limited to 'app/helpers/icons_helper.rb')
-rw-r--r-- | app/helpers/icons_helper.rb | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/app/helpers/icons_helper.rb b/app/helpers/icons_helper.rb index a5612372aa6..037004327b9 100644 --- a/app/helpers/icons_helper.rb +++ b/app/helpers/icons_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'json' module IconsHelper @@ -47,9 +49,10 @@ module IconsHelper end end - css_classes = size ? "s#{size}" : "" - css_classes << " #{css_class}" unless css_class.blank? - content_tag(:svg, content_tag(:use, "", { "xlink:href" => "#{sprite_icon_path}##{icon_name}" } ), class: css_classes.empty? ? nil : css_classes) + css_classes = [] + css_classes << "s#{size}" if size + css_classes << "#{css_class}" unless css_class.blank? + content_tag(:svg, content_tag(:use, "", { "xlink:href" => "#{sprite_icon_path}##{icon_name}" } ), class: css_classes.empty? ? nil : css_classes.join(' ')) end def external_snippet_icon(name) @@ -70,10 +73,10 @@ module IconsHelper end def spinner(text = nil, visible = false) - css_class = 'loading' - css_class << ' hide' unless visible + css_class = ['loading'] + css_class << 'hide' unless visible - content_tag :div, class: css_class do + content_tag :div, class: css_class.join(' ') do icon('spinner spin') + text end end @@ -97,9 +100,10 @@ module IconsHelper 'globe' end - name << " fw" if fw + name = [name] + name << "fw" if fw - icon(name, options) + icon(name.join(' '), options) end def file_type_icon_class(type, mode, name) |