Compare commits

...

3 Commits

Author SHA1 Message Date
Bilal
8410eaee07 add contract preview to the amendment signing form 2020-07-29 19:48:06 +02:00
Bilal
3c16effbe1 add main legal language to the amendment signing page 2020-07-29 09:47:44 +02:00
Senad Uka
9cbd8d31a8 Upstream sync 2020-07-29 05:15:02 +00:00
28 changed files with 1616 additions and 81 deletions

View File

@@ -0,0 +1,9 @@
$(document).on("turbolinks:load", function() {
$("#upload_directory_files").on('click', function(e){
const newFilesCount = $('input[name = "directory[files][]"][type = "hidden"]').length;
if (newFilesCount === 0){
e.preventDefault();
}
});
});

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

@@ -50,11 +50,58 @@ class MaterialReleasesController < ApplicationController
private
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 material_release_params
params.require(:material_release).permit(
params.require(:material_release).permit(person_params, guardian_params, second_guardian_params, :minor,
:name, :address_street1, :address_street2, :address_city, :address_state, :address_zip, :address_country,
:person_first_name, :person_last_name, :person_title, :person_company, :person_phone, :person_email,
:person_address_street1, :person_address_street2, :person_address_city, :person_address_state, :person_address_zip, :person_address_country,
:applicable_medium_id, :applicable_medium_text,
:territory_id, :territory_text,
:term_id, :term_text,

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

@@ -39,11 +39,59 @@ class Public::MaterialReleasesController < Public::BaseController
authorize material_releases.build(params)
end
def person_params
%i[
person_first_name
person_last_name
person_phone
person_email
person_title
person_company
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 material_release_params
params.require(:material_release).permit(
params.require(:material_release).permit(person_params, guardian_params, second_guardian_params, :minor,
:name, :address_street1, :address_street2, :address_city, :address_state, :address_zip, :address_country,
:person_first_name, :person_last_name, :person_title, :person_company, :person_phone, :person_email,
:person_address_street1, :person_address_street2, :person_address_city, :person_address_state, :person_address_zip, :person_address_country,
:signature_base64,
:locale, :contract_template, :description, photos: []
)

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

@@ -12,6 +12,11 @@ class MaterialRelease < ApplicationRecord
include PersonName
include CsvExportable
include Approvable
include GuardianPhotoable
include SecondGuardianPhotoable
include GuardianName
include SecondGuardianName
class << self
def custom_csv_exportable_headers
@@ -30,6 +35,39 @@ class MaterialRelease < 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
@@ -47,8 +85,8 @@ class MaterialRelease < ApplicationRecord
@contact_person ||= Contact.new(person_name, person_address, person_email, person_phone)
end
def minor?
false
def second_guardian_present?
guardian_2_first_name.present?
end
def uses_edl?

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

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

@@ -3,6 +3,6 @@
<%= render "shared/files_dropzone_fields", form: form, directory: directory %>
<% end %>
<div class="pt-3">
<%= form.submit t(".submit"), class: "btn btn-block btn-success", data: { disable_with: t("shared.disable_with") } %>
<%= form.submit t(".submit"), id: "upload_directory_files", class: "btn btn-block btn-success", data: { disable_with: t("shared.disable_with") } %>
</div>
<% end %>

View File

@@ -33,7 +33,7 @@
<th><%= t(".table_headers.notes") %></th>
<th><%= t(".table_headers.tags") %></th>
<th><%= t(".table_headers.signed_at") %></th>
<th></th>
<th><%= t(".table_headers.amendment_signed") %></th>
<th></th>
</tr>
</thead>

View File

@@ -12,6 +12,9 @@
<hr>
<%= field_set_tag content_tag(:span, t(".signer_details.heading"), class: "h6 text-muted text-uppercase") do %>
<%= form.form_group :minor do %>
<%= form.check_box :minor, label: t("helpers.label.material_release.minor"), data: { target: "[data-ujs-target=guardian-fields]", toggle: "collapse" } %>
<% end %>
<div class="form-row">
<%= form.text_field :person_first_name, wrapper_class: "col-sm-6" %>
<%= form.text_field :person_last_name, wrapper_class: "col-sm-6" %>
@@ -21,6 +24,28 @@
<%= form.text_field :person_title, wrapper_class: "col-sm-6" %>
</div>
<%= render "shared/address_fields", form: form, subject: "person" %>
<div class="<%= class_string("collapse" => !material_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: material_release.minor?, wrapper_class: "col-sm-3" %>
<%= form.text_field :guardian_last_name, required: material_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>
@@ -34,6 +59,44 @@
<%= field_set_tag content_tag(:span, t(".photos.heading"), class: "h6 text-muted text-uppercase") do %>
<%= render "shared/photos_dropzone_fields", form: form, release: material_release %>
<div class="<%= class_string("collapse" => !material_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 material_release.guardian_photo.attached? %>
<%= javascript_tag nonce: true do %>
App.PhotoPreview.set("#guardian-photo-preview", "<%= url_for(material_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 material_release.guardian_photo.attached?%>
<%= form.file_field :guardian_photo, hide_label: true, data: { ujs_target: "guardian-photo-input" }, help: "PNG or JPG only", accept: material_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 material_release.guardian_2_photo.attached? %>
<%= javascript_tag nonce: true do %>
App.PhotoPreview.set("#guardian-2-photo-preview", "<%= url_for(material_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 material_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: material_release.class.face_photo_acceptable_content_types.join(",") %>
</div>
</div>
<hr>
</div>
<% end %>
<div class="row align-items-center text-center mt-4">

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

@@ -8,6 +8,10 @@
<div class="card-body">
<%= errors_summary_for @release %>
<%= bootstrap_form_with model: @release, method: :post, url: public_send("account_project_contract_template_#{@contract_template.release_type}_release_amendments_path"), local: true do |form| %>
<%= card_field_set_tag t('.signed_contract_preview') do %>
<embed class="embeded-contract-preview" type="application/pdf" src="<%= url_for([@release, :contracts, format: "pdf"]) %>" width="80%" height="1200" />
<% end %>
<%= card_field_set_tag t(".amendment.heading") do %>
<p><%= @contract_template.amendment_clause %></p>
<% end %>

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(".release_info.heading") do %>
<div class="form-row">
<%= form.text_field :name, required: true, wrapper_class: "col-12" %>
@@ -40,6 +51,91 @@
<hr>
<% unless @contract_template.guardian_clause.blank? %>
<div class="<%= class_string("collapse" => !@material_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: @material_release.minor?, wrapper_class: "col-sm-3", data: { required_tag: "guardian" } %>
<%= form.text_field :guardian_last_name, required: @material_release.minor?, wrapper_class: "col-sm-3", data: { required_tag: "guardian" } %>
<%= form.phone_field :guardian_phone, required: @material_release.minor?, wrapper_class: "col-sm-6", data: { required_tag: "guardian" } %>
<%= form.text_field :guardian_email, required: @material_release.minor?, wrapper_class: "col-sm-6", data: { required_tag: "guardian" } %>
</div>
<%= render "shared/address_fields", form: form, subject: "guardian", required: @material_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 @material_release.guardian_photo.attached? %>
<%= javascript_tag nonce: true do %>
App.PhotoPreview.set("[data-behavior=guardian-photo-preview]", "<%= url_for(@material_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 @material_release.guardian_photo.attached? %>
<%= form.file_field :guardian_photo, required: @material_release.minor?, hide_label: true, data: { ujs_target: "guardian-photo-input" }, accept: @material_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 @material_release.guardian_2_photo.attached? %>
<%= javascript_tag nonce: true do %>
App.PhotoPreview.set("[data-behavior=guardian-photo-preview]", "<%= url_for(@material_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 @material_release.guardian_2_photo.attached? %>
<%= form.file_field :guardian_2_photo, hide_label: true, data: { ujs_target: "guardian-2-photo-input" }, accept: @material_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, instruction: 'For Owner or Authorized Signatory', signature_legal_text: @contract_template.signature_legal_text %>
<% 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
@@ -436,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
@@ -501,6 +531,27 @@ en:
person_last_name: Owner last name
material_release:
description: Description of licensed material
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 licensed material
person_address: Address
person_address_city: City
@@ -721,6 +772,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
@@ -789,6 +842,7 @@ en:
empty: Location Releases will appear here
table_headers:
address: Address
amendment_signed: Amendment
approved: Approved
name: Location Name
notes: Notes
@@ -818,10 +872,18 @@ en:
form:
contract_and_rights:
heading: 3 of 4 Contract & Exploitable Rights
guardian_2_info:
heading: Second Guardian Information (if company requires)
guardian_info:
heading: Guardian Information
material_details:
heading: 1 of 3 Material Details
photos:
dropzone_label: Tap to take a photo of Licensed Material (optional)
guardian_2_photo:
heading: Second Guardian Photo
guardian_photo:
heading: Guardian Photo
heading: 4 of 4 Photos
signer_details:
heading: 2 of 4 Licensor/Owner Details
@@ -1042,10 +1104,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:
@@ -1058,6 +1138,7 @@ en:
copy_url: Copy sign amendment URL
signature:
heading: Signature
signed_contract_preview: Signed Contract Preview
appearance_releases:
create:
notice: Your release has been signed. Thank you!
@@ -1131,10 +1212,27 @@ en:
cancel: Cancel
contact_info:
heading: Licensor/Owner Contact 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
photo:
heading: Photos
no_photo: No photo yet
take_photo: Take Photo
warning: If your photo appears sideways, it will be autocorrected when you submit your release.
release_info:
heading: Release Information
signature:

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)
@@ -222,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)
@@ -250,6 +285,29 @@ es:
person_email: Dirección de correo electrónico
person_name: Nómbre
person_phone: Número de teléfono
material_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
medical_release:
guardian_2_address_city: Guardian 2 city (ES)
guardian_2_address_country: Guardian 2 country (ES)
@@ -328,6 +386,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:
@@ -336,6 +396,8 @@ es:
contract_template:
update: Save changes (ES)
create: 'Crear %{model}'
material_release:
create: Import Release (ES)
medical_release:
update: Approve (ES)
update: 'Actualizar %{model}'
@@ -346,6 +408,7 @@ es:
index:
table_headers:
address: Address (ES)
amendment_signed: Amendment (ES)
notes: Notes (ES)
signed_at: Date Signed (ES)
tags: Tags (ES)
@@ -356,9 +419,19 @@ es:
amendment_not_signed_tooltip: Amendment not yet signed (ES)
amendment_signed_tooltip: Amendment Signed (ES)
material_releases:
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:
dropzone_label: Tap to take a photo of Licensed Material (optional) (ES)
guardian_2_photo:
heading: Second Guardian Photo
guardian_photo:
heading: Guardian Photo
index:
table_headers:
name: Name (ES)
@@ -401,6 +474,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)
@@ -411,6 +504,7 @@ es:
copy_url: Copy sign amendment URL (ES)
signature:
heading: Signature (ES)
signed_contract_preview: Signed Contract Preview (ES)
appearance_releases:
create:
notice: La autorización está firmada. ¡Gracias!
@@ -450,8 +544,25 @@ es:
heading: Photos (ES)
material_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:
heading: Photos (ES)
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)
medical_releases:
new:
guardian_2_info:

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

@@ -0,0 +1,25 @@
class AddGuardiansFieldsToMaterialReleases < ActiveRecord::Migration[6.0]
def change
add_column :material_releases, :minor, :boolean, default: false
add_column :material_releases, :guardian_first_name, :string
add_column :material_releases, :guardian_last_name, :string
add_column :material_releases, :guardian_email, :string
add_column :material_releases, :guardian_phone, :string
add_column :material_releases, :guardian_address_street1, :string
add_column :material_releases, :guardian_address_street2, :string
add_column :material_releases, :guardian_address_city, :string
add_column :material_releases, :guardian_address_state, :string
add_column :material_releases, :guardian_address_zip, :string
add_column :material_releases, :guardian_address_country, :string
add_column :material_releases, :guardian_2_first_name, :string
add_column :material_releases, :guardian_2_last_name, :string
add_column :material_releases, :guardian_2_email, :string
add_column :material_releases, :guardian_2_phone, :string
add_column :material_releases, :guardian_2_address_street1, :string
add_column :material_releases, :guardian_2_address_street2, :string
add_column :material_releases, :guardian_2_address_city, :string
add_column :material_releases, :guardian_2_address_state, :string
add_column :material_releases, :guardian_2_address_zip, :string
add_column :material_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
);
@@ -981,7 +1002,28 @@ CREATE TABLE public.material_releases (
person_last_name character varying,
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 +3986,8 @@ INSERT INTO "schema_migrations" (version) VALUES
('20200716105723'),
('20200720051634'),
('20200720131309'),
('20200721140821');
('20200721140821'),
('20200725231419'),
('20200727143209');

View File

@@ -94,7 +94,7 @@ RSpec.describe Api::SyncController, type: :controller do
expect(appearance_releases.first).to include('guardian_photo')
expect(talent_releases.first).to include('guardian_photo')
expect(location_releases.first).not_to include('guardian_photo')
expect(material_releases.first).not_to include('guardian_photo')
expect(material_releases.first).to include('guardian_photo')
end
it 'guardian photo has same format as other photos' do

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

@@ -15,6 +15,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
trait :with_photo do
photos do
path = Rails.root.join("spec", "fixtures", "files", "material_photo.png")

View File

@@ -160,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'
@@ -178,7 +178,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('Material Release')
expect(pdf_body).not_to have_content('Guardian')
expect(pdf_body).to have_content('Guardian')
end
context 'preventing creation of release template with wrong fee value' do

View File

@@ -51,6 +51,13 @@ RSpec.feature "User manages project custom folders", type: :feature do
expect(page).to have_content("UPLOAD NEW FILES")
expect do
click_button "Upload Files"
end.not_to raise_exception
expect(page).to have_content("UPLOAD NEW FILES")
expect(page).not_to have_content("The folder has been updated")
drop_file Rails.root.join(file_fixture("person_photo.png")), type: :dropzone
click_button "Upload Files"

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

@@ -127,6 +127,14 @@ feature "User managing location releases" do
sign_in current_user
end
scenario "listing all releases, table have correct headers", js:true do
ct = create(:contract_template, :with_amendment_clause, project: project)
create(:location_release, :native, project: project, contract_template: ct)
visit project_location_releases_path(project)
table_headers.each { |s| expect(page).to have_content s }
end
scenario "creating a release", js: true do
visit new_project_location_release_path(project)
@@ -243,6 +251,9 @@ feature "User managing location releases" do
new_window = window_opened_by { click_link sign_amendment_link }
within_window new_window do
expect(page).to have_content amendments_heading
expect(page).to have_content signed_contract_preview.upcase
expect(page).to have_selector 'embed'
fill_in amendment_signer_name_field, with: 'Big Signer'
draw_signature file_fixture("signature.png"), amendment_signature_field
@@ -682,6 +693,10 @@ feature "User managing location releases" do
t 'public.amendments.new.amendment.heading'
end
def signed_contract_preview
t 'public.amendments.new.signed_contract_preview'
end
def amendment_signer_name_field
'location_release[amendment_signer_name]'
end
@@ -729,4 +744,16 @@ feature "User managing location releases" do
def amendment_signature_label
t 'contracts.amendment_page.description_labels.amendment_signature'
end
def table_headers
[
t('location_releases.index.table_headers.approved'),
t('location_releases.index.table_headers.name'),
t('location_releases.index.table_headers.address'),
t('location_releases.index.table_headers.notes'),
t('location_releases.index.table_headers.tags'),
t('location_releases.index.table_headers.signed_at'),
t('location_releases.index.table_headers.amendment_signed')
]
end
end

View File

@@ -40,6 +40,93 @@ feature "User managing material releases" do
expect(MaterialRelease.last.photos.attached?).to eq true
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_material_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_material_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_all_fields
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"), signature_field
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_material_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_all_fields
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"), signature_field
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(MaterialRelease.last.guardian_2_first_name).to eq 'Second'
end
scenario "creating release is possible only after filling all fields", js: true do
contract_template = create(:contract_template, project: project)
@@ -98,7 +185,7 @@ feature "User managing material releases" do
sign_in current_user
end
scenario "creating a release", js: true do
scenario "creating a release for and adult", js: true do
visit new_project_material_release_path(project)
by "attaching only a contract" do
@@ -120,13 +207,94 @@ feature "User managing material releases" do
click_button create_release_button
expect(page).to have_content(create_release_notice)
expect(page).to have_photo("material_photo.png")
expect(page).to have_photo("material_photo.png", visible: :all)
click_on "Manage"
expect(page).to have_link("Download")
end
end
scenario "creating a release for a minor - guardian fields are required when minor checkbox is checked", js: true do
visit new_project_material_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_material_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_release_fields name: "Apple Laptop"
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(MaterialRelease.last.guardian_first_name).to eq 'Guardian'
end
scenario "creating a release for a minor with two guardians", js: true do
visit new_project_material_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_release_fields name: "Apple Laptop"
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(MaterialRelease.last.guardian_first_name).to eq 'Guardian'
expect(MaterialRelease.last.guardian_2_first_name).to eq 'Second'
end
scenario "updating an existing release", js: true do
material_release = create(:material_release, :non_native, project: project)
@@ -190,7 +358,7 @@ feature "User managing material releases" do
click_on "Save Changes"
expect(page).to have_content("The release has been updated")
expect(page).to have_photo("material_photo.png")
expect(page).to have_photo("material_photo.png", visible: :all)
end
scenario "viewing the contract PDF" do
@@ -419,8 +587,8 @@ feature "User managing material releases" do
"material_release[person_address_zip]"
end
def have_photo(filename)
have_selector("img[src*='#{filename}']")
def have_photo(filename, visible: true)
have_selector("img[src*='#{filename}']", visible: visible)
end
def import_material_release_link(project)
@@ -542,4 +710,107 @@ feature "User managing material releases" do
def date_issued
t 'contracts.for_office_use_only.description_labels.date_issued'
end
def person_is_minor_checkbox
'material_release_minor'
end
def guardian_2_first_name_field
t 'helpers.label.material_release.guardian_2_first_name'
end
def guardian_2_last_name_field
t 'helpers.label.material_release.guardian_2_last_name'
end
def guardian_2_phone_field
t 'helpers.label.material_release.guardian_2_phone'
end
def guardian_first_name_field
t 'helpers.label.material_release.guardian_first_name'
end
def guardian_last_name_field
t 'helpers.label.material_release.guardian_last_name'
end
def guardian_phone_field
t 'helpers.label.material_release.guardian_phone'
end
def guardian_email_field
t 'helpers.label.material_release.guardian_email'
end
def guardian_address_street1_field
t('helpers.label.material_release.guardian_address_street1')
end
def guardian_address_city_field
t('helpers.label.material_release.guardian_address_city')
end
def guardian_address_state_field
t('helpers.label.material_release.guardian_address_state')
end
def guardian_address_zip_field
t('helpers.label.material_release.guardian_address_zip')
end
def guardian_photo_field
'material_release[guardian_photo]'
end
def guardian_2_photo_field
'material_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.material_releases.new.guardian_info.heading'
end
def guardian_photo_heading
t 'public.material_releases.new.guardian_photo.heading'
end
def guardian_2_information_heading
t 'public.material_releases.new.guardian_2_info.heading'
end
def guardian_2_photo_heading
t 'public.material_releases.new.guardian_2_photo.heading'
end
def contract_field
'material_release[contract]'
end
def import_release_button
t 'helpers.submit.material_release.create'
end
def successful_import_message
t 'material_releases.create.notice'
end
def signature_field
'material_release_signature_base64'
end
end