Upstream sync

This commit is contained in:
Senad Uka
2020-06-30 05:07:43 +02:00
parent 8951667e61
commit dd0ac5b110
17 changed files with 605 additions and 190 deletions

View File

@@ -4,7 +4,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby "2.6.3" ruby "2.6.3"
# Bundle edge Rails instead: gem "rails", github: "rails/rails" # 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 # Use postgresql as the database for Active Record
gem "pg", "~> 0.18" gem "pg", "~> 0.18"
# Use Puma as the app server # Use Puma as the app server

View File

@@ -44,71 +44,71 @@ GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
Ascii85 (1.0.3) Ascii85 (1.0.3)
actioncable (6.0.0) actioncable (6.0.3.2)
actionpack (= 6.0.0) actionpack (= 6.0.3.2)
nio4r (~> 2.0) nio4r (~> 2.0)
websocket-driver (>= 0.6.1) websocket-driver (>= 0.6.1)
actionmailbox (6.0.0) actionmailbox (6.0.3.2)
actionpack (= 6.0.0) actionpack (= 6.0.3.2)
activejob (= 6.0.0) activejob (= 6.0.3.2)
activerecord (= 6.0.0) activerecord (= 6.0.3.2)
activestorage (= 6.0.0) activestorage (= 6.0.3.2)
activesupport (= 6.0.0) activesupport (= 6.0.3.2)
mail (>= 2.7.1) mail (>= 2.7.1)
actionmailer (6.0.0) actionmailer (6.0.3.2)
actionpack (= 6.0.0) actionpack (= 6.0.3.2)
actionview (= 6.0.0) actionview (= 6.0.3.2)
activejob (= 6.0.0) activejob (= 6.0.3.2)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
actionpack (6.0.0) actionpack (6.0.3.2)
actionview (= 6.0.0) actionview (= 6.0.3.2)
activesupport (= 6.0.0) activesupport (= 6.0.3.2)
rack (~> 2.0) rack (~> 2.0, >= 2.0.8)
rack-test (>= 0.6.3) rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.0.0) actiontext (6.0.3.2)
actionpack (= 6.0.0) actionpack (= 6.0.3.2)
activerecord (= 6.0.0) activerecord (= 6.0.3.2)
activestorage (= 6.0.0) activestorage (= 6.0.3.2)
activesupport (= 6.0.0) activesupport (= 6.0.3.2)
nokogiri (>= 1.8.5) nokogiri (>= 1.8.5)
actionview (6.0.0) actionview (6.0.3.2)
activesupport (= 6.0.0) activesupport (= 6.0.3.2)
builder (~> 3.1) builder (~> 3.1)
erubi (~> 1.4) erubi (~> 1.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0)
active_storage_base64 (1.0.0) active_storage_base64 (1.0.0)
rails (~> 6.0) rails (~> 6.0)
activejob (6.0.0) activejob (6.0.3.2)
activesupport (= 6.0.0) activesupport (= 6.0.3.2)
globalid (>= 0.3.6) globalid (>= 0.3.6)
activemodel (6.0.0) activemodel (6.0.3.2)
activesupport (= 6.0.0) activesupport (= 6.0.3.2)
activemodel-serializers-xml (1.0.2) activemodel-serializers-xml (1.0.2)
activemodel (> 5.x) activemodel (> 5.x)
activesupport (> 5.x) activesupport (> 5.x)
builder (~> 3.1) builder (~> 3.1)
activerecord (6.0.0) activerecord (6.0.3.2)
activemodel (= 6.0.0) activemodel (= 6.0.3.2)
activesupport (= 6.0.0) activesupport (= 6.0.3.2)
activeresource (5.1.0) activeresource (5.1.0)
activemodel (>= 5.0, < 7) activemodel (>= 5.0, < 7)
activemodel-serializers-xml (~> 1.0) activemodel-serializers-xml (~> 1.0)
activesupport (>= 5.0, < 7) activesupport (>= 5.0, < 7)
activestorage (6.0.0) activestorage (6.0.3.2)
actionpack (= 6.0.0) actionpack (= 6.0.3.2)
activejob (= 6.0.0) activejob (= 6.0.3.2)
activerecord (= 6.0.0) activerecord (= 6.0.3.2)
marcel (~> 0.3.1) marcel (~> 0.3.1)
activesupport (6.0.0) activesupport (6.0.3.2)
concurrent-ruby (~> 1.0, >= 1.0.2) concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2) i18n (>= 0.7, < 2)
minitest (~> 5.1) minitest (~> 5.1)
tzinfo (~> 1.1) tzinfo (~> 1.1)
zeitwerk (~> 2.1, >= 2.1.8) zeitwerk (~> 2.2, >= 2.2.2)
addressable (2.7.0) addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0) public_suffix (>= 2.0.2, < 5.0)
afm (0.2.2) afm (0.2.2)
@@ -181,7 +181,7 @@ GEM
coffee-script-source coffee-script-source
execjs execjs
coffee-script-source (1.12.2) coffee-script-source (1.12.2)
concurrent-ruby (1.1.5) concurrent-ruby (1.1.6)
connection_pool (2.2.2) connection_pool (2.2.2)
countries (2.1.4) countries (2.1.4)
i18n_data (~> 0.8.0) i18n_data (~> 0.8.0)
@@ -230,7 +230,7 @@ GEM
hubspot-ruby (0.9.0) hubspot-ruby (0.9.0)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
httparty (>= 0.10.0) httparty (>= 0.10.0)
i18n (1.8.2) i18n (1.8.3)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
i18n_data (0.8.0) i18n_data (0.8.0)
i18n_yaml_sorter (0.2.0) i18n_yaml_sorter (0.2.0)
@@ -270,22 +270,22 @@ GEM
ruby_dep (~> 1.2) ruby_dep (~> 1.2)
loaf (0.8.1) loaf (0.8.1)
rails (>= 3.2) rails (>= 3.2)
loofah (2.4.0) loofah (2.6.0)
crass (~> 1.0.2) crass (~> 1.0.2)
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
mail (2.7.1) mail (2.7.1)
mini_mime (>= 0.1.1) mini_mime (>= 0.1.1)
marcel (0.3.3) marcel (0.3.3)
mimemagic (~> 0.3.2) mimemagic (~> 0.3.2)
method_source (0.9.2) method_source (1.0.0)
mime-types (3.3) mime-types (3.3)
mime-types-data (~> 3.2015) mime-types-data (~> 3.2015)
mime-types-data (3.2019.0904) mime-types-data (3.2019.0904)
mimemagic (0.3.3) mimemagic (0.3.5)
mini_magick (4.9.5) mini_magick (4.9.5)
mini_mime (1.0.2) mini_mime (1.0.2)
mini_portile2 (2.4.0) mini_portile2 (2.4.0)
minitest (5.14.0) minitest (5.14.1)
monetize (1.9.2) monetize (1.9.2)
money (~> 6.12) money (~> 6.12)
money (6.13.4) money (6.13.4)
@@ -298,8 +298,8 @@ GEM
msgpack (1.3.1) msgpack (1.3.1)
multi_xml (0.6.0) multi_xml (0.6.0)
multipart-post (2.1.1) multipart-post (2.1.1)
nio4r (2.5.1) nio4r (2.5.2)
nokogiri (1.10.7) nokogiri (1.10.9)
mini_portile2 (~> 2.4.0) mini_portile2 (~> 2.4.0)
oath (1.1.0) oath (1.1.0)
bcrypt bcrypt
@@ -337,20 +337,20 @@ GEM
rack rack
rack-test (1.1.0) rack-test (1.1.0)
rack (>= 1.0, < 3) rack (>= 1.0, < 3)
rails (6.0.0) rails (6.0.3.2)
actioncable (= 6.0.0) actioncable (= 6.0.3.2)
actionmailbox (= 6.0.0) actionmailbox (= 6.0.3.2)
actionmailer (= 6.0.0) actionmailer (= 6.0.3.2)
actionpack (= 6.0.0) actionpack (= 6.0.3.2)
actiontext (= 6.0.0) actiontext (= 6.0.3.2)
actionview (= 6.0.0) actionview (= 6.0.3.2)
activejob (= 6.0.0) activejob (= 6.0.3.2)
activemodel (= 6.0.0) activemodel (= 6.0.3.2)
activerecord (= 6.0.0) activerecord (= 6.0.3.2)
activestorage (= 6.0.0) activestorage (= 6.0.3.2)
activesupport (= 6.0.0) activesupport (= 6.0.3.2)
bundler (>= 1.3.0) bundler (>= 1.3.0)
railties (= 6.0.0) railties (= 6.0.3.2)
sprockets-rails (>= 2.0.0) sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.4) rails-controller-testing (1.0.4)
actionpack (>= 5.0.1.x) actionpack (>= 5.0.1.x)
@@ -363,9 +363,9 @@ GEM
nokogiri (>= 1.6) nokogiri (>= 1.6)
rails-html-sanitizer (1.3.0) rails-html-sanitizer (1.3.0)
loofah (~> 2.3) loofah (~> 2.3)
railties (6.0.0) railties (6.0.3.2)
actionpack (= 6.0.0) actionpack (= 6.0.3.2)
activesupport (= 6.0.0) activesupport (= 6.0.3.2)
method_source method_source
rake (>= 0.8.7) rake (>= 0.8.7)
thor (>= 0.20.3, < 2.0) thor (>= 0.20.3, < 2.0)
@@ -469,7 +469,7 @@ GEM
turbolinks-source (5.2.0) turbolinks-source (5.2.0)
typhoeus (1.3.1) typhoeus (1.3.1)
ethon (>= 0.9.0) ethon (>= 0.9.0)
tzinfo (1.2.6) tzinfo (1.2.7)
thread_safe (~> 0.1) thread_safe (~> 0.1)
uglifier (4.1.20) uglifier (4.1.20)
execjs (>= 0.3.0, < 3) execjs (>= 0.3.0, < 3)
@@ -494,9 +494,9 @@ GEM
activesupport (>= 4.2) activesupport (>= 4.2)
rack-proxy (>= 0.6.1) rack-proxy (>= 0.6.1)
railties (>= 4.2) railties (>= 4.2)
websocket-driver (0.7.1) websocket-driver (0.7.2)
websocket-extensions (>= 0.1.0) websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.4) websocket-extensions (0.1.5)
will_paginate (3.2.1) will_paginate (3.2.1)
will_paginate-bootstrap4 (0.2.2) will_paginate-bootstrap4 (0.2.2)
will_paginate (~> 3.0, >= 3.0.0) will_paginate (~> 3.0, >= 3.0.0)
@@ -504,7 +504,7 @@ GEM
wkhtmltopdf-heroku (2.12.5.0) wkhtmltopdf-heroku (2.12.5.0)
xpath (3.2.0) xpath (3.2.0)
nokogiri (~> 1.8) nokogiri (~> 1.8)
zeitwerk (2.2.2) zeitwerk (2.3.1)
PLATFORMS PLATFORMS
ruby ruby
@@ -561,7 +561,7 @@ DEPENDENCIES
rack! rack!
rack-contrib (~> 2.0.1) rack-contrib (~> 2.0.1)
rack-cors rack-cors
rails (~> 6.0.0) rails (~> 6.0.3.1)
rails-controller-testing (~> 1.0.4) rails-controller-testing (~> 1.0.4)
rails-data-migrations (~> 1.2.0) rails-data-migrations (~> 1.2.0)
redcarpet (~> 3.4.0) redcarpet (~> 3.4.0)

