Compare commits

..

2 Commits

Author SHA1 Message Date
bilal
b6cd775068 change submit button copy for medical release 2020-06-12 16:39:18 +02:00
Senad Uka
fbf3173747 Upstream sync 2020-06-12 16:38:59 +02:00
19 changed files with 127 additions and 62 deletions

View File

@@ -1,11 +1,16 @@
$(document).on("change", "[data-toggle=collapse-select]", function(event) { $(document).on("change", "[data-toggle=collapse-select]", function(event) {
const select = event.target; const select = event.target;
const target = select.dataset.target; const mappings = JSON.parse(select.dataset.targetShowValuesMapping);
const showValues = JSON.parse(select.dataset.showValues);
$.each(mappings, function( key, value ) {
if (showValues.indexOf(select.value) > -1) { if (value.indexOf(select.value) > -1) {
$(target).show("fast"); $(key).show("fast");
} else { } else {
$(target).hide("fast"); $(key).hide("fast");
} }
});
}); });
$(document).on("turbolinks:load", function() {
$("[data-toggle=collapse-select]").trigger("change");
});

View File

@@ -61,7 +61,12 @@ class ContractTemplatesController < ApplicationController
:applicable_medium_id, :applicable_medium_text, :applicable_medium_id, :applicable_medium_text,
:territory_id, :territory_text, :territory_id, :territory_text,
:term_id, :term_text, :term_id, :term_text,
:restriction_id, :restriction_text) :restriction_id, :restriction_text,
:question_1_text, :question_2_text,
:question_3_text, :question_4_text,
:question_5_text, :question_6_text,
:question_7_text, :question_8_text,
:question_9_text, :question_10_text)
end end
def download_attributes def download_attributes

View File

@@ -41,7 +41,7 @@ class Public::AppearanceReleasesController < Public::BaseController
def appearance_release_params def appearance_release_params
params.require(:appearance_release).permit(:person_address, :person_first_name, :person_last_name, :person_phone, :person_email, :person_photo, 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_email, :guardian_photo, :minor, :guardian_address, :guardian_first_name, :guardian_last_name, :guardian_phone, :guardian_photo, :minor,
:signature_base64, :person_date_of_birth, :signature_base64, :person_date_of_birth,
:locale, :contract_template,) :locale, :contract_template,)
end end

View File

@@ -48,6 +48,11 @@ class Public::MedicalReleasesController < Public::BaseController
:signature_base64, :signature_base64,
:locale, :locale,
:contract_template, :contract_template,
:question_1_answer, :question_2_answer,
:question_3_answer, :question_4_answer,
:question_5_answer, :question_6_answer,
:question_7_answer, :question_8_answer,
:question_9_answer, :question_10_answer,
photos: [], photos: [],
) )
end end

View File

@@ -39,7 +39,6 @@ class AppearanceRelease < ApplicationRecord
# These validations apply to releases being signed by a minor # These validations apply to releases being signed by a minor
with_options if: :minor? do with_options if: :minor? do
validates :guardian_first_name, :guardian_last_name, presence: true validates :guardian_first_name, :guardian_last_name, presence: true
validates :guardian_email, email: true, allow_blank: true
end end
validates :person_photo, content_type: face_photo_acceptable_content_types validates :person_photo, content_type: face_photo_acceptable_content_types

View File

