Skip to content

Commit

Permalink
WIP !!!
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamfall committed May 22, 2024
1 parent 1df76c4 commit 542c4c7
Show file tree
Hide file tree
Showing 213 changed files with 23 additions and 37,615 deletions.
91 changes: 0 additions & 91 deletions app/controllers/form/support_letters_controller.rb
Original file line number Diff line number Diff line change
@@ -1,93 +1,2 @@
class Form::SupportLettersController < Form::BaseController
before_action :load_letter, only: :destroy

def create
@support_letter = @form_answer.support_letters.new(
support_letter_params.merge(
user_id: current_user.id,
manual: true,
),
)

attachment = SupportLetterAttachment.new(attachment_params)
attachment.user = current_user
attachment.form_answer = @form_answer
attachment.original_filename = attachment_params[:attachment].try(:original_filename)
@support_letter.support_letter_attachment = attachment

if @support_letter.save
add_support_letter_to_document!
@form_answer.save

redirect_to form_form_answer_supporters_path(@form_answer)
else
render :new
end
end

def new
@support_letter = @form_answer.support_letters.new
end

def destroy
if @support_letter.destroy
remove_support_letter_from_document!
@form_answer.save
end

redirect_to form_form_answer_supporters_path(@form_answer)
end

private

def support_letter_params
params[:support_letter].permit(
:first_name,
:last_name,
:relationship_to_nominee,
)
end

def attachment_params
if params[:support_letter] && params[:support_letter][:support_letter_attachment]
params[:support_letter][:support_letter_attachment].permit(:attachment)
else
{}
end
end

def load_letter
@support_letter = @form_answer.support_letters.find(params[:id])
end

def add_support_letter_to_document!
letters = support_letters_doc

new_letter = {
support_letter_id: @support_letter.id,
first_name: @support_letter.first_name,
last_name: @support_letter.last_name,
relationship_to_nominee: @support_letter.relationship_to_nominee,
letter_of_support: @support_letter.support_letter_attachment.id,
}

letters << new_letter

@form_answer.document = @form_answer.document.merge(supporter_letters_list: letters,
manually_upload: "yes",)
end

def remove_support_letter_from_document!
letters = support_letters_doc

letters.delete_if do |sup|
sup["support_letter_id"] == @support_letter.id
end

@form_answer.document = @form_answer.document.merge(supporter_letters_list: letters)
end

def support_letters_doc
@form_answer.document["supporter_letters_list"].presence || []
end
end
75 changes: 0 additions & 75 deletions app/controllers/form/supporters_controller.rb

This file was deleted.

4 changes: 0 additions & 4 deletions app/controllers/form_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
require "award_years/v2018/qae_forms"
require "award_years/v2019/qae_forms"
require "award_years/v2020/qae_forms"

class FormController < ApplicationController
before_action :authenticate_user!
before_action :check_account_completion, :check_number_of_collaborators, unless: -> { admin_signed_in? || assessor_signed_in? }
Expand Down
61 changes: 0 additions & 61 deletions app/controllers/support_letters_controller.rb

This file was deleted.

12 changes: 0 additions & 12 deletions app/mailers/account_mailers/notify_non_shortlisted_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,4 @@ def notify(form_answer_id, collaborator_id)

send_mail_if_not_bounces ENV["GOV_UK_NOTIFY_API_TEMPLATE_ID"], to: collaborator.email, subject: subject_with_env_prefix(@subject)
end

# ep_notify is disabled for now
def ep_notify(form_answer_id, collaborator_id)
@form_answer = FormAnswer.find(form_answer_id).decorate
@user = @form_answer.user.decorate
collaborator = User.find(collaborator_id)

@current_year = @form_answer.award_year.year
@subject = "King's Awards for Enterprise Promotion: Thank you for your nomination"

send_mail_if_not_bounces ENV["GOV_UK_NOTIFY_API_TEMPLATE_ID"], to: collaborator.email, subject: subject_with_env_prefix(@subject)
end
end

This file was deleted.

6 changes: 0 additions & 6 deletions app/models/form_answer.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
require_relative "../../forms/award_years/v2018/qae_forms"
require_relative "../../forms/award_years/v2019/qae_forms"
require_relative "../../forms/award_years/v2020/qae_forms"
require_relative "../../forms/award_years/v2021/qae_forms"
require_relative "../../forms/award_years/v2022/qae_forms"
require_relative "../../forms/award_years/v2023/qae_forms"
require_relative "../../forms/award_years/v2024/qae_forms"
require_relative "../../forms/award_years/v2025/qae_forms"

Expand Down

This file was deleted.

This file was deleted.

55 changes: 0 additions & 55 deletions app/views/form/support_letters/new.html.slim

This file was deleted.

24 changes: 0 additions & 24 deletions app/views/form/supporters/_footer.html.slim

This file was deleted.

Loading

0 comments on commit 542c4c7

Please sign in to comment.