View File

@@ -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('<i class="fa fa-check">&nbsp;</i>');
});

View File

@@ -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('<i class="fa fa-check">&nbsp;</i>');
});

View File

@@ -45,42 +45,59 @@ class Public::TalentReleasesController < Public::BaseController
.permit( .permit(
person_params, person_params,
guardian_params, guardian_params,
second_guardian_params,
:signature_base64, :signature_base64,
:locale, :locale,
:contract_template, :contract_template,
photos: [], photos: []
) )
end end
def person_params def person_params
[ %i[
:person_first_name, person_first_name
:person_last_name, person_last_name
:person_phone, person_phone
:person_email, person_email
:person_address_street1, person_address_street1
:person_address_street2, person_address_street2
:person_address_city, person_address_city
:person_address_state, person_address_state
:person_address_zip, person_address_zip
:person_address_country, person_address_country
] ]
end end
def guardian_params def guardian_params
[ %i[
:guardian_first_name, guardian_first_name
:guardian_last_name, guardian_last_name
:guardian_phone, guardian_phone
:guardian_email, guardian_email
:minor, minor
:guardian_address_street1, guardian_address_street1
:guardian_address_street2, guardian_address_street2
:guardian_address_city, guardian_address_city
:guardian_address_state, guardian_address_state
:guardian_address_zip, guardian_address_zip
:guardian_address_country, guardian_address_country
:guardian_photo, 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 end

View File

@@ -61,15 +61,67 @@ class TalentReleasesController < ApplicationController
end end
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 def talent_release_params
params.require(:talent_release).permit( params.require(:talent_release).permit(person_params,
:person_first_name, :person_last_name, :person_phone, :guardian_photo, :person_email, guardian_params,
:person_address_street1, :person_address_street2, :person_address_city, :person_address_state, :person_address_zip, :person_address_country, second_guardian_params,
:guardian_first_name, :guardian_last_name, :guardian_phone, :guardian_email, :minor, :contract, { photos: [] },
:guardian_address_street1, :guardian_address_street2, :guardian_address_city, :guardian_address_state, :guardian_address_zip, :guardian_address_country, :applicable_medium_id,
:contract, { photos: [] }, :applicable_medium_text,
:applicable_medium_id, :applicable_medium_text, :territory_id, :territory_text, :term_id, :term_text, :restriction_id, :restriction_text :territory_id,
) :territory_text,
:term_id,
:term_text,
:restriction_id,
:restriction_text)
end end
def build_talent_release(attrs = {}) def build_talent_release(attrs = {})

View File

@@ -11,7 +11,9 @@ class TalentRelease < ApplicationRecord
include Taggable include Taggable
include PersonName include PersonName
include GuardianPhotoable include GuardianPhotoable
include SecondGuardianPhotoable
include GuardianName include GuardianName
include SecondGuardianName
composed_of :person_address, composed_of :person_address,
class_name: "Address", class_name: "Address",
@@ -35,6 +37,17 @@ class TalentRelease < ApplicationRecord
%w(guardian_address_country country) %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 def self.face_photo_acceptable_content_types
["image/png", "image/jpeg"] ["image/png", "image/jpeg"]
end end
@@ -58,6 +71,7 @@ class TalentRelease < 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, :guardian_2_email, email: true, allow_blank: true
validates :guardian_phone, presence: true validates :guardian_phone, presence: true
end end
@@ -84,6 +98,10 @@ class TalentRelease < ApplicationRecord
false false
end end
def second_guardian_present?
guardian_2_first_name.present?
end
def contract_file_name def contract_file_name
"#{project.name.parameterize}_#{contract_template.release_type}_#{(signed_at || created_at).strftime("%Y.%m.%d")}_#{release_number}_#{filename_suffix.parameterize}" "#{project.name.parameterize}_#{contract_template.release_type}_#{(signed_at || created_at).strftime("%Y.%m.%d")}_#{release_number}_#{filename_suffix.parameterize}"
end end

View File

@@ -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" } %> <%= link_to "Switch View", "#", class: "btn btn-light border dropdown-toggle", role: "button", id: "dropdownMenuLink", data: { toggle: "dropdown" }, aria: { haspopup: "true", expanded: "false" } %>
<div class="dropdown-menu" aria-labelledby="dropdownMenuLink"> <div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
<h5 class="dropdown-header">Live Streams</h5> <h5 class="dropdown-header">Live Streams</h5>
<span class="dropdown-item active"><%= fa_icon("check", text: @broadcast.name.titleize) %></span> <%= link_to fa_icon("check", text: @broadcast.name.titleize), "#", class: "dropdown-item active" %>
<% @multi_view_broadcasts.each do |broadcast| %> <% @multi_view_broadcasts.each do |broadcast| %>
<% if broadcast.id != @broadcast.id %> <% if broadcast.id != @broadcast.id %>
<%= link_to broadcast.name.titleize, broadcast.url, class: class_string("dropdown-item", "active" => @broadcast.id == broadcast.id) %> <%= link_to broadcast.name.titleize, broadcast.url, class: class_string("dropdown-item", "active" => @broadcast.id == broadcast.id) %>
@@ -159,4 +159,4 @@
</div> </div>
</div> </div>
</div> </div>
<div> </div>

View File

@@ -31,8 +31,6 @@
<%= form.text_field :person_first_name, required: true, wrapper_class: "col-sm-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.text_field :person_last_name, required: true, wrapper_class: "col-sm-6" %>
<%= form.phone_field :person_phone, wrapper_class: "col-sm-6" %> <%= form.phone_field :person_phone, wrapper_class: "col-sm-6" %>
</div>
<div class="form-row">
<%= form.email_field :person_email, wrapper_class: "col-sm-6" %> <%= form.email_field :person_email, wrapper_class: "col-sm-6" %>
</div> </div>
<%= render "shared/address_fields", form: form, subject: "person" %> <%= 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_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.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.phone_field :guardian_phone, wrapper_class: "col-sm-6" %>
</div>
<div class="form-row">
<%= form.text_field :guardian_email, wrapper_class: "col-sm-6" %> <%= form.text_field :guardian_email, wrapper_class: "col-sm-6" %>
</div> </div>
<%= render "shared/address_fields", form: form, subject: "guardian" %> <%= render "shared/address_fields", form: form, subject: "guardian" %>
@@ -87,6 +83,48 @@
</div> </div>
<% end %> <% end %>
<hr>
<%= card_field_set_tag t(".guardian_2_info.heading") do %>
<div class="form-row">
<%= form.text_field :guardian_2_first_name, wrapper_class: "col-sm-3" %>
<%= form.text_field :guardian_2_last_name, wrapper_class: "col-sm-3" %>
<%= form.phone_field :guardian_2_phone, wrapper_class: "col-sm-6" %>
<%= form.text_field :guardian_2_email, wrapper_class: "col-sm-6" %>
</div>
<%= render "shared/address_fields", form: form, subject: "guardian_2" %>
<% end %>
<hr>
<%= card_field_set_tag t(".guardian_2_photo.heading") do %>
<div class="alert alert-warning font-weight-bold"><%= t ".guardian_2_photo.instructions" %></div>
<div class="text-center">
<div class="d-inline-block mb-2" data-behavior="guardian-photo-preview" data-file-input="[data-ujs-target=guardian-2-photo-input]">
<div class="align-items-center d-flex photo-preview img-thumbnail justify-content-center">
<span><%= t ".guardian_2_photo.no_photo" %></span>
</div>
</div>
<div class="d-inline-block text-left">
<% 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 %>
<div class="hidden-file-input">
<%= 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 %>
</div>
<%= 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]" } %>
</div>
<p class="p-2 font-weight-bold">
<%= fa_icon "arrow-up", text: t(".guardian_2_photo.camera_instructions_html") %><br>
<small class="text-muted"><%= t ".guardian_2_photo.warning" %></small>
</p>
</div>
<% end %>
<hr>
</div> </div>
<hr> <hr>

View File

@@ -9,22 +9,30 @@
<%= form.text_field :person_first_name, required: true, wrapper_class: "col-sm-3" %> <%= 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.text_field :person_last_name, required: true, wrapper_class: "col-sm-3" %>
<%= form.phone_field :person_phone, wrapper_class: "col-sm-6" %> <%= form.phone_field :person_phone, wrapper_class: "col-sm-6" %>
</div>
<div class="form-row">
<%= form.email_field :person_email, wrapper_class: "col-sm-6" %> <%= form.email_field :person_email, wrapper_class: "col-sm-6" %>
</div> </div>
<%= render "shared/address_fields", form: form, subject: "person" %> <%= render "shared/address_fields", form: form, subject: "person" %>
<div class="<%= class_string("collapse" => !talent_release.minor?) %>" data-ujs-target="guardian-fields"> <div class="<%= class_string("collapse" => !talent_release.minor?) %>" data-ujs-target="guardian-fields">
<div class="form-row"> <%= card_field_set_tag t(".guardian_info.heading") do %>
<%= form.text_field :guardian_first_name, required: talent_release.minor?, wrapper_class: "col-sm-3" %> <div class="form-row">
<%= form.text_field :guardian_last_name, required: talent_release.minor?, wrapper_class: "col-sm-3" %> <%= form.text_field :guardian_first_name, required: talent_release.minor?, wrapper_class: "col-sm-3" %>
<%= form.phone_field :guardian_phone, wrapper_class: "col-sm-6" %> <%= form.text_field :guardian_last_name, required: talent_release.minor?, wrapper_class: "col-sm-3" %>
</div> <%= form.phone_field :guardian_phone, wrapper_class: "col-sm-6" %>
<div class="form-row"> <%= form.text_field :guardian_email, wrapper_class: "col-sm-6" %>
<%= form.text_field :guardian_email, wrapper_class: "col-sm-6" %> </div>
</div> <%= render "shared/address_fields", form: form, subject: "guardian" %>
<%= render "shared/address_fields", form: form, subject: "guardian" %> <% end %>
<%= card_field_set_tag t(".guardian_2_info.heading") do %>
<div class="form-row">
<%= 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" %>
</div>
<%= render "shared/address_fields", form: form, subject: "guardian_2" %>
<% end %>
</div> </div>
<% end %> <% end %>
@@ -44,20 +52,36 @@
<br> <br>
<div class="text-left"> <div class="text-left">
<p><%= t(".photos.guardian_photo.heading") %></p> <p><%= t(".photos.guardian_photo.heading") %></p>
<div class="d-inline-block mb-2" data-behavior="guardian-photo-preview" data-file-input="[data-ujs-target=guardian-photo-input]"> <div id="guardian-photo-preview" class="d-inline-block mb-2" data-behavior="guardian-photo-preview" data-file-input="[data-ujs-target=guardian-photo-input]">
<div class="align-items-center d-flex photo-preview img-thumbnail justify-content-center"> <div class="align-items-center d-flex photo-preview img-thumbnail justify-content-center">
<span>No photo yet</span> <span>No photo yet</span>
</div> </div>
</div> </div>
<% if talent_release.guardian_photo.attached? %> <% if talent_release.guardian_photo.attached? %>
<%= javascript_tag nonce: true do %> <%= 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 %>
<% end %> <% end %>
<div class="d-inline-block"> <div class="d-inline-block">
<%= form.hidden_field :guardian_photo, value: form.object.guardian_photo.signed_id if talent_release.guardian_photo.attached?%> <%= 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(",") %> <%= 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(",") %>
</div> </div>
<p><%= t(".photos.guardian_2_photo.heading") %></p>
<div id="guardian-2-photo-preview" class="d-inline-block mb-2" data-behavior="guardian-photo-preview" data-file-input="[data-ujs-target=guardian-2-photo-input]">
<div class="align-items-center d-flex photo-preview img-thumbnail justify-content-center">
<span>No photo yet</span>
</div>
</div>
<% if 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 %>
<div class="d-inline-block">
<%= 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(",") %>
</div>
</div> </div>
<hr> <hr>
</div> </div>

View File

@@ -458,6 +458,16 @@ en:
project: project:
predefined_client_name: Client predefined_client_name: Client
talent_release: 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_city: City
guardian_address_country: Guardian country guardian_address_country: Guardian country
guardian_address_state: State guardian_address_state: State
@@ -1011,6 +1021,16 @@ en:
notice: Your release has been signed. Thank you! notice: Your release has been signed. Thank you!
new: new:
cancel: Cancel cancel: Cancel
guardian_2_info:
heading: Second Guardian Information (if company requires)
guardian_2_photo:
camera_instructions_html: Click <em>Take Photo</em> 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: guardian_clause:
heading: Guardian Clause heading: Guardian Clause
guardian_info: guardian_info:
@@ -1111,7 +1131,13 @@ en:
form: form:
contract_and_rights: contract_and_rights:
heading: 2 of 3 Contract & Exploitable Rights heading: 2 of 3 Contract & Exploitable Rights
guardian_2_info:
heading: Guardian Information (if company requires)
guardian_info:
heading: Guardian Information
photos: photos:
guardian_2_photo:
heading: Second Guardian Photo
guardian_photo: guardian_photo:
heading: Guardian Photo heading: Guardian Photo
heading: 3 of 3 Photos heading: 3 of 3 Photos

View File

@@ -194,6 +194,36 @@ es:
name: Nómbre del proyecto de vídeo name: Nómbre del proyecto de vídeo
producer_address: Dirección del productor producer_address: Dirección del productor
producer_name: Nómbre 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: placeholder:
appearance_release: appearance_release:
person_address: Calle, Número de apartamento, Ciudad, Estado, Código Postal 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 warning: Si su foto aparece de lado, se corregirá automáticamente cuando actualizar la autorización
talent_releases: talent_releases:
new: 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: guardian_clause:
heading: Guardian Clause (ES) heading: Guardian Clause (ES)
guardian_info:
heading: ""
guardian_photo: guardian_photo:
camera_instructions_html: (ES) Click <em>Take Photo</em> to Turn ON Camera (ES) camera_instructions_html: (ES) Click <em>Take Photo</em> to Turn ON Camera (ES)
heading: Guardian Photo (ES) heading: Guardian Photo (ES)
@@ -290,6 +331,8 @@ es:
no_photo: No hay foto todavía no_photo: No hay foto todavía
take_photo: Take Photo (ES) take_photo: Take Photo (ES)
warning: (ES) If your photo appears sideways, it will be autocorrected when you submit your release. (ES) warning: (ES) If your photo appears sideways, it will be autocorrected when you submit your release. (ES)
photo:
heading: Photos (ES)
teams: teams:
show: show:
choose_project: ¿Qué proyecto de la lista de abajo asistirá? choose_project: ¿Qué proyecto de la lista de abajo asistirá?
@@ -298,6 +341,12 @@ es:
print: Print (ES) print: Print (ES)
talent_releases: talent_releases:
form: form:
guardian_2_info:
heading: Guardian Information (if company requires) (ES)
guardian_info:
heading: Guardian Information (ES)
photos: photos:
guardian_2_photo:
heading: Second Guardian Photo (ES)
guardian_photo: guardian_photo:
heading: Guardian Photo (ES) heading: Guardian Photo (ES)

View File

@@ -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

View File

@@ -1503,7 +1503,17 @@ CREATE TABLE public.talent_releases (
person_first_name character varying, person_first_name character varying,
person_last_name character varying, person_last_name character varying,
guardian_first_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'), ('20200619081446'),
('20200619085823'), ('20200619085823'),
('20200619134853'), ('20200619134853'),
('20200622180507'); ('20200622180507'),
('20200625144713');

View File

@@ -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(:current_user) { create(:user, :manager) }
let(:project) { create(:project, members: current_user, account: current_user.primary_account) } let(:project) { create(:project, members: current_user, account: current_user.primary_account) }
context "managing broadcasts" do context 'managing broadcasts' do
before do before do
sign_in current_user 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 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) visit new_project_broadcast_path(project)
by "filling out the form" do by 'filling out the form' do
fill_in broadcast_name_field, with: "My Broadcast" fill_in broadcast_name_field, with: 'My Broadcast'
end end
click_button "Create Live Stream" click_button 'Create Live Stream'
expect(page).to have_content("A live stream has been created") expect(page).to have_content('A live stream has been created')
click_on "Manage" click_on 'Manage'
expect(page).to have_link("Copy Stream URL", exact: true) 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('Copy Stream Key', exact: true)
expect(page).to have_link("View", exact: true) expect(page).to have_link('View', exact: true)
expect(page).to have_link("Delete", 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) allow_any_instance_of(Broadcast).to receive(:destroy_mux_live_stream).and_return(true)
accept_alert do accept_alert do
click_link "Delete" click_link 'Delete'
end end
expect(page).to have_content("A live stream has been deleted") expect(page).to have_content('A live stream has been deleted')
expect(page).not_to have_content("My Broadcast") expect(page).not_to have_content('My Broadcast')
end end
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) broadcast = create(:broadcast, :with_stream, :with_files, project: project)
recording = create(:broadcast_recording, broadcast: broadcast) recording = create(:broadcast_recording, broadcast: broadcast)
visit project_broadcast_path(project, broadcast) 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("Copy URL") expect(page).to have_content('Copy URL')
within "#files" do within '#files' do
expect(page).to have_content("contract.pdf") expect(page).to have_content('contract.pdf')
end end
click_on "Previous Sessions" click_on 'Previous Sessions'
expect(page).to have_content(recording.download_file_name) expect(page).to have_content(recording.download_file_name)
end 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) broadcast = create(:broadcast, :with_stream, :with_files, project: project)
visit project_broadcast_path(project, broadcast) 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 expect(page).to have_content add_file_button
click_on add_file_button click_on add_file_button
end end
scenario "visit multi-view broadcast page", js: true do scenario 'visit multi-view broadcast page', js: true do
broadcast_one = create(:broadcast, :with_stream, :with_files, name: "Broadcast 1", project: project) 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) broadcast_two = create(:broadcast, :with_stream, :with_files, name: 'Broadcast 2', project: project)
visit project_broadcasts_path(project) visit project_broadcasts_path(project)
click_checkboxes 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 within_window new_window do
expect(page).to have_content("Switch View") expect(page).to have_content switch_view_dropdown
click_on "Switch View" click_on switch_view_dropdown
expect(page).to have_link("Broadcast 1") expect(page).to have_link('Broadcast 1')
expect(page).to have_link("Broadcast 2") expect(page).to have_link('Broadcast 2')
within "#files" do within '#files' do
click_on "Broadcast 1" click_on 'Broadcast 1'
expect(page).to have_content("contract.pdf") expect(page).to have_content('contract.pdf')
click_on "Broadcast 2" click_on 'Broadcast 2'
expect(page).to have_content("contract.pdf") expect(page).to have_content('contract.pdf')
end end
end end
end end
end end
private private
def add_file_button def add_file_button
@@ -99,11 +140,15 @@ feature "User managing broadcasts" do
end end
def broadcast_name_field def broadcast_name_field
"broadcast[name]" 'broadcast[name]'
end end
def click_checkboxes def click_checkboxes
all('input[type="checkbox"]')[0].click all('input[type="checkbox"]')[0].click
all('input[type="checkbox"]')[1].click all('input[type="checkbox"]')[1].click
end end
def switch_view_dropdown
'Switch View'
end
end end

