mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-20 15:31:12 +00:00
use "do end" instead of {} at app/models/query.rb
git-svn-id: http://svn.redmine.org/redmine/trunk@19972 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
9270f37860
commit
cdb4743408
@ -454,9 +454,13 @@ class Query < ActiveRecord::Base
|
|||||||
when :date, :date_past
|
when :date, :date_past
|
||||||
case operator_for(field)
|
case operator_for(field)
|
||||||
when "=", ">=", "<=", "><"
|
when "=", ">=", "<=", "><"
|
||||||
add_filter_error(field, :invalid) if values_for(field).detect {|v|
|
if values_for(field).detect do |v|
|
||||||
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?)
|
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?)
|
||||||
|
end
|
||||||
|
add_filter_error(field, :invalid)
|
||||||
|
end
|
||||||
when ">t-", "<t-", "t-", ">t+", "<t+", "t+", "><t+", "><t-"
|
when ">t-", "<t-", "t-", ">t+", "<t+", "t+", "><t+", "><t-"
|
||||||
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)
|
add_filter_error(field, :invalid)
|
||||||
@ -742,10 +746,10 @@ class Query < ActiveRecord::Base
|
|||||||
|
|
||||||
# Returns a Hash of columns and the key for sorting
|
# Returns a Hash of columns and the key for sorting
|
||||||
def sortable_columns
|
def sortable_columns
|
||||||
available_columns.inject({}) {|h, column|
|
available_columns.inject({}) do |h, column|
|
||||||
h[column.name.to_s] = column.sortable
|
h[column.name.to_s] = column.sortable
|
||||||
h
|
h
|
||||||
}
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def columns
|
def columns
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user