@@ -2,20 +2,24 @@
<%= field_set_tag content_tag(:span, t(".release_info.heading"), class: "h6 text-muted text-uppercase") do %> <%= field_set_tag content_tag(:span, t(".release_info.heading"), class: "h6 text-muted text-uppercase") do %>
<div class="form-row"> <div class="form-row">
<%= form.text_field :name, wrapper_class: "col-sm-6" %> <%= form.text_field :name, wrapper_class: "col-sm-6" %>
<%= form.select :release_type, options_for_release_type_select(project, @release_type), { wrapper_class: "col-sm-6" }, data: { toggle: "collapse-select", target: "#guardian_clause", show_values: %w(appearance talent) }, class: "form-control custom-select" %> <%= form.select :release_type, options_for_release_type_select(project, @release_type), { wrapper_class: "col-sm-6" }, data: { toggle: "collapse-select", target_show_values_mapping: { "#guardian_clause": %w(appearance talent), "#fee_field": %w(appearance talent location material acquired_media), "#exploitable_rights_fields": %w(appearance talent location material acquired_media), "#custom_fields": %w(medical) } }, class: "form-control custom-select" %>
</div> </div>
<div class="form-row"> <div class="form-row" id="fee_field">
<%= form.number_field :fee, min:"0", max:"99999999", step: "0.01", prepend: "$", help: "Leave at $0.00 for no-fee", wrapper_class: "col-sm-6" %> <%= form.number_field :fee, min:"0", max:"99999999", step: "0.01", prepend: "$", help: "Leave at $0.00 for no-fee", wrapper_class: "col-sm-6" %>
</div> </div>
<% end %> <% end %>
<hr> <hr>
<%= field_set_tag content_tag(:span, t(".exploitable_rights.heading"), class: "h6 text-muted text-uppercase")do %> <%= field_set_tag content_tag(:span, t(".exploitable_rights.heading"), class: "h6 text-muted text-uppercase"), id: "exploitable_rights_fields" do %>
<%= render "shared/exploitable_rights_fields", form: form %> <%= render "shared/exploitable_rights_fields", form: form %>
<hr>
<% end %>
<%= field_set_tag content_tag(:span, t(".custom_fields.heading"), class: "h6 text-muted text-uppercase"), id: "custom_fields", style: "display: none;" do %>
<%= render "shared/custom_fields", form: form %>
<hr>
<% end %> <% end %>
<hr>
<%= field_set_tag content_tag(:span, t(".legal.heading"), class: "h6 text-muted text-uppercase") do %> <%= field_set_tag content_tag(:span, t(".legal.heading"), class: "h6 text-muted text-uppercase") do %>
<%= form.form_group do %> <%= form.form_group do %>

View File

@@ -39,6 +39,15 @@
<% end %> <% end %>
</dl> </dl>
<% if releasable.model_name == "MedicalRelease" %>
<% (1..10).each do |n| %>
<% if contract_template.public_send("question_#{n}_text").present? %>
<p><strong><%= contract_template.public_send("question_#{n}_text") %></strong></p>
<p><%= releasable.public_send("question_#{n}_answer") %></p>
<% end %>
<% end %>
<% end %>
<% if releasable.minor? %> <% if releasable.minor? %>
<br/> <br/>
<p class="text-left"><strong>Guardian Information</strong></p> <p class="text-left"><strong>Guardian Information</strong></p>
@@ -56,7 +65,6 @@
<%= description_list_pair_for releasable, :guardian_name, append: ":" %> <%= description_list_pair_for releasable, :guardian_name, append: ":" %>
<%= description_list_pair_for releasable, :guardian_address, append: ":" %> <%= description_list_pair_for releasable, :guardian_address, append: ":" %>
<%= description_list_pair_for releasable, :guardian_phone, 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: ":" %> <%= description_list_pair_for releasable, :signed_on, append: ":" %>
</dl> </dl>

View File

@@ -1,6 +1,6 @@
<%= bootstrap_form_with model: project, local: true do |form| %> <%= bootstrap_form_with model: project, local: true do |form| %>
<%= form.text_field :name %> <%= form.text_field :name %>
<%= form.select :predefined_client_name, options_for_select(options_for_predefined_client_name_select, selected_project_client_value(project)), {}, data: { toggle: "collapse-select", target: "#other_client", show_values: [:other] }, class: "form-control custom-select" %> <%= form.select :predefined_client_name, options_for_select(options_for_predefined_client_name_select, selected_project_client_value(project)), {}, data: { toggle: "collapse-select", target_show_values_mapping: { "#other_client": [:other] } }, class: "form-control custom-select" %>
<div id="other_client" style="<%='display: none' if selected_project_client_value(project) != 'other'%>"> <div id="other_client" style="<%='display: none' if selected_project_client_value(project) != 'other'%>">
<%= form.text_field :client_name, placeholder: true %> <%= form.text_field :client_name, placeholder: true %>
<%= form.form_group do %> <%= form.form_group do %>

