From 71d88e55352a51b20dd5e2a4a44aa695834a36b9 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Mon, 13 Mar 2017 19:17:59 +0000 Subject: Get rid of sort_helper when using queries. git-svn-id: http://svn.redmine.org/redmine/trunk@16390 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/issues_controller.rb | 13 ++----------- app/controllers/journals_controller.rb | 4 ---- app/controllers/timelog_controller.rb | 6 +----- 3 files changed, 3 insertions(+), 20 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index a04c1a6b0..2b9512fc7 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -37,15 +37,10 @@ class IssuesController < ApplicationController helper :queries include QueriesHelper helper :repositories - helper :sort - include SortHelper helper :timelog def index retrieve_query - sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria) - sort_update(@query.sortable_columns) - @query.sort_criteria = sort_criteria.to_a if @query.valid? case params[:format] @@ -66,9 +61,7 @@ class IssuesController < ApplicationController @issue_count = @query.issue_count @issue_pages = Paginator.new @issue_count, @limit, params['page'] @offset ||= @issue_pages.offset - @issues = @query.issues(:order => sort_clause, - :offset => @offset, - :limit => @limit) + @issues = @query.issues(:offset => @offset, :limit => @limit) respond_to do |format| format.html { render :template => 'issues/index', :layout => !request.xhr? } @@ -421,10 +414,8 @@ class IssuesController < ApplicationController else retrieve_query_from_session if @query - sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria) - sort_update(@query.sortable_columns, 'issues_index_sort') limit = 500 - issue_ids = @query.issue_ids(:order => sort_clause, :limit => (limit + 1)) + issue_ids = @query.issue_ids(:limit => (limit + 1)) if (idx = issue_ids.index(@issue.id)) && idx < limit if issue_ids.size < 500 @issue_position = idx + 1 diff --git a/app/controllers/journals_controller.rb b/app/controllers/journals_controller.rb index 106c0692d..cce9c1e69 100644 --- a/app/controllers/journals_controller.rb +++ b/app/controllers/journals_controller.rb @@ -27,13 +27,9 @@ class JournalsController < ApplicationController helper :custom_fields helper :queries include QueriesHelper - helper :sort - include SortHelper def index retrieve_query - sort_init 'id', 'desc' - sort_update(@query.sortable_columns) if @query.valid? @journals = @query.journals(:order => "#{Journal.table_name}.created_on DESC", :limit => 25) diff --git a/app/controllers/timelog_controller.rb b/app/controllers/timelog_controller.rb index a88ede4a5..9cfe16312 100644 --- a/app/controllers/timelog_controller.rb +++ b/app/controllers/timelog_controller.rb @@ -32,8 +32,6 @@ class TimelogController < ApplicationController rescue_from Query::StatementInvalid, :with => :query_statement_invalid - helper :sort - include SortHelper helper :issues include TimelogHelper helper :custom_fields @@ -43,9 +41,7 @@ class TimelogController < ApplicationController def index 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). + scope = time_entry_scope. preload(:issue => [:project, :tracker, :status, :assigned_to, :priority]). preload(:project, :user) -- cgit v1.2.3