diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-01-13 18:16:15 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-01-13 18:16:15 +0000 |
commit | 919d0a68c39b14ac8970ad889e6dc9345fade7f0 (patch) | |
tree | 4987968f7749f8591e8bc6d73b2e620b89c9eeff /app/models/query.rb | |
parent | 1054237d821b0a2a5e3bb24eed1f469d423d0dc7 (diff) | |
download | redmine-919d0a68c39b14ac8970ad889e6dc9345fade7f0.tar.gz redmine-919d0a68c39b14ac8970ad889e6dc9345fade7f0.zip |
Adds "my projects" filter on the cross-project issue list.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8637 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/query.rb')
-rw-r--r-- | app/models/query.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/query.rb b/app/models/query.rb index 96885ed63..1286fe86b 100644 --- a/app/models/query.rb +++ b/app/models/query.rb @@ -240,6 +240,9 @@ class Query < ActiveRecord::Base # project filter project_values = [] + if User.current.logged? && User.current.memberships.any? + project_values << ["<< #{l(:label_my_projects).downcase} >>", "mine"] + end Project.project_tree(all_projects) do |p, level| prefix = (level > 0 ? ('--' * level + ' ') : '') project_values << ["#{prefix}#{p.name}", p.id.to_s] @@ -522,6 +525,12 @@ class Query < ActiveRecord::Base end end + if field == 'project_id' + if v.delete('mine') + v += User.current.memberships.map(&:project_id).map(&:to_s) + end + end + if field =~ /^cf_(\d+)$/ # custom field filters_clauses << sql_for_custom_field(field, operator, v, $1) |