View File

@@ -62,6 +62,47 @@ feature "User managing talent releases" do
expect(page).to have_content("Your release was successfully submitted. Thank you.") expect(page).to have_content("Your release was successfully submitted. Thank you.")
end 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 end
context "when signed in" do context "when signed in" do
@@ -125,6 +166,43 @@ feature "User managing talent releases" do
expect(page).to have_photo("person_photo.png") expect(page).to have_photo("person_photo.png")
end 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 scenario "updating an existing release" do
talent_release = create(:talent_release, project: project) talent_release = create(:talent_release, project: project)
@@ -301,6 +379,14 @@ feature "User managing talent releases" do
"Guardian last name" "Guardian last name"
end 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 def guardian_phone_field
"Guardian phone" "Guardian phone"
end end
@@ -309,6 +395,10 @@ feature "User managing talent releases" do
"talent_release[guardian_photo]" "talent_release[guardian_photo]"
end end
def guardian_2_photo_field
"talent_release[guardian_2_photo]"
end
def have_photo_button def have_photo_button
have_selector(".take-photo-button") have_selector(".take-photo-button")
end end
@@ -387,4 +477,32 @@ feature "User managing talent releases" do
select "Other", from: "Restriction" select "Other", from: "Restriction"
fill_in "Describe other restrictions", with: "Test" fill_in "Describe other restrictions", with: "Test"
end 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 end

View File

@@ -133,7 +133,8 @@ RSpec.describe Account do
ZoomMeeting, ZoomMeeting,
MedicalRelease, MedicalRelease,
MiscRelease, 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! Rails.application.eager_load!
ActiveRecord::Base.descendants.each do |model| ActiveRecord::Base.descendants.each do |model|