View File

@@ -76,9 +76,6 @@
<%= form.text_field :guardian_last_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.phone_field :guardian_phone, wrapper_class: "col-sm-6" %>
</div> </div>
<div class="form-row">
<%= form.text_field :guardian_email, wrapper_class: "col-sm-6" %>
</div>
<div class="form-row"> <div class="form-row">
<%= form.text_field :guardian_address, wrapper_class: "col-sm-6" %> <%= form.text_field :guardian_address, wrapper_class: "col-sm-6" %>
</div> </div>

View File

@@ -13,6 +13,19 @@
<% end %> <% end %>
<hr> <hr>
<% if (1..10).map {|n| @contract_template.public_send("question_#{n}_text").presence }.compact.any? %>
<%= card_field_set_tag t(".questionnaire.heading") do %>
<% (1..10).each do |n| %>
<% if @contract_template.public_send("question_#{n}_text").present? %>
<div class="form-row">
<%= form.text_area "question_#{n}_answer", wrapper_class: "col-sm-12", label: @contract_template.public_send("question_#{n}_text") %>
</div>
<% end %>
<% end %>
<% end %>
<hr>
<% end %>
<%= card_field_set_tag t(".personal_info.heading") do %> <%= card_field_set_tag t(".personal_info.heading") do %>
<div class="alert alert-warning font-weight-bold"><%= t ".personal_info.instructions" %></div> <div class="alert alert-warning font-weight-bold"><%= t ".personal_info.instructions" %></div>
@@ -36,7 +49,7 @@
<% end %> <% end %>
<div class="mt-5"> <div class="mt-5">
<%= form.button t("shared.submit_release_long"), class: "btn btn-block btn-lg btn-success", data: { disable_with: t("shared.disable_with") } %> <%= form.button t("shared.submit_release_short"), class: "btn btn-block btn-lg btn-success", data: { disable_with: t("shared.disable_with") } %>
</div> </div>
<% end %> <% end %>
</div> </div>

View File

@@ -0,0 +1,5 @@
<% (1..10).each do |n| %>
<div class="form-row">
<%= form.text_area "question_#{n}_text", wrapper_class: "col-sm-12" %>
</div>
<% end%>

View File

@@ -212,12 +212,14 @@ en:
archived_failure: Failed to archive the release template archived_failure: Failed to archive the release template
archived_notice: The release template has been archived archived_notice: The release template has been archived
form: form:
custom_fields:
heading: Custom Fields
exploitable_rights: exploitable_rights:
heading: 2 of 3 Exploitable Rights heading: Exploitable Rights
legal: legal:
heading: 3 of 3 Legal heading: Legal
release_info: release_info:
heading: 1 of 3 Release Info heading: Release Info
index: index:
actions: actions:
import: Import Release Template import: Import Release Template
@@ -851,6 +853,8 @@ en:
instructions: Now, enter your personal information. instructions: Now, enter your personal information.
photo: photo:
heading: Photos heading: Photos
questionnaire:
heading: Questionnaire
signature: signature:
heading: Signature heading: Signature
talent_releases: talent_releases:
@@ -940,6 +944,7 @@ en:
search: Search search: Search
submit_release: Submit Release submit_release: Submit Release
submit_release_long: I have read and agree to the above submit_release_long: I have read and agree to the above
submit_release_short: Submit
suite: Suite suite: Suite
tag_multiple_releases: Add Tag tag_multiple_releases: Add Tag
tag_multiple_releases_form: tag_multiple_releases_form:

View File

@@ -0,0 +1,14 @@
class AddQuestionFieldsToContractTemplates < ActiveRecord::Migration[6.0]
def change
add_column :contract_templates, :question_1_text, :text
add_column :contract_templates, :question_2_text, :text
add_column :contract_templates, :question_3_text, :text
add_column :contract_templates, :question_4_text, :text
add_column :contract_templates, :question_5_text, :text
add_column :contract_templates, :question_6_text, :text
add_column :contract_templates, :question_7_text, :text
add_column :contract_templates, :question_8_text, :text
add_column :contract_templates, :question_9_text, :text
add_column :contract_templates, :question_10_text, :text
end
end

