From a6104b4563e026094ae2ffd752da8dc0db2d60d4 Mon Sep 17 00:00:00 2001 From: bilal Date: Fri, 19 Jun 2020 15:01:30 +0200 Subject: [PATCH 1/9] add second guardian fields --- app/assets/javascripts/photo_preview.js | 3 ++ .../public/appearance_releases_controller.rb | 17 ++++++++ app/models/appearance_release.rb | 17 ++++++++ app/models/concerns/second_guardian_name.rb | 20 +++++++++ .../concerns/second_guardian_photoable.rb | 9 ++++ app/views/contracts/_photos.html.erb | 11 +++++ app/views/contracts/_signature_page.html.erb | 15 +++++++ .../public/appearance_releases/new.html.erb | 43 +++++++++++++++++++ config/locales/en.yml | 21 +++++++++ config/locales/es.yml | 17 ++++++++ ..._guardian_fields_to_appearance_releases.rb | 14 ++++++ 11 files changed, 187 insertions(+) create mode 100644 app/models/concerns/second_guardian_name.rb create mode 100644 app/models/concerns/second_guardian_photoable.rb create mode 100644 db/migrate/20200619134853_add_second_guardian_fields_to_appearance_releases.rb diff --git a/app/assets/javascripts/photo_preview.js b/app/assets/javascripts/photo_preview.js index 3f0cbb8..34c4543 100644 --- a/app/assets/javascripts/photo_preview.js +++ b/app/assets/javascripts/photo_preview.js @@ -57,4 +57,7 @@ $(document).on("turbolinks:load", function() { $("[data-behavior=take-guardian-photo]").click(function(e) { $("[data-ujs-target=guardian-photo-input]").trigger("click"); }); + $("[data-behavior=take-guardian-2-photo]").click(function(e) { + $("[data-ujs-target=guardian-2-photo-input]").trigger("click"); + }); }); diff --git a/app/controllers/public/appearance_releases_controller.rb b/app/controllers/public/appearance_releases_controller.rb index 419fcd1..17d5464 100644 --- a/app/controllers/public/appearance_releases_controller.rb +++ b/app/controllers/public/appearance_releases_controller.rb @@ -71,8 +71,25 @@ class Public::AppearanceReleasesController < Public::BaseController ] 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 + guardian_2_address_street2 + guardian_2_address_city + guardian_2_address_state + guardian_2_address_zip + guardian_2_address_country + ] + end + def appearance_release_params params.require(:appearance_release).permit(person_params, guardian_params, + second_guardian_params, :minor, :signature_base64, :person_date_of_birth, :locale, :contract_template) diff --git a/app/models/appearance_release.rb b/app/models/appearance_release.rb index 078eefd..9a750a7 100644 --- a/app/models/appearance_release.rb +++ b/app/models/appearance_release.rb @@ -12,7 +12,9 @@ class AppearanceRelease < ApplicationRecord include Taggable include PersonName include GuardianPhotoable + include SecondGuardianPhotoable include GuardianName + include SecondGuardianName has_one_attached :person_photo @@ -38,6 +40,17 @@ class AppearanceRelease < 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] + ] + # These validations apply to all releases validates :person_email, email: true, allow_blank: true @@ -132,6 +145,10 @@ class AppearanceRelease < ApplicationRecord true end + def second_guardian_present? + self.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 diff --git a/app/models/concerns/second_guardian_name.rb b/app/models/concerns/second_guardian_name.rb new file mode 100644 index 0000000..8e4e04d --- /dev/null +++ b/app/models/concerns/second_guardian_name.rb @@ -0,0 +1,20 @@ +module SecondGuardianName + extend ActiveSupport::Concern + + included do + def guardian_2_name + "#{guardian_2_first_name} #{guardian_2_last_name}".titleize + end + + def guardian_2_name=(value) + if value.include?(' ') + split = value.split(" ", 2) + self.guardian_2_first_name = split.first + self.guardian_2_last_name = split.last + else + self.guardian_2_first_name = value + self.guardian_2_last_name = "(Not Given)" + end + end + end +end diff --git a/app/models/concerns/second_guardian_photoable.rb b/app/models/concerns/second_guardian_photoable.rb new file mode 100644 index 0000000..5e21240 --- /dev/null +++ b/app/models/concerns/second_guardian_photoable.rb @@ -0,0 +1,9 @@ +module SecondGuardianPhotoable + extend ActiveSupport::Concern + + included do + has_one_attached :guardian_2_photo + + validates :guardian_2_photo, content_type: ["image/png", "image/jpeg"] + end +end diff --git a/app/views/contracts/_photos.html.erb b/app/views/contracts/_photos.html.erb index 6f429f7..242881c 100644 --- a/app/views/contracts/_photos.html.erb +++ b/app/views/contracts/_photos.html.erb @@ -5,6 +5,9 @@ <% if release.respond_to? :guardian_photo %> <% @total_photos_count += release.guardian_photo.attached? ? 1 : 0 %> <% end %> +<% if release.respond_to? :guardian_2_photo %> + <% @total_photos_count += release.guardian_2_photo.attached? ? 1 : 0 %> +<% end %>

