diff --git a/app/controllers/talent_releases_controller.rb b/app/controllers/talent_releases_controller.rb
index c937db9..e2255c2 100644
--- a/app/controllers/talent_releases_controller.rb
+++ b/app/controllers/talent_releases_controller.rb
@@ -61,15 +61,67 @@ class TalentReleasesController < ApplicationController
end
end
+ def person_params
+ %i[
+ person_first_name
+ person_last_name
+ person_phone
+ person_email
+ person_address_street1
+ person_address_street2
+ person_address_city
+ person_address_state
+ person_address_zip
+ person_address_country
+ ]
+ end
+
+ def guardian_params
+ %i[
+ guardian_first_name
+ guardian_last_name
+ guardian_phone
+ guardian_email
+ minor
+ guardian_address_street1
+ guardian_address_street2
+ guardian_address_city
+ guardian_address_state
+ guardian_address_zip
+ guardian_address_country
+ guardian_photo
+ ]
+ end
+
+ def second_guardian_params
+ %i[
+ guardian_2_first_name
+ guardian_2_last_name
+ guardian_2_phone
+ guardian_2_email
+ guardian_2_address_street1
+ guardian_2_address_street2
+ guardian_2_address_city
+ guardian_2_address_state
+ guardian_2_address_zip
+ guardian_2_address_country
+ guardian_2_photo
+ ]
+ end
+
def talent_release_params
- params.require(:talent_release).permit(
- :person_first_name, :person_last_name, :person_phone, :guardian_photo, :person_email,
- :person_address_street1, :person_address_street2, :person_address_city, :person_address_state, :person_address_zip, :person_address_country,
- :guardian_first_name, :guardian_last_name, :guardian_phone, :guardian_email, :minor,
- :guardian_address_street1, :guardian_address_street2, :guardian_address_city, :guardian_address_state, :guardian_address_zip, :guardian_address_country,
- :contract, { photos: [] },
- :applicable_medium_id, :applicable_medium_text, :territory_id, :territory_text, :term_id, :term_text, :restriction_id, :restriction_text
- )
+ params.require(:talent_release).permit(person_params,
+ guardian_params,
+ second_guardian_params,
+ :contract, { photos: [] },
+ :applicable_medium_id,
+ :applicable_medium_text,
+ :territory_id,
+ :territory_text,
+ :term_id,
+ :term_text,
+ :restriction_id,
+ :restriction_text)
end
def build_talent_release(attrs = {})
diff --git a/app/views/talent_releases/_form.html.erb b/app/views/talent_releases/_form.html.erb
index 76fbff9..2c2caa7 100644
--- a/app/views/talent_releases/_form.html.erb
+++ b/app/views/talent_releases/_form.html.erb
@@ -9,22 +9,30 @@
<%= form.text_field :person_first_name, required: true, wrapper_class: "col-sm-3" %>
<%= form.text_field :person_last_name, required: true, wrapper_class: "col-sm-3" %>
<%= form.phone_field :person_phone, wrapper_class: "col-sm-6" %>
-
-
<%= form.email_field :person_email, wrapper_class: "col-sm-6" %>
<%= render "shared/address_fields", form: form, subject: "person" %>
!talent_release.minor?) %>" data-ujs-target="guardian-fields">
-
- <%= form.text_field :guardian_first_name, required: talent_release.minor?, wrapper_class: "col-sm-3" %>
- <%= form.text_field :guardian_last_name, required: talent_release.minor?, wrapper_class: "col-sm-3" %>
- <%= form.phone_field :guardian_phone, wrapper_class: "col-sm-6" %>
-
-
- <%= form.text_field :guardian_email, wrapper_class: "col-sm-6" %>
-
- <%= render "shared/address_fields", form: form, subject: "guardian" %>
+ <%= card_field_set_tag t(".guardian_info.heading") do %>
+
+ <%= form.text_field :guardian_first_name, required: talent_release.minor?, wrapper_class: "col-sm-3" %>
+ <%= form.text_field :guardian_last_name, required: talent_release.minor?, wrapper_class: "col-sm-3" %>
+ <%= form.phone_field :guardian_phone, wrapper_class: "col-sm-6" %>
+ <%= form.text_field :guardian_email, wrapper_class: "col-sm-6" %>
+
+ <%= render "shared/address_fields", form: form, subject: "guardian" %>
+ <% end %>
+
+ <%= card_field_set_tag t(".guardian_2_info.heading") do %>
+
+ <%= form.text_field :guardian_2_first_name, required: talent_release.minor?, wrapper_class: "col-sm-3" %>
+ <%= form.text_field :guardian_2_last_name, required: talent_release.minor?, wrapper_class: "col-sm-3" %>
+ <%= form.phone_field :guardian_2_phone, wrapper_class: "col-sm-6" %>
+ <%= form.text_field :guardian_2_email, wrapper_class: "col-sm-6" %>
+
+ <%= render "shared/address_fields", form: form, subject: "guardian_2" %>
+ <% end %>
<% end %>
@@ -44,20 +52,36 @@
<%= t(".photos.guardian_photo.heading") %>
-
+
<% if talent_release.guardian_photo.attached? %>
<%= javascript_tag nonce: true do %>
- App.PhotoPreview.set("[data-behavior=guardian-photo-preview]", "<%= url_for(talent_release.guardian_photo.variant(auto_orient: true, resize: '200x200')) %>");
+ App.PhotoPreview.set("#guardian-photo-preview", "<%= url_for(talent_release.guardian_photo.variant(auto_orient: true, resize: '200x200')) %>");
<% end %>
<% end %>
<%= form.hidden_field :guardian_photo, value: form.object.guardian_photo.signed_id if talent_release.guardian_photo.attached?%>
<%= form.file_field :guardian_photo, hide_label: true, data: { ujs_target: "guardian-photo-input" }, help: "PNG or JPG only", accept: talent_release.class.face_photo_acceptable_content_types.join(",") %>
+
+
<%= t(".photos.guardian_2_photo.heading") %>
+
+ <% if talent_release.guardian_2_photo.attached? %>
+ <%= javascript_tag nonce: true do %>
+ App.PhotoPreview.set("#guardian-2-photo-preview", "<%= url_for(talent_release.guardian_2_photo.variant(auto_orient: true, resize: '200x200')) %>");
+ <% end %>
+ <% end %>
+
+ <%= form.hidden_field :guardian_2_photo, value: form.object.guardian_2_photo.signed_id if talent_release.guardian_2_photo.attached?%>
+ <%= form.file_field :guardian_2_photo, hide_label: true, data: { ujs_target: "guardian-2-photo-input" }, help: "PNG or JPG only", accept: talent_release.class.face_photo_acceptable_content_types.join(",") %>
+
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 5214706..9e6d763 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -1131,7 +1131,13 @@ en:
form:
contract_and_rights:
heading: 2 of 3 Contract & Exploitable Rights
+ guardian_2_info:
+ heading: Guardian Information (if company requires)
+ guardian_info:
+ heading: Guardian Information
photos:
+ guardian_2_photo:
+ heading: Second Guardian Photo
guardian_photo:
heading: Guardian Photo
heading: 3 of 3 Photos
diff --git a/config/locales/es.yml b/config/locales/es.yml
index 22ca3fa..fc92aae 100644
--- a/config/locales/es.yml
+++ b/config/locales/es.yml
@@ -322,6 +322,8 @@ es:
warning: ""
guardian_clause:
heading: Guardian Clause (ES)
+ guardian_info:
+ heading: ""
guardian_photo:
camera_instructions_html: (ES) Click Take Photo to Turn ON Camera (ES)
heading: Guardian Photo (ES)
@@ -331,8 +333,6 @@ es:
warning: (ES) If your photo appears sideways, it will be autocorrected when you submit your release. (ES)
photo:
heading: Photos (ES)
- guardian_info:
- heading: ""
teams:
show:
choose_project: ¿Qué proyecto de la lista de abajo asistirá?
@@ -341,6 +341,12 @@ es:
print: Print (ES)
talent_releases:
form:
+ guardian_2_info:
+ heading: Guardian Information (if company requires) (ES)
+ guardian_info:
+ heading: Guardian Information (ES)
photos:
+ guardian_2_photo:
+ heading: Second Guardian Photo (ES)
guardian_photo:
heading: Guardian Photo (ES)
diff --git a/spec/features/user_managing_talent_releases_spec.rb b/spec/features/user_managing_talent_releases_spec.rb
index e9256a7..6362a58 100644
--- a/spec/features/user_managing_talent_releases_spec.rb
+++ b/spec/features/user_managing_talent_releases_spec.rb
@@ -166,6 +166,43 @@ feature "User managing talent releases" do
expect(page).to have_photo("person_photo.png")
end
+ scenario "creating a release for minor with two guardians", js: true do
+ visit new_project_talent_release_path(project)
+
+ expect(page).not_to have_content guardian_photo_heading
+ expect(page).not_to have_content guardian_2_photo_heading
+
+ page.check person_is_minor_checkbox
+
+ expect(page).to have_content guardian_photo_heading
+ expect(page).to have_content guardian_2_photo_heading
+
+ fill_in person_first_name_field, with: "John"
+ fill_in person_last_name_field, with: "Doe"
+
+ fill_in guardian_first_name_field, with: "Guardian"
+ fill_in guardian_last_name_field, with: "Name"
+ fill_in guardian_phone_field, with: "01010"
+
+ fill_in guardian_2_first_name_field, with: "Second"
+ fill_in guardian_2_last_name_field, with: "Guardian"
+
+ fill_in_exploitable_rights
+
+ attach_file contract_field, Rails.root.join(file_fixture("contract.pdf")), visible: false
+ drop_file Rails.root.join(file_fixture("person_photo.png")), type: :dropzone
+ attach_file guardian_photo_field, Rails.root.join(file_fixture("hemsworth.jpeg")), visible: false
+ attach_file guardian_2_photo_field, Rails.root.join(file_fixture("pratt.jpg")), visible: false
+
+ click_button create_release_button
+
+ expect(page).to have_content create_release_notice
+ expect(page).to have_photo("person_photo.png")
+
+ expect(TalentRelease.last.guardian_2_photo.attached?).to eq true
+ expect(TalentRelease.last.guardian_2_name).to eq "Second Guardian"
+ end
+
scenario "updating an existing release" do
talent_release = create(:talent_release, project: project)
@@ -464,4 +501,8 @@ feature "User managing talent releases" do
def success_submit_message
"Your release was successfully submitted. Thank you."
end
+
+ def contract_field
+ "talent_release[contract]"
+ end
end