View File

@@ -0,0 +1,14 @@
class AddAnswerFieldsToMedicalReleases < ActiveRecord::Migration[6.0]
def change
add_column :medical_releases, :question_1_answer, :text
add_column :medical_releases, :question_2_answer, :text
add_column :medical_releases, :question_3_answer, :text
add_column :medical_releases, :question_4_answer, :text
add_column :medical_releases, :question_5_answer, :text
add_column :medical_releases, :question_6_answer, :text
add_column :medical_releases, :question_7_answer, :text
add_column :medical_releases, :question_8_answer, :text
add_column :medical_releases, :question_9_answer, :text
add_column :medical_releases, :question_10_answer, :text
end
end

View File

@@ -1,5 +0,0 @@
class AddGuardianEmailToAppearanceReleases < ActiveRecord::Migration[6.0]
def change
add_column :appearance_releases, :guardian_email, :string
end
end

View File

@@ -606,7 +606,17 @@ CREATE TABLE public.contract_templates (
term_text character varying, term_text character varying,
restriction_id bigint, restriction_id bigint,
restriction_text character varying, restriction_text character varying,
archived_at timestamp without time zone archived_at timestamp without time zone,
question_1_text text,
question_2_text text,
question_3_text text,
question_4_text text,
question_5_text text,
question_6_text text,
question_7_text text,
question_8_text text,
question_9_text text,
question_10_text text
); );
@@ -955,7 +965,17 @@ CREATE TABLE public.medical_releases (
notes text, notes text,
signed_at timestamp without time zone, signed_at timestamp without time zone,
created_at timestamp(6) without time zone NOT NULL, created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL updated_at timestamp(6) without time zone NOT NULL,
question_1_answer text,
question_2_answer text,
question_3_answer text,
question_4_answer text,
question_5_answer text,
question_6_answer text,
question_7_answer text,
question_8_answer text,
question_9_answer text,
question_10_answer text
); );
@@ -3595,6 +3615,8 @@ INSERT INTO "schema_migrations" (version) VALUES
('20200512161738'), ('20200512161738'),
('20200526113516'), ('20200526113516'),
('20200603090419'), ('20200603090419'),
('20200606044747'); ('20200606044747'),
('20200610085411'),
('20200610140459');

View File

@@ -263,10 +263,7 @@ RSpec.describe AppearanceReleasesController, tye: :controller do
end end
def minor_appearance_release_params def minor_appearance_release_params
attributes_for(:appearance_release, :non_native, :minor_with_guardian_photo) attributes_for(:appearance_release, :non_native, :minor_with_guardian_photo).except(:contract).merge(contract_param, exploitable_rights_params)
.except(:contract)
.except(:guardian_email)
.merge(contract_param, exploitable_rights_params)
end end
def exploitable_rights_params def exploitable_rights_params

View File

@@ -33,7 +33,6 @@ FactoryBot.define do
guardian_last_name "Doe" guardian_last_name "Doe"
guardian_address "100 Test Lane, New York, 10001" guardian_address "100 Test Lane, New York, 10001"
guardian_phone "123-555-1234" guardian_phone "123-555-1234"
guardian_email "guardian@galaxy.all"
end end
trait :minor_with_guardian_photo do trait :minor_with_guardian_photo do
@@ -42,7 +41,6 @@ FactoryBot.define do
guardian_last_name "Doe" guardian_last_name "Doe"
guardian_address "100 Test Lane, New York, 10001" guardian_address "100 Test Lane, New York, 10001"
guardian_phone "123-555-1234" guardian_phone "123-555-1234"
guardian_email "guardian@galaxy.all"
guardian_photo do guardian_photo do
path = Rails.root.join("spec", "fixtures", "files", "pratt.jpg") path = Rails.root.join("spec", "fixtures", "files", "pratt.jpg")
Rack::Test::UploadedFile.new(path, "image/jpeg") Rack::Test::UploadedFile.new(path, "image/jpeg")