<%= t '.heading', count: @total_photos_count %>

diff --git a/app/views/contracts/_signature_page.html.erb b/app/views/contracts/_signature_page.html.erb index 28ef969..d413565 100644 --- a/app/views/contracts/_signature_page.html.erb +++ b/app/views/contracts/_signature_page.html.erb @@ -69,4 +69,19 @@ <%= description_list_pair_for releasable, :signed_on, append: ":" %> + <% if releasable.respond_to?(:second_guardian_present?) && releasable.second_guardian_present? %> + +
+

Second guardian Information

+ + <% # Second guardian information %> +
+ <%= description_list_pair_for releasable, :guardian_2_name, append: ":" %> + <%= description_list_pair_for releasable, :guardian_2_address, append: ":" %> + <%= description_list_pair_for releasable, :guardian_2_phone, append: ":" %> + <%= description_list_pair_for releasable, :guardian_2_email, append: ":" %> +
+ + <% end %> + <% end %> diff --git a/app/views/public/appearance_releases/new.html.erb b/app/views/public/appearance_releases/new.html.erb index 99d4c40..56ceeed 100644 --- a/app/views/public/appearance_releases/new.html.erb +++ b/app/views/public/appearance_releases/new.html.erb @@ -113,6 +113,49 @@
+ <%= card_field_set_tag t(".guardian_2_info.heading") do %> +
+ <%= form.text_field :guardian_2_first_name, required: @appearance_release.minor?, wrapper_class: "col-sm-3" %> + <%= form.text_field :guardian_2_last_name, required: @appearance_release.minor?, wrapper_class: "col-sm-3" %> + <%= form.phone_field :guardian_2_phone, required: @appearance_release.minor?, wrapper_class: "col-sm-6" %> +
+
+ <%= form.text_field :guardian_2_email, required: @appearance_release.minor?, wrapper_class: "col-sm-6" %> +
+ <%= render "shared/address_fields", form: form, subject: "guardian_2", required: @appearance_release.minor? %> + <% end %> + +
+ + <%= card_field_set_tag t(".guardian_2_photo.heading") do %> +
<%= t ".guardian_2_photo.instructions" %>
+
+
+
+ <%= t ".photo.no_photo" %> +
+
+
+ <% if @appearance_release.guardian_2_photo.attached? %> + <%= javascript_tag nonce: true do %> + App.PhotoPreview.set("[data-behavior=guardian-photo-preview]", "<%= url_for(@appearance_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 @appearance_release.guardian_2_photo.attached? %> + <%= form.file_field :guardian_2_photo, required: @appearance_release.minor?, hide_label: true, data: { ujs_target: "guardian-2-photo-input" }, accept: @appearance_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: "take-guardian-2-photo" } %> +
+

+ <%= fa_icon "arrow-up", text: t(".photo.camera_instructions_html") %>
+ <%= t ".photo.warning" %> +

+
+ <% end %> + +
+ <% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 65c27ab..1e4f5b3 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -66,6 +66,10 @@ en: person_phone: Phone person_photo: Photo signed_on: Date + guardian_2_address: Second guardian address + guardian_2_name: Second guardian name + guardian_2_phone: Second guardian phone + guardian_2_email: Second guardian email location_release: person_company: Company person_email: Email @@ -244,6 +248,7 @@ en: minor_photos_heading: one: Minor photo other: Minor photos + guardian_2_photo_heading: Second guardian photo signature_page: heading: Signature Page instructions: "By signing this signature page, as of the date listed below, I hereby agree, acknowledge and accept the terms and conditions listed in this %{releasable_name}." @@ -334,6 +339,16 @@ en: guardian_address_street1: Guardian address guardian_address_street2: Guardian address (Line 2) guardian_address_zip: Guardian zip code + guardian_2_address_city: Second guardian city + guardian_2_address_country: Second guardian country + guardian_2_address_state: Second guardian state + guardian_2_address_street1: Second guardian address + guardian_2_address_street2: Second guardian address (Line 2) + guardian_2_address_zip: Second guardian zip code + guardian_2_first_name: Second guardian first name + guardian_2_last_name: Second guardian last name + guardian_2_phone: Second guardian phone + guardian_2_email: Second guardian email minor: Is the person a minor? person_address_city: City person_address_country: Country @@ -806,10 +821,16 @@ en: heading: Guardian Clause guardian_info: heading: Guardian Information + guardian_2_info: + heading: Second 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! + 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! instructions_html: > Congrats on appearing in %{name}. After scrolling down and reading the appearance release form, please enter your personal information, take a selfie photo and press the "Submit Release" button. If the person appearing on camera is a minor, you will enter their personal information first, select the button noting this person is a minor, and then enter your own personal info under "Guardian Information" at the bottom. legal: diff --git a/config/locales/es.yml b/config/locales/es.yml index 82258a2..6e5bde0 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -73,6 +73,7 @@ es: minor_photos_heading: one: Minor photo (ES) other: Minor photos (ES) + guardian_2_photo_heading: Second guardian photo (ES) signature_page: heading: Página de Firma de Autorización de Aparacimiento instructions: Al firmar esta página de firma, a partir de la fecha indicada abajo, por la presente acepto, reconozco y acepto los términos y condiciones enumerados en esta autorización de aparacimiento. @@ -121,6 +122,16 @@ 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_2_address_city: Second guardian city (ES) + guardian_2_address_country: Second guardian country (ES) + guardian_2_address_state: Second guardian state (ES) + guardian_2_address_street1: Second guardian address (ES) + guardian_2_address_street2: Second guardian address (Line 2) (ES) + guardian_2_address_zip: Second guardian zip code (ES) + guardian_2_first_name: Second guardian first name (ES) + guardian_2_last_name: Second guardian last name (ES) + guardian_2_phone: Second guardian phone (ES) + guardian_2_email: Second guardian email (ES) guardian_name: Nómbre del tutor legal guardian_phone: Número de teléfono del tutor legal minor: El firmante es un menor @@ -189,6 +200,12 @@ es: clear: Despejar heading: Firma instructions: 'Firma Abajo:' + guardian_2_info: + heading: Second Guardian Information (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) location_releases: new: photos: diff --git a/db/migrate/20200619134853_add_second_guardian_fields_to_appearance_releases.rb b/db/migrate/20200619134853_add_second_guardian_fields_to_appearance_releases.rb new file mode 100644 index 0000000..a067b44 --- /dev/null +++ b/db/migrate/20200619134853_add_second_guardian_fields_to_appearance_releases.rb @@ -0,0 +1,14 @@ +class AddSecondGuardianFieldsToAppearanceReleases < ActiveRecord::Migration[6.0] + def change + add_column :appearance_releases, :guardian_2_first_name, :string + add_column :appearance_releases, :guardian_2_last_name, :string + add_column :appearance_releases, :guardian_2_email, :string + add_column :appearance_releases, :guardian_2_phone, :string + add_column :appearance_releases, :guardian_2_address_street1, :string + add_column :appearance_releases, :guardian_2_address_street2, :string + add_column :appearance_releases, :guardian_2_address_city, :string + add_column :appearance_releases, :guardian_2_address_state, :string + add_column :appearance_releases, :guardian_2_address_zip, :string + add_column :appearance_releases, :guardian_2_address_country, :string + end +end -- 2.47.3 From 9c91d86e478b17a671b01a8baf740f4b9cf3b081 Mon Sep 17 00:00:00 2001 From: bilal Date: Fri, 19 Jun 2020 15:13:12 +0200 Subject: [PATCH 2/9] make second guardian fields not required --- app/views/public/appearance_releases/new.html.erb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/views/public/appearance_releases/new.html.erb b/app/views/public/appearance_releases/new.html.erb index 56ceeed..f23960f 100644 --- a/app/views/public/appearance_releases/new.html.erb +++ b/app/views/public/appearance_releases/new.html.erb @@ -115,14 +115,14 @@ <%= card_field_set_tag t(".guardian_2_info.heading") do %>
- <%= form.text_field :guardian_2_first_name, required: @appearance_release.minor?, wrapper_class: "col-sm-3" %> - <%= form.text_field :guardian_2_last_name, required: @appearance_release.minor?, wrapper_class: "col-sm-3" %> - <%= form.phone_field :guardian_2_phone, required: @appearance_release.minor?, wrapper_class: "col-sm-6" %> + <%= 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, required: @appearance_release.minor?, 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", required: @appearance_release.minor? %> + <%= render "shared/address_fields", form: form, subject: "guardian_2" %> <% end %>
@@ -143,7 +143,7 @@ <% end %>
<%= 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, required: @appearance_release.minor?, hide_label: true, data: { ujs_target: "guardian-2-photo-input" }, accept: @appearance_release.class.face_photo_acceptable_content_types.join(","), direct_upload: true %> + <%= form.file_field :guardian_2_photo, hide_label: true, data: { ujs_target: "guardian-2-photo-input" }, accept: @appearance_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: "take-guardian-2-photo" } %> -- 2.47.3 From e3f69f55b1a5986d90701618b313c39c9ec16241 Mon Sep 17 00:00:00 2001 From: bilal Date: Fri, 19 Jun 2020 15:27:12 +0200 Subject: [PATCH 3/9] add spec --- .../user_managing_appearance_releases_spec.rb | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/spec/features/user_managing_appearance_releases_spec.rb b/spec/features/user_managing_appearance_releases_spec.rb index 33e1eb3..8eba877 100644 --- a/spec/features/user_managing_appearance_releases_spec.rb +++ b/spec/features/user_managing_appearance_releases_spec.rb @@ -72,6 +72,61 @@ feature 'User managing appearance releases' do expect(page).to have_content(successful_submission_message) end + + scenario 'creating a release for a minor with two guardians', js: true do + allow(BrayniacAI::Validation).to receive(:create).and_return(double(:validation, valid: true)) + + project = create(:project, members: current_user, account: current_user.primary_account) + contract_template = create(:contract_template, project: project) + + visit new_account_project_contract_template_appearance_release_path(project.account, project, contract_template) + + expect(page).to have_photo_button + expect(page).not_to have_content('SECOND GUARDIAN INFORMATION') + expect(page).not_to have_content('SECOND GUARDIAN PHOTO') + + 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' + + expect(page).to have_content 'SECOND GUARDIAN INFORMATION' + expect(page).to have_content 'SECOND GUARDIAN PHOTO' + expect(page).to have_content 'Second Guardian Email' + expect(page).to have_content 'Second Guardian Phone' + expect(page).to have_content 'Second Guardian Address' + + 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 person_first_name_field, with: 'Jane' + fill_in person_last_name_field, with: 'Doe' + fill_in_person_address_fields + fill_in person_phone_field, with: '555-555-5555' + fill_in person_email_field, with: 'jane.doe@test.com' + fill_in person_date_of_birth, with: '01/01/1999' + 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' + + 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' + fill_in_guardian_address_fields + attach_file guardian_photo_field, file_fixture('hemsworth.jpeg'), visible: :all + draw_signature file_fixture('signature.png'), 'appearance_release_signature_base64' + + 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(AppearanceRelease.last.guardian_2_first_name).to eq 'Second' + end end context 'when signed in' do @@ -454,6 +509,18 @@ feature 'User managing appearance releases' do 'appearance_release_minor' end + def guardian_2_first_name_field + 'Second guardian first name' + end + + def guardian_2_last_name_field + 'Second guardian last name' + end + + def guardian_2_phone_field + 'Second guardian phone' + end + def guardian_first_name_field 'Guardian first name' end -- 2.47.3 From 0c25c5b3e94629a1963eeabf35e8c6743df755d1 Mon Sep 17 00:00:00 2001 From: bilal Date: Tue, 23 Jun 2020 11:59:39 +0200 Subject: [PATCH 4/9] fix MR comments --- .../public/appearance_releases/new.html.erb | 4 --- config/locales/en.yml | 30 +++++++++---------- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/app/views/public/appearance_releases/new.html.erb b/app/views/public/appearance_releases/new.html.erb index f23960f..2b08f1a 100644 --- a/app/views/public/appearance_releases/new.html.erb +++ b/app/views/public/appearance_releases/new.html.erb @@ -75,8 +75,6 @@ <%= 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, required: @appearance_release.minor?, wrapper_class: "col-sm-6" %> - -
<%= form.text_field :guardian_email, required: @appearance_release.minor?, wrapper_class: "col-sm-6" %>
<%= render "shared/address_fields", form: form, subject: "guardian", required: @appearance_release.minor? %> @@ -118,8 +116,6 @@ <%= 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" %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 1e4f5b3..9008fb6 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -66,10 +66,10 @@ en: person_phone: Phone person_photo: Photo signed_on: Date - guardian_2_address: Second guardian address - guardian_2_name: Second guardian name - guardian_2_phone: Second guardian phone - guardian_2_email: Second guardian email + guardian_2_address: Guardian 2 address + guardian_2_name: Guardian 2 name + guardian_2_phone: Guardian 2 phone + guardian_2_email: Guardian 2 email location_release: person_company: Company person_email: Email @@ -339,16 +339,16 @@ en: guardian_address_street1: Guardian address guardian_address_street2: Guardian address (Line 2) guardian_address_zip: Guardian zip code - guardian_2_address_city: Second guardian city - guardian_2_address_country: Second guardian country - guardian_2_address_state: Second guardian state - guardian_2_address_street1: Second guardian address - guardian_2_address_street2: Second guardian address (Line 2) - guardian_2_address_zip: Second guardian zip code - guardian_2_first_name: Second guardian first name - guardian_2_last_name: Second guardian last name - guardian_2_phone: Second guardian phone - guardian_2_email: Second guardian email + 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_first_name: Guardian 2 first name + guardian_2_last_name: Guardian 2 last name + guardian_2_phone: Guardian 2 phone + guardian_2_email: Guardian 2 email minor: Is the person a minor? person_address_city: City person_address_country: Country @@ -822,7 +822,7 @@ en: guardian_info: heading: Guardian Information guardian_2_info: - heading: Second Guardian Information + heading: Second Guardian Information (if company requires) guardian_photo: heading: Guardian Photo instructions: > -- 2.47.3 From 9b3ad29b8298efdacd7d4fae1488a174e8fd3939 Mon Sep 17 00:00:00 2001 From: bilal Date: Tue, 23 Jun 2020 12:13:28 +0200 Subject: [PATCH 5/9] fix MR comments --- app/assets/javascripts/photo_preview.js | 11 +++-------- app/views/public/appearance_releases/new.html.erb | 6 +++--- app/views/public/talent_releases/new.html.erb | 2 +- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/app/assets/javascripts/photo_preview.js b/app/assets/javascripts/photo_preview.js index 34c4543..741db37 100644 --- a/app/assets/javascripts/photo_preview.js +++ b/app/assets/javascripts/photo_preview.js @@ -51,13 +51,8 @@ $(document).on("turbolinks:load", function() { $("[data-behavior=guardian-photo-preview]").each(function(index, element) { App.PhotoPreview.init(element); }); - $("[data-behavior=take-person-photo]").click(function(e) { - $("[data-ujs-target=person-photo-input]").trigger("click"); - }); - $("[data-behavior=take-guardian-photo]").click(function(e) { - $("[data-ujs-target=guardian-photo-input]").trigger("click"); - }); - $("[data-behavior=take-guardian-2-photo]").click(function(e) { - $("[data-ujs-target=guardian-2-photo-input]").trigger("click"); + $("[data-behavior=trigger-click]").click(function(e) { + const target = $(this).data("target"); + $(target).trigger("click"); }); }); diff --git a/app/views/public/appearance_releases/new.html.erb b/app/views/public/appearance_releases/new.html.erb index 2b08f1a..c88d7d6 100644 --- a/app/views/public/appearance_releases/new.html.erb +++ b/app/views/public/appearance_releases/new.html.erb @@ -57,7 +57,7 @@ <%= form.hidden_field :person_photo, value: form.object.person_photo.signed_id if @appearance_release.person_photo.attached? %> <%= form.file_field :person_photo, hide_label: true, data: { ujs_target: "person-photo-input" }, accept: @appearance_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: "take-person-photo" } %> + <%= 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=person-photo-input]" } %>

