Permalink
Browse files

Retrieve members only once

  • Loading branch information...
1 parent 944525e commit 6f7a5eb74134a733a302be60a56c58d84d8f7769 @den-plugins committed Jan 4, 2012
Showing with 6 additions and 2 deletions.
  1. +5 −0 app/controllers/task_boards_controller.rb
  2. +1 −2 app/helpers/task_boards_helper.rb
@@ -5,6 +5,7 @@ class TaskBoardsController < ApplicationController
before_filter :get_project, :authorize, :only => [:index, :show]
before_filter :set_cache_buster
before_filter :get_issue, :only => [:update_issue_status, :update_issue, :add_comment, :get_comment]
+ before_filter :get_members, :only => [:update_issue_status, :update_issue, :show]
def set_cache_buster
response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate"
@@ -207,6 +208,10 @@ def get_journals(ticket)
ticket.journals.find(:all, :include => [:user, :journalized], :conditions => "notes <> ''", :order => "created_on DESC")
end
+ def get_members
+ @members = @project.members.find(:all, :include => [:user], :order => "users.firstname ASC")
+ end
+
def ordered_keys(values)
values.keys.sort{|x,y| values[x][:order] <=> values[y][:order]}
end
@@ -32,8 +32,7 @@ def task_board_border_class issue
end
def select_assigned_to f, issue
- members = @project.members.find(:all, :include => [:user], :order => "users.firstname ASC")
- f.select :assigned_to_id, (members.collect {|p| [p.name, p.user.id]}), :selected => (issue.assigned_to.nil? ? '' : issue.assigned_to.id), :include_blank => true
+ f.select :assigned_to_id, (@members.collect {|p| [p.name, p.user.id]}), :selected => (issue.assigned_to.nil? ? '' : issue.assigned_to.id), :include_blank => true
end
def select_status f, issue

0 comments on commit 6f7a5eb

Please sign in to comment.