Compare commits
4 Commits
API-can-fe
...
add-guardi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
867260514e | ||
|
|
a5822a9556 | ||
|
|
96968b2adc | ||
|
|
25c4c73ad5 |
@@ -41,7 +41,7 @@ class Public::AppearanceReleasesController < Public::BaseController
|
||||
|
||||
def appearance_release_params
|
||||
params.require(:appearance_release).permit(:person_address, :person_first_name, :person_last_name, :person_phone, :person_email, :person_photo,
|
||||
:guardian_address, :guardian_first_name, :guardian_last_name, :guardian_phone, :guardian_photo, :minor,
|
||||
:guardian_address, :guardian_first_name, :guardian_last_name, :guardian_phone, :guardian_email, :guardian_photo, :minor,
|
||||
:signature_base64, :person_date_of_birth,
|
||||
:locale, :contract_template,)
|
||||
end
|
||||
|
||||
@@ -39,6 +39,7 @@ class AppearanceRelease < 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, email: true, allow_blank: true
|
||||
end
|
||||
|
||||
validates :person_photo, content_type: face_photo_acceptable_content_types
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
<%= description_list_pair_for releasable, :guardian_name, append: ":" %>
|
||||
<%= description_list_pair_for releasable, :guardian_address, append: ":" %>
|
||||
<%= description_list_pair_for releasable, :guardian_phone, append: ":" %>
|
||||
<%= description_list_pair_for releasable, :guardian_email, append: ":" %>
|
||||
<%= description_list_pair_for releasable, :signed_on, append: ":" %>
|
||||
</dl>
|
||||
|
||||
|
||||
@@ -76,6 +76,9 @@
|
||||
<%= 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" %>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<%= form.text_field :guardian_email, wrapper_class: "col-sm-6" %>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<%= form.text_field :guardian_address, wrapper_class: "col-sm-6" %>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class AddGuardianEmailToAppearanceReleases < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_column :appearance_releases, :guardian_email, :string
|
||||
end
|
||||
end
|
||||
@@ -263,7 +263,10 @@ RSpec.describe AppearanceReleasesController, tye: :controller do
|
||||
end
|
||||
|
||||
def minor_appearance_release_params
|
||||
attributes_for(:appearance_release, :non_native, :minor_with_guardian_photo).except(:contract).merge(contract_param, exploitable_rights_params)
|
||||
attributes_for(:appearance_release, :non_native, :minor_with_guardian_photo)
|
||||
.except(:contract)
|
||||
.except(:guardian_email)
|
||||
.merge(contract_param, exploitable_rights_params)
|
||||
end
|
||||
|
||||
def exploitable_rights_params
|
||||
|
||||
@@ -33,6 +33,7 @@ FactoryBot.define do
|
||||
guardian_last_name "Doe"
|
||||
guardian_address "100 Test Lane, New York, 10001"
|
||||
guardian_phone "123-555-1234"
|
||||
guardian_email "guardian@galaxy.all"
|
||||
end
|
||||
|
||||
trait :minor_with_guardian_photo do
|
||||
@@ -41,6 +42,7 @@ FactoryBot.define do
|
||||
guardian_last_name "Doe"
|
||||
guardian_address "100 Test Lane, New York, 10001"
|
||||
guardian_phone "123-555-1234"
|
||||
guardian_email "guardian@galaxy.all"
|
||||
guardian_photo do
|
||||
path = Rails.root.join("spec", "fixtures", "files", "pratt.jpg")
|
||||
Rack::Test::UploadedFile.new(path, "image/jpeg")
|
||||
|
||||
@@ -25,7 +25,7 @@ feature 'User managing appearance releases' do
|
||||
fill_in person_date_of_birth, with: '01/01/1999'
|
||||
attach_file person_photo_field, file_fixture('person_photo.png'), visible: :all
|
||||
draw_signature file_fixture('signature.png'), 'appearance_release_signature_base64'
|
||||
click_button 'I have read and agree to the above'
|
||||
click_button submit_release_button
|
||||
|
||||
expect(page).to have_content(successful_submission_message)
|
||||
end
|
||||
@@ -45,6 +45,7 @@ feature 'User managing appearance releases' do
|
||||
page.check person_is_minor_checkbox
|
||||
expect(page).to have_content('GUARDIAN INFORMATION')
|
||||
expect(page).to have_content('GUARDIAN PHOTO')
|
||||
expect(page).to have_content 'Guardian Email'
|
||||
|
||||
fill_in guardian_first_name_field, with: 'Guardian'
|
||||
fill_in guardian_last_name_field, with: 'Name'
|
||||
@@ -58,7 +59,14 @@ feature 'User managing appearance releases' do
|
||||
attach_file person_photo_field, file_fixture('person_photo.png'), visible: :all
|
||||
attach_file guardian_photo_field, file_fixture('hemsworth.jpeg'), visible: :all
|
||||
draw_signature file_fixture('signature.png'), 'appearance_release_signature_base64'
|
||||
click_button 'I have read and agree to the above'
|
||||
|
||||
fill_in guardian_email_field, with: 'invalid@email'
|
||||
click_button submit_release_button
|
||||
expect(page).to have_content('Guardian email is not an email')
|
||||
|
||||
fill_in guardian_email_field, with: 'valid@email.com'
|
||||
draw_signature file_fixture('signature.png'), 'appearance_release_signature_base64'
|
||||
click_button submit_release_button
|
||||
|
||||
expect(page).to have_content(successful_submission_message)
|
||||
end
|
||||
@@ -249,6 +257,7 @@ feature 'User managing appearance releases' do
|
||||
expect(pdf_body).to have_content('TAGS')
|
||||
expect(pdf_body).to have_content('Woman')
|
||||
expect(pdf_body).to have_content('Brunette')
|
||||
expect(pdf_body).not_to have_content('Guardian Email')
|
||||
end
|
||||
|
||||
scenario 'viewing contract PDF for a minor without guardian photo' do
|
||||
@@ -262,8 +271,10 @@ feature 'User managing appearance releases' do
|
||||
expect(pdf_filename).to include(appearance_release.filename_suffix.parameterize)
|
||||
expect(pdf_body).to have_content(appearance_release.name)
|
||||
expect(pdf_body).to have_content(appearance_release.guardian_name)
|
||||
expect(pdf_body).to have_content(appearance_release.guardian_email)
|
||||
expect(pdf_body).to have_content photos_heading.upcase
|
||||
expect(pdf_body).to have_content(appearance_release.photo.filename.to_s)
|
||||
expect(pdf_body).to have_content('Guardian Email')
|
||||
end
|
||||
|
||||
scenario 'viewing contract PDF for a minor with guardian photo' do
|
||||
@@ -277,9 +288,11 @@ feature 'User managing appearance releases' do
|
||||
expect(pdf_filename).to include(appearance_release.filename_suffix.parameterize)
|
||||
expect(pdf_body).to have_content(appearance_release.name)
|
||||
expect(pdf_body).to have_content(appearance_release.guardian_name)
|
||||
expect(pdf_body).to have_content(appearance_release.guardian_email)
|
||||
expect(pdf_body).to have_content photos_heading(2).upcase
|
||||
expect(pdf_body).to have_content(appearance_release.photo.filename.to_s)
|
||||
expect(pdf_body).to have_content(appearance_release.guardian_photo.filename.to_s)
|
||||
expect(pdf_body).to have_content('Guardian Email')
|
||||
end
|
||||
|
||||
scenario 'deleting a release', js: true do
|
||||
@@ -470,6 +483,10 @@ feature 'User managing appearance releases' do
|
||||
'Guardian phone'
|
||||
end
|
||||
|
||||
def guardian_email_field
|
||||
'Guardian email'
|
||||
end
|
||||
|
||||
def guardian_photo_field
|
||||
'appearance_release[guardian_photo]'
|
||||
end
|
||||
@@ -518,6 +535,10 @@ feature 'User managing appearance releases' do
|
||||
'Import Release'
|
||||
end
|
||||
|
||||
def submit_release_button
|
||||
'I have read and agree to the above'
|
||||
end
|
||||
|
||||
def submit_update_button
|
||||
'Save Changes'
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user