diff --git a/app/views/public/material_releases/new.html.erb b/app/views/public/material_releases/new.html.erb
index 6e756e4..cb650f8 100644
--- a/app/views/public/material_releases/new.html.erb
+++ b/app/views/public/material_releases/new.html.erb
@@ -13,6 +13,17 @@
+ <% unless @contract_template.guardian_clause.blank? %>
+ <%= form.form_group :minor do %>
+ <%= form.check_box :minor, label: t("helpers.label.appearance_release.minor"), data: { behavior: "update-required-status", target: "[data-ujs-target=guardian-fields]", toggle: "collapse" } %>
+ <% end %>
+
+ <%= card_field_set_tag t(".guardian_clause.heading") do %>
+
+ <% end %>
+
<%= card_field_set_tag t(".release_info.heading") do %>
<%= form.text_field :name, required: true, wrapper_class: "col-12" %>
@@ -40,6 +51,91 @@
+ <% unless @contract_template.guardian_clause.blank? %>
+
!@material_release.minor?) %>" data-ujs-target="guardian-fields">
+ <%= card_field_set_tag t(".guardian_info.heading") do %>
+
+ <%= form.text_field :guardian_first_name, required: @material_release.minor?, wrapper_class: "col-sm-3", data: { required_tag: "guardian" } %>
+ <%= form.text_field :guardian_last_name, required: @material_release.minor?, wrapper_class: "col-sm-3", data: { required_tag: "guardian" } %>
+ <%= form.phone_field :guardian_phone, required: @material_release.minor?, wrapper_class: "col-sm-6", data: { required_tag: "guardian" } %>
+ <%= form.text_field :guardian_email, required: @material_release.minor?, wrapper_class: "col-sm-6", data: { required_tag: "guardian" } %>
+
+ <%= render "shared/address_fields", form: form, subject: "guardian", required: @material_release.minor?, data: { required_tag: "guardian" } %>
+ <% end %>
+
+
+
+ <%= card_field_set_tag t(".guardian_photo.heading") do %>
+
<%= t ".guardian_photo.instructions" %>
+
+
+
+ <%= t ".photo.no_photo" %>
+
+
+
+ <% if @material_release.guardian_photo.attached? %>
+ <%= javascript_tag nonce: true do %>
+ App.PhotoPreview.set("[data-behavior=guardian-photo-preview]", "<%= url_for(@material_release.guardian_photo.variant(auto_orient: true, resize: '200x200')) %>");
+ <% end %>
+ <% end %>
+
+ <%= form.hidden_field :guardian_photo, value: form.object.guardian_photo.signed_id if @material_release.guardian_photo.attached? %>
+ <%= form.file_field :guardian_photo, required: @material_release.minor?, hide_label: true, data: { ujs_target: "guardian-photo-input" }, accept: @material_release.class.face_photo_acceptable_content_types.join(","), direct_upload: true %>
+
+ <%= button_tag t(".photo.take_photo"), type: "button", class: "btn btn-lg btn-primary take-photo-button", data: { behavior: "trigger-click", target: "[data-ujs-target=guardian-photo-input]" } %>
+
+
+ <%= t ".photo.warning" %>
+
+
+ <% 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" %>
+
+ <%= render "shared/address_fields", form: form, subject: "guardian_2" %>
+ <% end %>
+
+
+
+ <%= card_field_set_tag t(".guardian_2_photo.heading") do %>
+
<%= t ".guardian_2_photo.instructions" %>
+
+
+
+ <%= t ".photo.no_photo" %>
+
+
+
+ <% if @material_release.guardian_2_photo.attached? %>
+ <%= javascript_tag nonce: true do %>
+ App.PhotoPreview.set("[data-behavior=guardian-photo-preview]", "<%= url_for(@material_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 @material_release.guardian_2_photo.attached? %>
+ <%= form.file_field :guardian_2_photo, hide_label: true, data: { ujs_target: "guardian-2-photo-input" }, accept: @material_release.class.face_photo_acceptable_content_types.join(","), direct_upload: true %>
+
+ <%= button_tag t(".photo.take_photo"), type: "button", class: "btn btn-lg btn-primary take-photo-button", data: { behavior: "trigger-click", target: "[data-ujs-target=guardian-2-photo-input]" } %>
+
+
+ <%= t ".photo.warning" %>
+
+
+ <% end %>
+
+
+
+
+ <% end %>
+
<%= card_field_set_tag t(".signature.heading") do %>
<%= render "shared/signature_fields", form: form, instruction: 'For Owner or Authorized Signatory', signature_legal_text: @contract_template.signature_legal_text %>
<% end %>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 7363cdd..2804b53 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -500,6 +500,27 @@ en:
person_first_name: Owner first name
person_last_name: Owner last name
material_release:
+ guardian_2_address_city: Guardian 2 city
+ guardian_2_address_country: Guardian 2 country
+ guardian_2_address_state: Guardian 2 state
+ guardian_2_address_street1: Guardian 2 address
+ guardian_2_address_street2: Guardian 2 address (Line 2)
+ guardian_2_address_zip: Guardian 2 zip code
+ guardian_2_email: Guardian 2 email
+ guardian_2_first_name: Guardian 2 first name
+ guardian_2_last_name: Guardian 2 last name
+ guardian_2_phone: Guardian 2 phone
+ guardian_address_city: Guardian city
+ guardian_address_country: Guardian country
+ guardian_address_state: Guardian state
+ guardian_address_street1: Guardian address
+ guardian_address_street2: Guardian address (Line 2)
+ guardian_address_zip: Guardian zip code
+ guardian_email: Guardian email
+ guardian_first_name: Guardian first name
+ guardian_last_name: Guardian last name
+ guardian_phone: Guardian phone
+ minor: Is the person a minor?
description: Description of licensed material
name: Name of licensed material
person_address: Address
@@ -820,7 +841,15 @@ en:
heading: 3 of 4 Contract & Exploitable Rights
material_details:
heading: 1 of 3 Material Details
+ guardian_2_info:
+ heading: Second Guardian Information (if company requires)
+ guardian_info:
+ heading: Guardian Information
photos:
+ guardian_2_photo:
+ heading: Second Guardian Photo
+ guardian_photo:
+ heading: Guardian Photo
dropzone_label: Tap to take a photo of Licensed Material (optional)
heading: 4 of 4 Photos
signer_details:
@@ -1128,6 +1157,18 @@ en:
create:
notice: Your release has been signed. Thank you!
new:
+ guardian_2_info:
+ heading: Second Guardian Information (if company requires)
+ guardian_2_photo:
+ heading: Second Guardian Photo
+ instructions: >
+ Lastly, it's time for second guardian to take a selfie photo! Please remove your hat and sunglasses (regular eyewear is ok), make sure that you are the only person in the photo, look straight into the camera, and say Cheese!
+ guardian_info:
+ heading: Guardian Information
+ guardian_photo:
+ heading: Guardian Photo
+ instructions: >
+ Lastly, it's time for guardian to take a selfie photo! Please remove your hat and sunglasses (regular eyewear is ok), make sure that you are the only person in the photo, look straight into the camera, and say Cheese!
cancel: Cancel
contact_info:
heading: Licensor/Owner Contact Information
@@ -1135,10 +1176,15 @@ en:
heading: Legal
photo:
heading: Photos
+ no_photo: No photo yet
+ take_photo: Take Photo
+ warning: If your photo appears sideways, it will be autocorrected when you submit your release.
release_info:
heading: Release Information
signature:
heading: Sign Below
+ guardian_clause:
+ heading: Guardian Clause
medical_releases:
create:
notice: Your release has been signed. Thank you!
diff --git a/config/locales/es.yml b/config/locales/es.yml
index a4a4688..d38afc8 100644
--- a/config/locales/es.yml
+++ b/config/locales/es.yml
@@ -250,6 +250,29 @@ es:
person_email: Dirección de correo electrónico
person_name: Nómbre
person_phone: Número de teléfono
+ material_release:
+ guardian_2_address_city: Guardian 2 city (ES)
+ guardian_2_address_country: Guardian 2 country (ES)
+ guardian_2_address_state: Guardian 2 state (ES)
+ guardian_2_address_street1: Guardian 2 address (ES)
+ guardian_2_address_street2: Guardian 2 address (Line 2) (ES)
+ guardian_2_address_zip: Guardian 2 zip code (ES)
+ guardian_2_email: Guardian 2 email (ES)
+ guardian_2_first_name: Guardian 2 first name (ES)
+ guardian_2_last_name: Guardian 2 last name (ES)
+ guardian_2_phone: Guardian 2 phone (ES)
+ guardian_address_city: Guardian city (ES)
+ guardian_address_country: Guardian country (ES)
+ guardian_address_state: Guardian state (ES)
+ guardian_address_street1: Dirección del tutor legal
+ guardian_address_street2: Dirección del tutor legal (Línea 2)
+ guardian_address_zip: Guardian zip code (ES)
+ guardian_email: Guardian email (ES)
+ guardian_first_name: Guardian first name (ES)
+ guardian_last_name: Guardian last name (ES)
+ guardian_name: Nómbre del tutor legal
+ guardian_phone: Número de teléfono del tutor legal
+ minor: El firmante es un menor
medical_release:
guardian_2_address_city: Guardian 2 city (ES)
guardian_2_address_country: Guardian 2 country (ES)
@@ -336,6 +359,8 @@ es:
contract_template:
update: Save changes (ES)
create: 'Crear %{model}'
+ material_release:
+ create: Import Release (ES)
medical_release:
update: Approve (ES)
update: 'Actualizar %{model}'
@@ -356,8 +381,18 @@ es:
amendment_not_signed_tooltip: Amendment not yet signed (ES)
amendment_signed_tooltip: Amendment Signed (ES)
material_releases:
+ create:
+ notice: The acquired media release has been created (ES)
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
+ guardian_photo:
+ heading: Guardian Photo
dropzone_label: Tap to take a photo of Licensed Material (optional) (ES)
index:
table_headers:
@@ -450,8 +485,25 @@ es:
heading: Photos (ES)
material_releases:
new:
+ guardian_2_info:
+ heading: Second Guardian Information (if company requires) [ES]
+ guardian_2_photo:
+ heading: Second Guardian Photo (ES)
+ instructions: >
+ (ES) Lastly, it's time for second guardian to take a selfie photo! Please remove your hat and sunglasses (regular eyewear is ok), make sure that you are the only person in the photo, look straight into the camera, and say Cheese! (ES)
+ guardian_clause:
+ heading: Guardian Clause (ES)
+ guardian_info:
+ heading: Guardian Information (ES)
+ guardian_photo:
+ heading: Guardian Photo (ES)
+ instructions: >
+ (ES) Lastly, it's time for guardian to take a selfie photo! Please remove your hat and sunglasses (regular eyewear is ok), make sure that you are the only person in the photo, look straight into the camera, and say Cheese! (ES)
photo:
heading: Photos (ES)
+ no_photo: No photo yet (ES)
+ take_photo: Take Photo (ES)
+ warning: If your photo appears sideways, it will be autocorrected when you submit your release. (ES)
medical_releases:
new:
guardian_2_info:
diff --git a/db/migrate/20200727143209_add_guardians_fields_to_material_releases.rb b/db/migrate/20200727143209_add_guardians_fields_to_material_releases.rb
new file mode 100644
index 0000000..8a06faf
--- /dev/null
+++ b/db/migrate/20200727143209_add_guardians_fields_to_material_releases.rb
@@ -0,0 +1,25 @@
+class AddGuardiansFieldsToMaterialReleases < ActiveRecord::Migration[6.0]
+ def change
+ add_column :material_releases, :minor, :boolean, default: false
+ add_column :material_releases, :guardian_first_name, :string
+ add_column :material_releases, :guardian_last_name, :string
+ add_column :material_releases, :guardian_email, :string
+ add_column :material_releases, :guardian_phone, :string
+ add_column :material_releases, :guardian_address_street1, :string
+ add_column :material_releases, :guardian_address_street2, :string
+ add_column :material_releases, :guardian_address_city, :string
+ add_column :material_releases, :guardian_address_state, :string
+ add_column :material_releases, :guardian_address_zip, :string
+ add_column :material_releases, :guardian_address_country, :string
+ add_column :material_releases, :guardian_2_first_name, :string
+ add_column :material_releases, :guardian_2_last_name, :string
+ add_column :material_releases, :guardian_2_email, :string
+ add_column :material_releases, :guardian_2_phone, :string
+ add_column :material_releases, :guardian_2_address_street1, :string
+ add_column :material_releases, :guardian_2_address_street2, :string
+ add_column :material_releases, :guardian_2_address_city, :string
+ add_column :material_releases, :guardian_2_address_state, :string
+ add_column :material_releases, :guardian_2_address_zip, :string
+ add_column :material_releases, :guardian_2_address_country, :string
+ end
+end
\ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index 76a20f1..0a15802 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -981,7 +981,28 @@ CREATE TABLE public.material_releases (
person_last_name character varying,
approved_by_user_name text,
approved_by_user_email text,
- approved_at timestamp without time zone
+ approved_at timestamp without time zone,
+ minor boolean DEFAULT false,
+ guardian_first_name character varying,
+ guardian_last_name character varying,
+ guardian_email character varying,
+ guardian_phone character varying,
+ guardian_address_street1 character varying,
+ guardian_address_street2 character varying,
+ guardian_address_city character varying,
+ guardian_address_state character varying,
+ guardian_address_zip character varying,
+ guardian_address_country character varying,
+ guardian_2_first_name character varying,
+ guardian_2_last_name character varying,
+ guardian_2_email character varying,
+ guardian_2_phone character varying,
+ guardian_2_address_street1 character varying,
+ guardian_2_address_street2 character varying,
+ guardian_2_address_city character varying,
+ guardian_2_address_state character varying,
+ guardian_2_address_zip character varying,
+ guardian_2_address_country character varying
);
@@ -3944,6 +3965,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20200716105723'),
('20200720051634'),
('20200720131309'),
-('20200721140821');
+('20200721140821'),
+('20200727143209');
diff --git a/spec/controllers/api/sync_controller_spec.rb b/spec/controllers/api/sync_controller_spec.rb
index f34878a..c070b6e 100644
--- a/spec/controllers/api/sync_controller_spec.rb
+++ b/spec/controllers/api/sync_controller_spec.rb
@@ -94,7 +94,7 @@ RSpec.describe Api::SyncController, type: :controller do
expect(appearance_releases.first).to include('guardian_photo')
expect(talent_releases.first).to include('guardian_photo')
expect(location_releases.first).not_to include('guardian_photo')
- expect(material_releases.first).not_to include('guardian_photo')
+ expect(material_releases.first).to include('guardian_photo')
end
it 'guardian photo has same format as other photos' do
diff --git a/spec/factories/material_releases.rb b/spec/factories/material_releases.rb
index d4ac6d5..164979f 100644
--- a/spec/factories/material_releases.rb
+++ b/spec/factories/material_releases.rb
@@ -15,6 +15,16 @@ FactoryBot.define do
end
end
+ trait :minor do
+ minor true
+ guardian_first_name "Guardian1"
+ guardian_last_name "First"
+ guardian_2_first_name "Guardian2"
+ guardian_2_last_name "Second"
+ guardian_phone "1111"
+ guardian_2_phone "2222"
+ end
+
trait :with_photo do
photos do
path = Rails.root.join("spec", "fixtures", "files", "material_photo.png")
diff --git a/spec/features/user_manages_contract_templates_spec.rb b/spec/features/user_manages_contract_templates_spec.rb
index 48ba336..340663f 100644
--- a/spec/features/user_manages_contract_templates_spec.rb
+++ b/spec/features/user_manages_contract_templates_spec.rb
@@ -178,7 +178,7 @@ RSpec.feature 'User manages contract templates', type: :feature do
expect(content_disposition).to include('inline')
expect(pdf_body).to have_content('PREVIEW ONLY')
expect(pdf_body).to have_content('Material Release')
- expect(pdf_body).not_to have_content('Guardian')
+ expect(pdf_body).to have_content('Guardian')
end
context 'preventing creation of release template with wrong fee value' do
diff --git a/spec/features/user_managing_material_releases_spec.rb b/spec/features/user_managing_material_releases_spec.rb
index ae69e09..b98f5d6 100644
--- a/spec/features/user_managing_material_releases_spec.rb
+++ b/spec/features/user_managing_material_releases_spec.rb
@@ -40,6 +40,93 @@ feature "User managing material releases" do
expect(MaterialRelease.last.photos.attached?).to eq true
end
+ scenario "creating a release for a minor - guardian fields are required when minor checkbox is checked", js: true do
+ contract_template = create(:contract_template, project: project)
+
+ visit new_account_project_contract_template_material_release_path(project.account, project, contract_template)
+
+ all('input[data-required-tag="guardian"]').each do |field|
+ expect(field['required']).to eq 'false'
+ expect(field).not_to be_visible
+ end
+
+ page.check person_is_minor_checkbox
+
+ all('input[data-required-tag="guardian"]').each do |field|
+ expect(field['required']).to eq 'true'
+ expect(field).to be_visible
+ end
+ end
+
+ scenario 'creating a release for a minor', js: true do
+ project = create(:project, members: current_user, account: current_user.primary_account)
+ contract_template = create(:contract_template, project: project)
+
+ visit new_account_project_contract_template_material_release_path(project.account, project, contract_template)
+
+ expect(page).not_to have_content guardian_information_heading.upcase
+ expect(page).not_to have_content guardian_photo_heading.upcase
+
+ page.check person_is_minor_checkbox
+
+ expect(page).to have_content guardian_information_heading.upcase
+ expect(page).to have_content guardian_photo_heading.upcase
+ expect(page).to have_content guardian_email_field.titleize
+
+ fill_all_fields
+
+ fill_in guardian_first_name_field, with: 'Guardian'
+ fill_in guardian_last_name_field, with: 'Name'
+ fill_in guardian_phone_field, with: '001101'
+ fill_in guardian_email_field, with: 'valid@email.com'
+ attach_file guardian_photo_field, file_fixture('hemsworth.jpeg'), visible: :all
+ fill_in_guardian_address_fields
+
+ draw_signature file_fixture("signature.png"), signature_field
+
+ click_button submit_release_button
+
+ expect(page).to have_content(successful_submission_message)
+ end
+
+ scenario 'creating a release for a minor with two guardians', js: true do
+ project = create(:project, members: current_user, account: current_user.primary_account)
+ contract_template = create(:contract_template, project: project)
+
+ visit new_account_project_contract_template_material_release_path(project.account, project, contract_template)
+
+ expect(page).not_to have_content guardian_2_information_heading.upcase
+ expect(page).not_to have_content guardian_2_photo_heading.upcase
+
+ page.check person_is_minor_checkbox
+ expect(page).to have_content guardian_information_heading.upcase
+ expect(page).to have_content guardian_photo_heading.upcase
+ expect(page).to have_content guardian_email_field.titleize
+
+ expect(page).to have_content guardian_2_information_heading.upcase
+ expect(page).to have_content guardian_2_photo_heading.upcase
+ expect(page).to have_content guardian_2_phone_field.titleize
+
+ fill_all_fields
+
+ fill_in guardian_first_name_field, with: 'Guardian'
+ fill_in guardian_last_name_field, with: 'Name'
+ fill_in guardian_phone_field, with: '001101'
+ fill_in guardian_email_field, with: 'valid@email.com'
+ attach_file guardian_photo_field, file_fixture('hemsworth.jpeg'), visible: :all
+ fill_in_guardian_address_fields
+ draw_signature file_fixture("signature.png"), signature_field
+
+ fill_in guardian_2_first_name_field, with: 'Second'
+ fill_in guardian_2_last_name_field, with: 'Guardian'
+ fill_in guardian_2_phone_field, with: '999'
+
+ click_button submit_release_button
+
+ expect(page).to have_content(successful_submission_message)
+ expect(MaterialRelease.last.guardian_2_first_name).to eq 'Second'
+ end
+
scenario "creating release is possible only after filling all fields", js: true do
contract_template = create(:contract_template, project: project)
@@ -98,7 +185,7 @@ feature "User managing material releases" do
sign_in current_user
end
- scenario "creating a release", js: true do
+ scenario "creating a release for and adult", js: true do
visit new_project_material_release_path(project)
by "attaching only a contract" do
@@ -120,13 +207,94 @@ feature "User managing material releases" do
click_button create_release_button
expect(page).to have_content(create_release_notice)
- expect(page).to have_photo("material_photo.png")
+ expect(page).to have_photo("material_photo.png", visible: :all)
click_on "Manage"
expect(page).to have_link("Download")
end
end
+ scenario "creating a release for a minor - guardian fields are required when minor checkbox is checked", js: true do
+ visit new_project_material_release_path(project)
+
+ all('input[data-required-tag="guardian"]').each do |field|
+ expect(field['required']).to eq 'false'
+ expect(field).not_to be_visible
+ end
+
+ page.check person_is_minor_checkbox
+
+ all('input[data-required-tag="guardian"]').each do |field|
+ expect(field['required']).to eq 'true'
+ expect(field).to be_visible
+ end
+ end
+
+ scenario "creating a release for a minor", js: true do
+ visit new_project_material_release_path(project)
+
+ expect(page).not_to have_content guardian_information_heading.upcase
+ expect(page).not_to have_content guardian_photo_heading
+
+ page.check person_is_minor_checkbox
+
+ expect(page).to have_content guardian_information_heading.upcase
+ expect(page).to have_content guardian_photo_heading
+ expect(page).to have_content guardian_email_field.titleize
+
+ fill_in_release_fields name: "Apple Laptop"
+ attach_file contract_field, Rails.root.join(file_fixture("contract.pdf")), visible: false
+
+ fill_in guardian_first_name_field, with: 'Guardian'
+ fill_in guardian_last_name_field, with: 'Name'
+ fill_in guardian_phone_field, with: '001101'
+ fill_in guardian_email_field, with: 'valid@email.com'
+ attach_file guardian_photo_field, file_fixture('hemsworth.jpeg'), visible: :all
+ fill_in_guardian_address_fields
+
+ click_button import_release_button
+
+ expect(page).to have_content successful_import_message
+ expect(MaterialRelease.last.guardian_first_name).to eq 'Guardian'
+ end
+
+ scenario "creating a release for a minor with two guardians", js: true do
+ visit new_project_material_release_path(project)
+
+ expect(page).not_to have_content guardian_2_information_heading.upcase
+ expect(page).not_to have_content guardian_2_photo_heading
+
+ page.check person_is_minor_checkbox
+
+ expect(page).to have_content guardian_information_heading.upcase
+ expect(page).to have_content guardian_photo_heading
+ expect(page).to have_content guardian_email_field.titleize
+
+ expect(page).to have_content guardian_2_information_heading.upcase
+ expect(page).to have_content guardian_2_photo_heading
+ expect(page).to have_content guardian_2_phone_field.titleize
+
+ fill_in_release_fields name: "Apple Laptop"
+ attach_file contract_field, Rails.root.join(file_fixture("contract.pdf")), visible: false
+
+ fill_in guardian_first_name_field, with: 'Guardian'
+ fill_in guardian_last_name_field, with: 'Name'
+ fill_in guardian_phone_field, with: '001101'
+ fill_in guardian_email_field, with: 'valid@email.com'
+ attach_file guardian_photo_field, file_fixture('hemsworth.jpeg'), visible: :all
+ fill_in_guardian_address_fields
+
+ fill_in guardian_2_first_name_field, with: 'Second'
+ fill_in guardian_2_last_name_field, with: 'Guardian'
+ fill_in guardian_2_phone_field, with: '999'
+
+ click_button import_release_button
+
+ expect(page).to have_content successful_import_message
+ expect(MaterialRelease.last.guardian_first_name).to eq 'Guardian'
+ expect(MaterialRelease.last.guardian_2_first_name).to eq 'Second'
+ end
+
scenario "updating an existing release", js: true do
material_release = create(:material_release, :non_native, project: project)
@@ -190,7 +358,7 @@ feature "User managing material releases" do
click_on "Save Changes"
expect(page).to have_content("The release has been updated")
- expect(page).to have_photo("material_photo.png")
+ expect(page).to have_photo("material_photo.png", visible: :all)
end
scenario "viewing the contract PDF" do
@@ -419,8 +587,8 @@ feature "User managing material releases" do
"material_release[person_address_zip]"
end
- def have_photo(filename)
- have_selector("img[src*='#{filename}']")
+ def have_photo(filename, visible: true)
+ have_selector("img[src*='#{filename}']", visible: visible)
end
def import_material_release_link(project)
@@ -542,4 +710,107 @@ feature "User managing material releases" do
def date_issued
t 'contracts.for_office_use_only.description_labels.date_issued'
end
+
+ def person_is_minor_checkbox
+ 'material_release_minor'
+ end
+
+ def guardian_2_first_name_field
+ t 'helpers.label.material_release.guardian_2_first_name'
+ end
+
+ def guardian_2_last_name_field
+ t 'helpers.label.material_release.guardian_2_last_name'
+ end
+
+ def guardian_2_phone_field
+ t 'helpers.label.material_release.guardian_2_phone'
+ end
+
+ def guardian_first_name_field
+ t 'helpers.label.material_release.guardian_first_name'
+ end
+
+ def guardian_last_name_field
+ t 'helpers.label.material_release.guardian_last_name'
+ end
+
+ def guardian_phone_field
+ t 'helpers.label.material_release.guardian_phone'
+ end
+
+ def guardian_email_field
+ t 'helpers.label.material_release.guardian_email'
+ end
+
+ def guardian_address_street1_field
+ t('helpers.label.material_release.guardian_address_street1')
+ end
+
+ def guardian_address_city_field
+ t('helpers.label.material_release.guardian_address_city')
+ end
+
+ def guardian_address_state_field
+ t('helpers.label.material_release.guardian_address_state')
+ end
+
+ def guardian_address_zip_field
+ t('helpers.label.material_release.guardian_address_zip')
+ end
+
+ def guardian_photo_field
+ 'material_release[guardian_photo]'
+ end
+
+ def guardian_2_photo_field
+ 'material_release[guardian_2_photo]'
+ end
+
+ def fill_in_guardian_address_fields
+ fill_in guardian_address_street1_field, with: "124 Test Lane"
+ fill_in guardian_address_city_field, with: "New York"
+ fill_in guardian_address_state_field, with: "NY"
+ fill_in guardian_address_zip_field, with: '1000'
+ end
+
+ def submit_release_button
+ 'I have read and agree to the above'
+ end
+
+ def successful_submission_message
+ 'Your release was successfully submitted. Thank you.'
+ end
+
+ def guardian_information_heading
+ t 'public.material_releases.new.guardian_info.heading'
+ end
+
+ def guardian_photo_heading
+ t 'public.material_releases.new.guardian_photo.heading'
+ end
+
+ def guardian_2_information_heading
+ t 'public.material_releases.new.guardian_2_info.heading'
+ end
+
+ def guardian_2_photo_heading
+ t 'public.material_releases.new.guardian_2_photo.heading'
+ end
+
+ def contract_field
+ 'material_release[contract]'
+ end
+
+ def import_release_button
+ t 'helpers.submit.material_release.create'
+ end
+
+ def successful_import_message
+ t 'material_releases.create.notice'
+ end
+
+ def signature_field
+ 'material_release_signature_base64'
+ end
end