View File

@@ -25,7 +25,7 @@ feature 'User managing appearance releases' do
fill_in person_date_of_birth, with: '01/01/1999' fill_in person_date_of_birth, with: '01/01/1999'
attach_file person_photo_field, file_fixture('person_photo.png'), visible: :all attach_file person_photo_field, file_fixture('person_photo.png'), visible: :all
draw_signature file_fixture('signature.png'), 'appearance_release_signature_base64' draw_signature file_fixture('signature.png'), 'appearance_release_signature_base64'
click_button submit_release_button click_button 'I have read and agree to the above'
expect(page).to have_content(successful_submission_message) expect(page).to have_content(successful_submission_message)
end end
@@ -45,7 +45,6 @@ feature 'User managing appearance releases' do
page.check person_is_minor_checkbox page.check person_is_minor_checkbox
expect(page).to have_content('GUARDIAN INFORMATION') expect(page).to have_content('GUARDIAN INFORMATION')
expect(page).to have_content('GUARDIAN PHOTO') 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_first_name_field, with: 'Guardian'
fill_in guardian_last_name_field, with: 'Name' fill_in guardian_last_name_field, with: 'Name'
@@ -59,14 +58,7 @@ feature 'User managing appearance releases' do
attach_file person_photo_field, file_fixture('person_photo.png'), visible: :all attach_file person_photo_field, file_fixture('person_photo.png'), visible: :all
attach_file guardian_photo_field, file_fixture('hemsworth.jpeg'), visible: :all attach_file guardian_photo_field, file_fixture('hemsworth.jpeg'), visible: :all
draw_signature file_fixture('signature.png'), 'appearance_release_signature_base64' 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) expect(page).to have_content(successful_submission_message)
end end
@@ -257,7 +249,6 @@ feature 'User managing appearance releases' do
expect(pdf_body).to have_content('TAGS') expect(pdf_body).to have_content('TAGS')
expect(pdf_body).to have_content('Woman') expect(pdf_body).to have_content('Woman')
expect(pdf_body).to have_content('Brunette') expect(pdf_body).to have_content('Brunette')
expect(pdf_body).not_to have_content('Guardian Email')
end end
scenario 'viewing contract PDF for a minor without guardian photo' do scenario 'viewing contract PDF for a minor without guardian photo' do
@@ -271,10 +262,8 @@ feature 'User managing appearance releases' do
expect(pdf_filename).to include(appearance_release.filename_suffix.parameterize) 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.name)
expect(pdf_body).to have_content(appearance_release.guardian_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 photos_heading.upcase
expect(pdf_body).to have_content(appearance_release.photo.filename.to_s) expect(pdf_body).to have_content(appearance_release.photo.filename.to_s)
expect(pdf_body).to have_content('Guardian Email')
end end
scenario 'viewing contract PDF for a minor with guardian photo' do scenario 'viewing contract PDF for a minor with guardian photo' do
@@ -288,11 +277,9 @@ feature 'User managing appearance releases' do
expect(pdf_filename).to include(appearance_release.filename_suffix.parameterize) 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.name)
expect(pdf_body).to have_content(appearance_release.guardian_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 photos_heading(2).upcase
expect(pdf_body).to have_content(appearance_release.photo.filename.to_s) 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(appearance_release.guardian_photo.filename.to_s)
expect(pdf_body).to have_content('Guardian Email')
end end
scenario 'deleting a release', js: true do scenario 'deleting a release', js: true do
@@ -483,10 +470,6 @@ feature 'User managing appearance releases' do
'Guardian phone' 'Guardian phone'
end end
def guardian_email_field
'Guardian email'
end
def guardian_photo_field def guardian_photo_field
'appearance_release[guardian_photo]' 'appearance_release[guardian_photo]'
end end
@@ -535,10 +518,6 @@ feature 'User managing appearance releases' do
'Import Release' 'Import Release'
end end
def submit_release_button
'I have read and agree to the above'
end
def submit_update_button def submit_update_button
'Save Changes' 'Save Changes'
end end