Compare commits
2 Commits
master
...
add-second
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
812dd955bd | ||
|
|
181be3fc1d |
@@ -45,42 +45,59 @@ class Public::TalentReleasesController < Public::BaseController
|
||||
.permit(
|
||||
person_params,
|
||||
guardian_params,
|
||||
second_guardian_params,
|
||||
:signature_base64,
|
||||
:locale,
|
||||
:contract_template,
|
||||
photos: [],
|
||||
photos: []
|
||||
)
|
||||
end
|
||||
|
||||
def person_params
|
||||
[
|
||||
: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,
|
||||
%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
|
||||
[
|
||||
: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,
|
||||
%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
|
||||
|
||||
|
||||
@@ -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 = {})
|
||||
|
||||
@@ -11,7 +11,9 @@ class TalentRelease < ApplicationRecord
|
||||
include Taggable
|
||||
include PersonName
|
||||
include GuardianPhotoable
|
||||
include SecondGuardianPhotoable
|
||||
include GuardianName
|
||||
include SecondGuardianName
|
||||
|
||||
composed_of :person_address,
|
||||
class_name: "Address",
|
||||
@@ -35,6 +37,17 @@ class TalentRelease < ApplicationRecord
|
||||
%w(guardian_address_country country)
|
||||
]
|
||||
|
||||
composed_of :guardian_2_address,
|
||||
class_name: "Address",
|
||||
mapping: [
|
||||
%w(guardian_2_address_street1 street1),
|
||||
%w(guardian_2_address_street2 street2),
|
||||
%w(guardian_2_address_city city),
|
||||
%w(guardian_2_address_state state),
|
||||
%w(guardian_2_address_zip zip),
|
||||
%w(guardian_2_address_country country)
|
||||
]
|
||||
|
||||
def self.face_photo_acceptable_content_types
|
||||
["image/png", "image/jpeg"]
|
||||
end
|
||||
@@ -58,6 +71,7 @@ class TalentRelease < ApplicationRecord
|
||||
# These validations apply to releases being signed by a minor
|
||||
with_options if: :minor? do
|
||||
validates :guardian_first_name, :guardian_last_name, presence: true
|
||||
validates :guardian_email, :guardian_2_email, email: true, allow_blank: true
|
||||
validates :guardian_phone, presence: true
|
||||
end
|
||||
|
||||
@@ -84,6 +98,10 @@ class TalentRelease < ApplicationRecord
|
||||
false
|
||||
end
|
||||
|
||||
def second_guardian_present?
|
||||
guardian_2_first_name.present?
|
||||
end
|
||||
|
||||
def contract_file_name
|
||||
"#{project.name.parameterize}_#{contract_template.release_type}_#{(signed_at || created_at).strftime("%Y.%m.%d")}_#{release_number}_#{filename_suffix.parameterize}"
|
||||
end
|
||||
|
||||
@@ -31,8 +31,6 @@
|
||||
<%= form.text_field :person_first_name, required: true, wrapper_class: "col-sm-6" %>
|
||||
<%= form.text_field :person_last_name, required: true, 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" %>
|
||||
</div>
|
||||
<%= render "shared/address_fields", form: form, subject: "person" %>
|
||||
@@ -51,8 +49,6 @@
|
||||
<%= 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" %>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<%= form.text_field :guardian_email, wrapper_class: "col-sm-6" %>
|
||||
</div>
|
||||
<%= render "shared/address_fields", form: form, subject: "guardian" %>
|
||||
@@ -87,6 +83,48 @@
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<hr>
|
||||
|
||||
<%= card_field_set_tag t(".guardian_2_info.heading") do %>
|
||||
<div class="form-row">
|
||||
<%= 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" %>
|
||||
</div>
|
||||
<%= render "shared/address_fields", form: form, subject: "guardian_2" %>
|
||||
<% end %>
|
||||
|
||||
<hr>
|
||||
|
||||
<%= card_field_set_tag t(".guardian_2_photo.heading") do %>
|
||||
<div class="alert alert-warning font-weight-bold"><%= t ".guardian_2_photo.instructions" %></div>
|
||||
<div class="text-center">
|
||||
<div 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><%= t ".guardian_2_photo.no_photo" %></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-inline-block text-left">
|
||||
<% if @talent_release.guardian_2_photo.attached? %>
|
||||
<%= javascript_tag nonce: true do %>
|
||||
App.PhotoPreview.set("[data-behavior=guardian-photo-preview]", "<%= url_for(@talent_release.guardian_2_photo.variant(auto_orient: true, resize: '200x200')) %>");
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div class="hidden-file-input">
|
||||
<%= 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" }, accept: @talent_release.class.face_photo_acceptable_content_types.join(","), direct_upload: true %>
|
||||
</div>
|
||||
<%= button_tag t(".guardian_2_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]" } %>
|
||||
</div>
|
||||
<p class="p-2 font-weight-bold">
|
||||
<%= fa_icon "arrow-up", text: t(".guardian_2_photo.camera_instructions_html") %><br>
|
||||
<small class="text-muted"><%= t ".guardian_2_photo.warning" %></small>
|
||||
</p>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<hr>
|
||||
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
@@ -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" %>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<%= form.email_field :person_email, wrapper_class: "col-sm-6" %>
|
||||
</div>
|
||||
<%= render "shared/address_fields", form: form, subject: "person" %>
|
||||
|
||||
<div class="<%= class_string("collapse" => !talent_release.minor?) %>" data-ujs-target="guardian-fields">
|
||||
<div class="form-row">
|
||||
<%= 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" %>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<%= form.text_field :guardian_email, wrapper_class: "col-sm-6" %>
|
||||
</div>
|
||||
<%= render "shared/address_fields", form: form, subject: "guardian" %>
|
||||
<%= card_field_set_tag t(".guardian_info.heading") do %>
|
||||
<div class="form-row">
|
||||
<%= 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" %>
|
||||
</div>
|
||||
<%= 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>
|
||||
<% end %>
|
||||
|
||||
@@ -44,20 +52,36 @@
|
||||
<br>
|
||||
<div class="text-left">
|
||||
<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">
|
||||
<span>No photo yet</span>
|
||||
</div>
|
||||
</div>
|
||||
<% 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 %>
|
||||
<div class="d-inline-block">
|
||||
<%= 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(",") %>
|
||||
</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>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
@@ -458,6 +458,16 @@ en:
|
||||
project:
|
||||
predefined_client_name: Client
|
||||
talent_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: City
|
||||
guardian_address_country: Guardian country
|
||||
guardian_address_state: State
|
||||
@@ -1011,6 +1021,16 @@ en:
|
||||
notice: Your release has been signed. Thank you!
|
||||
new:
|
||||
cancel: Cancel
|
||||
guardian_2_info:
|
||||
heading: Second Guardian Information (if company requires)
|
||||
guardian_2_photo:
|
||||
camera_instructions_html: Click <em>Take Photo</em> to Turn ON Camera
|
||||
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!
|
||||
no_photo: No photo yet
|
||||
take_photo: Take Photo
|
||||
warning: If your photo appears sideways, it will be autocorrected when you submit your release.
|
||||
guardian_clause:
|
||||
heading: Guardian Clause
|
||||
guardian_info:
|
||||
@@ -1111,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
|
||||
|
||||
@@ -194,6 +194,36 @@ es:
|
||||
name: Nómbre del proyecto de vídeo
|
||||
producer_address: Dirección del productor
|
||||
producer_name: Nómbre del productor
|
||||
talen_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: City (ES)
|
||||
guardian_address_country: Guardian country (ES)
|
||||
guardian_address_state: State (ES)
|
||||
guardian_address_street1: Guardian address (ES)
|
||||
guardian_address_street2: Guardian address (Line 2) (ES)
|
||||
guardian_address_zip: Zip code (ES)
|
||||
guardian_email: Guardian email address (ES)
|
||||
guardian_name: Guardian name (ES)
|
||||
guardian_phone: Guardian phone number (ES)
|
||||
minor: Is the person a minor? (ES)
|
||||
person_address_city: City (ES)
|
||||
person_address_country: Country (ES)
|
||||
person_address_state: State (ES)
|
||||
person_address_street1: Address (ES)
|
||||
person_address_street2: Address (Line 2) (ES)
|
||||
person_address_zip: Zip code (ES)
|
||||
person_email: Email address (ES)
|
||||
person_name: Name (ES)
|
||||
person_phone: Phone number (ES)
|
||||
placeholder:
|
||||
appearance_release:
|
||||
person_address: Calle, Número de apartamento, Ciudad, Estado, Código Postal
|
||||
@@ -281,8 +311,19 @@ es:
|
||||
warning: Si su foto aparece de lado, se corregirá automáticamente cuando actualizar la autorización
|
||||
talent_releases:
|
||||
new:
|
||||
guardian_2_info:
|
||||
heading: Second Guardian Information (if company requires) (ES)
|
||||
guardian_2_photo:
|
||||
camera_instructions_html: ""
|
||||
heading: Second Guardian Photo (ES)
|
||||
instructions: ""
|
||||
no_photo: ""
|
||||
take_photo: ""
|
||||
warning: ""
|
||||
guardian_clause:
|
||||
heading: Guardian Clause (ES)
|
||||
guardian_info:
|
||||
heading: ""
|
||||
guardian_photo:
|
||||
camera_instructions_html: (ES) Click <em>Take Photo</em> to Turn ON Camera (ES)
|
||||
heading: Guardian Photo (ES)
|
||||
@@ -290,6 +331,8 @@ es:
|
||||
no_photo: No hay foto todavía
|
||||
take_photo: Take Photo (ES)
|
||||
warning: (ES) If your photo appears sideways, it will be autocorrected when you submit your release. (ES)
|
||||
photo:
|
||||
heading: Photos (ES)
|
||||
teams:
|
||||
show:
|
||||
choose_project: ¿Qué proyecto de la lista de abajo asistirá?
|
||||
@@ -298,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)
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
class AddSecondGuardianFieldsToTalentReleases < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_column :talent_releases, :guardian_2_first_name, :string
|
||||
add_column :talent_releases, :guardian_2_last_name, :string
|
||||
add_column :talent_releases, :guardian_2_email, :string
|
||||
add_column :talent_releases, :guardian_2_phone, :string
|
||||
add_column :talent_releases, :guardian_2_address_street1, :string
|
||||
add_column :talent_releases, :guardian_2_address_street2, :string
|
||||
add_column :talent_releases, :guardian_2_address_city, :string
|
||||
add_column :talent_releases, :guardian_2_address_state, :string
|
||||
add_column :talent_releases, :guardian_2_address_zip, :string
|
||||
add_column :talent_releases, :guardian_2_address_country, :string
|
||||
end
|
||||
end
|
||||
@@ -1503,7 +1503,17 @@ CREATE TABLE public.talent_releases (
|
||||
person_first_name character varying,
|
||||
person_last_name character varying,
|
||||
guardian_first_name character varying,
|
||||
guardian_last_name character varying
|
||||
guardian_last_name 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
|
||||
);
|
||||
|
||||
|
||||
@@ -3812,6 +3822,7 @@ INSERT INTO "schema_migrations" (version) VALUES
|
||||
('20200619081446'),
|
||||
('20200619085823'),
|
||||
('20200619134853'),
|
||||
('20200622180507');
|
||||
('20200622180507'),
|
||||
('20200625144713');
|
||||
|
||||
|
||||
|
||||
@@ -62,6 +62,47 @@ feature "User managing talent releases" do
|
||||
|
||||
expect(page).to have_content("Your release was successfully submitted. Thank you.")
|
||||
end
|
||||
|
||||
scenario "creating a release for a minor with two guardians", js: true do
|
||||
contract_template = create(:contract_template, project: project)
|
||||
|
||||
visit new_account_project_contract_template_talent_release_path(project.account, project, contract_template)
|
||||
|
||||
expect(page).not_to have_content guardian_information_heading.upcase
|
||||
expect(page).not_to have_content guardian_2_information_heading.upcase
|
||||
expect(page).not_to have_content guardian_photo_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_2_information_heading.upcase
|
||||
expect(page).to have_content guardian_photo_heading.upcase
|
||||
expect(page).to have_content guardian_2_photo_heading.upcase
|
||||
|
||||
fill_in person_first_name_field, with: "Jane"
|
||||
fill_in person_last_name_field, with: "Doe"
|
||||
fill_in person_address_field, with: "123 Test Lane, New York, NY 10000"
|
||||
fill_in person_phone_field, with: "555-555-5555"
|
||||
fill_in person_email_field, with: "jane.doe@test.com"
|
||||
|
||||
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_2_first_name_field, with: "Second"
|
||||
fill_in guardian_2_last_name_field, with: "Guardian"
|
||||
|
||||
drop_file Rails.root.join(file_fixture("person_photo.png")), type: :dropzone
|
||||
attach_file guardian_photo_field, file_fixture("hemsworth.jpeg"), visible: :all
|
||||
attach_file guardian_2_photo_field, file_fixture("person_photo.png"), visible: :all
|
||||
draw_signature file_fixture("signature.png"), "talent_release_signature_base64"
|
||||
|
||||
click_button submit_button
|
||||
|
||||
expect(page).to have_content success_submit_message
|
||||
expect(TalentRelease.last.guardian_2_photo.attached?).to eq true
|
||||
expect(TalentRelease.last.guardian_2_name).to eq "Second Guardian"
|
||||
end
|
||||
end
|
||||
|
||||
context "when signed in" do
|
||||
@@ -125,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)
|
||||
|
||||
@@ -301,6 +379,14 @@ feature "User managing talent releases" do
|
||||
"Guardian last name"
|
||||
end
|
||||
|
||||
def guardian_2_first_name_field
|
||||
"talent_release[guardian_2_first_name]"
|
||||
end
|
||||
|
||||
def guardian_2_last_name_field
|
||||
"talent_release[guardian_2_last_name]"
|
||||
end
|
||||
|
||||
def guardian_phone_field
|
||||
"Guardian phone"
|
||||
end
|
||||
@@ -309,6 +395,10 @@ feature "User managing talent releases" do
|
||||
"talent_release[guardian_photo]"
|
||||
end
|
||||
|
||||
def guardian_2_photo_field
|
||||
"talent_release[guardian_2_photo]"
|
||||
end
|
||||
|
||||
def have_photo_button
|
||||
have_selector(".take-photo-button")
|
||||
end
|
||||
@@ -387,4 +477,32 @@ feature "User managing talent releases" do
|
||||
select "Other", from: "Restriction"
|
||||
fill_in "Describe other restrictions", with: "Test"
|
||||
end
|
||||
|
||||
def guardian_information_heading
|
||||
t 'public.talent_releases.new.guardian_info.heading'
|
||||
end
|
||||
|
||||
def guardian_2_information_heading
|
||||
t 'public.talent_releases.new.guardian_2_info.heading'
|
||||
end
|
||||
|
||||
def guardian_photo_heading
|
||||
t 'public.talent_releases.new.guardian_photo.heading'
|
||||
end
|
||||
|
||||
def guardian_2_photo_heading
|
||||
t 'public.talent_releases.new.guardian_2_photo.heading'
|
||||
end
|
||||
|
||||
def submit_button
|
||||
t 'shared.submit_release_long'
|
||||
end
|
||||
|
||||
def success_submit_message
|
||||
"Your release was successfully submitted. Thank you."
|
||||
end
|
||||
|
||||
def contract_field
|
||||
"talent_release[contract]"
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user