Mercurial > hg > soundsoftware-site
comparison app/controllers/queries_controller.rb @ 1115:433d4f72a19b redmine-2.2
Update to Redmine SVN revision 11137 on 2.2-stable branch
author | Chris Cannam |
---|---|
date | Mon, 07 Jan 2013 12:01:42 +0000 |
parents | cbb26bc654de |
children | 622f24f53b42 261b3d9a4903 |
comparison
equal
deleted
inserted
replaced
929:5f33065ddc4b | 1115:433d4f72a19b |
---|---|
1 # Redmine - project management software | 1 # Redmine - project management software |
2 # Copyright (C) 2006-2011 Jean-Philippe Lang | 2 # Copyright (C) 2006-2012 Jean-Philippe Lang |
3 # | 3 # |
4 # This program is free software; you can redistribute it and/or | 4 # This program is free software; you can redistribute it and/or |
5 # modify it under the terms of the GNU General Public License | 5 # modify it under the terms of the GNU General Public License |
6 # as published by the Free Software Foundation; either version 2 | 6 # as published by the Free Software Foundation; either version 2 |
7 # of the License, or (at your option) any later version. | 7 # of the License, or (at your option) any later version. |
48 @query.project = @project | 48 @query.project = @project |
49 @query.is_public = false unless User.current.allowed_to?(:manage_public_queries, @project) || User.current.admin? | 49 @query.is_public = false unless User.current.allowed_to?(:manage_public_queries, @project) || User.current.admin? |
50 build_query_from_params | 50 build_query_from_params |
51 end | 51 end |
52 | 52 |
53 verify :method => :post, :only => :create, :render => {:nothing => true, :status => :method_not_allowed } | |
54 def create | 53 def create |
55 @query = Query.new(params[:query]) | 54 @query = Query.new(params[:query]) |
56 @query.user = User.current | 55 @query.user = User.current |
57 @query.project = params[:query_is_for_all] ? nil : @project | 56 @query.project = params[:query_is_for_all] ? nil : @project |
58 @query.is_public = false unless User.current.allowed_to?(:manage_public_queries, @project) || User.current.admin? | 57 @query.is_public = false unless User.current.allowed_to?(:manage_public_queries, @project) || User.current.admin? |
68 end | 67 end |
69 | 68 |
70 def edit | 69 def edit |
71 end | 70 end |
72 | 71 |
73 verify :method => :put, :only => :update, :render => {:nothing => true, :status => :method_not_allowed } | |
74 def update | 72 def update |
75 @query.attributes = params[:query] | 73 @query.attributes = params[:query] |
76 @query.project = nil if params[:query_is_for_all] | 74 @query.project = nil if params[:query_is_for_all] |
77 @query.is_public = false unless User.current.allowed_to?(:manage_public_queries, @project) || User.current.admin? | 75 @query.is_public = false unless User.current.allowed_to?(:manage_public_queries, @project) || User.current.admin? |
78 build_query_from_params | 76 build_query_from_params |
84 else | 82 else |
85 render :action => 'edit' | 83 render :action => 'edit' |
86 end | 84 end |
87 end | 85 end |
88 | 86 |
89 verify :method => :delete, :only => :destroy, :render => {:nothing => true, :status => :method_not_allowed } | |
90 def destroy | 87 def destroy |
91 @query.destroy | 88 @query.destroy |
92 redirect_to :controller => 'issues', :action => 'index', :project_id => @project, :set_filter => 1 | 89 redirect_to :controller => 'issues', :action => 'index', :project_id => @project, :set_filter => 1 |
93 end | 90 end |
94 | 91 |