Compare commits

..

5 Commits

Author SHA1 Message Date
Senad Uka
eb7f8f1a43 Initial teams commit 2020-08-06 16:57:39 +00:00
Senad Uka
190ff2854b Upstream sync 2020-08-06 16:56:40 +00:00
Senad Uka
8214ba9e67 Changes 2020-08-03 21:52:04 +00:00
Senad Uka
9cbd8d31a8 Upstream sync 2020-07-29 05:15:02 +00:00
Senad Uka
9c3fac4ab9 Upstream sync 2020-07-27 10:17:56 +00:00
35 changed files with 1045 additions and 97 deletions

View File

@@ -16,9 +16,10 @@ REDIS_URL=
# Required for Zoom.us integration
ZOOM_API_KEY=
ZOOM_API_SECRET=
ZOOM_ACCOUNT_NUMBER=
ZOOM_PRO_USERS_LIMIT= # defaults to 3
ZOOM_USER_TYPE= # 'pro' / 'basic'
ZOOM_ENABLE_RECORDINGS=0 # 0 / 1
ZOOM_ENABLE_RECORDINGS= # true / false (default: false)
# Token for webhooks authorization
ZOOM_VERIFICATION_TOKEN=

View File

@@ -139,6 +139,10 @@ gem 'rack-cors'
# Ruby wrappers for the HubSpot REST API
gem "hubspot-ruby"
# authenticate via Microsoft
# gem 'omniauth-microsoft_graph', git: 'https://github.com/m4c3/omniauth-microsoft_graph'
gem 'omniauth-microsoft_graph'
group :development, :test, :review do
# Call "byebug" anywhere in the code to stop execution and get a debugger console
gem "byebug", "~> 11.0.1", platforms: [:mri, :mingw, :x64_mingw]

View File

@@ -220,6 +220,7 @@ GEM
activesupport (>= 4.2.0)
hashdiff (1.0.1)
hashery (2.1.2)
hashie (4.1.0)
hexapdf (0.9.3)
cmdparse (~> 3.0, >= 3.0.3)
geom2d (~> 0.2)
@@ -297,6 +298,7 @@ GEM
money (~> 6.13.2)
railties (>= 3.0)
msgpack (1.3.1)
multi_json (1.15.0)
multi_xml (0.6.0)
multipart-post (2.1.1)
nio4r (2.5.2)
@@ -308,6 +310,21 @@ GEM
warden
oath-generators (1.0.1)
oath (>= 0.0.12)
oauth2 (1.4.4)
faraday (>= 0.8, < 2.0)
jwt (>= 1.0, < 3.0)
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (>= 1.2, < 3)
omniauth (1.9.1)
hashie (>= 3.4.6)
rack (>= 1.6.2, < 3)
omniauth-microsoft_graph (0.3.3)
omniauth (~> 1.1, >= 1.1.1)
omniauth-oauth2 (~> 1.6)
omniauth-oauth2 (1.6.0)
oauth2 (~> 1.1)
omniauth (~> 1.9)
parallel (1.19.1)
parity (3.2.0)
parser (2.6.5.0)
@@ -552,6 +569,7 @@ DEPENDENCIES
mux_ruby!
oath (~> 1.1.0)
oath-generators (~> 1.0.1)
omniauth-microsoft_graph
parity (~> 3.2.0)
pdf-reader (~> 2.1.0)
pdfkit (~> 0.8.2)

View File

