diff --git a/app/controllers/appearance_releases_controller.rb b/app/controllers/appearance_releases_controller.rb
index a1e53d6..16440ac 100644
--- a/app/controllers/appearance_releases_controller.rb
+++ b/app/controllers/appearance_releases_controller.rb
@@ -77,9 +77,43 @@ class AppearanceReleasesController < ApplicationController
results
end
+ def person_params
+ %i[
+ person_first_name
+ person_last_name
+ person_phone
+ person_email
+ person_photo
+ person_address_street1
+ ]
+ end
+
+ def guardian_params
+ %i[
+ guardian_first_name
+ guardian_last_name
+ guardian_phone
+ guardian_email
+ guardian_photo
+ guardian_address_street1
+ ]
+ end
+
+ def second_guardian_params
+ %i[
+ guardian_2_first_name
+ guardian_2_last_name
+ guardian_2_phone
+ guardian_2_email
+ guardian_2_photo
+ guardian_2_address_street1
+ ]
+ end
+
def appearance_release_params
- params.require(:appearance_release).permit(:contract, :guardian_address_street1, :guardian_first_name, :guardian_last_name, :guardian_phone, :guardian_photo, :guardian_email, :minor,
- :person_address_street1, :person_first_name, :person_last_name, :person_phone, :person_email, :person_photo,
+ params.require(:appearance_release).permit(person_params,
+ guardian_params, second_guardian_params,
+ :contract, :minor,
:applicable_medium_id, :applicable_medium_text,
:territory_id, :territory_text,
:term_id, :term_text, :person_date_of_birth,
diff --git a/app/views/appearance_releases/_form.html.erb b/app/views/appearance_releases/_form.html.erb
index 9264f28..3e9e915 100644
--- a/app/views/appearance_releases/_form.html.erb
+++ b/app/views/appearance_releases/_form.html.erb
@@ -17,17 +17,25 @@
!appearance_release.minor?) %>" data-ujs-target="guardian-fields">
-
- <%= form.text_field :guardian_first_name, required: appearance_release.minor?, wrapper_class: "col-sm-3" %>
- <%= form.text_field :guardian_last_name, required: appearance_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" %>
-
-
- <%= form.text_field :guardian_address_street1, wrapper_class: "col-sm-6" %>
-
+ <%= card_field_set_tag t(".guardian_info.heading") do %>
+
+ <%= form.text_field :guardian_first_name, required: appearance_release.minor?, wrapper_class: "col-sm-3" %>
+ <%= form.text_field :guardian_last_name, required: appearance_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" %>
+ <%= form.text_field :guardian_address_street1, wrapper_class: "col-sm-6" %>
+
+ <% end %>
+
+ <%= card_field_set_tag t(".guardian_2_info.heading") do %>
+
+ <%= form.text_field :guardian_2_first_name, wrapper_class: "col-sm-3" %>
+ <%= form.text_field :guardian_2_last_name, 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" %>
+ <%= form.text_field :guardian_2_address_street1, wrapper_class: "col-sm-6" %>
+
+ <% end %>
<% end %>
@@ -62,20 +70,36 @@
!appearance_release.minor?) %>" data-ujs-target="guardian-fields">
<%= t(".photos.guardian_photo.heading") %>
-
+
<% if appearance_release.guardian_photo.attached? %>
<%= javascript_tag nonce: true do %>
- App.PhotoPreview.set("[data-behavior=guardian-photo-preview]", "<%= url_for(appearance_release.guardian_photo.variant(auto_orient: true, resize: '200x200')) %>");
+ App.PhotoPreview.set("#guardian-photo-preview", "<%= url_for(appearance_release.guardian_photo.variant(auto_orient: true, resize: '200x200')) %>");
<% end %>
<% end %>
<%= form.hidden_field :guardian_photo, value: form.object.guardian_photo.signed_id if appearance_release.guardian_photo.attached?%>
<%= form.file_field :guardian_photo, hide_label: true, data: { ujs_target: "guardian-photo-input" }, help: "PNG or JPG only", accept: appearance_release.class.face_photo_acceptable_content_types.join(",") %>
+
+
<%= t(".photos.guardian_2_photo.heading") %>
+
+ <% if appearance_release.guardian_2_photo.attached? %>
+ <%= javascript_tag nonce: true do %>
+ App.PhotoPreview.set("#guardian-2-photo-preview", "<%= url_for(appearance_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 appearance_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: appearance_release.class.face_photo_acceptable_content_types.join(",") %>
+
<% end %>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 22f5b35..74f1e51 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -123,9 +123,15 @@ en:
form:
contract_and_rights:
heading: 2 of 3 Contract & Exploitable Rights
+ guardian_2_info:
+ heading: Second Guardian Information (if company requires)
+ guardian_info:
+ heading: Guardian Information
person_details:
heading: 1 of 3 Person Details
photos:
+ guardian_2_photo:
+ heading: Second Guardian Photo
guardian_photo:
heading: Guardian Photo
heading: 3 of 3 Photo
diff --git a/config/locales/es.yml b/config/locales/es.yml
index b2087b9..4737090 100644
--- a/config/locales/es.yml
+++ b/config/locales/es.yml
@@ -28,7 +28,13 @@ es:
matching_started: Matching started (ES)
no_attachments: Failed to import - no attachments (ES)
form:
+ guardian_2_info:
+ heading: Second 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)
person_photo:
diff --git a/spec/features/user_managing_appearance_releases_spec.rb b/spec/features/user_managing_appearance_releases_spec.rb
index 06ea050..9335a0f 100644
--- a/spec/features/user_managing_appearance_releases_spec.rb
+++ b/spec/features/user_managing_appearance_releases_spec.rb
@@ -194,6 +194,28 @@ feature 'User managing appearance releases' do
expect(page).to have_content 'New Jane'
end
+ scenario 'user can enter information for second guardian when editing non native release for minor', js: true do
+ appearance_release = create(:appearance_release, :non_native, :minor, project: project)
+
+ visit edit_appearance_release_path(appearance_release)
+
+ expect(page).to have_content guardian_2_first_name_field.titleize
+ expect(page).to have_content guardian_2_photo_heading
+
+ fill_in guardian_first_name_field, with: 'Guardian'
+ fill_in guardian_last_name_field, with: 'Name'
+ attach_file guardian_photo_field, file_fixture('hemsworth.jpeg'), visible: :all
+
+ fill_in guardian_2_first_name_field, with: 'Second'
+ fill_in guardian_2_last_name_field, with: 'guardian'
+ attach_file guardian_2_photo_field, file_fixture('person_photo.png'), visible: :all
+
+ click_button submit_update_button
+
+ expect(page).to have_content successful_update_message
+ expect(AppearanceRelease.last.guardian_2_photo.attached?).to eq true
+ end
+
scenario 'progress bar shows when user imports a release', js: true do
visit project_appearance_releases_path(project)
@@ -557,6 +579,10 @@ feature 'User managing appearance releases' do
'appearance_release[guardian_photo]'
end
+ def guardian_2_photo_field
+ 'appearance_release[guardian_2_photo]'
+ end
+
def person_name_field
t('helpers.label.appearance_release.person_name')
end
@@ -662,4 +688,12 @@ feature 'User managing appearance releases' do
def successful_destroy_message
'The release has been deleted'
end
+
+ def guardian_photo_heading
+ t 'appearance_releases.form.photos.guardian_photo.heading'
+ end
+
+ def guardian_2_photo_heading
+ t 'appearance_releases.form.photos.guardian_2_photo.heading'
+ end
end