Added a new value for date filters: 'this week'

git-svn-id: http://redmine.rubyforge.org/svn/trunk@704 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2007-09-05 17:47:17 +00:00
parent a19a0d7b92
commit c27106d859
14 changed files with 19 additions and 3 deletions

View File

@ -36,6 +36,7 @@ class Query < ActiveRecord::Base
">t+" => :label_in_more_than,
"t+" => :label_in,
"t" => :label_today,
"w" => :label_this_week,
">t-" => :label_less_than_ago,
"<t-" => :label_more_than_ago,
"t-" => :label_ago,
@ -48,8 +49,8 @@ class Query < ActiveRecord::Base
:list_status => [ "o", "=", "!", "c", "*" ],
:list_optional => [ "=", "!", "!*", "*" ],
:list_one_or_more => [ "*", "=" ],
:date => [ "<t+", ">t+", "t+", "t", ">t-", "<t-", "t-" ],
:date_past => [ ">t-", "<t-", "t-", "t" ],
:date => [ "<t+", ">t+", "t+", "t", "w", ">t-", "<t-", "t-" ],
:date_past => [ ">t-", "<t-", "t-", "t", "w" ],
:string => [ "=", "~", "!", "!~" ],
:text => [ "~", "!~" ] }
@ -71,7 +72,7 @@ class Query < ActiveRecord::Base
# filter requires one or more values
(values_for(field) and !values_for(field).first.empty?) or
# filter doesn't require any value
["o", "c", "!*", "*", "t"].include? operator_for(field)
["o", "c", "!*", "*", "t", "w"].include? operator_for(field)
end if filters
end
@ -238,6 +239,8 @@ class Query < ActiveRecord::Base
sql = sql + "#{db_table}.#{db_field} BETWEEN '%s' AND '%s'" % [connection.quoted_date((Date.today + v.first.to_i).to_time), connection.quoted_date((Date.today + v.first.to_i + 1).to_time)]
when "t"
sql = sql + "#{db_table}.#{db_field} BETWEEN '%s' AND '%s'" % [connection.quoted_date(Date.today.to_time), connection.quoted_date((Date.today+1).to_time)]
when "w"
sql = sql + "#{db_table}.#{db_field} BETWEEN '%s' AND '%s'" % [connection.quoted_date(Time.now.at_beginning_of_week), connection.quoted_date(Time.now.next_week)]
when "~"
sql = sql + "#{db_table}.#{db_field} LIKE '%#{connection.quote_string(v.first)}%'"
when "!~"

View File

@ -34,6 +34,7 @@ function toggle_operator(field) {
case "!*":
case "*":
case "t":
case "w":
case "o":
case "c":
Element.hide("div_values_" + field);

View File

@ -318,6 +318,7 @@ label_in_less_than: по-малко от
label_in_more_than: повече от
label_in: в следващите
label_today: днес
label_this_week: this week
label_less_than_ago: преди по-малко от
label_more_than_ago: преди повече от
label_ago: преди дни

View File

@ -318,6 +318,7 @@ label_in_less_than: in weniger als
label_in_more_than: in mehr als
label_in: an
label_today: heute
label_this_week: this week
label_less_than_ago: vor weniger als
label_more_than_ago: vor mehr als
label_ago: vor

View File

@ -318,6 +318,7 @@ label_in_less_than: in less than
label_in_more_than: in more than
label_in: in
label_today: today
label_this_week: this week
label_less_than_ago: less than days ago
label_more_than_ago: more than days ago
label_ago: days ago

View File

@ -318,6 +318,7 @@ label_in_less_than: en menos que
label_in_more_than: en más que
label_in: en
label_today: hoy
label_this_week: this week
label_less_than_ago: hace menos de
label_more_than_ago: hace más de
label_ago: hace

View File

@ -318,6 +318,7 @@ label_in_less_than: dans moins de
label_in_more_than: dans plus de
label_in: dans
label_today: aujourd'hui
label_this_week: cette semaine
label_less_than_ago: il y a moins de
label_more_than_ago: il y a plus de
label_ago: il y a

View File

@ -318,6 +318,7 @@ label_in_less_than: è minore di
label_in_more_than: è maggiore di
label_in: in
label_today: oggi
label_this_week: this week
label_less_than_ago: meno di giorni fa
label_more_than_ago: più di giorni fa
label_ago: giorni fa

View File

@ -319,6 +319,7 @@ label_in_less_than: 残日数がこれより多い
label_in_more_than: 残日数がこれより少ない
label_in: 残日数
label_today: 今日
label_this_week: this week
label_less_than_ago: 経過日数がこれより少ない
label_more_than_ago: 経過日数がこれより多い
label_ago: 日前

View File

@ -318,6 +318,7 @@ label_in_less_than: in minder dan
label_in_more_than: in meer dan
label_in: in
label_today: vandaag
label_this_week: this week
label_less_than_ago: minder dan dagen geleden
label_more_than_ago: meer dan dagen geleden
label_ago: dagen geleden

View File

@ -318,6 +318,7 @@ label_in_less_than: e maior que
label_in_more_than: e menor que
label_in: em
label_today: hoje
label_this_week: this week
label_less_than_ago: faz menos de
label_more_than_ago: faz mais de
label_ago: dias atras

View File

@ -318,6 +318,7 @@ label_in_less_than: é maior que
label_in_more_than: é menor que
label_in: em
label_today: hoje
label_this_week: this week
label_less_than_ago: faz menos de
label_more_than_ago: faz mais de
label_ago: dias atrás

View File

@ -318,6 +318,7 @@ label_in_less_than: i mindre än
label_in_more_than: i mer än
label_in: i
label_today: idag
label_this_week: this week
label_less_than_ago: mindre än dagar sedan
label_more_than_ago: mer än dagar sedan
label_ago: dagar sedan

View File

@ -321,6 +321,7 @@ label_in_less_than: 剩余天数小于
label_in_more_than: 剩余天数大于
label_in: 剩余天数
label_today: 今天
label_this_week: this week
label_less_than_ago: 之前天数少于
label_more_than_ago: 之前天数大于
label_ago: 之前天数