@@ -21,10 +21,11 @@ $(document).on "turbolinks:load", ->
refreshBroadcastVideo: (data) ->
$("#broadcast_updates").html data.status_content
stream_selected = $("#broadcast_video").attr('video-type') == 'stream';
stream_selected = $("#broadcast_video").data('videoType') == 'stream';
if data.streamer_status == 'recording' && data.status == 'active' && stream_selected
$("#broadcast_video").html data.video_content
new (Clappr.Player)(
<%= "baseUrl: 'http://cdn.clappr.io/latest'," if Rails.env.test? %>
parentId: '#broadcast_video'
source: data.full_live_stream_playback_url
width: '100%',

View File

@@ -3,7 +3,7 @@ $(document).on("click", "[data-behavior=play_recording]", function() {
return false;
}
$("#broadcast_video").attr('video-type', 'recording');
$("#broadcast_video").data('videoType', 'recording');
var playback_url = $(this).attr("data-playback-url")
$("#broadcast_video").empty();
@@ -25,4 +25,4 @@ $(document).on("click", "[data-behavior=play_recording]", function() {
$(this).prepend('<i class="fa fa-check">&nbsp;</i>');
});
$(document).on("click", "[data-behavior=play_stream]", function() { $("#broadcast_video").attr('video-type', 'stream'); });
$(document).on("click", "[data-behavior=play_stream]", function() { $("#broadcast_video").data('videoType', 'stream'); });

View File

@@ -56,35 +56,74 @@ class AcquiredMediaReleasesController < ApplicationController
end
end
def person_params
%i[
person_first_name
person_last_name
person_phone
person_company
person_email
person_title
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
guardian_photo
guardian_address_street1
guardian_address_street2
guardian_address_city
guardian_address_state
guardian_address_zip
guardian_address_country
]
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 acquired_media_release_params
params.require(:acquired_media_release).permit(
:name,
:territory,
:term,
:person_first_name,
:person_last_name,
:person_phone,
:person_email,
:person_company,
:person_title,
:person_address_street1,
:person_address_street2,
:person_address_city,
:person_address_state,
:person_address_zip,
:person_address_country,
:contract,
:applicable_medium_id, :applicable_medium_text,
:territory_id, :territory_text,
:term_id, :term_text,
:restriction_id, :restriction_text,
categories: [],
file_infos_attributes: [
:filename,
:content_type,
:byte_size
]
)
params.require(:acquired_media_release).permit(person_params,
guardian_params,
second_guardian_params,
:minor,
:name,
:territory,
:term,
:contract,
:applicable_medium_id, :applicable_medium_text,
:territory_id, :territory_text,
:term_id, :term_text,
:restriction_id, :restriction_text,
categories: [],
file_infos_attributes: %i[
filename
content_type
byte_size
])
end
def build_acquired_media_release(attrs = {})

View File

@@ -3,7 +3,7 @@ class BroadcastsController < ApplicationController
before_action :set_project
before_action :build_broadcast, only: [:new, :create]
before_action :set_broadcast, only: [:show, :destroy, :update]
before_action :set_broadcast, only: [:show, :destroy, :update, :destroy_file]
before_action :set_multi_view_broadcasts, only: [:show]
before_action :show_splash_screen, only: :index
@@ -39,10 +39,7 @@ class BroadcastsController < ApplicationController
end
@broadcast.update(broadcast_params)
@files = @broadcast.files.order("created_at DESC").paginate(page: 1)
pagination_content = ApplicationController.render html: helpers.will_paginate(@files, params: { active_tab: params[:active_tab], page: params[:page], active_files_tab: params[:active_files_tab] })
BroadcastsChannel.broadcast_file_upload_updates(@broadcast, @files, pagination_content)
update_files_section
end
def destroy
@@ -53,8 +50,23 @@ class BroadcastsController < ApplicationController
end
end
def destroy_file
authorize Broadcast
file = ActiveStorage::Attachment.find(params[:file_id])
file.destroy
update_files_section
end
private
def update_files_section
@files = @broadcast.files.order("created_at DESC").paginate(page: 1)
pagination_content = ApplicationController.render html: helpers.will_paginate(@files, params: { active_tab: params[:active_tab], page: params[:page], active_files_tab: params[:active_files_tab] })
BroadcastsChannel.broadcast_file_upload_updates(@broadcast, @files, pagination_content)
end
def show_splash_screen
render :splash if broadcasts.count.zero?
end

View File

@@ -0,0 +1,10 @@
class CallbacksController < ApplicationController
skip_before_action :require_login
skip_after_action :verify_authorized, except: :index
skip_after_action :verify_policy_scoped, only: :index
skip_before_action :verify_authenticity_token
def create
render plain: params.inspect
end
end

View File

@@ -41,31 +41,70 @@ class Public::AcquiredMediaReleasesController < Public::BaseController
end
end
def person_params
%i[
person_first_name
person_last_name
person_phone
person_fax
person_email
person_title
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
guardian_photo
guardian_address_street1
guardian_address_street2
guardian_address_city
guardian_address_state
guardian_address_zip
guardian_address_country
]
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 acquired_media_release_params
params.require(:acquired_media_release).permit(
:name,
:description,
:person_first_name,
:person_last_name,
:person_email,
:person_title,
:person_phone,
:person_fax,
:person_address_street1,
:person_address_street2,
:person_address_city,
:person_address_state,
:person_address_zip,
:person_address_country,
:signature_base64,
:locale, :contract_template,
categories: [],
file_infos_attributes: [
:filename,
:content_type,
:byte_size
]
)
params.require(:acquired_media_release).permit(person_params,
guardian_params,
second_guardian_params,
:minor,
:name,
:description,
:signature_base64,
:locale, :contract_template,
categories: [],
file_infos_attributes: %i[
filename
content_type
byte_size
])
end
def acquired_media_release_params_with_locale

View File

@@ -11,6 +11,10 @@ class AcquiredMediaRelease < ApplicationRecord
include PersonName
include CsvExportable
include Approvable
include GuardianPhotoable
include SecondGuardianPhotoable
include GuardianName
include SecondGuardianName
class << self
def custom_csv_exportable_headers
@@ -33,6 +37,38 @@ class AcquiredMediaRelease < ApplicationRecord
%w(person_address_country country)
]
composed_of :guardian_address,
class_name: 'Address',
mapping: [
%w[guardian_address_street1 street1],
%w[guardian_address_street2 street2],
%w[guardian_address_city city],
%w[guardian_address_state state],
%w[guardian_address_zip zip],
%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]
]
# We don't care for the argument but method WILL receive option name
# when called from inside with_option block, hence * argument
def self.face_photo_acceptable_content_types(*)
['image/png', 'image/jpeg']
end
def self.acceptable_import_file_extensions
['.png', '.jpeg', '.jpg', '.pdf']
end
validates :name, presence: true
validates :person_email, email: true, allow_blank: true
@@ -54,8 +90,8 @@ class AcquiredMediaRelease < ApplicationRecord
# CATEGORIES = ["Artwork", "Film Footage", "Video Footage", "Still Photograph"].freeze
CATEGORIES = ["Film Footage", "Video Footage", "Still Photograph"].freeze
def minor?
false
def second_guardian_present?
guardian_2_first_name.present?
end
def contact_person

View File

@@ -15,7 +15,7 @@ class AppHost
end
def domain_with_port
[domain, port].compact.join(":")
[domain, port].reject(&:blank?).compact.join(":")
end
def protocol

View File

@@ -18,4 +18,12 @@ class BroadcastPolicy < ApplicationPolicy
def update?
true
end
def destroy_file?
if user.nil? || user.user.nil?
return false
end
user.manager? || user.account_manager?
end
end

View File

