diff options
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/admin_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/boards_controller.rb | 6 | ||||
-rw-r--r-- | app/controllers/issues_controller.rb | 10 | ||||
-rw-r--r-- | app/controllers/projects_controller.rb | 8 | ||||
-rw-r--r-- | app/controllers/timelog_controller.rb | 7 | ||||
-rw-r--r-- | app/controllers/users_controller.rb | 2 |
6 files changed, 24 insertions, 11 deletions
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index d3afeeea1..be260b419 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -27,7 +27,7 @@ class AdminController < ApplicationController def projects sort_init 'name', 'asc' - sort_update + sort_update %w(name is_public created_on) @status = params[:status] ? params[:status].to_i : 1 c = ARCondition.new(@status == 0 ? "status <> 0" : ["status = ?", @status]) diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index 4532a88fe..c6ce934ee 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -35,8 +35,10 @@ class BoardsController < ApplicationController end def show - sort_init "#{Message.table_name}.updated_on", "desc" - sort_update + sort_init 'updated_on', 'desc' + sort_update 'created_on' => "#{Message.table_name}.created_on", + 'replies' => "#{Message.table_name}.replies_count", + 'updated_on' => "#{Message.table_name}.updated_on" @topic_count = @board.topics.count @topic_pages = Paginator.new self, @topic_count, per_page_option, params['page'] diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 916229cbc..f1f88bfdb 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -45,9 +45,10 @@ class IssuesController < ApplicationController helper :timelog def index - sort_init "#{Issue.table_name}.id", "desc" - sort_update retrieve_query + sort_init 'id', 'desc' + sort_update({'id' => "#{Issue.table_name}.id"}.merge(@query.columns.inject({}) {|h, c| h[c.name.to_s] = c.sortable; h})) + if @query.valid? limit = per_page_option respond_to do |format| @@ -78,9 +79,10 @@ class IssuesController < ApplicationController end def changes - sort_init "#{Issue.table_name}.id", "desc" - sort_update retrieve_query + sort_init 'id', 'desc' + sort_update({'id' => "#{Issue.table_name}.id"}.merge(@query.columns.inject({}) {|h, c| h[c.name.to_s] = c.sortable; h})) + if @query.valid? @journals = Journal.find :all, :include => [ :details, :user, {:issue => [:project, :author, :tracker, :status]} ], :conditions => @query.statement, diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 427165a3d..efb690144 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -197,8 +197,12 @@ class ProjectsController < ApplicationController end def list_files - sort_init "#{Attachment.table_name}.filename", "asc" - sort_update + sort_init 'filename', 'asc' + sort_update 'filename' => "#{Attachment.table_name}.filename", + 'created_on' => "#{Attachment.table_name}.created_on", + 'size' => "#{Attachment.table_name}.filesize", + 'downloads' => "#{Attachment.table_name}.downloads" + @versions = @project.versions.find(:all, :include => :attachments, :order => sort_clause).sort.reverse render :layout => !request.xhr? end diff --git a/app/controllers/timelog_controller.rb b/app/controllers/timelog_controller.rb index c333c02bb..58df1f5bc 100644 --- a/app/controllers/timelog_controller.rb +++ b/app/controllers/timelog_controller.rb @@ -138,7 +138,12 @@ class TimelogController < ApplicationController def details sort_init 'spent_on', 'desc' - sort_update + sort_update 'spent_on' => 'spent_on', + 'user' => 'user_id', + 'activity' => 'activity_id', + 'project' => "#{Project.table_name}.name", + 'issue' => 'issue_id', + 'hours' => 'hours' cond = ARCondition.new if @project.nil? diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index e2ab510fb..4c9302824 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -30,7 +30,7 @@ class UsersController < ApplicationController def list sort_init 'login', 'asc' - sort_update + sort_update %w(login firstname lastname mail admin created_on last_login_on) @status = params[:status] ? params[:status].to_i : 1 c = ARCondition.new(@status == 0 ? "status <> 0" : ["status = ?", @status]) |