diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-07-12 17:40:19 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-07-12 17:40:19 +0000 |
commit | beb5e6039166dadc8efccb65feb0f7ee450c9558 (patch) | |
tree | 291bd88733f83345216020cc9cc00b8ec0a145f2 /app/controllers | |
parent | 7c6757c81a04a4351063ffd764a1afd53209d09d (diff) | |
download | redmine-beb5e6039166dadc8efccb65feb0f7ee450c9558.tar.gz redmine-beb5e6039166dadc8efccb65feb0f7ee450c9558.zip |
Makes spent time queries savable (#14790).
git-svn-id: http://svn.redmine.org/redmine/trunk@15639 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/queries_controller.rb | 17 | ||||
-rw-r--r-- | app/controllers/timelog_controller.rb | 9 |
2 files changed, 19 insertions, 7 deletions
diff --git a/app/controllers/queries_controller.rb b/app/controllers/queries_controller.rb index 961b75dcc..84843c1dd 100644 --- a/app/controllers/queries_controller.rb +++ b/app/controllers/queries_controller.rb @@ -60,7 +60,7 @@ class QueriesController < ApplicationController if @query.save flash[:notice] = l(:notice_successful_create) - redirect_to_issues(:query_id => @query) + redirect_to_items(:query_id => @query) else render :action => 'new', :layout => !request.xhr? end @@ -74,7 +74,7 @@ class QueriesController < ApplicationController if @query.save flash[:notice] = l(:notice_successful_update) - redirect_to_issues(:query_id => @query) + redirect_to_items(:query_id => @query) else render :action => 'edit' end @@ -82,7 +82,7 @@ class QueriesController < ApplicationController def destroy @query.destroy - redirect_to_issues(:set_filter => 1) + redirect_to_items(:set_filter => 1) end private @@ -117,7 +117,12 @@ class QueriesController < ApplicationController @query end - def redirect_to_issues(options) + def redirect_to_items(options) + method = "redirect_to_#{@query.class.name.underscore}" + send method, options + end + + def redirect_to_issue_query(options) if params[:gantt] if @project redirect_to project_gantt_path(@project, options) @@ -129,6 +134,10 @@ class QueriesController < ApplicationController end end + def redirect_to_time_entry_query(options) + redirect_to _time_entries_path(@project, nil, options) + end + # Returns the Query subclass, IssueQuery by default # for compatibility with previous behaviour def query_class diff --git a/app/controllers/timelog_controller.rb b/app/controllers/timelog_controller.rb index 66ae97678..a0f0ea31d 100644 --- a/app/controllers/timelog_controller.rb +++ b/app/controllers/timelog_controller.rb @@ -40,8 +40,7 @@ class TimelogController < ApplicationController include QueriesHelper def index - @query = TimeEntryQuery.build_from_params(params, :project => @project, :name => '_') - + retrieve_time_entry_query sort_init(@query.sort_criteria.empty? ? [['spent_on', 'desc']] : @query.sort_criteria) sort_update(@query.sortable_columns) scope = time_entry_scope(:order => sort_clause). @@ -75,7 +74,7 @@ class TimelogController < ApplicationController end def report - @query = TimeEntryQuery.build_from_params(params, :project => @project, :name => '_') + retrieve_time_entry_query scope = time_entry_scope @report = Redmine::Helpers::TimeReport.new(@project, @issue, params[:criteria], params[:columns], scope) @@ -271,4 +270,8 @@ private end scope end + + def retrieve_time_entry_query + retrieve_query(TimeEntryQuery, false) + end end |