summaryrefslogtreecommitdiffstats
path: root/app/helpers
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-03-30 12:29:07 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-03-30 12:29:07 +0000
commit287d86e3632546b06aeb955db8b0e5eea139082b (patch)
tree38d14393e22d0a577e0bed0f733c17c092c49e1b /app/helpers
parentfaf1f1e812b385dcf88591eac6fc898f86947c75 (diff)
downloadredmine-287d86e3632546b06aeb955db8b0e5eea139082b.tar.gz
redmine-287d86e3632546b06aeb955db8b0e5eea139082b.zip
Queries can be marked as 'For all projects'. Such queries will be available on all projects and on the global issue list (#897, closes #671).
Only admin users can create/edit queries that are public and for all projects. Note: this change does not allow to save a query from the global issue list. You have to be inside a project but then you can mark the query as 'For all projects'. git-svn-id: http://redmine.rubyforge.org/svn/trunk@1311 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/issues_helper.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index 17889fadd..6013f1ec8 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -32,6 +32,19 @@ module IssuesHelper
"<strong>#{@cached_label_assigned_to}</strong>: #{issue.assigned_to}<br />" +
"<strong>#{@cached_label_priority}</strong>: #{issue.priority.name}"
end
+
+ def sidebar_queries
+ unless @sidebar_queries
+ # User can see public queries and his own queries
+ visible = ARCondition.new(["is_public = ? OR user_id = ?", true, (User.current.logged? ? User.current.id : 0)])
+ # Project specific queries and global queries
+ visible << (@project.nil? ? ["project_id IS NULL"] : ["project_id IS NULL OR project_id = ?", @project.id])
+ @sidebar_queries = Query.find(:all,
+ :order => "name ASC",
+ :conditions => visible.conditions)
+ end
+ @sidebar_queries
+ end
def show_detail(detail, no_html=false)
case detail.property