@@ -1,6 +1,10 @@
<%= errors_summary_for acquired_media_release %>
<%= bootstrap_form_with model: model, local: true do |form| %>
<%= field_set_tag content_tag(:span, t(".acquired_media_details.heading"), class: "h6 text-muted text-uppercase") do %>
<%= form.form_group :minor do %>
<%= form.check_box :minor, label: t("helpers.label.talent_release.minor"), data: { target: "[data-ujs-target=guardian-fields]", toggle: "collapse" } %>
<% end %>
<div class="form-row">
<%= form.text_field :name, required: true, wrapper_class: "col-12" %>
</div>
@@ -9,6 +13,28 @@
<%= form.check_box :categories, { multiple: true, label: category }, category, false %>
<% end %>
<% end %>
<div class="<%= class_string("collapse" => !acquired_media_release.minor?) %>" data-ujs-target="guardian-fields">
<%= card_field_set_tag t(".guardian_info.heading") do %>
<div class="form-row">
<%= form.text_field :guardian_first_name, required: acquired_media_release.minor?, wrapper_class: "col-sm-3" %>
<%= form.text_field :guardian_last_name, required: acquired_media_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" %>
</div>
<%= 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, 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 %>
</div>
<% end %>
<hr>
@@ -19,6 +45,44 @@
<strong>For optimal accuracy, please ensure video file names and photo file names match the source file name in the editing sequence.</strong>
</div>
<%= render "shared/file_infos_dropzone", form: form, releasable: acquired_media_release %>
<div class="<%= class_string("collapse" => !acquired_media_release.minor?) %>" data-ujs-target="guardian-fields">
<br>
<div class="text-left">
<p><%= t(".photos.guardian_photo.heading") %></p>
<div id="guardian-photo-preview" class="d-inline-block mb-2" data-behavior="guardian-photo-preview" data-file-input="[data-ujs-target=guardian-photo-input]">
<div class="align-items-center d-flex photo-preview img-thumbnail justify-content-center">
<span>No photo yet</span>
</div>
</div>
<% if acquired_media_release.guardian_photo.attached? %>
<%= javascript_tag nonce: true do %>
App.PhotoPreview.set("#guardian-photo-preview", "<%= url_for(acquired_media_release.guardian_photo.variant(auto_orient: true, resize: '200x200')) %>");
<% end %>
<% end %>
<div class="d-inline-block">
<%= form.hidden_field :guardian_photo, value: form.object.guardian_photo.signed_id if acquired_media_release.guardian_photo.attached?%>
<%= form.file_field :guardian_photo, hide_label: true, data: { ujs_target: "guardian-photo-input" }, help: "PNG or JPG only", accept: acquired_media_release.class.face_photo_acceptable_content_types.join(",") %>
</div>
<p><%= t(".photos.guardian_2_photo.heading") %></p>
<div id="guardian-2-photo-preview" class="d-inline-block mb-2" data-behavior="guardian-photo-preview" data-file-input="[data-ujs-target=guardian-2-photo-input]">
<div class="align-items-center d-flex photo-preview img-thumbnail justify-content-center">
<span>No photo yet</span>
</div>
</div>
<% if acquired_media_release.guardian_2_photo.attached? %>
<%= javascript_tag nonce: true do %>
App.PhotoPreview.set("#guardian-2-photo-preview", "<%= url_for(acquired_media_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 acquired_media_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: acquired_media_release.class.face_photo_acceptable_content_types.join(",") %>
</div>
</div>
<hr>
</div>
<% end %>
<hr>

View File

@@ -1,12 +1,25 @@
<li class="my-2" id="<%= dom_id(file) %>">
<% if file.variable? %>
<%= link_to image_tag(file.variant(resize_and_pad: [300, 300, background: "#F7F8F9"]), class: "bg-light img-thumbnail img-fluid"), file, target: "_blank" %>
<% else %>
<div class="border rounded bg-light text-muted d-flex justify-content-center align-items-center fix-h-and-w">
<%= link_to file, target: "_blank" do %>
<%= fa_icon("file", style: "font-size: 2rem") %>
<div class="mt-2"><%= file.filename %></div>
<div class="row">
<% broadcast = file.record %>
<% show_delete = controller.class.module_parent.to_s == "Public" ? false : policy(broadcast).destroy_file? %>
<% file_class = show_delete ? "col-8" : "col-12" %>
<div class="<%= file_class %>">
<li class="my-2" id="<%= dom_id(file) %>">
<% if file.variable? %>
<%= link_to image_tag(file.variant(resize_and_pad: [300, 300, background: "#F7F8F9"]), class: "bg-light img-thumbnail img-fluid"), file, target: "_blank" %>
<% else %>
<div class="border rounded bg-light text-muted d-flex justify-content-center align-items-center img-fluid fix-h-and-w">
<%= link_to file, target: "_blank" do %>
<%= fa_icon("file", style: "font-size: 2rem") %>
<div class="mt-2"><%= file.filename %></div>
<% end %>
</div>
<% end %>
</li>
</div>
<% if show_delete %>
<div class="col-4 align-self-center p-0 m-0">
<% url = url_for [:destroy_file, broadcast.project, broadcast, { file_id: file.id }] %>
<%= link_to fa_icon("trash fw", text: t('.actions.delete_file')), url, class: "btn btn-danger", remote: true, method: :delete, data: { confirm: t('.confirm_delete') } %>
</div>
<% end %>
</li>
</div>

View File

@@ -1,7 +1,7 @@
<% if broadcast.streamer_recording? && broadcast.active? %>
<div id="broadcast_video" class="embed-responsive-item"></div>
<div id="broadcast_video" class="embed-responsive-item" data-video-type="stream"></div>
<% else %>
<div id="broadcast_video" class="embed-responsive-item">
<div id="broadcast_video" class="embed-responsive-item" data-video-type="stream">
<table class="w-100 h-100 bg-secondary">
<tbody>
<tr>

View File

@@ -2,7 +2,7 @@
<%= field_set_tag content_tag(:span, t(".release_info.heading"), class: "h6 text-muted text-uppercase") do %>
<div class="form-row">
<%= form.text_field :name, wrapper_class: "col-sm-6" %>
<%= form.select :release_type, options_for_release_type_select(project, @release_type), { wrapper_class: "col-sm-6" }, data: { toggle: "collapse-select", target_show_values_mapping: { "#guardian_clause": %w(appearance talent misc medical), "#fee_field": %w(appearance talent location material acquired_media), "#exploitable_rights_fields": %w(appearance talent location material acquired_media), "#custom_fields": %w(medical misc), "#amendment_clause": %w(location) } }, class: "form-control custom-select" %>
<%= form.select :release_type, options_for_release_type_select(project, @release_type), { wrapper_class: "col-sm-6" }, data: { toggle: "collapse-select", target_show_values_mapping: { "#guardian_clause": %w(acquired_media appearance talent misc medical), "#fee_field": %w(appearance talent location material acquired_media), "#exploitable_rights_fields": %w(appearance talent location material acquired_media), "#custom_fields": %w(medical misc), "#amendment_clause": %w(location) } }, class: "form-control custom-select" %>
</div>
<div class="form-row mb-3">
<%= form.radio_button :accessibility, :public_template, label: "Public", wrapper_class: "mr-3" %>

View File

@@ -6,7 +6,8 @@
<%= link_to t(".actions.book_demo"), 'https://meetings.hubspot.com/bray2', class: "btn btn-primary border align-self-center h-50 ml-auto mr-2 pb-2", target: '_blank' %>
<% if policy(ContractTemplate).new? %>
<%= link_to t(".actions.create_template"), [:new, @project, :contract_template], class: "btn btn-success border align-self-center h-50 pb-2" %>
<%= link_to t(".actions.create_template"), [:new, @project, :contract_template], class: "btn btn-success border align-self-center h-50 mr-2 pb-2" %>
<%= link_to t(".actions.import_template"), [:new, @project, :release_template_imports], class: "btn btn-light border align-self-center h-50 pb-2" %>
<% end %>
</div>
@@ -47,4 +48,4 @@
</div>
</div>
</div>
</div>
</div>

View File

@@ -18,10 +18,14 @@
<% end %>
</dd>
<% end %>
<%= description_list_pair_for releasable, :name, append: ":" %>
<%= description_list_pair "Contact Address:", releasable.contact_person.address %>
<%= description_list_pair "Contact Phone:", releasable.contact_person.phone %>
<%= description_list_pair "Contact Email:", releasable.contact_person.email %>
<%= description_list_pair t(".labels.#{releasable.model_name.param_key}.name", default: "Name"), releasable.name, append: ":" %>
<% if releasable.model_name == "LocationRelease" %>
<%= description_list_pair "Location Address:", releasable.address %>
<%= description_list_pair "Owner Name", releasable.person_name, append: ":" %>
<% end %>
<%= description_list_pair t(".labels.#{releasable.model_name.param_key}.contact_person_address", default: "Contact Address"), releasable.contact_person.address, append: ":" %>
<%= description_list_pair t(".labels.#{releasable.model_name.param_key}.contact_person_phone", default: "Contact Phone"), releasable.contact_person.phone, append: ":" %>
<%= description_list_pair t(".labels.#{releasable.model_name.param_key}.contact_person_email", default: "Contact Email"), releasable.contact_person.email, append: ":" %>
<% if releasable.model_name == "AppearanceRelease" %>
<%= description_list_pair "Person Date of Birth:", releasable&.person_date_of_birth&.strftime("%D") %>
<% end %>

View File

@@ -28,7 +28,7 @@
<th data-behavior="all-selectable"><%= check_box_tag "location_release_ids[]", false, false %></th>
<th><%= t '.table_headers.approved'%></th>
<th></th>
<th><%= LocationRelease.human_attribute_name(:name) %></th>
<th><%= t(".table_headers.name") %></th>
<th><%= t(".table_headers.address") %>
<th><%= t(".table_headers.notes") %></th>
<th><%= t(".table_headers.tags") %></th>

View File

@@ -17,6 +17,7 @@
<%= @user.role_for(Current.account).to_s.titleize %>
<% end %>
</p>
<%= link_to 'Auth to Microsoft', '/auth/microsoft_graph', class: "btn btn-primary" %>
</div>
<div class="mt-3">

View File

@@ -13,6 +13,17 @@
<hr>
<% unless @contract_template.guardian_clause.blank? %>
<%= form.form_group :minor do %>
<%= form.check_box :minor, label: t("helpers.label.appearance_release.minor"), data: { behavior: "update-required-status", target: "[data-ujs-target=guardian-fields]", toggle: "collapse" } %>
<% end %>
<%= card_field_set_tag t(".guardian_clause.heading") do %>
<p><%= @contract_template.guardian_clause %></p>
<% end %>
<hr>
<% end %>
<%= card_field_set_tag t(".acquired_media_info.heading") do %>
<div class="form-row">
<%= form.text_field :name, required: true, wrapper_class: "col-12" %>
@@ -49,6 +60,91 @@
<hr>
<% unless @contract_template.guardian_clause.blank? %>
<div class="<%= class_string("collapse" => !@acquired_media_release.minor?) %>" data-ujs-target="guardian-fields">
<%= card_field_set_tag t(".guardian_info.heading") do %>
<div class="form-row">
<%= form.text_field :guardian_first_name, required: @acquired_media_release.minor?, wrapper_class: "col-sm-3", data: { required_tag: "guardian" } %>
<%= form.text_field :guardian_last_name, required: @acquired_media_release.minor?, wrapper_class: "col-sm-3", data: { required_tag: "guardian" } %>
<%= form.phone_field :guardian_phone, required: @acquired_media_release.minor?, wrapper_class: "col-sm-6", data: { required_tag: "guardian" } %>
<%= form.text_field :guardian_email, required: @acquired_media_release.minor?, wrapper_class: "col-sm-6", data: { required_tag: "guardian" } %>
</div>
<%= render "shared/address_fields", form: form, subject: "guardian", required: @acquired_media_release.minor?, data: { required_tag: "guardian" } %>
<% end %>
<hr>
<%= card_field_set_tag t(".guardian_photo.heading") do %>
<div class="alert alert-warning font-weight-bold"><%= t ".guardian_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-photo-input]">
<div class="align-items-center d-flex photo-preview img-thumbnail justify-content-center">
<span><%= t ".photo.no_photo" %></span>
</div>
</div>
<div class="d-inline-block text-left">
<% if @acquired_media_release.guardian_photo.attached? %>
<%= javascript_tag nonce: true do %>
App.PhotoPreview.set("[data-behavior=guardian-photo-preview]", "<%= url_for(@acquired_media_release.guardian_photo.variant(auto_orient: true, resize: '200x200')) %>");
<% end %>
<% end %>
<div class="hidden-file-input">
<%= form.hidden_field :guardian_photo, value: form.object.guardian_photo.signed_id if @acquired_media_release.guardian_photo.attached? %>
<%= form.file_field :guardian_photo, required: @acquired_media_release.minor?, hide_label: true, data: { ujs_target: "guardian-photo-input" }, accept: @acquired_media_release.class.face_photo_acceptable_content_types.join(","), direct_upload: true %>
</div>
<%= 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]" } %>
</div>
<p class="p-2 font-weight-bold">
<small class="text-muted"><%= t ".photo.warning" %></small>
</p>
</div>
<% 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 ".photo.no_photo" %></span>
</div>
</div>
<div class="d-inline-block text-left">
<% if @acquired_media_release.guardian_2_photo.attached? %>
<%= javascript_tag nonce: true do %>
App.PhotoPreview.set("[data-behavior=guardian-photo-preview]", "<%= url_for(@acquired_media_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 @acquired_media_release.guardian_2_photo.attached? %>
<%= form.file_field :guardian_2_photo, hide_label: true, data: { ujs_target: "guardian-2-photo-input" }, accept: @acquired_media_release.class.face_photo_acceptable_content_types.join(","), direct_upload: true %>
</div>
<%= 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]" } %>
</div>
<p class="p-2 font-weight-bold">
<small class="text-muted"><%= t ".photo.warning" %></small>
</p>
</div>
<% end %>
<hr>
</div>
<% end %>
<%= card_field_set_tag t(".signature.heading") do %>
<%= render "shared/signature_fields", form: form, signature_legal_text: @contract_template.signature_legal_text %>
<% end %>

