Mercurial > hg > soundsoftware-site
comparison app/models/.svn/text-base/query.rb.svn-base @ 14:1d32c0a0efbf
* Update to SVN trunk (revisions 3892-4040)
author | Chris Cannam |
---|---|
date | Wed, 25 Aug 2010 16:30:24 +0100 |
parents | 513646585e45 |
children | 40f7cfd4df19 |
comparison
equal
deleted
inserted
replaced
4:9cc62779c13a | 14:1d32c0a0efbf |
---|---|
185 user_values = [] | 185 user_values = [] |
186 user_values << ["<< #{l(:label_me)} >>", "me"] if User.current.logged? | 186 user_values << ["<< #{l(:label_me)} >>", "me"] if User.current.logged? |
187 if project | 187 if project |
188 user_values += project.users.sort.collect{|s| [s.name, s.id.to_s] } | 188 user_values += project.users.sort.collect{|s| [s.name, s.id.to_s] } |
189 else | 189 else |
190 project_ids = User.current.projects.collect(&:id) | 190 project_ids = Project.all(:conditions => Project.visible_by(User.current)).collect(&:id) |
191 if project_ids.any? | 191 if project_ids.any? |
192 # members of the user's projects | 192 # members of the user's projects |
193 user_values += User.active.find(:all, :conditions => ["#{User.table_name}.id IN (SELECT DISTINCT user_id FROM members WHERE project_id IN (?))", project_ids]).sort.collect{|s| [s.name, s.id.to_s] } | 193 user_values += User.active.find(:all, :conditions => ["#{User.table_name}.id IN (SELECT DISTINCT user_id FROM members WHERE project_id IN (?))", project_ids]).sort.collect{|s| [s.name, s.id.to_s] } |
194 end | 194 end |
195 end | 195 end |
217 system_shared_versions = Version.visible.find_all_by_sharing('system') | 217 system_shared_versions = Version.visible.find_all_by_sharing('system') |
218 unless system_shared_versions.empty? | 218 unless system_shared_versions.empty? |
219 @available_filters["fixed_version_id"] = { :type => :list_optional, :order => 7, :values => system_shared_versions.sort.collect{|s| ["#{s.project.name} - #{s.name}", s.id.to_s] } } | 219 @available_filters["fixed_version_id"] = { :type => :list_optional, :order => 7, :values => system_shared_versions.sort.collect{|s| ["#{s.project.name} - #{s.name}", s.id.to_s] } } |
220 end | 220 end |
221 add_custom_fields_filters(IssueCustomField.find(:all, :conditions => {:is_filter => true, :is_for_all => true})) | 221 add_custom_fields_filters(IssueCustomField.find(:all, :conditions => {:is_filter => true, :is_for_all => true})) |
222 # project filter | |
223 project_values = Project.all(:conditions => Project.visible_by(User.current), :order => 'lft').map do |p| | |
224 pre = (p.level > 0 ? ('--' * p.level + ' ') : '') | |
225 ["#{pre}#{p.name}",p.id.to_s] | |
226 end | |
227 @available_filters["project_id"] = { :type => :list, :order => 1, :values => project_values} | |
222 end | 228 end |
223 @available_filters | 229 @available_filters |
224 end | 230 end |
225 | 231 |
226 def add_filter(field, operator, values) | 232 def add_filter(field, operator, values) |