Index: app/models/query.rb =================================================================== --- app/models/query.rb (revision 3255) +++ app/models/query.rb (working copy) @@ -97,6 +97,9 @@ "t+" => :label_in, "t" => :label_today, "w" => :label_this_week, + "m-" => :label_prev_month, + "m" => :label_this_month, + "m+" => :label_next_month, ">t-" => :label_less_than_ago, " :label_more_than_ago, "t-" => :label_ago, @@ -109,8 +112,8 @@ :list_status => [ "o", "=", "!", "c", "*" ], :list_optional => [ "=", "!", "!*", "*" ], :list_subprojects => [ "*", "!*", "=" ], - :date => [ "t+", "t+", "t", "w", ">t-", " [ ">t-", " [ "t+", "t+", "t", "w", ">t-", " [ ">t-", " [ "=", "~", "!", "!~" ], :text => [ "~", "!~" ], :integer => [ "=", ">=", "<=", "!*", "*" ] } @@ -520,6 +523,16 @@ sql = "LOWER(#{db_table}.#{db_field}) LIKE '%#{connection.quote_string(value.first.to_s.downcase)}%'" when "!~" sql = "LOWER(#{db_table}.#{db_field}) NOT LIKE '%#{connection.quote_string(value.first.to_s.downcase)}%'" + when "m", "m+", "m-" + date = Time.now + date = date.last_month if operator.at(1) == "-" + date = date.next_month if operator.at(1) == "+" + + from = date.at_beginning_of_month + to = date.at_end_of_month + sql = "#{db_table}.#{db_field} BETWEEN '%s' AND '%s'" % [connection.quoted_date(from), connection.quoted_date(to)] + else + sql = "1 = 1" end return sql Index: app/views/queries/_filters.rhtml =================================================================== --- app/views/queries/_filters.rhtml (revision 3255) +++ app/views/queries/_filters.rhtml (working copy) @@ -35,6 +35,9 @@ case "*": case "t": case "w": + case "m-": + case "m": + case "m+": case "o": case "c": Element.hide("div_values_" + field); Index: config/locales/en.yml =================================================================== --- config/locales/en.yml (revision 3255) +++ config/locales/en.yml (working copy) @@ -567,6 +567,8 @@ label_last_week: last week label_last_n_days: "last {{count}} days" label_this_month: this month + label_prev_month: previous month + label_next_month: next month label_last_month: last month label_this_year: this year label_date_range: Date range Index: config/locales/ru.yml =================================================================== --- config/locales/ru.yml (revision 3255) +++ config/locales/ru.yml (working copy) @@ -575,6 +575,7 @@ label_news_view_all: Посмотреть все новости label_news: Новости label_next: Следующий + label_next_month: следующий месяц label_nobody: никто label_no_change_option: (Нет изменений) label_no_data: Нет данных для отображения @@ -600,6 +601,7 @@ label_precedes: предшествует label_preferences: Предпочтения label_preview: Предварительный просмотр + label_prev_month: предыдущий месяц label_previous: Предыдущий label_project: проект label_project_all: Все проекты