Support frozen_string_literal in issue, journal, and query (#26561).
Patch by Pavel Rosický. git-svn-id: http://svn.redmine.org/redmine/trunk@17980 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
46208a6743
commit
d4daf4e23b
@ -1,4 +1,4 @@
|
||||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang
|
||||
@ -72,7 +72,7 @@ class JournalsController < ApplicationController
|
||||
end
|
||||
# Replaces pre blocks with [...]
|
||||
text = text.to_s.strip.gsub(%r{<pre>(.*?)</pre>}m, '[...]')
|
||||
@content = "#{ll(Setting.default_language, :text_user_wrote, user)}\n> "
|
||||
@content = +"#{ll(Setting.default_language, :text_user_wrote, user)}\n> "
|
||||
@content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
|
@ -1,4 +1,4 @@
|
||||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang
|
||||
@ -74,7 +74,7 @@ module IssuesHelper
|
||||
end
|
||||
|
||||
def render_issue_subject_with_tree(issue)
|
||||
s = ''
|
||||
s = +''
|
||||
ancestors = issue.root? ? [] : issue.ancestors.visible.to_a
|
||||
ancestors.each do |ancestor|
|
||||
s << '<div>' + content_tag('p', link_to_issue(ancestor, :project => (issue.project_id != ancestor.project_id)))
|
||||
@ -91,9 +91,9 @@ module IssuesHelper
|
||||
|
||||
def render_descendants_tree(issue)
|
||||
manage_relations = User.current.allowed_to?(:manage_subtasks, issue.project)
|
||||
s = '<table class="list issues odd-even">'
|
||||
s = +'<table class="list issues odd-even">'
|
||||
issue_list(issue.descendants.visible.preload(:status, :priority, :tracker, :assigned_to).sort_by(&:lft)) do |child, level|
|
||||
css = "issue issue-#{child.id} hascontextmenu #{child.css_classes}"
|
||||
css = +"issue issue-#{child.id} hascontextmenu #{child.css_classes}"
|
||||
css << " idnt idnt-#{level}" if level > 0
|
||||
buttons = manage_relations ? link_to(l(:label_delete_link_to_subtask),
|
||||
issue_path({:id => child.id, :issue => {:parent_issue_id => ''}, :back_url => issue_path(issue.id), :no_flash => '1'}),
|
||||
@ -156,7 +156,7 @@ module IssuesHelper
|
||||
l_hours_short(issue.estimated_hours)
|
||||
else
|
||||
s = issue.estimated_hours.present? ? l_hours_short(issue.estimated_hours) : ""
|
||||
s << " (#{l(:label_total)}: #{l_hours_short(issue.total_estimated_hours)})"
|
||||
s += " (#{l(:label_total)}: #{l_hours_short(issue.total_estimated_hours)})"
|
||||
s.html_safe
|
||||
end
|
||||
end
|
||||
@ -170,7 +170,7 @@ module IssuesHelper
|
||||
link_to(l_hours_short(issue.spent_hours), path)
|
||||
else
|
||||
s = issue.spent_hours > 0 ? l_hours_short(issue.spent_hours) : ""
|
||||
s << " (#{l(:label_total)}: #{link_to l_hours_short(issue.total_spent_hours), path})"
|
||||
s += " (#{l(:label_total)}: #{link_to l_hours_short(issue.total_spent_hours), path})"
|
||||
s.html_safe
|
||||
end
|
||||
end
|
||||
|
@ -1,4 +1,4 @@
|
||||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang
|
||||
@ -290,9 +290,9 @@ module QueriesHelper
|
||||
session_key = klass.name.underscore.to_sym
|
||||
|
||||
if params[:query_id].present?
|
||||
cond = "project_id IS NULL"
|
||||
cond << " OR project_id = #{@project.id}" if @project
|
||||
@query = klass.where(cond).find(params[:query_id])
|
||||
scope = klass.where(:project_id => nil)
|
||||
scope = scope.or(klass.where(:project_id => @project)) if @project
|
||||
@query = scope.find(params[:query_id])
|
||||
raise ::Unauthorized unless @query.visible?
|
||||
@query.project = @project
|
||||
session[session_key] = {:id => @query.id, :project_id => @query.project_id} if use_session
|
||||
@ -389,7 +389,7 @@ module QueriesHelper
|
||||
content_tag('h3', title) + "\n" +
|
||||
content_tag('ul',
|
||||
queries.collect {|query|
|
||||
css = 'query'
|
||||
css = +'query'
|
||||
css << ' selected' if query == @query
|
||||
content_tag('li', link_to(query.name, url_params.merge(:query_id => query), :class => css))
|
||||
}.join("\n").html_safe,
|
||||
|
@ -1,4 +1,4 @@
|
||||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang
|
||||
@ -1352,7 +1352,7 @@ class Issue < ActiveRecord::Base
|
||||
|
||||
# Returns a string of css classes that apply to the issue
|
||||
def css_classes(user=User.current)
|
||||
s = "issue tracker-#{tracker_id} status-#{status_id} #{priority.try(:css_classes)}"
|
||||
s = +"issue tracker-#{tracker_id} status-#{status_id} #{priority.try(:css_classes)}"
|
||||
s << ' closed' if closed?
|
||||
s << ' overdue' if overdue?
|
||||
s << ' child' if child?
|
||||
|
@ -1,4 +1,4 @@
|
||||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang
|
||||
@ -126,7 +126,7 @@ class Journal < ActiveRecord::Base
|
||||
|
||||
# Returns a string of css classes
|
||||
def css_classes
|
||||
s = 'journal'
|
||||
s = +'journal'
|
||||
s << ' has-notes' unless notes.blank?
|
||||
s << ' has-details' unless details.blank?
|
||||
s << ' private-notes' if private_notes?
|
||||
|
@ -1,4 +1,4 @@
|
||||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang
|
||||
@ -1144,10 +1144,10 @@ class Query < ActiveRecord::Base
|
||||
end
|
||||
when "!*"
|
||||
sql = "#{db_table}.#{db_field} IS NULL"
|
||||
sql << " OR #{db_table}.#{db_field} = ''" if (is_custom_filter || [:text, :string].include?(type_for(field)))
|
||||
sql += " OR #{db_table}.#{db_field} = ''" if (is_custom_filter || [:text, :string].include?(type_for(field)))
|
||||
when "*"
|
||||
sql = "#{db_table}.#{db_field} IS NOT NULL"
|
||||
sql << " AND #{db_table}.#{db_field} <> ''" if is_custom_filter
|
||||
sql += " AND #{db_table}.#{db_field} <> ''" if is_custom_filter
|
||||
when ">="
|
||||
if [:date, :date_past].include?(type_for(field))
|
||||
sql = date_clause(db_table, db_field, parse_date(value.first), nil, is_custom_filter)
|
||||
|
Loading…
x
Reference in New Issue
Block a user