diff options
author | Louise Crow <louise.crow@gmail.com> | 2013-08-21 10:46:50 +0100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2013-09-16 12:41:45 +0100 |
commit | 5f964420b0b66cc2acd93a866e3671c32cc42d91 (patch) | |
tree | 7bf0bd6a8a41091d38f3822f2295407e1daca3f9 /app/controllers/request_controller.rb | |
parent | e668912be052da6933289a692d8ec3b86bae5a82 (diff) |
Extract the various info_request assigns
So we can reuse them when rendering the show template to a file. Lots of
the sidebar prep isn't going to be needed for that view, so make that
optional in the template.
Diffstat (limited to 'app/controllers/request_controller.rb')
-rw-r--r-- | app/controllers/request_controller.rb | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 515c7ac5a..6f1a549c5 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -80,15 +80,7 @@ class RequestController < ApplicationController @update_status = params[:update_status] ? true : false end - # Other parameters - @info_request_events = @info_request.info_request_events - @status = @info_request.calculate_status - @old_unclassified = @info_request.is_old_unclassified? && !authenticated_user.nil? - @is_owning_user = @info_request.is_owning_user?(authenticated_user) - @last_info_request_event_id = @info_request.last_event_id_needing_description - @new_responses_count = @info_request.events_needing_description.select {|i| i.event_type == 'response'}.size - # For send followup link at bottom - @last_response = @info_request.get_last_response + assign_variables_for_show_template(@info_request) if @update_status return if !@is_owning_user && !authenticated_as_user?(@info_request.user, @@ -99,6 +91,7 @@ class RequestController < ApplicationController end # Sidebar stuff + @sidebar = true # ... requests that have similar imporant terms begin limit = 10 @@ -958,5 +951,18 @@ class RequestController < ApplicationController false end + def assign_variables_for_show_template(info_request) + # Other parameters + @info_request_events = info_request.info_request_events + @status = info_request.calculate_status + @old_unclassified = info_request.is_old_unclassified? && !authenticated_user.nil? + @is_owning_user = info_request.is_owning_user?(authenticated_user) + @last_info_request_event_id = info_request.last_event_id_needing_description + @new_responses_count = info_request.events_needing_description.select {|i| i.event_type == 'response'}.size + # For send followup link at bottom + @last_response = info_request.get_last_response + end + + end |