diff options
author | Go MAEDA <maeda@farend.jp> | 2019-03-17 13:36:03 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2019-03-17 13:36:03 +0000 |
commit | bd5977d97eaf92f852c1bfe499052b6b07ab8aae (patch) | |
tree | 714a9672c2007f78dbe7c2c5a649e24505ae9863 /app/helpers | |
parent | 72a163d8b30978f23059ba2a2083675a38bd5680 (diff) | |
download | redmine-bd5977d97eaf92f852c1bfe499052b6b07ab8aae.tar.gz redmine-bd5977d97eaf92f852c1bfe499052b6b07ab8aae.zip |
Support frozen_string_literal in app/**/*.rb (#26561).
Contributed by Pavel Rosický.
git-svn-id: http://svn.redmine.org/redmine/trunk@17987 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/application_helper.rb | 26 | ||||
-rw-r--r-- | app/helpers/attachments_helper.rb | 2 | ||||
-rw-r--r-- | app/helpers/calendars_helper.rb | 4 | ||||
-rw-r--r-- | app/helpers/context_menus_helper.rb | 6 | ||||
-rw-r--r-- | app/helpers/custom_fields_helper.rb | 6 | ||||
-rw-r--r-- | app/helpers/projects_helper.rb | 6 | ||||
-rw-r--r-- | app/helpers/repositories_helper.rb | 8 | ||||
-rw-r--r-- | app/helpers/search_helper.rb | 4 | ||||
-rw-r--r-- | app/helpers/wiki_helper.rb | 6 |
9 files changed, 34 insertions, 34 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 23520d953..8dab89735 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # Redmine - project management software # Copyright (C) 2006-2017 Jean-Philippe Lang @@ -292,7 +292,7 @@ module ApplicationHelper end def toggle_link(name, id, options={}) - onclick = "$('##{id}').toggle(); " + onclick = +"$('##{id}').toggle(); " onclick << (options[:focus] ? "$('##{options[:focus]}').focus(); " : "this.blur(); ") onclick << "$(window).scrollTop($('##{options[:focus]}').position().top); " if options[:scroll] onclick << "return false;" @@ -336,7 +336,7 @@ module ApplicationHelper # The given collection may be a subset of the whole project tree # (eg. some intermediate nodes are private and can not be seen) def render_project_nested_lists(projects, &block) - s = '' + s = +'' if projects.any? ancestors = [] original_project = @project @@ -366,7 +366,7 @@ module ApplicationHelper end def render_page_hierarchy(pages, node=nil, options={}) - content = '' + content = +'' if pages[node] content << "<ul class=\"pages-hierarchy\">\n" pages[node].each do |page| @@ -383,7 +383,7 @@ module ApplicationHelper # Renders flash messages def render_flash_messages - s = '' + s = +'' flash.each do |k,v| s << content_tag('div', v.html_safe, :class => "flash #{k}", :id => "flash_#{k}") end @@ -422,7 +422,7 @@ module ApplicationHelper def render_projects_for_jump_box(projects, selected=nil) jump = params[:jump].presence || current_menu_item - s = ''.html_safe + s = (+'').html_safe project_tree(projects) do |project, level| padding = level * 16 text = content_tag('span', project.name, :style => "padding-left:#{padding}px;") @@ -483,7 +483,7 @@ module ApplicationHelper end def principals_check_box_tags(name, principals) - s = '' + s = +'' principals.each do |principal| s << "<label>#{ check_box_tag name, principal.id, false, :id => nil } #{h principal}</label>\n" end @@ -492,11 +492,11 @@ module ApplicationHelper # Returns a string for users/groups option tags def principals_options_for_select(collection, selected=nil) - s = '' + s = +'' if collection.include?(User.current) s << content_tag('option', "<< #{l(:label_me)} >>", :value => User.current.id) end - groups = '' + groups = +'' collection.sort.each do |element| selected_attribute = ' selected="selected"' if option_value_selected?(element, selected) || element.id.to_s == selected (element.is_a?(Group) ? groups : s) << %(<option value="#{element.id}"#{selected_attribute}>#{h element.name}</option>) @@ -728,7 +728,7 @@ module ApplicationHelper def parse_non_pre_blocks(text, obj, macros) s = StringScanner.new(text) tags = [] - parsed = '' + parsed = +'' while !s.eos? s.scan(/(.*?)(<(\/)?(pre|code)(.*?)>|\z)/im) text, full_tag, closing, tag = s[1], s[2], s[3], s[4] @@ -1208,10 +1208,10 @@ module ApplicationHelper if headings.empty? '' else - div_class = 'toc' + div_class = +'toc' div_class << ' right' if right_align div_class << ' left' if left_align - out = "<ul class=\"#{div_class}\"><li><strong>#{l :label_table_of_contents}</strong></li><li>" + out = +"<ul class=\"#{div_class}\"><li><strong>#{l :label_table_of_contents}</strong></li><li>" root = headings.map(&:first).min current = root started = false @@ -1272,7 +1272,7 @@ module ApplicationHelper # Renders a list of error messages def render_error_messages(errors) - html = "" + html = +"" if errors.present? html << "<div id='errorExplanation'><ul>\n" errors.each do |error| diff --git a/app/helpers/attachments_helper.rb b/app/helpers/attachments_helper.rb index 899472b25..0719db2a3 100644 --- a/app/helpers/attachments_helper.rb +++ b/app/helpers/attachments_helper.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # Redmine - project management software # Copyright (C) 2006-2017 Jean-Philippe Lang diff --git a/app/helpers/calendars_helper.rb b/app/helpers/calendars_helper.rb index 8375a9792..865c5c8b7 100644 --- a/app/helpers/calendars_helper.rb +++ b/app/helpers/calendars_helper.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # Redmine - project management software # Copyright (C) 2006-2017 Jean-Philippe Lang @@ -59,7 +59,7 @@ module CalendarsHelper end def calendar_day_css_classes(calendar, day) - css = day.month==calendar.month ? 'even' : 'odd' + css = day.month==calendar.month ? +'even' : +'odd' css << " today" if User.current.today == day css << " nwday" if non_working_week_days.include?(day.cwday) css diff --git a/app/helpers/context_menus_helper.rb b/app/helpers/context_menus_helper.rb index f0bbf15cc..06d4a2245 100644 --- a/app/helpers/context_menus_helper.rb +++ b/app/helpers/context_menus_helper.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # Redmine - project management software # Copyright (C) 2006-2017 Jean-Philippe Lang @@ -21,14 +21,14 @@ module ContextMenusHelper def context_menu_link(name, url, options={}) options[:class] ||= '' if options.delete(:selected) - options[:class] << ' icon-checked disabled' + options[:class] += ' icon-checked disabled' options[:disabled] = true end if options.delete(:disabled) options.delete(:method) options.delete(:data) options[:onclick] = 'return false;' - options[:class] << ' disabled' + options[:class] += ' disabled' url = '#' end link_to h(name), url, options diff --git a/app/helpers/custom_fields_helper.rb b/app/helpers/custom_fields_helper.rb index 13ee985b0..b4b44b238 100644 --- a/app/helpers/custom_fields_helper.rb +++ b/app/helpers/custom_fields_helper.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # Redmine - project management software # Copyright (C) 2006-2017 Jean-Philippe Lang @@ -69,7 +69,7 @@ module CustomFieldsHelper def custom_field_tag_name(prefix, custom_field) name = "#{prefix}[custom_field_values][#{custom_field.id}]" - name << "[]" if custom_field.multiple? + name += "[]" if custom_field.multiple? name end @@ -80,7 +80,7 @@ module CustomFieldsHelper # Return custom field html tag corresponding to its format def custom_field_tag(prefix, custom_value) css = "#{custom_value.custom_field.field_format}_cf" - css << ' wiki-edit' if custom_value.custom_field.full_text_formatting? + css += ' wiki-edit' if custom_value.custom_field.full_text_formatting? custom_value.custom_field.format.edit_tag self, custom_field_tag_id(prefix, custom_value.custom_field), diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index fb38ab26a..6a34a79e7 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # Redmine - project management software # Copyright (C) 2006-2017 Jean-Philippe Lang @@ -42,14 +42,14 @@ module ProjectsHelper selected = (parent_id.blank? ? nil : Project.find(parent_id)) end - options = '' + options = +'' options << "<option value=''> </option>" if project.allowed_parents.include?(nil) options << project_tree_options_for_select(project.allowed_parents.compact, :selected => selected) content_tag('select', options.html_safe, :name => 'project[parent_id]', :id => 'project_parent_id') end def render_project_action_links - links = "".html_safe + links = (+"").html_safe if User.current.allowed_to?(:add_project, nil, :global => true) links << link_to(l(:label_project_new), new_project_path, :class => 'icon icon-add') end diff --git a/app/helpers/repositories_helper.rb b/app/helpers/repositories_helper.rb index 9c025c581..fb5392e73 100644 --- a/app/helpers/repositories_helper.rb +++ b/app/helpers/repositories_helper.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # Redmine - project management software # Copyright (C) 2006-2017 Jean-Philippe Lang @@ -43,7 +43,7 @@ module RepositoriesHelper def render_properties(properties) unless properties.nil? || properties.empty? - content = '' + content = +'' properties.keys.sort.each do |property| content << content_tag('li', "<b>#{h property}</b>: <span>#{h properties[property]}</span>".html_safe) end @@ -87,10 +87,10 @@ module RepositoriesHelper def render_changes_tree(tree) return '' if tree.nil? - output = '' + output = +'' output << '<ul>' tree.keys.sort.each do |file| - style = 'change' + style = +'change' text = File.basename(h(file)) if s = tree[file][:s] style << ' folder' diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb index f236f3181..0b0160c6b 100644 --- a/app/helpers/search_helper.rb +++ b/app/helpers/search_helper.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # Redmine - project management software # Copyright (C) 2006-2017 Jean-Philippe Lang @@ -22,7 +22,7 @@ module SearchHelper return text unless text && tokens && !tokens.empty? re_tokens = tokens.collect {|t| Regexp.escape(t)} regexp = Regexp.new "(#{re_tokens.join('|')})", Regexp::IGNORECASE - result = '' + result = +'' text.split(regexp).each_with_index do |words, i| if result.length > 1200 # maximum length of the preview reached diff --git a/app/helpers/wiki_helper.rb b/app/helpers/wiki_helper.rb index f640ee48d..bf3164440 100644 --- a/app/helpers/wiki_helper.rb +++ b/app/helpers/wiki_helper.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # Redmine - project management software # Copyright (C) 2006-2017 Jean-Philippe Lang @@ -22,10 +22,10 @@ module WikiHelper def wiki_page_options_for_select(pages, selected = nil, parent = nil, level = 0) pages = pages.group_by(&:parent) unless pages.is_a?(Hash) - s = ''.html_safe + s = (+'').html_safe if pages.has_key?(parent) pages[parent].each do |page| - attrs = "value='#{page.id}'" + attrs = +"value='#{page.id}'" attrs << " selected='selected'" if selected == page indent = (level > 0) ? (' ' * level * 2 + '» ') : '' |