<%= fa_icon "arrow-up", text: t(".photo.camera_instructions_html") %>
@@ -100,7 +100,7 @@ <%= form.hidden_field :guardian_photo, value: form.object.guardian_photo.signed_id if @appearance_release.guardian_photo.attached? %> <%= form.file_field :guardian_photo, required: @appearance_release.minor?, hide_label: true, data: { ujs_target: "guardian-photo-input" }, accept: @appearance_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: "take-guardian-photo" } %> + <%= 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]" } %>

<%= fa_icon "arrow-up", text: t(".photo.camera_instructions_html") %>
@@ -141,7 +141,7 @@ <%= 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" }, accept: @appearance_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: "take-guardian-2-photo" } %> + <%= 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]" } %>

<%= fa_icon "arrow-up", text: t(".photo.camera_instructions_html") %>
diff --git a/app/views/public/talent_releases/new.html.erb b/app/views/public/talent_releases/new.html.erb index 17c5239..43483c9 100644 --- a/app/views/public/talent_releases/new.html.erb +++ b/app/views/public/talent_releases/new.html.erb @@ -78,7 +78,7 @@ <%= 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" }, accept: @talent_release.class.face_photo_acceptable_content_types.join(","), direct_upload: true %> - <%= button_tag t(".guardian_photo.take_photo"), type: "button", class: "btn btn-lg btn-primary take-photo-button", data: { behavior: "take-guardian-photo" } %> + <%= button_tag t(".guardian_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]" } %>