View File

@@ -0,0 +1,20 @@
ENV['AZURE_CLIENT_ID'] = 'c45b93ae-ef07-415d-b13a-ab566b877c1c'
ENV['AZURE_CLIENT_SECRET'] = 'XVboF2sRaS_H2oK6I9R56.A_exnRhiv~Xt'
ENV['AZURE_TENANT_ID'] = '1e33d1c7-dfb4-4df1-86da-62770313bcb0'
ENV['AZURE_EXTENSIONS'] = ''
# Rails.application.config.middleware.use OmniAuth::Builder do
# provider :microsoft_graph,{
# client_id: ENV['AZURE_CLIENT_ID'],
# client_secret: ENV['AZURE_CLIENT_SECRET'],
# tenant_id: ENV['AZURE_TENANT_ID'],
# extensions: ENV['AZURE_EXTENSIONS'],
# redirect_uri: 'https://517e57c6cd6c.ngrok.io/auth/microsoft_graph/callback',
# scope: 'openid email profile User.Read'
# }
# end
Rails.application.config.middleware.use OmniAuth::Builder do
provider :microsoft_graph, ENV['AZURE_CLIENT_ID'], ENV['AZURE_CLIENT_SECRET'], scope: 'openid email profile User.Read'
end

View File

@@ -46,6 +46,15 @@ en:
heading: 3 of 3 Contract & Exploitable Rights
files:
heading: 2 of 3 Files
guardian_2_info:
heading: Second Guardian Information (if company requires)
guardian_info:
heading: Guardian Information
photos:
guardian_2_photo:
heading: Second Guardian Photo
guardian_photo:
heading: Guardian Photo
index:
actions:
new: Import Release
@@ -214,6 +223,10 @@ en:
destroy:
alert: A live stream has been deleted
api_error: Something went wrong, please try again later after some time
file:
actions:
delete_file: Delete
confirm_delete: Are you sure?
index:
actions:
new: Create New Live Stream
@@ -307,6 +320,7 @@ en:
actions:
book_demo: Schedule a Demo
create_template: Create New Release Template
import_template: Import Template
headings:
benefits: Benefits
how_it_works: How It Works
@@ -353,6 +367,12 @@ en:
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}."
labels:
location_release:
contact_person_address: Owner Address
contact_person_email: Owner Email
contact_person_phone: Owner Phone
name: Location Name
directories:
destroy:
alert: The folder has been deleted
@@ -425,6 +445,27 @@ en:
label:
acquired_media_release:
description: Description of property
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: 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_email: Guardian email
guardian_first_name: Guardian first name
guardian_last_name: Guardian last name
guardian_phone: Guardian phone
minor: Is the person a minor?
name: Name of property
person_address: Address
person_address_city: City
@@ -710,6 +751,8 @@ en:
acquired_media_release:
create: Import Release
update: Save Changes
acquired_media_releases:
create: Import Release
appearance_release:
create: Import Release
update: Save Changes
@@ -779,7 +822,7 @@ en:
table_headers:
address: Address
approved: Approved
name: Name
name: Location Name
notes: Notes
signed_at: Date Signed
tags: Tags
@@ -1031,10 +1074,28 @@ en:
cancel: Cancel
files:
heading: File Information
guardian_2_info:
heading: Second Guardian Information (if company requires)
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!
legal:
heading: Legal
personal_info:
heading: Licensor/Owner Contact Information
photo:
no_photo: No photo yet
take_photo: Take Photo
warning: If your photo appears sideways, it will be autocorrected when you submit your release.
signature:
heading: Signature
amendments:

