add second guardian fields to the non native signing form for talent releases
This commit is contained in:
@@ -61,15 +61,67 @@ class TalentReleasesController < ApplicationController
|
|||||||
end
|
end
|
||||||
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
|
def talent_release_params
|
||||||
params.require(:talent_release).permit(
|
params.require(:talent_release).permit(person_params,
|
||||||
:person_first_name, :person_last_name, :person_phone, :guardian_photo, :person_email,
|
guardian_params,
|
||||||
:person_address_street1, :person_address_street2, :person_address_city, :person_address_state, :person_address_zip, :person_address_country,
|
second_guardian_params,
|
||||||
:guardian_first_name, :guardian_last_name, :guardian_phone, :guardian_email, :minor,
|
:contract, { photos: [] },
|
||||||
:guardian_address_street1, :guardian_address_street2, :guardian_address_city, :guardian_address_state, :guardian_address_zip, :guardian_address_country,
|
:applicable_medium_id,
|
||||||
:contract, { photos: [] },
|
:applicable_medium_text,
|
||||||
:applicable_medium_id, :applicable_medium_text, :territory_id, :territory_text, :term_id, :term_text, :restriction_id, :restriction_text
|
:territory_id,
|
||||||
)
|
:territory_text,
|
||||||
|
:term_id,
|
||||||
|
:term_text,
|
||||||
|
:restriction_id,
|
||||||
|
:restriction_text)
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_talent_release(attrs = {})
|
def build_talent_release(attrs = {})
|
||||||
|
|||||||
@@ -9,22 +9,30 @@
|
|||||||
<%= form.text_field :person_first_name, required: true, wrapper_class: "col-sm-3" %>
|
<%= 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.text_field :person_last_name, required: true, wrapper_class: "col-sm-3" %>
|
||||||
<%= form.phone_field :person_phone, wrapper_class: "col-sm-6" %>
|
<%= form.phone_field :person_phone, wrapper_class: "col-sm-6" %>
|
||||||
</div>
|
|
||||||
<div class="form-row">
|
|
||||||
<%= form.email_field :person_email, wrapper_class: "col-sm-6" %>
|
<%= form.email_field :person_email, wrapper_class: "col-sm-6" %>
|
||||||
</div>
|
</div>
|
||||||
<%= render "shared/address_fields", form: form, subject: "person" %>
|
<%= render "shared/address_fields", form: form, subject: "person" %>
|
||||||
|
|
||||||
<div class="<%= class_string("collapse" => !talent_release.minor?) %>" data-ujs-target="guardian-fields">
|
<div class="<%= class_string("collapse" => !talent_release.minor?) %>" data-ujs-target="guardian-fields">
|
||||||
<div class="form-row">
|
<%= card_field_set_tag t(".guardian_info.heading") do %>
|
||||||
<%= form.text_field :guardian_first_name, required: talent_release.minor?, wrapper_class: "col-sm-3" %>
|
<div class="form-row">
|
||||||
<%= form.text_field :guardian_last_name, required: talent_release.minor?, wrapper_class: "col-sm-3" %>
|
<%= form.text_field :guardian_first_name, required: talent_release.minor?, wrapper_class: "col-sm-3" %>
|
||||||
<%= form.phone_field :guardian_phone, wrapper_class: "col-sm-6" %>
|
<%= form.text_field :guardian_last_name, required: talent_release.minor?, wrapper_class: "col-sm-3" %>
|
||||||
</div>
|
<%= form.phone_field :guardian_phone, wrapper_class: "col-sm-6" %>
|
||||||
<div class="form-row">
|
<%= form.text_field :guardian_email, wrapper_class: "col-sm-6" %>
|
||||||
<%= form.text_field :guardian_email, wrapper_class: "col-sm-6" %>
|
</div>
|
||||||
</div>
|
<%= render "shared/address_fields", form: form, subject: "guardian" %>
|
||||||
<%= render "shared/address_fields", form: form, subject: "guardian" %>
|
<% end %>
|
||||||
|
|
||||||
|
<%= card_field_set_tag t(".guardian_2_info.heading") do %>
|
||||||
|
<div class="form-row">
|
||||||
|
<%= 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" %>
|
||||||
|
</div>
|
||||||
|
<%= render "shared/address_fields", form: form, subject: "guardian_2" %>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
@@ -44,20 +52,36 @@
|
|||||||
<br>
|
<br>
|
||||||
<div class="text-left">
|
<div class="text-left">
|
||||||
<p><%= t(".photos.guardian_photo.heading") %></p>
|
<p><%= t(".photos.guardian_photo.heading") %></p>
|
||||||
<div class="d-inline-block mb-2" data-behavior="guardian-photo-preview" data-file-input="[data-ujs-target=guardian-photo-input]">
|
<div id="guardian-photo-preview" class="d-inline-block mb-2" data-behavior="guardian-photo-preview" data-file-input="[data-ujs-target=guardian-photo-input]">
|
||||||
<div class="align-items-center d-flex photo-preview img-thumbnail justify-content-center">
|
<div class="align-items-center d-flex photo-preview img-thumbnail justify-content-center">
|
||||||
<span>No photo yet</span>
|
<span>No photo yet</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% if talent_release.guardian_photo.attached? %>
|
<% if talent_release.guardian_photo.attached? %>
|
||||||
<%= javascript_tag nonce: true do %>
|
<%= 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 %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="d-inline-block">
|
<div class="d-inline-block">
|
||||||
<%= form.hidden_field :guardian_photo, value: form.object.guardian_photo.signed_id if talent_release.guardian_photo.attached?%>
|
<%= 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(",") %>
|
<%= 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(",") %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<p><%= t(".photos.guardian_2_photo.heading") %></p>
|
||||||
|
<div id="guardian-2-photo-preview" class="d-inline-block mb-2" data-behavior="guardian-photo-preview" data-file-input="[data-ujs-target=guardian-2-photo-input]">
|
||||||
|
<div class="align-items-center d-flex photo-preview img-thumbnail justify-content-center">
|
||||||
|
<span>No photo yet</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% 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 %>
|
||||||
|
<div class="d-inline-block">
|
||||||
|
<%= 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(",") %>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1131,7 +1131,13 @@ en:
|
|||||||
form:
|
form:
|
||||||
contract_and_rights:
|
contract_and_rights:
|
||||||
heading: 2 of 3 Contract & Exploitable Rights
|
heading: 2 of 3 Contract & Exploitable Rights
|
||||||
|
guardian_2_info:
|
||||||
|
heading: Guardian Information (if company requires)
|
||||||
|
guardian_info:
|
||||||
|
heading: Guardian Information
|
||||||
photos:
|
photos:
|
||||||
|
guardian_2_photo:
|
||||||
|
heading: Second Guardian Photo
|
||||||
guardian_photo:
|
guardian_photo:
|
||||||
heading: Guardian Photo
|
heading: Guardian Photo
|
||||||
heading: 3 of 3 Photos
|
heading: 3 of 3 Photos
|
||||||
|
|||||||
@@ -322,6 +322,8 @@ es:
|
|||||||
warning: ""
|
warning: ""
|
||||||
guardian_clause:
|
guardian_clause:
|
||||||
heading: Guardian Clause (ES)
|
heading: Guardian Clause (ES)
|
||||||
|
guardian_info:
|
||||||
|
heading: ""
|
||||||
guardian_photo:
|
guardian_photo:
|
||||||
camera_instructions_html: (ES) Click <em>Take Photo</em> to Turn ON Camera (ES)
|
camera_instructions_html: (ES) Click <em>Take Photo</em> to Turn ON Camera (ES)
|
||||||
heading: Guardian Photo (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)
|
warning: (ES) If your photo appears sideways, it will be autocorrected when you submit your release. (ES)
|
||||||
photo:
|
photo:
|
||||||
heading: Photos (ES)
|
heading: Photos (ES)
|
||||||
guardian_info:
|
|
||||||
heading: ""
|
|
||||||
teams:
|
teams:
|
||||||
show:
|
show:
|
||||||
choose_project: ¿Qué proyecto de la lista de abajo asistirá?
|
choose_project: ¿Qué proyecto de la lista de abajo asistirá?
|
||||||
@@ -341,6 +341,12 @@ es:
|
|||||||
print: Print (ES)
|
print: Print (ES)
|
||||||
talent_releases:
|
talent_releases:
|
||||||
form:
|
form:
|
||||||
|
guardian_2_info:
|
||||||
|
heading: Guardian Information (if company requires) (ES)
|
||||||
|
guardian_info:
|
||||||
|
heading: Guardian Information (ES)
|
||||||
photos:
|
photos:
|
||||||
|
guardian_2_photo:
|
||||||
|
heading: Second Guardian Photo (ES)
|
||||||
guardian_photo:
|
guardian_photo:
|
||||||
heading: Guardian Photo (ES)
|
heading: Guardian Photo (ES)
|
||||||
|
|||||||
@@ -166,6 +166,43 @@ feature "User managing talent releases" do
|
|||||||
expect(page).to have_photo("person_photo.png")
|
expect(page).to have_photo("person_photo.png")
|
||||||
end
|
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
|
scenario "updating an existing release" do
|
||||||
talent_release = create(:talent_release, project: project)
|
talent_release = create(:talent_release, project: project)
|
||||||
|
|
||||||
@@ -464,4 +501,8 @@ feature "User managing talent releases" do
|
|||||||
def success_submit_message
|
def success_submit_message
|
||||||
"Your release was successfully submitted. Thank you."
|
"Your release was successfully submitted. Thank you."
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def contract_field
|
||||||
|
"talent_release[contract]"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user