Compare commits

...

4 Commits

Author SHA1 Message Date
Bilal
a57dc12557 make email required for misc public form 2020-07-08 12:58:55 +02:00
Senad Uka
19b1e75384 Upstream sync 2020-07-07 23:14:42 +02:00
Senad Uka
93a4ce462d Upstream sync 2020-07-07 21:45:30 +02:00
Senad Uka
0e16791d8b Upstream sync 2020-07-07 05:08:32 +02:00
31 changed files with 148 additions and 52 deletions

View File

@@ -17,7 +17,9 @@ class Api::ApiController < ActionController::Base
def return_error(exception)
raise exception if Rails.env.test?
logger.error "==Handled======="
Raven.capture_exception(exception)
logger.error "==Handled======"
logger.error exception.message
logger.error exception.backtrace.join("\n")
logger.error "==Handled======="

View File

@@ -5,6 +5,8 @@ class Api::UserTokenController < Knock::AuthTokenController
# Catch exception and return JSON-formatted error
def return_error(exception)
Raven.capture_exception(exception)
logger.error "==Handled======="
logger.error exception.message
logger.error exception.backtrace.join("\n")

View File

@@ -62,18 +62,19 @@ class ContractTemplatesController < ApplicationController
def contract_template_params
params
.require(:contract_template)
.permit(:name, :release_type, :body, :guardian_clause, :fee,
.permit(:name, :release_type, :body, :guardian_clause,
:signature_legal_text, :fee,
:applicable_medium_id, :applicable_medium_text,
:territory_id, :territory_text,
:term_id, :term_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_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,
:question_11_text, :question_12_text,
:question_13_text, :question_14_text,
:question_11_text, :question_12_text,
:question_13_text, :question_14_text,
:question_15_text)
end

View File

@@ -22,7 +22,7 @@ class GenerateContractsZipJob < ApplicationJob
end
end
@download.file.attach(io: File.open(zipfile_name), filename: @folder_name)
@download.file.attach(io: File.open(zipfile_name), filename: "#{@folder_name}.zip")
end
rescue StandardError => e
Rails.logger.error("Failed to generate download for project (##{project.id}) with release type #{release_type}\n" + e.message)

View File

@@ -21,6 +21,7 @@ class ContractTemplate < ApplicationRecord
monetize :fee_cents
has_rich_text :body
has_rich_text :guardian_clause
has_rich_text :signature_legal_text
validates :name, presence: true
validates :release_type, presence: true

View File

@@ -10,7 +10,7 @@ class QrCode
url = Rails.application.routes.url_helpers.url_for(route)
filename = [contract_template.project.name, contract_template.name].map(&:parameterize).join("_")
new(url, filename)
new(url, "#{filename}.png")
end
def initialize(url, filename = "qrcode.png")

View File

@@ -18,15 +18,7 @@
<div class="card-body p-0">
<div class="embed-responsive embed-responsive-16by9">
<div class="embed-responsive-item">
<table class="w-100 h-100 bg-secondary">
<tbody>
<tr>
<td class="text-center align-middle text-white">
Video tutorial will be available soon
</td>
</tr>
</tbody>
</table>
<div style="padding:56.25% 0 0 0;position:relative;"><iframe src="https://player.vimeo.com/video/435943632" style="position:absolute;top:0;left:0;width:100%;height:100%;" frameborder="0" allow="autoplay; fullscreen" allowfullscreen></iframe></div><script src="https://player.vimeo.com/api/player.js"></script>
</div>
</div>
</div>

View File

@@ -27,7 +27,7 @@
<%= link_to fa_icon("print", text: "Print"), [:new, contract_template, :blank_contracts], class: "dropdown-item", target: :_blank %>
<% end %>
<% if policy(contract_template).destroy? %>
<%= link_to fa_icon("archive", text: "Archive"), contract_template, class: "dropdown-item", method: :delete, data: { confirm: "Are you sure?" } %>
<%= link_to fa_icon("trash", text: "Delete"), contract_template, class: "dropdown-item", method: :delete, data: { confirm: "Are you sure?" } %>
<% end %>
</div>
</div>

View File

@@ -25,6 +25,11 @@
<%= form.rich_text_area :guardian_clause %>
<% end %>
</div>
<div id="signature_legal_text">
<%= form.form_group do %>
<%= form.rich_text_area :signature_legal_text %>
<% end %>
</div>
<% end %>
<%= field_set_tag content_tag(:span, t(".custom_fields.heading"), class: "h6 text-muted text-uppercase"), id: "custom_fields", style: "display: none;" do %>

View File

@@ -18,15 +18,7 @@
<div class="card-body p-0">
<div class="embed-responsive embed-responsive-16by9">
<div class="embed-responsive-item">
<table class="w-100 h-100 bg-secondary">
<tbody>
<tr>
<td class="text-center align-middle text-white">
Video tutorial will be available soon
</td>
</tr>
</tbody>
</table>
<div style="padding:56.25% 0 0 0;position:relative;"><iframe src="https://player.vimeo.com/video/435942851" style="position:absolute;top:0;left:0;width:100%;height:100%;" frameborder="0" allow="autoplay; fullscreen" allowfullscreen></iframe></div><script src="https://player.vimeo.com/api/player.js"></script>
</div>
</div>
</div>

View File

@@ -50,7 +50,7 @@
<hr>
<%= card_field_set_tag t(".signature.heading") do %>
<%= render "shared/signature_fields", form: form %>
<%= render "shared/signature_fields", form: form, signature_legal_text: @contract_template.signature_legal_text %>
<% end %>
<div class="mt-5">

View File

@@ -156,7 +156,7 @@
<% end %>
<%= card_field_set_tag t(".signature.heading") do %>
<%= render "shared/signature_fields", form: form %>
<%= render "shared/signature_fields", form: form, signature_legal_text: @contract_template.signature_legal_text %>
<% end %>
<div class="mt-5">

View File

@@ -50,7 +50,7 @@
<% end %>
<%= card_field_set_tag t(".signature.heading") do %>
<%= render "shared/signature_fields", form: form, instruction: 'An Authorized Signatory' %>
<%= render "shared/signature_fields", form: form, instruction: 'An Authorized Signatory', signature_legal_text: @contract_template.signature_legal_text %>
<% end %>
<div class="mt-5">

View File

@@ -41,7 +41,7 @@
<hr>
<%= card_field_set_tag t(".signature.heading") do %>
<%= render "shared/signature_fields", form: form, instruction: 'For Owner or Authorized Signatory' %>
<%= render "shared/signature_fields", form: form, instruction: 'For Owner or Authorized Signatory', signature_legal_text: @contract_template.signature_legal_text %>
<% end %>
<div class="mt-5">

View File

@@ -145,7 +145,7 @@
<% end %>
<%= card_field_set_tag t(".signature.heading") do %>
<%= render "shared/signature_fields", form: form %>
<%= render "shared/signature_fields", form: form, signature_legal_text: @contract_template.signature_legal_text %>
<% end %>
<div class="mt-5">

View File

@@ -39,9 +39,7 @@
<%= form.text_field :person_first_name, required: true, wrapper_class: "col-sm-6" %>
<%= form.text_field :person_last_name, required: true, wrapper_class: "col-sm-6" %>
<%= form.phone_field :person_phone, wrapper_class: "col-sm-6" %>
</div>
<div class="form-row">
<%= form.email_field :person_email, wrapper_class: "col-sm-6" %>
<%= form.email_field :person_email, required: true, wrapper_class: "col-sm-6" %>
</div>
<%= render "shared/address_fields", form: form, subject: "person" %>
<% end %>
@@ -97,7 +95,7 @@
<% end %>
<%= card_field_set_tag t(".signature.heading") do %>
<%= render "shared/signature_fields", form: form %>
<%= render "shared/signature_fields", form: form, signature_legal_text: @contract_template.signature_legal_text %>
<% end %>
<div class="mt-5">

View File

@@ -131,7 +131,7 @@
<% end %>
<%= card_field_set_tag t(".signature.heading") do %>
<%= render "shared/signature_fields", form: form %>
<%= render "shared/signature_fields", form: form, signature_legal_text: @contract_template.signature_legal_text %>
<% end %>
<div class="mt-5">

View File

@@ -12,4 +12,8 @@
<%= fa_icon "refresh" %> <%= t "shared.clear" %>
<% end %>
</div>
<br>
<% if local_assigns[:signature_legal_text] && signature_legal_text.present? %>
<div class="alert alert-warning font-weight-bold"><%= signature_legal_text %></div>
<% end %>

View File

@@ -13,3 +13,4 @@
<% end %>
<% end %>
<p class="alert alert-success p-3 lead text-center"><%= t '.success_message' %></p>
<%= link_to fa_icon("check", text: "Done"), [@project, :task_requests], class: "btn btn-primary" %>

View File

@@ -6,7 +6,7 @@
<%= link_to t(".actions.book_demo"), 'https://meetings.hubspot.com/bray2', class: "btn btn-primary border align-self-center h-50 ml-auto mr-2 pb-2", target: '_blank' %>
<% if policy(Video).new? %>
<%= link_to t(".actions.upload_video"), [:new, @project, :video], class: "btn btn-success border align-self-center h-50 pb-2" %>
<%= link_to t(".actions.upload_video"), [:landing, @project, :videos], class: "btn btn-success border align-self-center h-50 pb-2" %>
<% end %>
</div>
@@ -18,15 +18,7 @@
<div class="card-body p-0">
<div class="embed-responsive embed-responsive-16by9">
<div class="embed-responsive-item">
<table class="w-100 h-100 bg-secondary">
<tbody>
<tr>
<td class="text-center align-middle text-white">
Video tutorial will be available soon
</td>
</tr>
</tbody>
</table>
<div style="padding:56.25% 0 0 0;position:relative;"><iframe src="https://player.vimeo.com/video/435943995" style="position:absolute;top:0;left:0;width:100%;height:100%;" frameborder="0" allow="autoplay; fullscreen" allowfullscreen></iframe></div><script src="https://player.vimeo.com/api/player.js"></script>
</div>
</div>
</div>

View File

@@ -364,6 +364,7 @@ en:
contract_template:
fee: Leave at $0.00 for no-fee
guardian_clause: Leave blank if not required for this contract
signature_legal_text: Leave blank if not required for this contract
task_request:
time_allowed: Minimum of 2 hours, no partial hours allowed
video:

View File

@@ -160,6 +160,7 @@ es:
contract_template:
fee: Leave at $0.00 for no-fee (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:
appearance_release:
guardian_2_address_city: Guardian 2 city (ES)

View File

@@ -21,6 +21,7 @@ RSpec.feature 'User creates task request', type: :feature do
click_on 'Create Task request'
expect(page).to have_content task_created_message
expect(page).to have_link("Done")
end
scenario 'user can view task request details' do
@@ -89,4 +90,4 @@ RSpec.feature 'User creates task request', type: :feature do
def task_created_message
t 'task_requests.create.success_message'
end
end
end

View File

@@ -35,6 +35,24 @@ RSpec.feature 'User manages contract templates', type: :feature do
expect(page).to have_content(create_contract_template_success_message)
end
scenario 'creating new release template, all release types accept signature legal text' do
all_release_types = ['Acquired Media', 'Appearance', 'Location', 'Material', 'Medical', 'Misc', 'Talent']
all_release_types.each do |release_type|
visit new_project_contract_template_path(project)
dropdown_selection = "#{release_type} Release"
select dropdown_selection, from: 'Release type'
fill_in 'Name', with: "My #{release_type} template"
fill_in_trix signature_legal_text_field, with: 'LL'
expect do
click_on 'Create Release Template'
end.to change(ContractTemplate, :count).by(1)
end
end
scenario 'medical release template has a guardian clause field' do
visit new_project_contract_template_path(project)
@@ -222,7 +240,7 @@ RSpec.feature 'User manages contract templates', type: :feature do
click_on 'Manage'
accept_alert do
click_on 'Archive'
click_on 'Delete'
end
expect(page).to have_content('The release template has been archived')
@@ -273,7 +291,7 @@ RSpec.feature 'User manages contract templates', type: :feature do
visit project_contract_templates_path(project)
click_on 'Manage'
expect(page).to have_content('Archive')
expect(page).to have_content('Delete')
end
it 'does not show create release button on splash page' do
@@ -310,6 +328,10 @@ RSpec.feature 'User manages contract templates', type: :feature do
'contract_template_guardian_clause_trix_input_contract_template'
end
def signature_legal_text_field
'contract_template_signature_legal_text'
end
def create_contract_template_success_message
'The release template has been created'
end
@@ -329,4 +351,8 @@ RSpec.feature 'User manages contract templates', type: :feature do
def create_release_template
t 'contract_templates.splash.actions.create_template'
end
def signature_legal_text_trix_field
'Signature legal text'
end
end

View File

@@ -41,6 +41,13 @@ feature "User managing acquired_media releases" do
expect(AcquiredMediaRelease.last.categories).to include("Still Photograph")
expect(page).to have_content("Your release was successfully submitted. Thank you.")
end
scenario "creating a release, if contract template contains signature legal language, it is shown" do
contract_template = create(:contract_template, project: project, signature_legal_text: dummy_signature_legal_text)
visit new_account_project_contract_template_acquired_media_release_path(project.account, project, contract_template)
expect(page).to have_content dummy_signature_legal_text
end
end
context "when signed in" do
@@ -357,4 +364,8 @@ feature "User managing acquired_media releases" do
def destroy_release_alert
t "acquired_media_releases.destroy.alert"
end
def dummy_signature_legal_text
'Some signature legal language'
end
end

View File

@@ -137,6 +137,13 @@ feature 'User managing appearance releases' do
expect(page).to have_content(successful_submission_message)
expect(AppearanceRelease.last.guardian_2_first_name).to eq 'Second'
end
scenario "creating a release, if contract template contains signature legal language, it is shown" do
contract_template = create(:contract_template, project: project, signature_legal_text: dummy_signature_legal_text)
visit new_account_project_contract_template_appearance_release_path(project.account, project, contract_template)
expect(page).to have_content dummy_signature_legal_text
end
end
context 'when signed in' do
@@ -706,4 +713,8 @@ feature 'User managing appearance releases' do
def guardian_2_photo_heading
t 'appearance_releases.form.photos.guardian_2_photo.heading'
end
def dummy_signature_legal_text
'Some signature legal language'
end
end

View File

@@ -71,6 +71,13 @@ feature "User managing location releases" do
expect(page).to have_content("Your release was successfully submitted. Thank you.")
expect(LocationRelease.last.photos.attached?).to eq true
end
scenario "creating a release, if contract template contains signature legal language, it is shown" do
contract_template = create(:contract_template, project: project, signature_legal_text: dummy_signature_legal_text)
visit new_account_project_contract_template_location_release_path(project.account, project, contract_template)
expect(page).to have_content dummy_signature_legal_text
end
end
context "when signed in" do
@@ -375,4 +382,8 @@ feature "User managing location releases" do
select "Other", from: "Restriction"
fill_in "Describe other restrictions", with: "Test"
end
def dummy_signature_legal_text
'Some signature legal language'
end
end

View File

@@ -84,6 +84,13 @@ feature "User managing material releases" do
click_button submit_release_button
expect(page).to have_content success_submit_message
end
scenario "creating a release, if contract template contains signature legal language, it is shown" do
contract_template = create(:contract_template, project: project, signature_legal_text: dummy_signature_legal_text)
visit new_account_project_contract_template_material_release_path(project.account, project, contract_template)
expect(page).to have_content dummy_signature_legal_text
end
end
context "when signed in" do
@@ -382,4 +389,8 @@ feature "User managing material releases" do
click_button submit_release_button
expect(page).not_to have_content success_submit_message
end
def dummy_signature_legal_text
'Some signature legal language'
end
end

View File

@@ -168,6 +168,13 @@ feature "User managing medical releases" do
expect(page).to have_content(successful_submission_message)
end
scenario "creating a release, if contract template contains signature legal language, it is shown" do
contract_template = create(:contract_template, project: project, signature_legal_text: dummy_signature_legal_text)
visit new_account_project_contract_template_medical_release_path(project.account, project, contract_template)
expect(page).to have_content dummy_signature_legal_text
end
end
context "when signed in as account manager" do
@@ -447,4 +454,8 @@ feature "User managing medical releases" do
def answer_field_for_question(number)
"medical_release[question_#{number}_answer]"
end
def dummy_signature_legal_text
'Some signature legal language'
end
end

View File

@@ -48,6 +48,13 @@ feature "User managing misc releases" do
expect(field).to be_visible
end
end
scenario "creating a release, if contract template contains signature legal language, it is shown" do
contract_template = create(:contract_template, project: project, signature_legal_text: dummy_signature_legal_text)
visit new_account_project_contract_template_misc_release_path(project.account, project, contract_template)
expect(page).to have_content dummy_signature_legal_text
end
end
context "when signed in as account manager" do
@@ -199,4 +206,8 @@ feature "User managing misc releases" do
def person_is_minor_checkbox
'misc_release_minor'
end
def dummy_signature_legal_text
'Some signature legal language'
end
end

View File

@@ -126,6 +126,13 @@ feature "User managing talent releases" do
expect(TalentRelease.last.guardian_2_photo.attached?).to eq true
expect(TalentRelease.last.guardian_2_name).to eq "Second Guardian"
end
scenario "creating a release, if contract template contains signature legal language, it is shown" do
contract_template = create(:contract_template, project: project, signature_legal_text: dummy_signature_legal_text)
visit new_account_project_contract_template_talent_release_path(project.account, project, contract_template)
expect(page).to have_content dummy_signature_legal_text
end
end
context "when signed in" do
@@ -555,4 +562,8 @@ feature "User managing talent releases" do
fill_in guardian_address_state_field, with: "NY"
fill_in guardian_address_zip_field, with: '1000'
end
def dummy_signature_legal_text
'Some signature legal language'
end
end