Class: Fe::ReferencesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Fe::ReferencesController
- Defined in:
- app/controllers/fe/references_controller.rb
Instance Method Summary collapse
-
#edit ⇒ Object
AnswerSheet for reference to fill in /applications/1/references/token.
- #send_invite ⇒ Object
- #show ⇒ Object
-
#submit ⇒ Object
final submission.
Instance Method Details
#edit ⇒ Object
AnswerSheet for reference to fill in /applications/1/references/token
14 15 16 17 |
# File 'app/controllers/fe/references_controller.rb', line 14 def edit ref = Fe::ReferenceSheet.find_by_access_key(params[:id]) redirect_to edit_fe_reference_sheet_path(ref, a: params[:id]) end |
#send_invite ⇒ Object
62 63 64 65 66 67 68 |
# File 'app/controllers/fe/references_controller.rb', line 62 def send_invite # Save references on page first #update_references @reference = Fe::ReferenceSheet.find(params[:id]) send_reference_invite(@reference) end |
#show ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'app/controllers/fe/references_controller.rb', line 43 def show @reference = @application.references.find_by_access_key(params[:id]) if @reference.nil? render action: :edit else @answer_sheet = @reference @question_sheet = @answer_sheet.question_sheet @elements = [] if @question_sheet @question_sheet.pages.order(:number).each do |page| @elements << page.elements.where("#{Element.table_name}.kind not in (?)", %w(Fe::Section Fe::Paragraph)).all end @elements = @elements.flatten @elements = QuestionSet.new(@elements, @answer_sheet).elements.group_by(&:page_id) end end end |
#submit ⇒ Object
final submission
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'app/controllers/fe/references_controller.rb', line 20 def submit @reference = @application.references.find(params[:id]) @reference.submit! # Send Reference Thank You Fe::Notifier.notification(@reference.email, Fe.from_email, "Reference Thank You", {'reference_full_name' => @reference.name, 'applicant_full_name' => @application.applicant.informal_full_name}).deliver # Send Reference Completion Notice Fe::Notifier.notification(@application.applicant.email, Fe.from_email, "Reference Complete", {'reference_full_name' => @reference.name, 'applicant_full_name' => @application.applicant.informal_full_name, 'reference_submission_date' => @reference.submitted_at.strftime("%m/%d/%Y")}).deliver end |