diff --git a/Gemfile b/Gemfile
index 7c011f9..4b30193 100644
--- a/Gemfile
+++ b/Gemfile
@@ -4,7 +4,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby "2.6.3"
# Bundle edge Rails instead: gem "rails", github: "rails/rails"
-gem "rails", "~> 6.0.0"
+gem "rails", "~> 6.0.3.1"
# Use postgresql as the database for Active Record
gem "pg", "~> 0.18"
# Use Puma as the app server
diff --git a/Gemfile.lock b/Gemfile.lock
index b1f67d7..25f6e5e 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -44,71 +44,71 @@ GEM
remote: https://rubygems.org/
specs:
Ascii85 (1.0.3)
- actioncable (6.0.0)
- actionpack (= 6.0.0)
+ actioncable (6.0.3.2)
+ actionpack (= 6.0.3.2)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
- actionmailbox (6.0.0)
- actionpack (= 6.0.0)
- activejob (= 6.0.0)
- activerecord (= 6.0.0)
- activestorage (= 6.0.0)
- activesupport (= 6.0.0)
+ actionmailbox (6.0.3.2)
+ actionpack (= 6.0.3.2)
+ activejob (= 6.0.3.2)
+ activerecord (= 6.0.3.2)
+ activestorage (= 6.0.3.2)
+ activesupport (= 6.0.3.2)
mail (>= 2.7.1)
- actionmailer (6.0.0)
- actionpack (= 6.0.0)
- actionview (= 6.0.0)
- activejob (= 6.0.0)
+ actionmailer (6.0.3.2)
+ actionpack (= 6.0.3.2)
+ actionview (= 6.0.3.2)
+ activejob (= 6.0.3.2)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
- actionpack (6.0.0)
- actionview (= 6.0.0)
- activesupport (= 6.0.0)
- rack (~> 2.0)
+ actionpack (6.0.3.2)
+ actionview (= 6.0.3.2)
+ activesupport (= 6.0.3.2)
+ rack (~> 2.0, >= 2.0.8)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
- actiontext (6.0.0)
- actionpack (= 6.0.0)
- activerecord (= 6.0.0)
- activestorage (= 6.0.0)
- activesupport (= 6.0.0)
+ actiontext (6.0.3.2)
+ actionpack (= 6.0.3.2)
+ activerecord (= 6.0.3.2)
+ activestorage (= 6.0.3.2)
+ activesupport (= 6.0.3.2)
nokogiri (>= 1.8.5)
- actionview (6.0.0)
- activesupport (= 6.0.0)
+ actionview (6.0.3.2)
+ activesupport (= 6.0.3.2)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
active_storage_base64 (1.0.0)
rails (~> 6.0)
- activejob (6.0.0)
- activesupport (= 6.0.0)
+ activejob (6.0.3.2)
+ activesupport (= 6.0.3.2)
globalid (>= 0.3.6)
- activemodel (6.0.0)
- activesupport (= 6.0.0)
+ activemodel (6.0.3.2)
+ activesupport (= 6.0.3.2)
activemodel-serializers-xml (1.0.2)
activemodel (> 5.x)
activesupport (> 5.x)
builder (~> 3.1)
- activerecord (6.0.0)
- activemodel (= 6.0.0)
- activesupport (= 6.0.0)
+ activerecord (6.0.3.2)
+ activemodel (= 6.0.3.2)
+ activesupport (= 6.0.3.2)
activeresource (5.1.0)
activemodel (>= 5.0, < 7)
activemodel-serializers-xml (~> 1.0)
activesupport (>= 5.0, < 7)
- activestorage (6.0.0)
- actionpack (= 6.0.0)
- activejob (= 6.0.0)
- activerecord (= 6.0.0)
+ activestorage (6.0.3.2)
+ actionpack (= 6.0.3.2)
+ activejob (= 6.0.3.2)
+ activerecord (= 6.0.3.2)
marcel (~> 0.3.1)
- activesupport (6.0.0)
+ activesupport (6.0.3.2)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
- zeitwerk (~> 2.1, >= 2.1.8)
+ zeitwerk (~> 2.2, >= 2.2.2)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
afm (0.2.2)
@@ -181,7 +181,7 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.12.2)
- concurrent-ruby (1.1.5)
+ concurrent-ruby (1.1.6)
connection_pool (2.2.2)
countries (2.1.4)
i18n_data (~> 0.8.0)
@@ -230,7 +230,7 @@ GEM
hubspot-ruby (0.9.0)
activesupport (>= 3.0.0)
httparty (>= 0.10.0)
- i18n (1.8.2)
+ i18n (1.8.3)
concurrent-ruby (~> 1.0)
i18n_data (0.8.0)
i18n_yaml_sorter (0.2.0)
@@ -270,22 +270,22 @@ GEM
ruby_dep (~> 1.2)
loaf (0.8.1)
rails (>= 3.2)
- loofah (2.4.0)
+ loofah (2.6.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
mini_mime (>= 0.1.1)
marcel (0.3.3)
mimemagic (~> 0.3.2)
- method_source (0.9.2)
+ method_source (1.0.0)
mime-types (3.3)
mime-types-data (~> 3.2015)
mime-types-data (3.2019.0904)
- mimemagic (0.3.3)
+ mimemagic (0.3.5)
mini_magick (4.9.5)
mini_mime (1.0.2)
mini_portile2 (2.4.0)
- minitest (5.14.0)
+ minitest (5.14.1)
monetize (1.9.2)
money (~> 6.12)
money (6.13.4)
@@ -298,8 +298,8 @@ GEM
msgpack (1.3.1)
multi_xml (0.6.0)
multipart-post (2.1.1)
- nio4r (2.5.1)
- nokogiri (1.10.7)
+ nio4r (2.5.2)
+ nokogiri (1.10.9)
mini_portile2 (~> 2.4.0)
oath (1.1.0)
bcrypt
@@ -337,20 +337,20 @@ GEM
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
- rails (6.0.0)
- actioncable (= 6.0.0)
- actionmailbox (= 6.0.0)
- actionmailer (= 6.0.0)
- actionpack (= 6.0.0)
- actiontext (= 6.0.0)
- actionview (= 6.0.0)
- activejob (= 6.0.0)
- activemodel (= 6.0.0)
- activerecord (= 6.0.0)
- activestorage (= 6.0.0)
- activesupport (= 6.0.0)
+ rails (6.0.3.2)
+ actioncable (= 6.0.3.2)
+ actionmailbox (= 6.0.3.2)
+ actionmailer (= 6.0.3.2)
+ actionpack (= 6.0.3.2)
+ actiontext (= 6.0.3.2)
+ actionview (= 6.0.3.2)
+ activejob (= 6.0.3.2)
+ activemodel (= 6.0.3.2)
+ activerecord (= 6.0.3.2)
+ activestorage (= 6.0.3.2)
+ activesupport (= 6.0.3.2)
bundler (>= 1.3.0)
- railties (= 6.0.0)
+ railties (= 6.0.3.2)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.4)
actionpack (>= 5.0.1.x)
@@ -363,9 +363,9 @@ GEM
nokogiri (>= 1.6)
rails-html-sanitizer (1.3.0)
loofah (~> 2.3)
- railties (6.0.0)
- actionpack (= 6.0.0)
- activesupport (= 6.0.0)
+ railties (6.0.3.2)
+ actionpack (= 6.0.3.2)
+ activesupport (= 6.0.3.2)
method_source
rake (>= 0.8.7)
thor (>= 0.20.3, < 2.0)
@@ -469,7 +469,7 @@ GEM
turbolinks-source (5.2.0)
typhoeus (1.3.1)
ethon (>= 0.9.0)
- tzinfo (1.2.6)
+ tzinfo (1.2.7)
thread_safe (~> 0.1)
uglifier (4.1.20)
execjs (>= 0.3.0, < 3)
@@ -494,9 +494,9 @@ GEM
activesupport (>= 4.2)
rack-proxy (>= 0.6.1)
railties (>= 4.2)
- websocket-driver (0.7.1)
+ websocket-driver (0.7.2)
websocket-extensions (>= 0.1.0)
- websocket-extensions (0.1.4)
+ websocket-extensions (0.1.5)
will_paginate (3.2.1)
will_paginate-bootstrap4 (0.2.2)
will_paginate (~> 3.0, >= 3.0.0)
@@ -504,7 +504,7 @@ GEM
wkhtmltopdf-heroku (2.12.5.0)
xpath (3.2.0)
nokogiri (~> 1.8)
- zeitwerk (2.2.2)
+ zeitwerk (2.3.1)
PLATFORMS
ruby
@@ -561,7 +561,7 @@ DEPENDENCIES
rack!
rack-contrib (~> 2.0.1)
rack-cors
- rails (~> 6.0.0)
+ rails (~> 6.0.3.1)
rails-controller-testing (~> 1.0.4)
rails-data-migrations (~> 1.2.0)
redcarpet (~> 3.4.0)
diff --git a/app/assets/javascripts/play_previous_recordings.js b/app/assets/javascripts/play_previous_recordings.js
deleted file mode 100644
index f2d1212..0000000
--- a/app/assets/javascripts/play_previous_recordings.js
+++ /dev/null
@@ -1,24 +0,0 @@
-$(document).on("click", "[data-behavior=play_recording]", function() {
- if ($(this).hasClass('active')){
- return false;
- }
-
- var playback_url = $(this).attr("data-playback-url")
- $("#broadcast_video").empty();
-
- new Clappr.Player({
- parentId: '#broadcast_video',
- source: playback_url,
- width: '100%',
- height: '100%',
- autoPlay: true
- });
-
- $(".dropdown-menu").children().removeClass('active');
- $(".dropdown-menu").children().children('i').remove();
- $(this).siblings().removeClass('active');
- $(this).siblings().children("i").remove();
- $(this).addClass('active');
- $(this).prepend(' ');
-});
-
diff --git a/app/assets/javascripts/play_previous_recordings.js.erb b/app/assets/javascripts/play_previous_recordings.js.erb
new file mode 100644
index 0000000..c3c7b49
--- /dev/null
+++ b/app/assets/javascripts/play_previous_recordings.js.erb
@@ -0,0 +1,26 @@
+$(document).on("click", "[data-behavior=play_recording]", function() {
+ if ($(this).hasClass('active')){
+ return false;
+ }
+
+ console.warn('Play prev : ', playback_url);
+
+ var playback_url = $(this).attr("data-playback-url")
+ $("#broadcast_video").empty();
+
+ new Clappr.Player({
+ <%= "baseUrl: 'http://cdn.clappr.io/latest'," if Rails.env.test? %>
+ parentId: '#broadcast_video',
+ source: playback_url,
+ width: '100%',
+ height: '100%',
+ autoPlay: true
+ });
+
+ $(".dropdown-menu").children().removeClass('active');
+ $(".dropdown-menu").children().children('i').remove();
+ $(this).siblings().removeClass('active');
+ $(this).siblings().children("i").remove();
+ $(this).addClass('active');
+ $(this).prepend(' ');
+});
\ No newline at end of file
diff --git a/app/controllers/public/talent_releases_controller.rb b/app/controllers/public/talent_releases_controller.rb
index 44d2f33..4c6fd3e 100644
--- a/app/controllers/public/talent_releases_controller.rb
+++ b/app/controllers/public/talent_releases_controller.rb
@@ -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
diff --git a/app/controllers/talent_releases_controller.rb b/app/controllers/talent_releases_controller.rb
index c937db9..e2255c2 100644
--- a/app/controllers/talent_releases_controller.rb
+++ b/app/controllers/talent_releases_controller.rb
@@ -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 = {})
diff --git a/app/models/talent_release.rb b/app/models/talent_release.rb
index 830c56f..8ca4dbe 100644
--- a/app/models/talent_release.rb
+++ b/app/models/talent_release.rb
@@ -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
diff --git a/app/views/broadcasts/show.html.erb b/app/views/broadcasts/show.html.erb
index 42b83a7..4d6e507 100644
--- a/app/views/broadcasts/show.html.erb
+++ b/app/views/broadcasts/show.html.erb
@@ -33,7 +33,7 @@
<%= link_to "Switch View", "#", class: "btn btn-light border dropdown-toggle", role: "button", id: "dropdownMenuLink", data: { toggle: "dropdown" }, aria: { haspopup: "true", expanded: "false" } %>
-
+
diff --git a/app/views/public/talent_releases/new.html.erb b/app/views/public/talent_releases/new.html.erb
index 43483c9..01f4e72 100644
--- a/app/views/public/talent_releases/new.html.erb
+++ b/app/views/public/talent_releases/new.html.erb
@@ -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" %>
-
-
<%= form.email_field :person_email, wrapper_class: "col-sm-6" %>
<%= 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" %>
-
-
<%= form.text_field :guardian_email, wrapper_class: "col-sm-6" %>
<%= render "shared/address_fields", form: form, subject: "guardian" %>
@@ -87,6 +83,48 @@
<% end %>
+
+
+ <%= card_field_set_tag t(".guardian_2_info.heading") do %>
+
+ <%= 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" %>
+ <% end %>
+
+
+
+ <%= card_field_set_tag t(".guardian_2_photo.heading") do %>
+ <%= t ".guardian_2_photo.instructions" %>
+
+
+
+ <%= t ".guardian_2_photo.no_photo" %>
+
+
+
+ <% 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 %>
+
+ <%= 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 %>
+
+ <%= 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]" } %>
+
+
+ <%= fa_icon "arrow-up", text: t(".guardian_2_photo.camera_instructions_html") %>
+ <%= t ".guardian_2_photo.warning" %>
+
+
+ <% end %>
+
+
diff --git a/app/views/talent_releases/_form.html.erb b/app/views/talent_releases/_form.html.erb
index 76fbff9..2c2caa7 100644
--- a/app/views/talent_releases/_form.html.erb
+++ b/app/views/talent_releases/_form.html.erb
@@ -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" %>
-
-
<%= form.email_field :person_email, wrapper_class: "col-sm-6" %>
<%= render "shared/address_fields", form: form, subject: "person" %>
!talent_release.minor?) %>" data-ujs-target="guardian-fields">
-
- <%= 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" %>
-
- <%= render "shared/address_fields", form: form, subject: "guardian" %>
+ <%= card_field_set_tag t(".guardian_info.heading") do %>
+
+ <%= 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" %>
+
+ <%= render "shared/address_fields", form: form, subject: "guardian" %>
+ <% end %>
+
+ <%= card_field_set_tag t(".guardian_2_info.heading") do %>
+
+ <%= 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" %>
+
+ <%= render "shared/address_fields", form: form, subject: "guardian_2" %>
+ <% end %>
<% end %>
@@ -44,20 +52,36 @@
<%= t(".photos.guardian_photo.heading") %>
-
+
<% 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 %>
<%= 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(",") %>
+
+
<%= t(".photos.guardian_2_photo.heading") %>
+
+ <% 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 %>
+
+ <%= 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(",") %>
+
diff --git a/config/locales/en.yml b/config/locales/en.yml
index cc583b2..9e6d763 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -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 Take Photo 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
diff --git a/config/locales/es.yml b/config/locales/es.yml
index 4737090..fc92aae 100644
--- a/config/locales/es.yml
+++ b/config/locales/es.yml
@@ -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 Take Photo 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)
diff --git a/db/migrate/20200625144713_add_second_guardian_fields_to_talent_releases.rb b/db/migrate/20200625144713_add_second_guardian_fields_to_talent_releases.rb
new file mode 100644
index 0000000..543c5c1
--- /dev/null
+++ b/db/migrate/20200625144713_add_second_guardian_fields_to_talent_releases.rb
@@ -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
diff --git a/db/structure.sql b/db/structure.sql
index 0a9c5d0..c124995 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -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');
diff --git a/spec/features/user_managing_broadcasts_spec.rb b/spec/features/user_managing_broadcasts_spec.rb
index ab3d71f..318697b 100644
--- a/spec/features/user_managing_broadcasts_spec.rb
+++ b/spec/features/user_managing_broadcasts_spec.rb
@@ -1,97 +1,138 @@
-require "rails_helper"
+# frozen_string_literal: true
-feature "User managing broadcasts" do
+require 'rails_helper'
+
+feature 'User managing broadcasts' do
let(:current_user) { create(:user, :manager) }
let(:project) { create(:project, members: current_user, account: current_user.primary_account) }
- context "managing broadcasts" do
+ context 'managing broadcasts' do
before do
sign_in current_user
- allow(MuxLiveStream).to receive(:new).and_return(double(id: "id", key: "key", playback_id: "playback_id"))
+ allow(MuxLiveStream).to receive(:new).and_return(double(id: 'id', key: 'key', playback_id: 'playback_id'))
end
- scenario "creating and deleting a broadcast", js: true do
+ scenario 'creating and deleting a broadcast', js: true do
visit new_project_broadcast_path(project)
- by "filling out the form" do
- fill_in broadcast_name_field, with: "My Broadcast"
+ by 'filling out the form' do
+ fill_in broadcast_name_field, with: 'My Broadcast'
end
- click_button "Create Live Stream"
- expect(page).to have_content("A live stream has been created")
- click_on "Manage"
- expect(page).to have_link("Copy Stream URL", exact: true)
- expect(page).to have_link("Copy Stream Key", exact: true)
- expect(page).to have_link("View", exact: true)
- expect(page).to have_link("Delete", exact: true)
+ click_button 'Create Live Stream'
+ expect(page).to have_content('A live stream has been created')
+ click_on 'Manage'
+ expect(page).to have_link('Copy Stream URL', exact: true)
+ expect(page).to have_link('Copy Stream Key', exact: true)
+ expect(page).to have_link('View', exact: true)
+ expect(page).to have_link('Delete', exact: true)
- it_also "Deletes the broadcast" do
+ it_also 'Deletes the broadcast' do
allow_any_instance_of(Broadcast).to receive(:destroy_mux_live_stream).and_return(true)
accept_alert do
- click_link "Delete"
+ click_link 'Delete'
end
-
- expect(page).to have_content("A live stream has been deleted")
- expect(page).not_to have_content("My Broadcast")
+
+ expect(page).to have_content('A live stream has been deleted')
+ expect(page).not_to have_content('My Broadcast')
end
end
- scenario "visit show page of broadcast", js: true do
+ scenario 'visit show page of broadcast', js: true do
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
recording = create(:broadcast_recording, broadcast: broadcast)
visit project_broadcast_path(project, broadcast)
- expect(page).to have_content("Live stream is waiting to begin.")
- expect(page).to have_content("Copy URL")
+ expect(page).to have_content('Live stream is waiting to begin.')
+ expect(page).to have_content('Copy URL')
- within "#files" do
- expect(page).to have_content("contract.pdf")
+ within '#files' do
+ expect(page).to have_content('contract.pdf')
end
- click_on "Previous Sessions"
+ click_on 'Previous Sessions'
expect(page).to have_content(recording.download_file_name)
end
- scenario "form will not submit if user clicks Add files without selected files", js: true do
+ scenario 'user can go back and forth between live session and previous sessions', js: true do
+ broadcast = create(:broadcast, :with_stream, :with_files, project: project)
+ recording = create(:broadcast_recording, broadcast: broadcast)
+
+ visit project_broadcast_path(project, broadcast)
+
+ expect(page).to have_content broadcast.name.titleize, count: 1
+ expect(page).to have_content recording.download_file_name, count: 0
+
+ click_on switch_view_dropdown
+ expect(page).to have_content broadcast.name.titleize, count: 2
+ expect(page).to have_content recording.download_file_name, count: 1
+
+ live_stream_nav_item = page.find('.dropdown-item', text: broadcast.name.titleize)
+ recording_nav_item = page.find('.dropdown-item', text: recording.download_file_name)
+
+ expect(live_stream_nav_item[:class].include?('active')).to eq true
+ expect(recording_nav_item[:class].include?('active')).to eq false
+
+ click_on recording.download_file_name
+
+ expect(page).to have_content broadcast.name.titleize, count: 1
+ expect(page).to have_content recording.download_file_name, count: 0
+ expect(live_stream_nav_item[:class].include?('active')).to eq false
+ expect(recording_nav_item[:class].include?('active')).to eq true
+
+ click_on switch_view_dropdown
+ click_on broadcast.name.titleize
+
+ expect(page).to have_content broadcast.name.titleize, count: 1
+ expect(page).to have_content recording.download_file_name, count: 0
+
+ # Page is reloaded, we need to get dropdown items again
+ live_stream_nav_item = page.find('.dropdown-item', text: broadcast.name.titleize, visible: :all)
+ recording_nav_item = page.find('.dropdown-item', text: recording.download_file_name, visible: :all)
+
+ expect(live_stream_nav_item[:class].include?('active')).to eq true
+ expect(recording_nav_item[:class].include?('active')).to eq false
+ end
+
+ scenario 'form will not submit if user clicks Add files without selected files', js: true do
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
visit project_broadcast_path(project, broadcast)
- expect(page).to have_content("Live stream is waiting to begin.")
+ expect(page).to have_content('Live stream is waiting to begin.')
expect(page).to have_content add_file_button
click_on add_file_button
end
- scenario "visit multi-view broadcast page", js: true do
- broadcast_one = create(:broadcast, :with_stream, :with_files, name: "Broadcast 1", project: project)
- broadcast_two = create(:broadcast, :with_stream, :with_files, name: "Broadcast 2", project: project)
-
+ scenario 'visit multi-view broadcast page', js: true do
+ broadcast_one = create(:broadcast, :with_stream, :with_files, name: 'Broadcast 1', project: project)
+ broadcast_two = create(:broadcast, :with_stream, :with_files, name: 'Broadcast 2', project: project)
+
visit project_broadcasts_path(project)
click_checkboxes
-
- new_window = window_opened_by { click_link "Multi-View" }
+
+ new_window = window_opened_by { click_link 'Multi-View' }
within_window new_window do
- expect(page).to have_content("Switch View")
+ expect(page).to have_content switch_view_dropdown
- click_on "Switch View"
- expect(page).to have_link("Broadcast 1")
- expect(page).to have_link("Broadcast 2")
+ click_on switch_view_dropdown
+ expect(page).to have_link('Broadcast 1')
+ expect(page).to have_link('Broadcast 2')
- within "#files" do
- click_on "Broadcast 1"
- expect(page).to have_content("contract.pdf")
+ within '#files' do
+ click_on 'Broadcast 1'
+ expect(page).to have_content('contract.pdf')
- click_on "Broadcast 2"
- expect(page).to have_content("contract.pdf")
+ click_on 'Broadcast 2'
+ expect(page).to have_content('contract.pdf')
end
- end
+ end
end
end
-
private
def add_file_button
@@ -99,11 +140,15 @@ feature "User managing broadcasts" do
end
def broadcast_name_field
- "broadcast[name]"
+ 'broadcast[name]'
end
def click_checkboxes
all('input[type="checkbox"]')[0].click
all('input[type="checkbox"]')[1].click
end
+
+ def switch_view_dropdown
+ 'Switch View'
+ end
end
diff --git a/spec/features/user_managing_talent_releases_spec.rb b/spec/features/user_managing_talent_releases_spec.rb
index 2464c84..6362a58 100644
--- a/spec/features/user_managing_talent_releases_spec.rb
+++ b/spec/features/user_managing_talent_releases_spec.rb
@@ -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
diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb
index 29e8eeb..2acceb7 100644
--- a/spec/models/account_spec.rb
+++ b/spec/models/account_spec.rb
@@ -133,7 +133,8 @@ RSpec.describe Account do
ZoomMeeting,
MedicalRelease,
MiscRelease,
- MatchingRequest
+ MatchingRequest,
+ ActionMailbox::InboundEmail # This is Rails model, we are not using it and it is NOT added to the Account#storage_total calculation
]
Rails.application.eager_load!
ActiveRecord::Base.descendants.each do |model|