summaryrefslogtreecommitdiffstats
path: root/app/models/query.rb
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2020-07-11 01:21:27 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2020-07-11 01:21:27 +0000
commit457b39a98051ce9cf146b98cdcc19d00d457de9a (patch)
treef1e979e5f567c2d3bd6993d2436c7d754784c8ba /app/models/query.rb
parent8402e08034b9d4c4c0e4b2f2e6623e4f256803ef (diff)
downloadredmine-457b39a98051ce9cf146b98cdcc19d00d457de9a.tar.gz
redmine-457b39a98051ce9cf146b98cdcc19d00d457de9a.zip
remove spaces inside {} of app/models/query.rb
git-svn-id: http://svn.redmine.org/redmine/trunk@19880 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/query.rb')
-rw-r--r--app/models/query.rb39
1 files changed, 27 insertions, 12 deletions
diff --git a/app/models/query.rb b/app/models/query.rb
index 45e9882a7..61c47bdda 100644
--- a/app/models/query.rb
+++ b/app/models/query.rb
@@ -235,7 +235,7 @@ class Query < ActiveRecord::Base
validates_presence_of :name
validates_length_of :name, :maximum => 255
- validates :visibility, :inclusion => { :in => [VISIBILITY_PUBLIC, VISIBILITY_ROLES, VISIBILITY_PRIVATE] }
+ validates :visibility, :inclusion => {:in => [VISIBILITY_PUBLIC, VISIBILITY_ROLES, VISIBILITY_PRIVATE]}
validate :validate_query_filters
validate do |query|
errors.add(:base, l(:label_role_plural) + ' ' + l('activerecord.errors.messages.blank')) if query.visibility == VISIBILITY_ROLES && roles.blank?
@@ -444,9 +444,13 @@ class Query < ActiveRecord::Base
if values_for(field)
case type_for(field)
when :integer
- add_filter_error(field, :invalid) if values_for(field).detect {|v| v.present? && !/\A[+-]?\d+(,[+-]?\d+)*\z/.match?(v) }
+ if values_for(field).detect {|v| v.present? && !/\A[+-]?\d+(,[+-]?\d+)*\z/.match?(v)}
+ add_filter_error(field, :invalid)
+ end
when :float
- add_filter_error(field, :invalid) if values_for(field).detect {|v| v.present? && !/\A[+-]?\d+(\.\d*)?\z/.match?(v) }
+ if values_for(field).detect {|v| v.present? && !/\A[+-]?\d+(\.\d*)?\z/.match?(v)}
+ add_filter_error(field, :invalid)
+ end
when :date, :date_past
case operator_for(field)
when "=", ">=", "<=", "><"
@@ -454,7 +458,9 @@ class Query < ActiveRecord::Base
v.present? && (!/\A\d{4}-\d{2}-\d{2}(T\d{2}((:)?\d{2}){0,2}(Z|\d{2}:?\d{2})?)?\z/.match?(v) || parse_date(v).nil?)
}
when ">t-", "<t-", "t-", ">t+", "<t+", "t+", "><t+", "><t-"
- add_filter_error(field, :invalid) if values_for(field).detect {|v| v.present? && !/^\d+$/.match?(v) }
+ if values_for(field).detect {|v| v.present? && !/^\d+$/.match?(v)}
+ add_filter_error(field, :invalid)
+ end
end
end
end
@@ -538,7 +544,7 @@ class Query < ActiveRecord::Base
end
def subproject_values
- project.descendants.visible.collect{|s| [s.name, s.id.to_s] }
+ project.descendants.visible.collect{|s| [s.name, s.id.to_s]}
end
def principals
@@ -566,7 +572,9 @@ class Query < ActiveRecord::Base
def author_values
author_values = []
author_values << ["<< #{l(:label_me)} >>", "me"] if User.current.logged?
- author_values += users.sort_by(&:status).collect{|s| [s.name, s.id.to_s, l("status_#{User::LABEL_BY_STATUS[s.status]}")] }
+ author_values +=
+ users.sort_by(&:status).
+ collect{|s| [s.name, s.id.to_s, l("status_#{User::LABEL_BY_STATUS[s.status]}")]}
author_values << [l(:label_user_anonymous), User.anonymous.id.to_s]
author_values
end
@@ -574,7 +582,9 @@ class Query < ActiveRecord::Base
def assigned_to_values
assigned_to_values = []
assigned_to_values << ["<< #{l(:label_me)} >>", "me"] if User.current.logged?
- assigned_to_values += (Setting.issue_group_assignment? ? principals : users).sort_by(&:status).collect{|s| [s.name, s.id.to_s, l("status_#{User::LABEL_BY_STATUS[s.status]}")] }
+ assigned_to_values +=
+ (Setting.issue_group_assignment? ? principals : users).sort_by(&:status).
+ collect{|s| [s.name, s.id.to_s, l("status_#{User::LABEL_BY_STATUS[s.status]}")]}
assigned_to_values
end
@@ -585,7 +595,8 @@ class Query < ActiveRecord::Base
else
versions = Version.visible.to_a
end
- Version.sort_by_status(versions).collect{|s| ["#{s.project.name} - #{s.name}", s.id.to_s, l("version_status_#{s.status}")] }
+ Version.sort_by_status(versions).
+ collect{|s| ["#{s.project.name} - #{s.name}", s.id.to_s, l("version_status_#{s.status}")]}
end
# Returns a scope of issue statuses that are available as columns for filters
@@ -600,7 +611,11 @@ class Query < ActiveRecord::Base
def watcher_values
watcher_values = [["<< #{l(:label_me)} >>", "me"]]
- watcher_values += principals.sort_by(&:status).collect{|s| [s.name, s.id.to_s, l("status_#{User::LABEL_BY_STATUS[s.status]}")] } if User.current.allowed_to?(:view_issue_watchers, self.project)
+ if User.current.allowed_to?(:view_issue_watchers, self.project)
+ watcher_values +=
+ principals.sort_by(&:status).
+ collect{|s| [s.name, s.id.to_s, l("status_#{User::LABEL_BY_STATUS[s.status]}")]}
+ end
watcher_values
end
@@ -738,7 +753,7 @@ class Query < ActiveRecord::Base
# preserve the column_names order
cols = (has_default_columns? ? default_columns_names : column_names).collect do |name|
- available_columns.find { |col| col.name == name }
+ available_columns.find {|col| col.name == name}
end.compact
available_columns.select(&:frozen?) | cols
end
@@ -777,8 +792,8 @@ class Query < ActiveRecord::Base
def column_names=(names)
if names
- names = names.select {|n| n.is_a?(Symbol) || !n.blank? }
- names = names.collect {|n| n.is_a?(Symbol) ? n : n.to_sym }
+ names = names.select {|n| n.is_a?(Symbol) || !n.blank?}
+ names = names.collect {|n| n.is_a?(Symbol) ? n : n.to_sym}
if names.delete(:all_inline)
names = available_inline_columns.map(&:name) | names
end