<%= fa_icon "arrow-up", text: t(".guardian_photo.camera_instructions_html") %>
-- 2.47.3 From 9772e3cffcb2ffe5d3db927d43d037d757f84aea Mon Sep 17 00:00:00 2001 From: bilal Date: Tue, 23 Jun 2020 12:36:51 +0200 Subject: [PATCH 6/9] fix MR comments --- config/locales/en.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 9008fb6..8b5d366 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -339,16 +339,16 @@ en: guardian_address_street1: Guardian address guardian_address_street2: Guardian address (Line 2) guardian_address_zip: Guardian zip code - 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_first_name: Guardian 2 first name - guardian_2_last_name: Guardian 2 last name - guardian_2_phone: Guardian 2 phone - guardian_2_email: Guardian 2 email + guardian_2_address_city: Second guardian city + guardian_2_address_country: Second guardian country + guardian_2_address_state: Second guardian state + guardian_2_address_street1: Second guardian address + guardian_2_address_street2: Second guardian address (Line 2) + guardian_2_address_zip: Second guardian zip code + guardian_2_first_name: Second guardian first name + guardian_2_last_name: Second guardian last name + guardian_2_phone: Second guardian phone + guardian_2_email: Second guardian email minor: Is the person a minor? person_address_city: City person_address_country: Country -- 2.47.3 From 85af8cd03df05f5ad0aab24cb8cb06b63a51cc0d Mon Sep 17 00:00:00 2001 From: bilal Date: Tue, 23 Jun 2020 12:45:11 +0200 Subject: [PATCH 7/9] fix MR comments --- config/locales/en.yml | 20 +++++++++---------- .../user_managing_appearance_releases_spec.rb | 12 +++++------ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 8b5d366..9008fb6 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -339,16 +339,16 @@ en: guardian_address_street1: Guardian address guardian_address_street2: Guardian address (Line 2) guardian_address_zip: Guardian zip code - guardian_2_address_city: Second guardian city - guardian_2_address_country: Second guardian country - guardian_2_address_state: Second guardian state - guardian_2_address_street1: Second guardian address - guardian_2_address_street2: Second guardian address (Line 2) - guardian_2_address_zip: Second guardian zip code - guardian_2_first_name: Second guardian first name - guardian_2_last_name: Second guardian last name - guardian_2_phone: Second guardian phone - guardian_2_email: Second guardian email + 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_first_name: Guardian 2 first name + guardian_2_last_name: Guardian 2 last name + guardian_2_phone: Guardian 2 phone + guardian_2_email: Guardian 2 email minor: Is the person a minor? person_address_city: City person_address_country: Country diff --git a/spec/features/user_managing_appearance_releases_spec.rb b/spec/features/user_managing_appearance_releases_spec.rb index 8eba877..06ea050 100644 --- a/spec/features/user_managing_appearance_releases_spec.rb +++ b/spec/features/user_managing_appearance_releases_spec.rb @@ -92,9 +92,9 @@ feature 'User managing appearance releases' do expect(page).to have_content 'SECOND GUARDIAN INFORMATION' expect(page).to have_content 'SECOND GUARDIAN PHOTO' - expect(page).to have_content 'Second Guardian Email' - expect(page).to have_content 'Second Guardian Phone' - expect(page).to have_content 'Second Guardian Address' + expect(page).to have_content 'Guardian 2 Email' + expect(page).to have_content 'Guardian 2 Phone' + expect(page).to have_content 'Guardian 2 Address' fill_in guardian_first_name_field, with: 'Guardian' fill_in guardian_last_name_field, with: 'Name' @@ -510,15 +510,15 @@ feature 'User managing appearance releases' do end def guardian_2_first_name_field - 'Second guardian first name' + 'Guardian 2 first name' end def guardian_2_last_name_field - 'Second guardian last name' + 'Guardian 2 last name' end def guardian_2_phone_field - 'Second guardian phone' + 'Guardian 2 phone' end def guardian_first_name_field -- 2.47.3 From c1c86183aaf078c687b8493480508307346ec5bb Mon Sep 17 00:00:00 2001 From: bilal Date: Tue, 23 Jun 2020 17:16:39 +0200 Subject: [PATCH 8/9] rebase --- db/structure.sql | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/db/structure.sql b/db/structure.sql index 3ad5cad..051cc35 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -9,20 +9,6 @@ SET xmloption = content; SET client_min_messages = warning; SET row_security = off; --- --- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: - --- - -CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog; - - --- --- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: - --- - -COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language'; - - -- -- Name: fuzzystrmatch; Type: EXTENSION; Schema: -; Owner: - -- @@ -342,7 +328,17 @@ CREATE TABLE public.appearance_releases ( guardian_address_city character varying, guardian_address_state character varying, guardian_address_zip character varying, - guardian_address_country 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 ); @@ -3793,6 +3789,7 @@ INSERT INTO "schema_migrations" (version) VALUES ('20200615133602'), ('20200616124214'), ('20200619081446'), -('20200619085823'); +('20200619085823'), +('20200619134853'); -- 2.47.3 From a1744d82d7b15be55d8ba10c6384d5231fb6a63f Mon Sep 17 00:00:00 2001 From: bilal Date: Tue, 23 Jun 2020 17:23:28 +0200 Subject: [PATCH 9/9] sort --- config/locales/en.yml | 40 ++++++++++++++++++++-------------------- config/locales/es.yml | 28 ++++++++++++++-------------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 9008fb6..f2bfa69 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -60,16 +60,16 @@ en: activerecord: attributes: appearance_release: + guardian_2_address: Guardian 2 address + guardian_2_email: Guardian 2 email + guardian_2_name: Guardian 2 name + guardian_2_phone: Guardian 2 phone person_address: Address person_email: Email person_name: Name person_phone: Phone person_photo: Photo signed_on: Date - guardian_2_address: Guardian 2 address - guardian_2_name: Guardian 2 name - guardian_2_phone: Guardian 2 phone - guardian_2_email: Guardian 2 email location_release: person_company: Company person_email: Email @@ -241,6 +241,7 @@ en: heading: New Release Template contracts: photos: + guardian_2_photo_heading: Second guardian photo guardian_photo_heading: Guardian photo heading: one: Photo @@ -248,7 +249,6 @@ en: minor_photos_heading: one: Minor photo other: Minor photos - guardian_2_photo_heading: Second guardian photo signature_page: heading: Signature Page instructions: "By signing this signature page, as of the date listed below, I hereby agree, acknowledge and accept the terms and conditions listed in this %{releasable_name}." @@ -333,22 +333,22 @@ en: person_phone: Phone number person_title: Title appearance_release: - 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_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_2_email: Guardian 2 email + 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 minor: Is the person a minor? person_address_city: City person_address_country: Country @@ -817,20 +817,20 @@ en: notice: Your release has been signed. Thank you! new: cancel: Cancel - guardian_clause: - heading: Guardian Clause - guardian_info: - heading: Guardian Information guardian_2_info: heading: Second Guardian Information (if company requires) - 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! 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_clause: + heading: Guardian Clause + 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! instructions_html: > Congrats on appearing in %{name}. After scrolling down and reading the appearance release form, please enter your personal information, take a selfie photo and press the "Submit Release" button. If the person appearing on camera is a minor, you will enter their personal information first, select the button noting this person is a minor, and then enter your own personal info under "Guardian Information" at the bottom. legal: diff --git a/config/locales/es.yml b/config/locales/es.yml index 6e5bde0..6ce2858 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -66,6 +66,7 @@ es: heading: Release Info (ES) contracts: photos: + guardian_2_photo_heading: Second guardian photo (ES) guardian_photo_heading: Guardian photo (ES) heading: one: Photo (ES) @@ -73,7 +74,6 @@ es: minor_photos_heading: one: Minor photo (ES) other: Minor photos (ES) - guardian_2_photo_heading: Second guardian photo (ES) signature_page: heading: Página de Firma de Autorización de Aparacimiento instructions: Al firmar esta página de firma, a partir de la fecha indicada abajo, por la presente acepto, reconozco y acepto los términos y condiciones enumerados en esta autorización de aparacimiento. @@ -116,22 +116,22 @@ es: helpers: label: appearance_release: - 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_2_address_city: Second guardian city (ES) guardian_2_address_country: Second guardian country (ES) guardian_2_address_state: Second guardian state (ES) guardian_2_address_street1: Second guardian address (ES) guardian_2_address_street2: Second guardian address (Line 2) (ES) guardian_2_address_zip: Second guardian zip code (ES) + guardian_2_email: Second guardian email (ES) guardian_2_first_name: Second guardian first name (ES) guardian_2_last_name: Second guardian last name (ES) guardian_2_phone: Second guardian phone (ES) - guardian_2_email: Second guardian email (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_name: Nómbre del tutor legal guardian_phone: Número de teléfono del tutor legal minor: El firmante es un menor @@ -178,6 +178,12 @@ es: notice: La autorización está firmada. ¡Gracias! new: cancel: Cancelar + guardian_2_info: + heading: Second Guardian Information (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_photo: @@ -200,12 +206,6 @@ es: clear: Despejar heading: Firma instructions: 'Firma Abajo:' - guardian_2_info: - heading: Second Guardian Information (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) location_releases: new: photos: -- 2.47.3