]> source.dussan.org Git - redmine.git/commitdiff
Added "% done" in the filter list.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 9 Sep 2007 19:46:28 +0000 (19:46 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 9 Sep 2007 19:46:28 +0000 (19:46 +0000)
git-svn-id: http://redmine.rubyforge.org/svn/trunk@721 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/query.rb
app/views/queries/_filters.rhtml

index 9bc15c0b962cde144d1f0125ede3a48c66ee7e0c..aaaa1ae7379da213a2b4b8782103f50c26e4d2c6 100644 (file)
@@ -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"
index f37a867009b838122a4b3ca41ad1ff7c30ae3ed4..bc60bd5ebf81c956037ca935e8ab9dff5c3079b0 100644 (file)
@@ -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>