summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-09-09 19:46:28 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-09-09 19:46:28 +0000
commit1590ad25187f7bc403a60473ef450c03a4eeb0c1 (patch)
treeb56023070b24004e23f09871eb4322a316d19ca3
parentb4d9ca8875898500ca198bff501dfc7d1c28bd71 (diff)
downloadredmine-1590ad25187f7bc403a60473ef450c03a4eeb0c1.tar.gz
redmine-1590ad25187f7bc403a60473ef450c03a4eeb0c1.zip
Added "% done" in the filter list.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@721 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/models/query.rb12
-rw-r--r--app/views/queries/_filters.rhtml2
2 files changed, 12 insertions, 2 deletions
diff --git a/app/models/query.rb b/app/models/query.rb
index 9bc15c0b9..aaaa1ae73 100644
--- a/app/models/query.rb
+++ b/app/models/query.rb
@@ -32,6 +32,8 @@ class Query < ActiveRecord::Base
"c" => :label_closed_issues,
"!*" => :label_none,
"*" => :label_all,
+ ">=" => '>=',
+ "<=" => '<=',
"<t+" => :label_in_less_than,
">t+" => :label_in_more_than,
"t+" => :label_in,
@@ -52,7 +54,8 @@ class Query < ActiveRecord::Base
:date => [ "<t+", ">t+", "t+", "t", "w", ">t-", "<t-", "t-" ],
:date_past => [ ">t-", "<t-", "t-", "t", "w" ],
:string => [ "=", "~", "!", "!~" ],
- :text => [ "~", "!~" ] }
+ :text => [ "~", "!~" ],
+ :integer => [ "=", ">=", "<=" ] }
cattr_reader :operators_by_filter_type
@@ -91,7 +94,8 @@ class Query < ActiveRecord::Base
"created_on" => { :type => :date_past, :order => 9 },
"updated_on" => { :type => :date_past, :order => 10 },
"start_date" => { :type => :date, :order => 11 },
- "due_date" => { :type => :date, :order => 12 } }
+ "due_date" => { :type => :date, :order => 12 },
+ "done_ratio" => { :type => :integer, :order => 13 }}
user_values = []
if project
@@ -221,6 +225,10 @@ class Query < ActiveRecord::Base
sql = sql + "#{db_table}.#{db_field} IS NULL"
when "*"
sql = sql + "#{db_table}.#{db_field} IS NOT NULL"
+ when ">="
+ sql = sql + "#{db_table}.#{db_field} >= #{v.first.to_i}"
+ when "<="
+ sql = sql + "#{db_table}.#{db_field} <= #{v.first.to_i}"
when "o"
sql = sql + "#{IssueStatus.table_name}.is_closed=#{connection.quoted_false}" if field == "status_id"
when "c"
diff --git a/app/views/queries/_filters.rhtml b/app/views/queries/_filters.rhtml
index f37a86700..bc60bd5eb 100644
--- a/app/views/queries/_filters.rhtml
+++ b/app/views/queries/_filters.rhtml
@@ -84,6 +84,8 @@ function toggle_multi_select(field) {
<%= text_field_tag "values[#{field}][]", query.values_for(field), :id => "values_#{field}", :size => 3, :class => "select-small" %> <%= l(:label_day_plural) %>
<% when :string, :text %>
<%= text_field_tag "values[#{field}][]", query.values_for(field), :id => "values_#{field}", :size => 30, :class => "select-small" %>
+ <% when :integer %>
+ <%= text_field_tag "values[#{field}][]", query.values_for(field), :id => "values_#{field}", :size => 3, :class => "select-small" %>
<% end %>
</div>
<script type="text/javascript">toggle_filter('<%= field %>');</script>