Mercurial > hg > soundsoftware-site
comparison app/controllers/.svn/text-base/queries_controller.rb.svn-base @ 441:cbce1fd3b1b7 redmine-1.2
Update to Redmine 1.2-stable branch (Redmine SVN rev 6000)
author | Chris Cannam |
---|---|
date | Mon, 06 Jun 2011 14:24:13 +0100 |
parents | 513646585e45 |
children |
comparison
equal
deleted
inserted
replaced
245:051f544170fe | 441:cbce1fd3b1b7 |
---|---|
23 def new | 23 def new |
24 @query = Query.new(params[:query]) | 24 @query = Query.new(params[:query]) |
25 @query.project = params[:query_is_for_all] ? nil : @project | 25 @query.project = params[:query_is_for_all] ? nil : @project |
26 @query.user = User.current | 26 @query.user = User.current |
27 @query.is_public = false unless User.current.allowed_to?(:manage_public_queries, @project) || User.current.admin? | 27 @query.is_public = false unless User.current.allowed_to?(:manage_public_queries, @project) || User.current.admin? |
28 | |
29 @query.add_filters(params[:fields] || params[:f], params[:operators] || params[:op], params[:values] || params[:v]) if params[:fields] || params[:f] | |
30 @query.group_by ||= params[:group_by] | |
31 @query.column_names = params[:c] if params[:c] | |
28 @query.column_names = nil if params[:default_columns] | 32 @query.column_names = nil if params[:default_columns] |
29 | |
30 @query.add_filters(params[:fields], params[:operators], params[:values]) if params[:fields] | |
31 @query.group_by ||= params[:group_by] | |
32 | 33 |
33 if request.post? && params[:confirm] && @query.save | 34 if request.post? && params[:confirm] && @query.save |
34 flash[:notice] = l(:notice_successful_create) | 35 flash[:notice] = l(:notice_successful_create) |
35 redirect_to :controller => 'issues', :action => 'index', :project_id => @project, :query_id => @query | 36 redirect_to :controller => 'issues', :action => 'index', :project_id => @project, :query_id => @query |
36 return | 37 return |
39 end | 40 end |
40 | 41 |
41 def edit | 42 def edit |
42 if request.post? | 43 if request.post? |
43 @query.filters = {} | 44 @query.filters = {} |
44 @query.add_filters(params[:fields], params[:operators], params[:values]) if params[:fields] | 45 @query.add_filters(params[:fields] || params[:f], params[:operators] || params[:op], params[:values] || params[:v]) if params[:fields] || params[:f] |
45 @query.attributes = params[:query] | 46 @query.attributes = params[:query] |
46 @query.project = nil if params[:query_is_for_all] | 47 @query.project = nil if params[:query_is_for_all] |
47 @query.is_public = false unless User.current.allowed_to?(:manage_public_queries, @project) || User.current.admin? | 48 @query.is_public = false unless User.current.allowed_to?(:manage_public_queries, @project) || User.current.admin? |
49 @query.group_by ||= params[:group_by] | |
50 @query.column_names = params[:c] if params[:c] | |
48 @query.column_names = nil if params[:default_columns] | 51 @query.column_names = nil if params[:default_columns] |
49 | 52 |
50 if @query.save | 53 if @query.save |
51 flash[:notice] = l(:notice_successful_update) | 54 flash[:notice] = l(:notice_successful_update) |
52 redirect_to :controller => 'issues', :action => 'index', :project_id => @project, :query_id => @query | 55 redirect_to :controller => 'issues', :action => 'index', :project_id => @project, :query_id => @query |