Compare commits
2 Commits
make-all-f
...
change-sub
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b6cd775068 | ||
|
|
fbf3173747 |
@@ -1,11 +1,16 @@
|
||||
$(document).on("change", "[data-toggle=collapse-select]", function(event) {
|
||||
const select = event.target;
|
||||
const target = select.dataset.target;
|
||||
const showValues = JSON.parse(select.dataset.showValues);
|
||||
|
||||
if (showValues.indexOf(select.value) > -1) {
|
||||
$(target).show("fast");
|
||||
} else {
|
||||
$(target).hide("fast");
|
||||
}
|
||||
const mappings = JSON.parse(select.dataset.targetShowValuesMapping);
|
||||
|
||||
$.each(mappings, function( key, value ) {
|
||||
if (value.indexOf(select.value) > -1) {
|
||||
$(key).show("fast");
|
||||
} else {
|
||||
$(key).hide("fast");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on("turbolinks:load", function() {
|
||||
$("[data-toggle=collapse-select]").trigger("change");
|
||||
});
|
||||
@@ -61,7 +61,12 @@ class ContractTemplatesController < ApplicationController
|
||||
:applicable_medium_id, :applicable_medium_text,
|
||||
:territory_id, :territory_text,
|
||||
:term_id, :term_text,
|
||||
:restriction_id, :restriction_text)
|
||||
:restriction_id, :restriction_text,
|
||||
:question_1_text, :question_2_text,
|
||||
:question_3_text, :question_4_text,
|
||||
:question_5_text, :question_6_text,
|
||||
:question_7_text, :question_8_text,
|
||||
:question_9_text, :question_10_text)
|
||||
end
|
||||
|
||||
def download_attributes
|
||||
|
||||
@@ -48,6 +48,11 @@ class Public::MedicalReleasesController < Public::BaseController
|
||||
:signature_base64,
|
||||
:locale,
|
||||
:contract_template,
|
||||
:question_1_answer, :question_2_answer,
|
||||
:question_3_answer, :question_4_answer,
|
||||
:question_5_answer, :question_6_answer,
|
||||
:question_7_answer, :question_8_answer,
|
||||
:question_9_answer, :question_10_answer,
|
||||
photos: [],
|
||||
)
|
||||
end
|
||||
|
||||
@@ -36,12 +36,7 @@ class LocationRelease < ApplicationRecord
|
||||
validate :end_date_after_start_date
|
||||
|
||||
with_options on: :native do
|
||||
validates :address_street1, :address_city, :address_state, :address_zip, :address_country,
|
||||
:person_first_name, :person_last_name,
|
||||
:person_phone, :person_email, :person_company, :person_title,
|
||||
:person_address_street1, :person_address_city, :person_address_state,
|
||||
:person_address_zip, :person_address_country,
|
||||
:filming_started_on, :filming_ended_on, :filming_hours, presence: true
|
||||
validates :person_first_name, :person_last_name, presence: true
|
||||
validates :signature, attached: true
|
||||
end
|
||||
|
||||
|
||||
@@ -2,20 +2,24 @@
|
||||
<%= 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: "#guardian_clause", show_values: %w(appearance talent) }, 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(appearance talent), "#fee_field": %w(appearance talent location material acquired_media), "#exploitable_rights_fields": %w(appearance talent location material acquired_media), "#custom_fields": %w(medical) } }, class: "form-control custom-select" %>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-row" id="fee_field">
|
||||
<%= form.number_field :fee, min:"0", max:"99999999", step: "0.01", prepend: "$", help: "Leave at $0.00 for no-fee", wrapper_class: "col-sm-6" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<hr>
|
||||
|
||||
<%= field_set_tag content_tag(:span, t(".exploitable_rights.heading"), class: "h6 text-muted text-uppercase")do %>
|
||||
<%= field_set_tag content_tag(:span, t(".exploitable_rights.heading"), class: "h6 text-muted text-uppercase"), id: "exploitable_rights_fields" do %>
|
||||
<%= render "shared/exploitable_rights_fields", form: form %>
|
||||
<hr>
|
||||
<% end %>
|
||||
|
||||
<%= field_set_tag content_tag(:span, t(".custom_fields.heading"), class: "h6 text-muted text-uppercase"), id: "custom_fields", style: "display: none;" do %>
|
||||
<%= render "shared/custom_fields", form: form %>
|
||||
<hr>
|
||||
<% end %>
|
||||
|
||||
<hr>
|
||||
|
||||
<%= field_set_tag content_tag(:span, t(".legal.heading"), class: "h6 text-muted text-uppercase") do %>
|
||||
<%= form.form_group do %>
|
||||
|
||||
@@ -39,6 +39,15 @@
|
||||
<% end %>
|
||||
</dl>
|
||||
|
||||
<% if releasable.model_name == "MedicalRelease" %>
|
||||
<% (1..10).each do |n| %>
|
||||
<% if contract_template.public_send("question_#{n}_text").present? %>
|
||||
<p><strong><%= contract_template.public_send("question_#{n}_text") %></strong></p>
|
||||
<p><%= releasable.public_send("question_#{n}_answer") %></p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if releasable.minor? %>
|
||||
<br/>
|
||||
<p class="text-left"><strong>Guardian Information</strong></p>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<%= bootstrap_form_with model: project, local: true do |form| %>
|
||||
<%= form.text_field :name %>
|
||||
<%= form.select :predefined_client_name, options_for_select(options_for_predefined_client_name_select, selected_project_client_value(project)), {}, data: { toggle: "collapse-select", target: "#other_client", show_values: [:other] }, class: "form-control custom-select" %>
|
||||
<%= form.select :predefined_client_name, options_for_select(options_for_predefined_client_name_select, selected_project_client_value(project)), {}, data: { toggle: "collapse-select", target_show_values_mapping: { "#other_client": [:other] } }, class: "form-control custom-select" %>
|
||||
<div id="other_client" style="<%='display: none' if selected_project_client_value(project) != 'other'%>">
|
||||
<%= form.text_field :client_name, placeholder: true %>
|
||||
<%= form.form_group do %>
|
||||
|
||||
@@ -17,21 +17,21 @@
|
||||
<div class="form-row">
|
||||
<%= form.text_field :name, required: true, wrapper_class: "col-12" %>
|
||||
</div>
|
||||
<%= render "shared/address_fields", form: form, subject: "", required: true %>
|
||||
<%= render "shared/address_fields", form: form, subject: "" %>
|
||||
<% end %>
|
||||
|
||||
<hr>
|
||||
|
||||
<%= card_field_set_tag t(".contact_info.heading") do %>
|
||||
<div class="form-row">
|
||||
<%= form.text_field :person_first_name, required: true, wrapper_class: "col-sm-6" %>
|
||||
<%= form.text_field :person_last_name, required: true, wrapper_class: "col-sm-6" %>
|
||||
<%= form.phone_field :person_phone, required: true, wrapper_class: "col-sm-6" %>
|
||||
<%= form.email_field :person_email, required: true, wrapper_class: "col-sm-6" %>
|
||||
<%= form.text_field :person_company, required: true, wrapper_class: "col-sm-6" %>
|
||||
<%= form.text_field :person_title, required: true, wrapper_class: "col-sm-6" %>
|
||||
<%= form.text_field :person_first_name, wrapper_class: "col-sm-6" %>
|
||||
<%= form.text_field :person_last_name, wrapper_class: "col-sm-6" %>
|
||||
<%= form.phone_field :person_phone, wrapper_class: "col-sm-6" %>
|
||||
<%= form.email_field :person_email, wrapper_class: "col-sm-6" %>
|
||||
<%= form.text_field :person_company, wrapper_class: "col-sm-6" %>
|
||||
<%= form.text_field :person_title, wrapper_class: "col-sm-6" %>
|
||||
</div>
|
||||
<%= render "shared/address_fields", form: form, subject: "person", required: true %>
|
||||
<%= render "shared/address_fields", form: form, subject: "person" %>
|
||||
<% end %>
|
||||
|
||||
<hr>
|
||||
@@ -39,9 +39,9 @@
|
||||
|
||||
<%= card_field_set_tag t(".filming_info.heading") do %>
|
||||
<div class="form-row">
|
||||
<%= form.text_field :filming_started_on, required: true, wrapper_class: "col-sm-6", class: "datepicker-control", readonly: true %>
|
||||
<%= form.text_field :filming_ended_on, required: true, wrapper_class: "col-sm-6", class: "datepicker-control", readonly: true %>
|
||||
<%= form.text_field :filming_hours, required: true, wrapper_class: "col-sm-12" %>
|
||||
<%= form.text_field :filming_started_on, wrapper_class: "col-sm-6", class: "datepicker-control", readonly: true %>
|
||||
<%= form.text_field :filming_ended_on, wrapper_class: "col-sm-6", class: "datepicker-control", readonly: true %>
|
||||
<%= form.text_field :filming_hours, wrapper_class: "col-sm-12" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
||||
@@ -13,6 +13,19 @@
|
||||
<% end %>
|
||||
|
||||
<hr>
|
||||
|
||||
<% if (1..10).map {|n| @contract_template.public_send("question_#{n}_text").presence }.compact.any? %>
|
||||
<%= card_field_set_tag t(".questionnaire.heading") do %>
|
||||
<% (1..10).each do |n| %>
|
||||
<% if @contract_template.public_send("question_#{n}_text").present? %>
|
||||
<div class="form-row">
|
||||
<%= form.text_area "question_#{n}_answer", wrapper_class: "col-sm-12", label: @contract_template.public_send("question_#{n}_text") %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<hr>
|
||||
<% end %>
|
||||
|
||||
<%= card_field_set_tag t(".personal_info.heading") do %>
|
||||
<div class="alert alert-warning font-weight-bold"><%= t ".personal_info.instructions" %></div>
|
||||
@@ -36,7 +49,7 @@
|
||||
<% end %>
|
||||
|
||||
<div class="mt-5">
|
||||
<%= form.button t("shared.submit_release_long"), class: "btn btn-block btn-lg btn-success", data: { disable_with: t("shared.disable_with") } %>
|
||||
<%= form.button t("shared.submit_release_short"), class: "btn btn-block btn-lg btn-success", data: { disable_with: t("shared.disable_with") } %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
<% field_name_prefix = subject.present? ? "#{subject}_" : "" %>
|
||||
<% required = required || false %>
|
||||
|
||||
<div class="form-row">
|
||||
<%= form.text_field "#{field_name_prefix}address_street1", required: required, wrapper_class: "col-sm-6" %>
|
||||
<%= form.text_field "#{field_name_prefix}address_street1", wrapper_class: "col-sm-6" %>
|
||||
<%= form.text_field "#{field_name_prefix}address_street2", wrapper_class: "col-sm-6" %>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<%= form.text_field "#{field_name_prefix}address_city", required: required, wrapper_class: "col-sm-6" %>
|
||||
<%= form.text_field "#{field_name_prefix}address_state", required: required, wrapper_class: "col-sm-3" %>
|
||||
<%= form.text_field "#{field_name_prefix}address_zip", required: required, wrapper_class: "col-sm-3" %>
|
||||
<%= form.text_field "#{field_name_prefix}address_city", wrapper_class: "col-sm-6" %>
|
||||
<%= form.text_field "#{field_name_prefix}address_state", wrapper_class: "col-sm-3" %>
|
||||
<%= form.text_field "#{field_name_prefix}address_zip", wrapper_class: "col-sm-3" %>
|
||||
</div>
|
||||
<%= form.form_group "#{field_name_prefix}address_country" do %>
|
||||
<%= form.label "#{field_name_prefix}address_country" %>
|
||||
|
||||
5
app/views/shared/_custom_fields.html.erb
Normal file
5
app/views/shared/_custom_fields.html.erb
Normal file
@@ -0,0 +1,5 @@
|
||||
<% (1..10).each do |n| %>
|
||||
<div class="form-row">
|
||||
<%= form.text_area "question_#{n}_text", wrapper_class: "col-sm-12" %>
|
||||
</div>
|
||||
<% end%>
|
||||
@@ -212,12 +212,14 @@ en:
|
||||
archived_failure: Failed to archive the release template
|
||||
archived_notice: The release template has been archived
|
||||
form:
|
||||
custom_fields:
|
||||
heading: Custom Fields
|
||||
exploitable_rights:
|
||||
heading: 2 of 3 Exploitable Rights
|
||||
heading: Exploitable Rights
|
||||
legal:
|
||||
heading: 3 of 3 Legal
|
||||
heading: Legal
|
||||
release_info:
|
||||
heading: 1 of 3 Release Info
|
||||
heading: Release Info
|
||||
index:
|
||||
actions:
|
||||
import: Import Release Template
|
||||
@@ -851,6 +853,8 @@ en:
|
||||
instructions: Now, enter your personal information.
|
||||
photo:
|
||||
heading: Photos
|
||||
questionnaire:
|
||||
heading: Questionnaire
|
||||
signature:
|
||||
heading: Signature
|
||||
talent_releases:
|
||||
@@ -940,6 +944,7 @@ en:
|
||||
search: Search
|
||||
submit_release: Submit Release
|
||||
submit_release_long: I have read and agree to the above
|
||||
submit_release_short: Submit
|
||||
suite: Suite
|
||||
tag_multiple_releases: Add Tag
|
||||
tag_multiple_releases_form:
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
class AddQuestionFieldsToContractTemplates < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_column :contract_templates, :question_1_text, :text
|
||||
add_column :contract_templates, :question_2_text, :text
|
||||
add_column :contract_templates, :question_3_text, :text
|
||||
add_column :contract_templates, :question_4_text, :text
|
||||
add_column :contract_templates, :question_5_text, :text
|
||||
add_column :contract_templates, :question_6_text, :text
|
||||
add_column :contract_templates, :question_7_text, :text
|
||||
add_column :contract_templates, :question_8_text, :text
|
||||
add_column :contract_templates, :question_9_text, :text
|
||||
add_column :contract_templates, :question_10_text, :text
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,14 @@
|
||||
class AddAnswerFieldsToMedicalReleases < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_column :medical_releases, :question_1_answer, :text
|
||||
add_column :medical_releases, :question_2_answer, :text
|
||||
add_column :medical_releases, :question_3_answer, :text
|
||||
add_column :medical_releases, :question_4_answer, :text
|
||||
add_column :medical_releases, :question_5_answer, :text
|
||||
add_column :medical_releases, :question_6_answer, :text
|
||||
add_column :medical_releases, :question_7_answer, :text
|
||||
add_column :medical_releases, :question_8_answer, :text
|
||||
add_column :medical_releases, :question_9_answer, :text
|
||||
add_column :medical_releases, :question_10_answer, :text
|
||||
end
|
||||
end
|
||||
@@ -606,7 +606,17 @@ CREATE TABLE public.contract_templates (
|
||||
term_text character varying,
|
||||
restriction_id bigint,
|
||||
restriction_text character varying,
|
||||
archived_at timestamp without time zone
|
||||
archived_at timestamp without time zone,
|
||||
question_1_text text,
|
||||
question_2_text text,
|
||||
question_3_text text,
|
||||
question_4_text text,
|
||||
question_5_text text,
|
||||
question_6_text text,
|
||||
question_7_text text,
|
||||
question_8_text text,
|
||||
question_9_text text,
|
||||
question_10_text text
|
||||
);
|
||||
|
||||
|
||||
@@ -955,7 +965,17 @@ CREATE TABLE public.medical_releases (
|
||||
notes text,
|
||||
signed_at timestamp without time zone,
|
||||
created_at timestamp(6) without time zone NOT NULL,
|
||||
updated_at timestamp(6) without time zone NOT NULL
|
||||
updated_at timestamp(6) without time zone NOT NULL,
|
||||
question_1_answer text,
|
||||
question_2_answer text,
|
||||
question_3_answer text,
|
||||
question_4_answer text,
|
||||
question_5_answer text,
|
||||
question_6_answer text,
|
||||
question_7_answer text,
|
||||
question_8_answer text,
|
||||
question_9_answer text,
|
||||
question_10_answer text
|
||||
);
|
||||
|
||||
|
||||
@@ -3595,6 +3615,8 @@ INSERT INTO "schema_migrations" (version) VALUES
|
||||
('20200512161738'),
|
||||
('20200526113516'),
|
||||
('20200603090419'),
|
||||
('20200606044747');
|
||||
('20200606044747'),
|
||||
('20200610085411'),
|
||||
('20200610140459');
|
||||
|
||||
|
||||
|
||||
@@ -86,32 +86,10 @@ releases.each do |release|
|
||||
io: small_photo,
|
||||
filename: 'photo1.jpg'
|
||||
}]
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if release[:type] == :location_release
|
||||
additional_params = {
|
||||
address_street1: 'Dummy St.',
|
||||
address_city: 'Dummy City',
|
||||
address_state: 'Dummy State',
|
||||
address_zip: '12121',
|
||||
address_country: 'US',
|
||||
person_email: 'mail@mail.com',
|
||||
person_company: 'Dummy Company Inc.',
|
||||
person_title: 'mr.',
|
||||
person_address_street1: 'Dummy St. 2',
|
||||
person_address_city: 'Dummy City 2',
|
||||
person_address_state: 'Dummy State 2',
|
||||
person_address_zip: '1111111',
|
||||
person_address_country: 'US',
|
||||
filming_ended_on: DateTime.now,
|
||||
filming_started_on: '01/02/20',
|
||||
filming_hours: '04-20'
|
||||
}
|
||||
|
||||
@parameters[release[:type]].merge!(additional_params)
|
||||
end
|
||||
|
||||
sign_in_to_api(current_user)
|
||||
end
|
||||
|
||||
|
||||
@@ -19,9 +19,9 @@ describe Public::LocationReleasesController do
|
||||
it "logs analytics" do
|
||||
contract_template = create(:contract_template, project: project)
|
||||
|
||||
expect do
|
||||
expect {
|
||||
post :create, params: { account_id: project.account.to_param, project_id: project, contract_template_id: contract_template, location_release: location_release_params }
|
||||
end.to(
|
||||
}.to(
|
||||
have_enqueued_job(TrackAnalyticsJob)
|
||||
.with(nil, nil, :track_create_native_release, release_type: "LocationRelease", account: project.account, user_agent: "Rails Testing", user_ip: "0.0.0.0")
|
||||
)
|
||||
@@ -31,54 +31,28 @@ describe Public::LocationReleasesController do
|
||||
contract_template = create(:contract_template, project: project)
|
||||
sign_in(user)
|
||||
|
||||
expect do
|
||||
post :create, params: {
|
||||
account_id: user.primary_account.to_param,
|
||||
project_id: project,
|
||||
contract_template_id: contract_template,
|
||||
location_release: attributes_for(:empty_location_release)
|
||||
}
|
||||
end.not_to change(LocationRelease, :count)
|
||||
post :create, params: { account_id: user.primary_account.to_param, project_id: project, contract_template_id: contract_template, location_release: { person_address_city: "Albuquerque", filming_started_on: '02/02/02', filming_ended_on: '01/01/02' } }
|
||||
|
||||
body = CGI.unescape_html(response.body)
|
||||
expect(body).to match /Name can't be blank/
|
||||
expect(body).to match /Address street1 can't be blank/
|
||||
expect(body).to match /Address city can't be blank/
|
||||
expect(body).to match /Address state can't be blank/
|
||||
expect(body).to match /Address zip can't be blank/
|
||||
expect(body).to match /Address country can't be blank/
|
||||
expect(body).to match /Person first name can't be blank/
|
||||
expect(body).to match /Person last name can't be blank/
|
||||
expect(body).to match /Phone can't be blank/
|
||||
expect(body).to match /Email can't be blank/
|
||||
expect(body).to match /Company can't be blank/
|
||||
expect(body).to match /Title can't be blank/
|
||||
expect(body).to match /Person address street1 can't be blank/
|
||||
expect(body).to match /Person address city can't be blank/
|
||||
expect(body).to match /Person address state can't be blank/
|
||||
expect(body).to match /Person address zip can't be blank/
|
||||
expect(body).to match /Person address country can't be blank/
|
||||
expect(body).to match /Filming started on can't be blank/
|
||||
expect(body).to match /Filming ended on can't be blank/
|
||||
expect(body).to match /Filming hours can't be blank/
|
||||
expect(body).to match /Signature is not attached/
|
||||
expect(body).to match />can't be blank</
|
||||
# expect(body).to match /must be after the filming started on date/
|
||||
end
|
||||
|
||||
it "renders a success page" do
|
||||
contract_template = create(:contract_template, project: project)
|
||||
|
||||
expect {
|
||||
post :create, params: { account_id: user.primary_account.to_param, project_id: project, contract_template_id: contract_template, location_release: location_release_params, filming_started_on: '01/02/20', filming_ended_on: '03/18/20' }
|
||||
}.to change(LocationRelease, :count).by(1)
|
||||
post :create, params: { account_id: user.primary_account.to_param, project_id: project, contract_template_id: contract_template, location_release: location_release_params, filming_started_on: '01/02/20', filming_ended_on: '03/18/20' }
|
||||
|
||||
expect(response).to be_successful
|
||||
end
|
||||
|
||||
it "runs set tags for releasable job" do
|
||||
contract_template = create(:contract_template, project: project)
|
||||
|
||||
expect do
|
||||
expect {
|
||||
post :create, params: { account_id: project.account.to_param, project_id: project, contract_template_id: contract_template, location_release: location_release_params }
|
||||
end.to(
|
||||
}.to(
|
||||
have_enqueued_job(SetTagsForReleasableJob)
|
||||
.with(LocationRelease.last)
|
||||
)
|
||||
@@ -87,9 +61,9 @@ describe Public::LocationReleasesController do
|
||||
it "runs attach contract to releasable job" do
|
||||
contract_template = create(:contract_template, project: project)
|
||||
|
||||
expect do
|
||||
expect {
|
||||
post :create, params: { account_id: project.account.to_param, project_id: project, contract_template_id: contract_template, location_release: location_release_params }
|
||||
end.to(
|
||||
}.to(
|
||||
have_enqueued_job(AttachContractToReleasableJob)
|
||||
.with(LocationRelease.last)
|
||||
)
|
||||
@@ -99,11 +73,11 @@ describe Public::LocationReleasesController do
|
||||
private
|
||||
|
||||
def location_release_params
|
||||
attributes_for(:location_release, :full_native).except(:signature).merge(signature_param).merge(person_address_params)
|
||||
attributes_for(:location_release, :native).except(:signature).merge(signature_param).merge(person_address_params)
|
||||
end
|
||||
|
||||
def location_release_params_with_photos
|
||||
attributes_for(:location_release, :full_native, :with_photo).except(:signature).merge(signature_param)
|
||||
attributes_for(:location_release, :native, :with_photo).except(:signature).merge(signature_param)
|
||||
end
|
||||
|
||||
def person_address_params
|
||||
|
||||
@@ -29,32 +29,6 @@ FactoryBot.define do
|
||||
end
|
||||
end
|
||||
|
||||
trait :full_native do
|
||||
address_street1 'Dummy St.'
|
||||
address_city 'Dummy City'
|
||||
address_state 'Dummy State'
|
||||
address_zip '12121'
|
||||
address_country 'US'
|
||||
person_first_name 'John'
|
||||
person_last_name 'Doe'
|
||||
person_phone '222223333'
|
||||
person_email 'mail@mail.com'
|
||||
person_company 'Dummy Company Inc.'
|
||||
person_title 'mr.'
|
||||
person_address_street1 'Dummy St. 2'
|
||||
person_address_city 'Dummy City 2'
|
||||
person_address_state 'Dummy State 2'
|
||||
person_address_zip '1111111'
|
||||
person_address_country 'US'
|
||||
filming_ended_on DateTime.now
|
||||
filming_started_on '01/02/20'
|
||||
filming_hours '04-20'
|
||||
end
|
||||
|
||||
factory :empty_location_release do
|
||||
name nil
|
||||
end
|
||||
|
||||
factory :location_release_with_contract_template do
|
||||
after(:build) do |location_release, _|
|
||||
location_release.contract_template = build(:location_release_contract_template)
|
||||
|
||||
@@ -17,16 +17,20 @@ feature "User managing location releases" do
|
||||
|
||||
visit new_account_project_contract_template_location_release_path(project.account, project, contract_template)
|
||||
|
||||
click_button submit_release_button
|
||||
expect(page).not_to have_content submitted_release_notice
|
||||
|
||||
by "filling out the form" do
|
||||
fill_all_form_fields
|
||||
fill_in location_name_field, with: "Benny's Burritos"
|
||||
fill_in person_first_name_field, with: "Jane"
|
||||
fill_in person_last_name_field, with: "Doe"
|
||||
fill_in person_phone_field, with: "555-555-5555"
|
||||
fill_in person_email_field, with: "jane.doe@test.com"
|
||||
fill_in person_address_street1_field, with: "100 Broadway"
|
||||
fill_in filming_hours_field, with: "04:00 - 22:00"
|
||||
draw_signature file_fixture("signature.png"), "location_release_signature_base64"
|
||||
end
|
||||
|
||||
click_button submit_release_button
|
||||
|
||||
expect(page).to have_content submitted_release_notice
|
||||
expect(page).to have_content("Your release was successfully submitted. Thank you.")
|
||||
end
|
||||
|
||||
scenario "creating a release with photos", js: true do
|
||||
@@ -34,7 +38,15 @@ feature "User managing location releases" do
|
||||
|
||||
visit new_account_project_contract_template_location_release_path(project.account, project, contract_template)
|
||||
|
||||
fill_all_form_fields
|
||||
fill_in location_name_field, with: "Benny's Burritos"
|
||||
fill_in person_first_name_field, with: "Jane"
|
||||
fill_in person_last_name_field, with: "Doe"
|
||||
fill_in person_phone_field, with: "555-555-5555"
|
||||
fill_in person_email_field, with: "jane.doe@test.com"
|
||||
fill_in person_address_street1_field, with: "100 Broadway"
|
||||
fill_in filming_hours_field, with: "04:00 - 22:00"
|
||||
draw_signature file_fixture("signature.png"), "location_release_signature_base64"
|
||||
|
||||
drop_file Rails.root.join(file_fixture("location_photo.png")), type: :dropzone
|
||||
click_button submit_release_button
|
||||
|
||||
@@ -211,29 +223,6 @@ feature "User managing location releases" do
|
||||
|
||||
private
|
||||
|
||||
def fill_all_form_fields
|
||||
fill_in location_name_field, with: "Benny's Burritos"
|
||||
fill_in address_street1_field, with: "100 Broadway"
|
||||
fill_in address_city_field, with: "D"
|
||||
fill_in address_state_field, with: "CA"
|
||||
fill_in address_zip_field, with: "123"
|
||||
fill_in person_first_name_field, with: "Jane"
|
||||
fill_in person_last_name_field, with: "Doe"
|
||||
fill_in person_phone_field, with: "555-555-5555"
|
||||
fill_in person_email_field, with: "jane.doe@test.com"
|
||||
fill_in person_company_field, with: "Inc"
|
||||
fill_in person_title_field, with: "Mrs."
|
||||
fill_in person_address_street1_field, with: "100 Broadway"
|
||||
fill_in person_address_city_field, with: "D"
|
||||
fill_in person_address_state_field, with: "CA"
|
||||
fill_in person_address_zip_field, with: "123"
|
||||
fill_filming_started_on_field
|
||||
fill_filming_ended_on_field
|
||||
fill_in filming_hours_field, with: "04:00 - 22:00"
|
||||
|
||||
draw_signature file_fixture("signature.png"), "location_release_signature_base64"
|
||||
end
|
||||
|
||||
def country_field_value
|
||||
find_field("location_release[person_address_country]").value
|
||||
end
|
||||
@@ -262,66 +251,14 @@ feature "User managing location releases" do
|
||||
"location_release[person_email]"
|
||||
end
|
||||
|
||||
def person_company_field
|
||||
"location_release[person_company]"
|
||||
end
|
||||
|
||||
def person_title_field
|
||||
"location_release[person_title]"
|
||||
end
|
||||
|
||||
def address_street1_field
|
||||
"location_release[address_street1]"
|
||||
end
|
||||
|
||||
def address_city_field
|
||||
"location_release[address_city]"
|
||||
end
|
||||
|
||||
def address_state_field
|
||||
"location_release[address_state]"
|
||||
end
|
||||
|
||||
def address_zip_field
|
||||
"location_release[address_zip]"
|
||||
end
|
||||
|
||||
def address_country_field
|
||||
"location_release[address_country]"
|
||||
end
|
||||
|
||||
def person_address_street1_field
|
||||
"location_release[person_address_street1]"
|
||||
end
|
||||
|
||||
def person_address_city_field
|
||||
"location_release[person_address_city]"
|
||||
end
|
||||
|
||||
def person_address_state_field
|
||||
"location_release[person_address_state]"
|
||||
end
|
||||
|
||||
def person_address_zip_field
|
||||
"location_release[person_address_zip]"
|
||||
end
|
||||
|
||||
def person_address_country_field
|
||||
"location_release[person_address_country]"
|
||||
end
|
||||
|
||||
def person_phone_field
|
||||
"location_release[person_phone]"
|
||||
end
|
||||
|
||||
def fill_filming_started_on_field
|
||||
page.execute_script("$('#location_release_filming_started_on').val('01/03/20')")
|
||||
end
|
||||
|
||||
def fill_filming_ended_on_field
|
||||
page.execute_script("$('#location_release_filming_ended_on').val('03/03/20')")
|
||||
end
|
||||
|
||||
def filming_hours_field
|
||||
"location_release[filming_hours]"
|
||||
end
|
||||
@@ -354,10 +291,6 @@ feature "User managing location releases" do
|
||||
t("shared.submit_release_long")
|
||||
end
|
||||
|
||||
def submitted_release_notice
|
||||
"Your release was successfully submitted. Thank you."
|
||||
end
|
||||
|
||||
def create_release_notice
|
||||
t "location_releases.create.notice"
|
||||
end
|
||||
|
||||
@@ -13,27 +13,7 @@ RSpec.describe LocationRelease do
|
||||
end
|
||||
|
||||
describe "validations" do
|
||||
it { is_expected.to validate_presence_of(:name).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:address_street1).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:address_city).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:address_state).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:address_zip).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:address_country).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:person_first_name).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:person_last_name).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:person_phone).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:person_email).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:person_company).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:person_title).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:person_address_street1).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:person_address_city).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:person_address_state).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:person_address_zip).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:person_address_country).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:filming_ended_on).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:filming_started_on).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:filming_hours).on(:native) }
|
||||
it { is_expected.to validate_attachment_of(:signature).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:name) }
|
||||
it { is_expected.to allow_value("test@test.com", nil).for(:person_email) }
|
||||
it { is_expected.not_to allow_values("foo", "test@foo", "N/A").for(:person_email) }
|
||||
|
||||
|
||||
@@ -150,49 +150,9 @@ describe "IOS App Support API" do
|
||||
expect(response.body).to match /Person/
|
||||
end
|
||||
|
||||
it 'creates location release' do
|
||||
release = releases.third
|
||||
release_json = { "data" => {
|
||||
"type" => "location_release",
|
||||
"attributes" => {
|
||||
"name" => "Test Premises",
|
||||
"address_street1" => "Dummy St.",
|
||||
"address_city" => "Dummy City",
|
||||
"address_state" => "Dummy State",
|
||||
"address_zip" => "12121",
|
||||
"address_country" => "US",
|
||||
"person_first_name" => "John",
|
||||
"person_last_name" => "Doe",
|
||||
"person_phone" => "222223333",
|
||||
"person_email" => "mail@mail.com",
|
||||
"person_company" => "Dummy Company Inc.",
|
||||
"person_title" => "mr.",
|
||||
"person_address_street1" => "Dummy St. 2",
|
||||
"person_address_city" => "Dummy City 2",
|
||||
"person_address_state" => "Dummy State 2",
|
||||
"person_address_zip" => "1111111",
|
||||
"person_address_country" => "US",
|
||||
"filming_ended_on" => DateTime.now,
|
||||
"filming_started_on" => "01/02/20",
|
||||
"filming_hours" => "04-20",
|
||||
"signature" => "#{signature_base64}"
|
||||
}
|
||||
} }.to_json
|
||||
|
||||
post "/api/v1/contract_templates/#{template.id}/#{release[:type].to_s.pluralize}", params: release_json, headers: required_headers(current_user)
|
||||
|
||||
json = JSON.parse(response.body)
|
||||
|
||||
expect(response.status).to eq 201
|
||||
expect(json["data"]["attributes"].keys.length).to be > 1
|
||||
expect(response.body).to match /John/
|
||||
expect(response.body).to match /Doe/
|
||||
end
|
||||
|
||||
it 'creates talent, material and location releases' do
|
||||
releases.each do |release|
|
||||
next if release[:type] == :appearance_release
|
||||
next if release[:type] == :location_release
|
||||
|
||||
release_json = { "data" => {
|
||||
"type" => release[:type].to_s,
|
||||
|
||||
Reference in New Issue
Block a user