View File

@@ -2,6 +2,18 @@ es:
acquired_media_releases:
acquired_media_release:
no_media: No Media (ES)
create:
notice: The acquired media release has been created (ES)
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
guardian_photo:
heading: Guardian Photo
index:
table_headers:
file_infos_count: No. Files (ES)
@@ -81,6 +93,10 @@ es:
do_not_copy_warning: "Do not copy (ES)"
serial_number_label: "Serial Number (ES)"
broadcasts:
file:
actions:
delete_file: Delete
confirm_delete: Are you sure? (ES)
show:
actions:
reset_url: Reset URL (ES)
@@ -218,6 +234,29 @@ es:
guardian_clause: Leave blank if not required for this contract (ES)
signature_legal_text: Leave blank if not required for this contract (ES)
label:
acquired_media_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: 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_email: Guardian email (ES)
guardian_first_name: Guardian first name (ES)
guardian_last_name: Guardian last name (ES)
guardian_name: Nómbre del tutor legal
guardian_phone: Número de teléfono del tutor legal
minor: El firmante es un menor
appearance_release:
guardian_2_address_city: Guardian 2 city (ES)
guardian_2_address_country: Guardian 2 country (ES)
@@ -324,6 +363,8 @@ es:
person_name: Jane Doe
person_phone: 555-555-5555
submit:
acquired_media_releases:
create: Import Release (ES)
appearance_release:
create: Crear Autorización
broadcast:
@@ -397,6 +438,26 @@ es:
signed_at: Date Signed (ES)
tags: Tags (ES)
public:
acquired_media_releases:
new:
guardian_2_info:
heading: Second Guardian Information (if company requires) [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_info:
heading: Guardian Information (ES)
guardian_photo:
heading: Guardian Photo (ES)
instructions: >
(ES) 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! (ES)
photo:
no_photo: No photo yet (ES)
take_photo: Take Photo (ES)
warning: If your photo appears sideways, it will be autocorrected when you submit your release. (ES)
amendments:
create:
amendment_already_signed_message: Release amendment is already signed! (ES)

View File

@@ -4,6 +4,8 @@ require 'sidekiq/web'
Rails.application.routes.draw do
AVAILABLE_LOCALES_REGEX = /#{I18n.available_locales.join("|")}/.freeze
get 'auth/microsoft_graph/callback', to: 'callbacks#create'
concern :confirmable do
resources :video_release_confirmations, only: [:new, :create, :destroy]
end
@@ -96,6 +98,9 @@ Rails.application.routes.draw do
end
resources :projects, only: [] do
resources :broadcasts, except: [:edit] do
member do
delete :destroy_file
end
resource :zoom_meeting, only: [:show]
end
resources :directories, except: [:index] do

View File

@@ -0,0 +1,25 @@
class AddGuardiansFieldsToAcquiredMediaReleases < ActiveRecord::Migration[6.0]
def change
add_column :acquired_media_releases, :minor, :boolean, default: false
add_column :acquired_media_releases, :guardian_first_name, :string
add_column :acquired_media_releases, :guardian_last_name, :string
add_column :acquired_media_releases, :guardian_email, :string
add_column :acquired_media_releases, :guardian_phone, :string
add_column :acquired_media_releases, :guardian_address_street1, :string
add_column :acquired_media_releases, :guardian_address_street2, :string
add_column :acquired_media_releases, :guardian_address_city, :string
add_column :acquired_media_releases, :guardian_address_state, :string
add_column :acquired_media_releases, :guardian_address_zip, :string
add_column :acquired_media_releases, :guardian_address_country, :string
add_column :acquired_media_releases, :guardian_2_first_name, :string
add_column :acquired_media_releases, :guardian_2_last_name, :string
add_column :acquired_media_releases, :guardian_2_email, :string
add_column :acquired_media_releases, :guardian_2_phone, :string
add_column :acquired_media_releases, :guardian_2_address_street1, :string
add_column :acquired_media_releases, :guardian_2_address_street2, :string
add_column :acquired_media_releases, :guardian_2_address_city, :string
add_column :acquired_media_releases, :guardian_2_address_state, :string
add_column :acquired_media_releases, :guardian_2_address_zip, :string
add_column :acquired_media_releases, :guardian_2_address_country, :string
end
end

View File

@@ -161,7 +161,28 @@ CREATE TABLE public.acquired_media_releases (
signed_at timestamp without time zone,
approved_by_user_name text,
approved_by_user_email text,
approved_at timestamp without time zone
approved_at timestamp without time zone,
minor boolean DEFAULT false,
guardian_first_name character varying,
guardian_last_name character varying,
guardian_email character varying,
guardian_phone character varying,
guardian_address_street1 character varying,
guardian_address_street2 character varying,
guardian_address_city character varying,
guardian_address_state character varying,
guardian_address_zip 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
);
@@ -3944,6 +3965,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20200716105723'),
('20200720051634'),
('20200720131309'),
('20200721140821');
('20200721140821'),
('20200725231419');

View File

@@ -106,7 +106,7 @@ RSpec.describe Api::BroadcastsController, type: :controller do
included = JSON.parse(response.body).dig('included')
expect(relationships.keys).to include('files')
expect(included.size).to eq 1
expect(included.size).to eq 3
expect(included.first.dig("id")).to eq broadcast.files.first.id.to_s
expect(included.first.dig("type")).to eq 'active_storage_attachment'
end

View File

@@ -43,8 +43,21 @@ describe ContractTemplatesController do
get :index, params: { project_id: project }
expect(response.body).to have_link "Create New Release Template"
expect(response.body).to have_link "Import Template"
expect(response.body).to have_link schedule_demo
end
context 'when current user is an associate' do
let(:current_user) { create(:user, :associate) }
it 'does not show the new contract template button' do
get :index, params: { project_id: project }
expect(response.body).not_to have_link "Create New Release Template"
expect(response.body).not_to have_link "Import Template"
expect(response.body).to have_link schedule_demo
end
end
end
context 'when current user is an associate' do

View File

@@ -87,6 +87,7 @@ RSpec.describe Public::BroadcastsController, type: :controller do
let!(:broadcast) { create(:broadcast, :with_stream, skip_create_callback: true, project: project ) }
it "uploads files to broadcast" do
allow(BroadcastsChannel).to receive(:broadcast_file_upload_updates)
patch :update, params: { token: broadcast.token, broadcast: file_params }, xhr: true
expect(broadcast.files.count).to eq(1)

View File

@@ -18,6 +18,16 @@ FactoryBot.define do
end
end
trait :minor do
minor true
guardian_first_name "Guardian1"
guardian_last_name "First"
guardian_2_first_name "Guardian2"
guardian_2_last_name "Second"
guardian_phone "1111"
guardian_2_phone "2222"
end
factory :acquired_media_release_with_contract_template do
after(:build) do |acquired_media_release, _|
acquired_media_release.contract_template = build(:acquired_media_release_contract_template)

View File

@@ -17,7 +17,13 @@ FactoryBot.define do
end
trait :with_files do
files { [Rack::Test::UploadedFile.new('spec/fixtures/files/contract.pdf', 'application/pdf')] }
files do
[
Rack::Test::UploadedFile.new('spec/fixtures/files/contract.pdf', 'application/pdf'),
Rack::Test::UploadedFile.new('spec/fixtures/files/audio.mp3', 'audio/mpeg'),
Rack::Test::UploadedFile.new('spec/fixtures/files/video_file.mp4', 'video/mp4')
]
end
end
after(:build) do |broadcast, evaluator|

View File

@@ -11,11 +11,12 @@ RSpec.feature 'User manages contract templates', type: :feature do
sign_in(current_user)
end
scenario 'splash page is shown if tehre are no contract templates' do
scenario 'splash page is shown if there are no contract templates' do
visit project_contract_templates_path(project)
expect(page).to have_content schedule_demo
expect(page).to have_content create_release_template
expect(page).to have_content import_release_template
end
scenario 'creating a new release template' do
@@ -159,7 +160,7 @@ RSpec.feature 'User manages contract templates', type: :feature do
expect(content_disposition).to include('inline')
expect(pdf_body).to have_content('PREVIEW ONLY')
expect(pdf_body).to have_content('Acquired Media Release')
expect(pdf_body).not_to have_content('Guardian')
expect(pdf_body).to have_content('Guardian')
visit new_project_contract_template_path(project)
select 'Location Release', from: 'Release type'
@@ -378,6 +379,7 @@ RSpec.feature 'User manages contract templates', type: :feature do
expect(page).to have_content schedule_demo
expect(page).not_to have_content create_release_template
expect(page).not_to have_content import_release_template
end
it 'does not show edit button' do
@@ -409,11 +411,12 @@ RSpec.feature 'User manages contract templates', type: :feature do
expect(page).to have_content('Delete')
end
it 'does not show create release button on splash page' do
it 'shows create release button on splash page' do
visit project_contract_templates_path(project)
expect(page).to have_content schedule_demo
expect(page).to have_content create_release_template
expect(page).to have_content import_release_template
end
it 'shows edit button when contract template is not signed' do
@@ -505,6 +508,10 @@ RSpec.feature 'User manages contract templates', type: :feature do
t 'contract_templates.splash.actions.create_template'
end
def import_release_template
t 'contract_templates.splash.actions.import_template'
end
def signature_legal_text_trix_field
'Signature legal text'
end

View File

@@ -12,7 +12,7 @@ feature "User managing acquired_media releases" do
expect(country_field_value).to eq "US"
end
scenario "creating a release", js: true do
scenario "creating a release for an adult", js: true do
contract_template = create(:contract_template, project: project)
visit new_account_project_contract_template_acquired_media_release_path(project.account, project, contract_template)
@@ -35,11 +35,121 @@ feature "User managing acquired_media releases" do
draw_signature file_fixture("signature.png"), "acquired_media_release_signature_base64"
end
click_button "I have read and agree to the above"
click_button submit_release_button
expect(AcquiredMediaRelease.last.categories).to include("Video Footage")
expect(AcquiredMediaRelease.last.categories).to include("Still Photograph")
expect(page).to have_content("Your release was successfully submitted. Thank you.")
expect(page).to have_content successful_submission_message
end
scenario "creating a release for a minor - guardian fields are required when minor checkbox is checked", js: true do
contract_template = create(:contract_template, project: project)
visit new_account_project_contract_template_acquired_media_release_path(project.account, project, contract_template)
all('input[data-required-tag="guardian"]').each do |field|
expect(field['required']).to eq 'false'
expect(field).not_to be_visible
end
page.check person_is_minor_checkbox
all('input[data-required-tag="guardian"]').each do |field|
expect(field['required']).to eq 'true'
expect(field).to be_visible
end
end
scenario 'creating a release for a minor', js: true do
project = create(:project, members: current_user, account: current_user.primary_account)
contract_template = create(:contract_template, project: project)
visit new_account_project_contract_template_acquired_media_release_path(project.account, project, contract_template)
expect(page).not_to have_content guardian_information_heading.upcase
expect(page).not_to have_content guardian_photo_heading.upcase
page.check person_is_minor_checkbox
expect(page).to have_content guardian_information_heading.upcase
expect(page).to have_content guardian_photo_heading.upcase
expect(page).to have_content guardian_email_field.titleize
fill_in acquired_media_name_field, with: "Jane Doe"
acquired_media_category_fields
fill_in acquried_media_description_field, with: "Description"
fill_in acquried_media_owner_first_name, with: "Jane"
fill_in acquried_media_owner_last_name, with: "Doe"
fill_in acquired_media_person_title, with: "Ms."
fill_in acquired_media_person_phone, with: "555-5555-5555"
fill_in acquired_media_person_email, with: "person@example.com"
fill_in acquired_media_person_fax, with: "FAX"
fill_in acquired_media_person_address_street_1, with: "Street 1"
fill_in acquired_media_person_address_city, with: "City"
fill_in acquired_media_person_address_state, with: "State"
fill_in acquired_media_release_person_address_zip, with: "ZIP"
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_email_field, with: 'valid@email.com'
attach_file guardian_photo_field, file_fixture('hemsworth.jpeg'), visible: :all
fill_in_guardian_address_fields
draw_signature file_fixture("signature.png"), "acquired_media_release_signature_base64"
click_button submit_release_button
expect(page).to have_content(successful_submission_message)
end
scenario 'creating a release for a minor with two guardians', js: true do
project = create(:project, members: current_user, account: current_user.primary_account)
contract_template = create(:contract_template, project: project)
visit new_account_project_contract_template_acquired_media_release_path(project.account, project, contract_template)
expect(page).not_to have_content guardian_2_information_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_photo_heading.upcase
expect(page).to have_content guardian_email_field.titleize
expect(page).to have_content guardian_2_information_heading.upcase
expect(page).to have_content guardian_2_photo_heading.upcase
expect(page).to have_content guardian_2_phone_field.titleize
fill_in acquired_media_name_field, with: "Jane Doe"
acquired_media_category_fields
fill_in acquried_media_description_field, with: "Description"
fill_in acquried_media_owner_first_name, with: "Jane"
fill_in acquried_media_owner_last_name, with: "Doe"
fill_in acquired_media_person_title, with: "Ms."
fill_in acquired_media_person_phone, with: "555-5555-5555"
fill_in acquired_media_person_email, with: "person@example.com"
fill_in acquired_media_person_fax, with: "FAX"
fill_in acquired_media_person_address_street_1, with: "Street 1"
fill_in acquired_media_person_address_city, with: "City"
fill_in acquired_media_person_address_state, with: "State"
fill_in acquired_media_release_person_address_zip, with: "ZIP"
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_email_field, with: 'valid@email.com'
attach_file guardian_photo_field, file_fixture('hemsworth.jpeg'), visible: :all
fill_in_guardian_address_fields
draw_signature file_fixture("signature.png"), "acquired_media_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(AcquiredMediaRelease.last.guardian_2_first_name).to eq 'Second'
end
scenario "creating a release, if contract template contains signature legal language, it is shown" do
@@ -51,6 +161,106 @@ feature "User managing acquired_media releases" do
end
context "when signed in" do
before do
sign_in current_user
end
scenario "creating a release for an adult", js: true do
visit new_project_acquired_media_release_path(project)
fill_in acquired_media_name_field, with: "Jane Doe"
acquired_media_category_fields
attach_file contract_field, Rails.root.join(file_fixture("contract.pdf")), visible: false
click_button import_release_button
expect(page).to have_content successful_import_message
end
scenario "creating a release for a minor - guardian fields are required when minor checkbox is checked", js: true do
visit new_project_acquired_media_release_path(project)
all('input[data-required-tag="guardian"]').each do |field|
expect(field['required']).to eq 'false'
expect(field).not_to be_visible
end
page.check person_is_minor_checkbox
all('input[data-required-tag="guardian"]').each do |field|
expect(field['required']).to eq 'true'
expect(field).to be_visible
end
end
scenario "creating a release for a minor", js: true do
visit new_project_acquired_media_release_path(project)
expect(page).not_to have_content guardian_information_heading.upcase
expect(page).not_to have_content guardian_photo_heading
page.check person_is_minor_checkbox
expect(page).to have_content guardian_information_heading.upcase
expect(page).to have_content guardian_photo_heading
expect(page).to have_content guardian_email_field.titleize
fill_in acquired_media_name_field, with: "Jane Doe"
acquired_media_category_fields
attach_file contract_field, Rails.root.join(file_fixture("contract.pdf")), visible: false
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_email_field, with: 'valid@email.com'
attach_file guardian_photo_field, file_fixture('hemsworth.jpeg'), visible: :all
fill_in_guardian_address_fields
click_button import_release_button
expect(page).to have_content successful_import_message
expect(AcquiredMediaRelease.last.guardian_first_name).to eq 'Guardian'
end
scenario "creating a release for a minor with two guardians", js: true do
visit new_project_acquired_media_release_path(project)
expect(page).not_to have_content guardian_2_information_heading.upcase
expect(page).not_to have_content guardian_2_photo_heading
page.check person_is_minor_checkbox
expect(page).to have_content guardian_information_heading.upcase
expect(page).to have_content guardian_photo_heading
expect(page).to have_content guardian_email_field.titleize
expect(page).to have_content guardian_2_information_heading.upcase
expect(page).to have_content guardian_2_photo_heading
expect(page).to have_content guardian_2_phone_field.titleize
fill_in acquired_media_name_field, with: "Jane Doe"
acquired_media_category_fields
attach_file contract_field, Rails.root.join(file_fixture("contract.pdf")), visible: false
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_email_field, with: 'valid@email.com'
attach_file guardian_photo_field, file_fixture('hemsworth.jpeg'), visible: :all
fill_in_guardian_address_fields
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 import_release_button
expect(page).to have_content successful_import_message
expect(AcquiredMediaRelease.last.guardian_first_name).to eq 'Guardian'
expect(AcquiredMediaRelease.last.guardian_2_first_name).to eq 'Second'
end
scenario "creating, updating, destroying a release", js: true do
release_data = {
name: "Test Acquired Media Release",
@@ -65,7 +275,7 @@ feature "User managing acquired_media releases" do
visit new_project_acquired_media_release_path(project)
by "attaching only a contract" do
attach_file "acquired_media_release[contract]", Rails.root.join(file_fixture("contract.pdf")), visible: false
attach_file contract_field, Rails.root.join(file_fixture("contract.pdf")), visible: false
click_button create_release_button
expect(page).to have_invalid_field(acquired_media_name_field)
@@ -117,7 +327,7 @@ feature "User managing acquired_media releases" do
end
end
scenario "viewing the contract PDF" do
scenario "viewing the contract PDF for an adult" do
acquired_media_release = create(:acquired_media_release_with_contract_template,
:native,
project: project,
@@ -176,6 +386,25 @@ feature "User managing acquired_media releases" do
expect(pdf_body).to have_content("Other files")
end
scenario "viewing the contract PDF for a minor" do
acquired_media_release = create(:acquired_media_release_with_contract_template,
:native,
:minor,
project: project,
person_name: "Jane Doe")
visit project_acquired_media_releases_path(project)
click_link *view_release_pdf_link_for(acquired_media_release)
expect(content_type).to eq("application/pdf")
expect(pdf_body).to have_content acquired_media_release.guardian_first_name
expect(pdf_body).to have_content acquired_media_release.guardian_last_name
expect(pdf_body).to have_content acquired_media_release.guardian_2_first_name
expect(pdf_body).to have_content acquired_media_release.guardian_2_last_name
expect(pdf_body).to have_content acquired_media_release.guardian_phone
expect(pdf_body).to have_content acquired_media_release.guardian_2_phone
end
scenario "searching for a release", js: true do
collection1 = create(:acquired_media_release, name: "EDM Music", project: project)
collection2 = create(:acquired_media_release, name: "Classical Music", project: project)
@@ -508,4 +737,103 @@ feature "User managing acquired_media releases" do
def date_issued
t 'contracts.for_office_use_only.description_labels.date_issued'
end
def person_is_minor_checkbox
'acquired_media_release_minor'
end
def guardian_2_first_name_field
t 'helpers.label.acquired_media_release.guardian_2_first_name'
end
def guardian_2_last_name_field
t 'helpers.label.acquired_media_release.guardian_2_last_name'
end
def guardian_2_phone_field
t 'helpers.label.acquired_media_release.guardian_2_phone'
end
def guardian_first_name_field
t 'helpers.label.acquired_media_release.guardian_first_name'
end
def guardian_last_name_field
t 'helpers.label.acquired_media_release.guardian_last_name'
end
def guardian_phone_field
t 'helpers.label.acquired_media_release.guardian_phone'
end
def guardian_email_field
t 'helpers.label.acquired_media_release.guardian_email'
end
def guardian_address_street1_field
t('helpers.label.acquired_media_release.guardian_address_street1')
end
def guardian_address_city_field
t('helpers.label.acquired_media_release.guardian_address_city')
end
def guardian_address_state_field
t('helpers.label.acquired_media_release.guardian_address_state')
end
def guardian_address_zip_field
t('helpers.label.acquired_media_release.guardian_address_zip')
end
def guardian_photo_field
'acquired_media_release[guardian_photo]'
end
def guardian_2_photo_field
'acquired_media_release[guardian_2_photo]'
end
def fill_in_guardian_address_fields
fill_in guardian_address_street1_field, with: "124 Test Lane"
fill_in guardian_address_city_field, with: "New York"
fill_in guardian_address_state_field, with: "NY"
fill_in guardian_address_zip_field, with: '1000'
end
def submit_release_button
'I have read and agree to the above'
end
def successful_submission_message
'Your release was successfully submitted. Thank you.'
end
def guardian_information_heading
t 'public.acquired_media_releases.new.guardian_info.heading'
end
def guardian_photo_heading
t 'public.acquired_media_releases.new.guardian_photo.heading'
end
def guardian_2_information_heading
t 'public.acquired_media_releases.new.guardian_2_info.heading'
end
def guardian_2_photo_heading
t 'public.acquired_media_releases.new.guardian_2_photo.heading'
end
def contract_field
'acquired_media_release[contract]'
end
def import_release_button
t 'helpers.submit.acquired_media_releases.create'
end
def successful_import_message
t 'acquired_media_releases.create.notice'
end
end

View File

@@ -93,7 +93,7 @@ feature 'User managing broadcasts' do
BroadcastsChannel.broadcast_stream_updates(broadcast)
expect(page).to have_content stream_begun_message
expect(page).to have_selector('div#broadcast_video', count: 1)
expect(page).to have_selector('div#broadcast_video', count: 2)
broadcast.streamer_status = :idle
broadcast.status = :idle
@@ -164,6 +164,21 @@ feature 'User managing broadcasts' do
click_on add_file_button
end
scenario 'manager user can click delete button next to the file and delete file', js: true do
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
visit project_broadcast_path(project, broadcast)
expect(page).to have_content delete_file_button, count: 3
accept_alert do
first('a', text: delete_file_button).click
end
expect(page).to have_content delete_file_button, count: 2
expect(Broadcast.find(broadcast.id).files.count).to eq 2
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)
@@ -198,6 +213,14 @@ feature 'User managing broadcasts' do
expect(page).to have_content schedule_demo
expect(page).not_to have_content create_stream
end
scenario 'associate user does not see delete button next to the file', js: true do
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
visit project_broadcast_path(project, broadcast)
expect(page).to have_content delete_file_button, count: 0
end
end
context 'When the user is account manager' do
@@ -209,6 +232,21 @@ feature 'User managing broadcasts' do
expect(page).to have_content schedule_demo
expect(page).to have_content create_stream
end
scenario 'account manager user can click delete button next to the file and delete file', js: true do
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
visit project_broadcast_path(project, broadcast)
expect(page).to have_content delete_file_button, count: 3
accept_alert do
first('a', text: delete_file_button).click
end
expect(page).to have_content delete_file_button, count: 2
expect(Broadcast.find(broadcast.id).files.count).to eq 2
end
end
end
@@ -262,5 +300,9 @@ feature 'User managing broadcasts' do
'Live stream is waiting to begin'
end
def delete_file_button
t 'broadcasts.file.actions.delete_file'
end
end