Compare commits
1 Commits
make-quest
...
add-second
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d1320a76d |
@@ -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,
|
||||
|
||||
@@ -17,17 +17,25 @@
|
||||
</div>
|
||||
|
||||
<div class="<%= class_string("collapse" => !appearance_release.minor?) %>" data-ujs-target="guardian-fields">
|
||||
<div class="form-row">
|
||||
<%= 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" %>
|
||||
</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_street1, wrapper_class: "col-sm-6" %>
|
||||
</div>
|
||||
<%= card_field_set_tag t(".guardian_info.heading") do %>
|
||||
<div class="form-row">
|
||||
<%= 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" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= 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" %>
|
||||
<%= form.text_field :guardian_2_address_street1, wrapper_class: "col-sm-6" %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -62,20 +70,36 @@
|
||||
<div class="<%= class_string("collapse" => !appearance_release.minor?) %>" data-ujs-target="guardian-fields">
|
||||
<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 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 %>
|
||||
<div class="d-inline-block">
|
||||
<%= 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(",") %>
|
||||
</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 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 %>
|
||||
<div class="d-inline-block">
|
||||
<%= 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(",") %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user