Compare commits
3 Commits
change-big
...
add-amendm
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a1b45ce85a | ||
|
|
1134424e37 | ||
|
|
ee710d7cd1 |
@@ -17,6 +17,7 @@ class AppearanceRelease < ApplicationRecord
|
||||
include SecondGuardianName
|
||||
include CsvExportable
|
||||
include Approvable
|
||||
include Amendmenable
|
||||
|
||||
class << self
|
||||
def custom_csv_exportable_headers
|
||||
|
||||
@@ -34,4 +34,8 @@ class AppearanceReleasePolicy < ReleasePolicy
|
||||
def approve?
|
||||
review?
|
||||
end
|
||||
|
||||
def sign_amendment?
|
||||
user.manager? || user.account_manager?
|
||||
end
|
||||
end
|
||||
|
||||
@@ -34,6 +34,17 @@
|
||||
<td>
|
||||
<%= appearance_release.signed_on %>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<% if appearance_release.amendment_signed? %>
|
||||
<i class="fa fa-check-square-o text-dark"
|
||||
data-toggle="tooltip"
|
||||
title="<%= t '.messages.amendment_signed_tooltip' %>"></i>
|
||||
<% elsif appearance_release.amendment_signable? %>
|
||||
<i class="fa fa-square-o"
|
||||
data-toggle="tooltip"
|
||||
title="<%= t '.messages.amendment_not_signed_tooltip' %>"></i>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div class="btn-group">
|
||||
<%= button_tag t(".actions.manage"), class: "btn btn-light btn-sm dropdown-toggle border", data: { toggle: "dropdown", boundary: "window" }, aria: { haspopup: true, expanded: false } %>
|
||||
@@ -44,6 +55,9 @@
|
||||
<% if policy(appearance_release.tags).new? %>
|
||||
<%= link_to fa_icon("tags fw", text: "Tags"), [:new, appearance_release, :acts_as_taggable_on_tag], class: "dropdown-item", remote: true %>
|
||||
<% end %>
|
||||
<% if policy(appearance_release).sign_amendment? && appearance_release.amendment_signable? && !appearance_release.amendment_signed? %>
|
||||
<%= link_to fa_icon("file-text fw", text: t('.actions.sign_amendment')), [:new, appearance_release.project.account, appearance_release.project, appearance_release.contract_template, appearance_release, :amendment], class: "dropdown-item", target: "_blank" %>
|
||||
<% end %>
|
||||
<% if policy(Contract).show? && (appearance_release.contract.attached? || appearance_release.contract_template.present?) %>
|
||||
<%= link_to fa_icon("download fw", text: "Download"), [appearance_release, :contracts, format: "pdf"], class: "dropdown-item", target: "_blank" %>
|
||||
<% end %>
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
<th><%= t(".table_headers.notes") %></th>
|
||||
<th><%= t(".table_headers.tags") %></th>
|
||||
<th><%= t(".table_headers.signed_at") %></th>
|
||||
<th><%= t '.table_headers.amendment_signed' %></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@@ -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(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" %>
|
||||
<%= 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(appearance 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" %>
|
||||
|
||||
@@ -140,7 +140,10 @@ en:
|
||||
actions:
|
||||
manage: Manage
|
||||
review: Review
|
||||
sign_amendment: Sign Additional Clause
|
||||
messages:
|
||||
amendment_not_signed_tooltip: Secondary Clause Not Yet Signed
|
||||
amendment_signed_tooltip: Secondary Clause Signed
|
||||
approved_tooltip: Approved by %{user} on %{timestamp}
|
||||
no_photos: Needs Photo
|
||||
create:
|
||||
@@ -173,6 +176,7 @@ en:
|
||||
empty: Appearance Releases will appear here
|
||||
imported_appearance_release_missing_attachment: Person photo or contract missing for imported appearance release
|
||||
table_headers:
|
||||
amendment_signed: Additional Clause
|
||||
approved: Approved
|
||||
contact_info: Contact info
|
||||
name: Name
|
||||
@@ -349,7 +353,7 @@ en:
|
||||
amendment_clause: Amendment Clause
|
||||
amendment_signature: Amendment Signature
|
||||
amendment_signer_name: Amendment Signer Name
|
||||
heading: Amendment
|
||||
heading: Secondary Clause
|
||||
for_office_use_only:
|
||||
description_labels:
|
||||
date_issued: Date Issued
|
||||
@@ -518,6 +522,8 @@ en:
|
||||
person_last_name: Last name
|
||||
person_name: Name
|
||||
person_phone: Phone number
|
||||
contract_template:
|
||||
amendment_clause: Secondary Clause
|
||||
location_release:
|
||||
address_city: City
|
||||
address_country: Country
|
||||
|
||||
@@ -45,6 +45,13 @@ es:
|
||||
models:
|
||||
appearance_release: Autorización de Aparacimiento
|
||||
appearance_releases:
|
||||
appearance_release:
|
||||
actions:
|
||||
sign_amendment: Sign Additional Clause (ES)
|
||||
manage: Manage (ES)
|
||||
messages:
|
||||
amendment_not_signed_tooltip: Amendment not yet signed (ES)
|
||||
amendment_signed_tooltip: Amendment signed (ES)
|
||||
create:
|
||||
failed_import: Failed to create appearance release for files listed below (ES)
|
||||
matching_started: Matching started (ES)
|
||||
@@ -64,6 +71,7 @@ es:
|
||||
index:
|
||||
imported_appearance_release_missing_attachment: Person photo or contract missing for imported appearance release (ES)
|
||||
table_headers:
|
||||
amendment_signed: Additional Clause (ES)
|
||||
contact_info: ""
|
||||
name: ""
|
||||
notes: ""
|
||||
@@ -169,7 +177,7 @@ es:
|
||||
amendment_clause: Amendment Clause (ES)
|
||||
amendment_signature: Amendment Signature (ES)
|
||||
amendment_signer_name: Amendment Signer Name (ES)
|
||||
heading: Amendment (ES)
|
||||
heading: Secondary Clause (ES)
|
||||
for_office_use_only:
|
||||
description_labels:
|
||||
date_issued: Date Issued (ES)
|
||||
|
||||
@@ -131,7 +131,9 @@ Rails.application.routes.draw do
|
||||
resources :projects, only: [] do
|
||||
resources :contract_templates, only: [:index] do
|
||||
resources :talent_releases, only: [:new, :create]
|
||||
resources :appearance_releases, only: [:new, :create]
|
||||
resources :appearance_releases, only: [:new, :create] do
|
||||
resources :amendments, only: [:new, :create]
|
||||
end
|
||||
resources :acquired_media_releases, only: [:new, :create]
|
||||
resources :location_releases, only: [:new, :create] do
|
||||
resources :amendments, only: [:new, :create]
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class AddAmendmentSignerDetailsToAppearanceReleases < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_column :appearance_releases, :amendment_signer_name, :string
|
||||
end
|
||||
end
|
||||
@@ -9,20 +9,6 @@ SET xmloption = content;
|
||||
SET client_min_messages = warning;
|
||||
SET row_security = off;
|
||||
|
||||
--
|
||||
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
|
||||
--
|
||||
|
||||
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
|
||||
|
||||
|
||||
--
|
||||
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
|
||||
--
|
||||
|
||||
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
|
||||
|
||||
|
||||
--
|
||||
-- Name: fuzzystrmatch; Type: EXTENSION; Schema: -; Owner: -
|
||||
--
|
||||
@@ -379,7 +365,8 @@ CREATE TABLE public.appearance_releases (
|
||||
guardian_2_address_country character varying,
|
||||
approved_by_user_name text,
|
||||
approved_by_user_email text,
|
||||
approved_at timestamp without time zone
|
||||
approved_at timestamp without time zone,
|
||||
amendment_signer_name character varying
|
||||
);
|
||||
|
||||
|
||||
@@ -1479,6 +1466,7 @@ CREATE TABLE public.settings (
|
||||
--
|
||||
|
||||
CREATE SEQUENCE public.settings_id_seq
|
||||
AS integer
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
@@ -1514,6 +1502,7 @@ CREATE TABLE public.taggings (
|
||||
--
|
||||
|
||||
CREATE SEQUENCE public.taggings_id_seq
|
||||
AS integer
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
@@ -1544,6 +1533,7 @@ CREATE TABLE public.tags (
|
||||
--
|
||||
|
||||
CREATE SEQUENCE public.tags_id_seq
|
||||
AS integer
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
@@ -4007,6 +3997,7 @@ INSERT INTO "schema_migrations" (version) VALUES
|
||||
('20200727143209'),
|
||||
('20200730050903'),
|
||||
('20200803145912'),
|
||||
('20200803150138');
|
||||
('20200803150138'),
|
||||
('20200804093409');
|
||||
|
||||
|
||||
|
||||
@@ -4,96 +4,108 @@ RSpec.describe Public::AmendmentsController, type: :controller do
|
||||
let(:user) { create(:user) }
|
||||
let(:account) { user.primary_account }
|
||||
let(:project) { create(:project, account: account) }
|
||||
let(:contract_template) { create(:location_release_contract_template, :with_amendment_clause, project: project) }
|
||||
let(:location_release) { create(:location_release, contract_template: contract_template, project: project) }
|
||||
|
||||
render_views
|
||||
|
||||
describe "#new" do
|
||||
it "shows amendment signing form for non-signed amendment of a release" do
|
||||
expect(location_release.amendment_signed?).to be_falsey
|
||||
shared_examples "amendments signing controller" do
|
||||
describe "#new" do
|
||||
it "shows amendment signing form for non-signed amendment of a release" do
|
||||
expect(subject.amendment_signed?).to be_falsey
|
||||
|
||||
get :new, params: {
|
||||
account_id: account,
|
||||
project_id: project,
|
||||
contract_template_id: location_release.contract_template,
|
||||
location_release_id: location_release
|
||||
}
|
||||
get :new, params: {
|
||||
account_id: account,
|
||||
project_id: project,
|
||||
contract_template_id: subject.contract_template,
|
||||
"#{subject.model_name.param_key}_id": subject
|
||||
}
|
||||
|
||||
expect(response).to be_successful
|
||||
expect(response).to be_successful
|
||||
|
||||
body = CGI.unescape_html(response.body)
|
||||
expect(body).not_to match already_signed_message
|
||||
body = CGI.unescape_html(response.body)
|
||||
expect(body).not_to match already_signed_message
|
||||
end
|
||||
|
||||
it "shows already signed message for signed amendment of a release" do
|
||||
expect(signed_release.amendment_signed?).to be_truthy
|
||||
|
||||
get :new, params: {
|
||||
account_id: account,
|
||||
project_id: project,
|
||||
contract_template_id: signed_release.contract_template,
|
||||
"#{signed_release.model_name.param_key}_id": signed_release
|
||||
}
|
||||
|
||||
expect(response).to be_successful
|
||||
|
||||
body = CGI.unescape_html(response.body)
|
||||
expect(body).to match already_signed_message
|
||||
end
|
||||
end
|
||||
|
||||
it "shows already signed message for signed amendment of a release" do
|
||||
signed_release = create(:location_release, :amendment_signed, contract_template: contract_template, project: project)
|
||||
describe "#create" do
|
||||
it "signs amendment" do
|
||||
expect(subject.amendment_signed?).to be_falsey
|
||||
|
||||
expect(signed_release.amendment_signed?).to be_truthy
|
||||
post :create, params: {
|
||||
account_id: account,
|
||||
project_id: project,
|
||||
contract_template_id: subject.contract_template,
|
||||
"#{subject.model_name.param_key}_id": subject,
|
||||
"#{subject.model_name.param_key}": {
|
||||
amendment_signer_name: "Signer Name",
|
||||
amendment_signature_base64: signature_base64
|
||||
}
|
||||
}
|
||||
|
||||
get :new, params: {
|
||||
account_id: account,
|
||||
project_id: project,
|
||||
contract_template_id: location_release.contract_template,
|
||||
location_release_id: signed_release
|
||||
}
|
||||
expect(response).to be_successful
|
||||
|
||||
expect(response).to be_successful
|
||||
body = CGI.unescape_html(response.body)
|
||||
expect(body).not_to match already_signed_message
|
||||
expect(body).to match signed_successfully_message
|
||||
|
||||
body = CGI.unescape_html(response.body)
|
||||
expect(body).to match already_signed_message
|
||||
expect(subject.class.last.amendment_signed?).to be_truthy
|
||||
expect(subject.class.last.amendment_signer_name).to eq "Signer Name"
|
||||
end
|
||||
|
||||
it "shows already signed message for signed amendment of a release" do
|
||||
expect(signed_release.amendment_signed?).to be_truthy
|
||||
|
||||
post :create, params: {
|
||||
account_id: account,
|
||||
project_id: project,
|
||||
contract_template_id: signed_release.contract_template,
|
||||
"#{signed_release.model_name.param_key}_id": signed_release,
|
||||
"#{signed_release.model_name.param_key}": {
|
||||
amendment_signer_name: "Signer Who",
|
||||
amendment_signature_base64: signature_base64
|
||||
}
|
||||
}
|
||||
|
||||
expect(response).to be_successful
|
||||
|
||||
body = CGI.unescape_html(response.body)
|
||||
expect(body).to match already_signed_message
|
||||
|
||||
expect(signed_release.amendment_signed?).to be_truthy
|
||||
expect(signed_release.amendment_signer_name).to eq "Amendment Signer"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#create" do
|
||||
it "signs amendment" do
|
||||
expect(location_release.amendment_signed?).to be_falsey
|
||||
context "for location release" do
|
||||
let(:contract_template) { create(:location_release_contract_template, :with_amendment_clause, project: project) }
|
||||
let(:signed_release) { create(:location_release, :amendment_signed, contract_template: contract_template, project: project) }
|
||||
subject { create(:location_release, contract_template: contract_template, project: project) }
|
||||
|
||||
post :create, params: {
|
||||
account_id: account,
|
||||
project_id: project,
|
||||
contract_template_id: location_release.contract_template,
|
||||
location_release_id: location_release,
|
||||
location_release: {
|
||||
amendment_signer_name: "Signer Name",
|
||||
amendment_signature_base64: signature_base64
|
||||
}
|
||||
}
|
||||
it_behaves_like "amendments signing controller"
|
||||
end
|
||||
|
||||
expect(response).to be_successful
|
||||
context "for location release" do
|
||||
let(:contract_template) { create(:appearance_release_contract_template, :with_amendment_clause, project: project) }
|
||||
let(:signed_release) { create(:appearance_release, :amendment_signed, contract_template: contract_template, project: project) }
|
||||
subject { create(:appearance_release, contract_template: contract_template, project: project) }
|
||||
|
||||
body = CGI.unescape_html(response.body)
|
||||
expect(body).not_to match already_signed_message
|
||||
expect(body).to match signed_successfully_message
|
||||
|
||||
expect(LocationRelease.last.amendment_signed?).to be_truthy
|
||||
expect(LocationRelease.last.amendment_signer_name).to eq "Signer Name"
|
||||
end
|
||||
|
||||
it "shows already signed message for signed amendment of a release" do
|
||||
signed_release = create(:location_release, :amendment_signed, name: "Test Loc", amendment_signer_name: "Big Signer", contract_template: contract_template, project: project)
|
||||
|
||||
expect(signed_release.amendment_signed?).to be_truthy
|
||||
|
||||
post :create, params: {
|
||||
account_id: account,
|
||||
project_id: project,
|
||||
contract_template_id: location_release.contract_template,
|
||||
location_release_id: signed_release,
|
||||
location_release: {
|
||||
amendment_signer_name: "Signer Who",
|
||||
amendment_signature_base64: signature_base64
|
||||
}
|
||||
}
|
||||
|
||||
expect(response).to be_successful
|
||||
|
||||
body = CGI.unescape_html(response.body)
|
||||
expect(body).to match already_signed_message
|
||||
|
||||
expect(signed_release.amendment_signed?).to be_truthy
|
||||
expect(signed_release.amendment_signer_name).to eq "Big Signer"
|
||||
end
|
||||
it_behaves_like "amendments signing controller"
|
||||
end
|
||||
|
||||
private
|
||||
@@ -109,4 +121,4 @@ RSpec.describe Public::AmendmentsController, type: :controller do
|
||||
def signature_base64
|
||||
@signature_base64 ||= Base64Image.from_image(file_fixture('signature.png')).data_uri
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -32,6 +32,14 @@ FactoryBot.define do
|
||||
end
|
||||
end
|
||||
|
||||
trait :amendment_signed do
|
||||
amendment_signature do
|
||||
path = Rails.root.join("spec", "fixtures", "files", "signature.png")
|
||||
Rack::Test::UploadedFile.new(path, "image/png")
|
||||
end
|
||||
amendment_signer_name "Amendment Signer"
|
||||
end
|
||||
|
||||
trait :minor do
|
||||
minor true
|
||||
guardian_first_name "Jamie"
|
||||
|
||||
@@ -66,6 +66,18 @@ RSpec.feature 'User manages contract templates', type: :feature do
|
||||
expect(ContractTemplate.last.amendment_clause.body.to_s).to match /Amendment clause text/
|
||||
end
|
||||
|
||||
scenario 'appearance release template has a amendment clause field' do
|
||||
visit new_project_contract_template_path(project)
|
||||
|
||||
fill_in 'Name', with: 'My Release Template'
|
||||
select 'Appearance Release', from: 'Release type'
|
||||
fill_hidden amendment_clause_field, with: 'Amendment clause text'
|
||||
click_on create_release_template_button
|
||||
|
||||
expect(page).to have_content(create_contract_template_success_message)
|
||||
expect(ContractTemplate.last.amendment_clause.body.to_s).to match /Amendment clause text/
|
||||
end
|
||||
|
||||
scenario 'medical release template has a guardian clause field' do
|
||||
visit new_project_contract_template_path(project)
|
||||
|
||||
|
||||
@@ -144,6 +144,49 @@ feature 'User managing appearance releases' do
|
||||
|
||||
expect(page).to have_content dummy_signature_legal_text
|
||||
end
|
||||
|
||||
scenario "signing amendment for a not-signed amendment release", js: true do
|
||||
contract_template = create(:appearance_release_contract_template, :with_amendment_clause, project: project)
|
||||
release = create(:appearance_release, contract_template: contract_template, project: project)
|
||||
|
||||
expect(release.amendment_signed?).to be_falsey
|
||||
|
||||
visit new_account_project_contract_template_appearance_release_amendment_path(project.account, project, contract_template, release)
|
||||
|
||||
expect(page).to have_content amendments_heading
|
||||
|
||||
fill_in amendment_signer_name_field, with: 'Big Signer'
|
||||
draw_signature file_fixture("signature.png"), amendment_signature_field
|
||||
|
||||
click_button sign_amendment_button
|
||||
|
||||
expect(page).to have_content signed_successfully_message
|
||||
expect(AppearanceRelease.find(release.id).amendment_signed?).to be_truthy
|
||||
end
|
||||
|
||||
scenario "opening signing amendment page for a signed amendment release shows already signed message", js: true do
|
||||
contract_template = create(:appearance_release_contract_template, :with_amendment_clause, project: project)
|
||||
release = create(:appearance_release, :amendment_signed, contract_template: contract_template, project: project)
|
||||
|
||||
expect(release.amendment_signed?).to be_truthy
|
||||
|
||||
visit new_account_project_contract_template_appearance_release_amendment_path(project.account, project, contract_template, release)
|
||||
|
||||
expect(page).not_to have_content amendments_heading
|
||||
expect(page).not_to have_content signed_successfully_message
|
||||
expect(page).to have_content already_signed_message
|
||||
end
|
||||
|
||||
scenario "amendment signing form has copy URL button" do
|
||||
contract_template = create(:appearance_release_contract_template, :with_amendment_clause, project: project)
|
||||
release = create(:appearance_release, contract_template: contract_template, project: project)
|
||||
|
||||
visit new_account_project_contract_template_appearance_release_amendment_path(project.account, project, contract_template, release)
|
||||
|
||||
expect(page).to have_content copy_url_button
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
context 'when signed in' do
|
||||
@@ -292,7 +335,81 @@ feature 'User managing appearance releases' do
|
||||
expect(page).to have_content('New Name')
|
||||
end
|
||||
|
||||
scenario 'viewing the contract PDF' do
|
||||
scenario "signing amendment for a not-signed amendment release", js: true do
|
||||
contract_template = create(:appearance_release_contract_template, :with_amendment_clause, project: project)
|
||||
release = create(:appearance_release, person_first_name: "First", contract_template: contract_template, project: project)
|
||||
|
||||
expect(release.amendment_signed?).to be_falsey
|
||||
|
||||
visit project_appearance_releases_path(project)
|
||||
|
||||
expect(page).to have_content "First"
|
||||
|
||||
click_on manage_button
|
||||
|
||||
expect(page).to have_link sign_amendment_link
|
||||
|
||||
new_window = window_opened_by { click_link sign_amendment_link }
|
||||
within_window new_window do
|
||||
expect(page).to have_content amendments_heading
|
||||
|
||||
fill_in amendment_signer_name_field, with: 'Big Signer'
|
||||
draw_signature file_fixture("signature.png"), amendment_signature_field
|
||||
|
||||
click_button sign_amendment_button
|
||||
|
||||
expect(page).to have_content signed_successfully_message
|
||||
expect(AppearanceRelease.find(release.id).amendment_signed?).to be_truthy
|
||||
end
|
||||
end
|
||||
|
||||
scenario "signed amendment release does not have sign amendment option in manage dropdown", js: true do
|
||||
contract_template = create(:appearance_release_contract_template, :with_amendment_clause, project: project)
|
||||
release = create(:appearance_release, :amendment_signed, person_first_name: "Firstn", contract_template: contract_template, project: project)
|
||||
|
||||
expect(release.amendment_signed?).to be_truthy
|
||||
|
||||
visit project_appearance_releases_path(project)
|
||||
|
||||
expect(page).to have_content "Firstn"
|
||||
|
||||
click_on manage_button
|
||||
|
||||
expect(page).not_to have_link sign_amendment_link
|
||||
end
|
||||
|
||||
scenario "signed amendment release have checked box in appearance releases index table", js: true do
|
||||
contract_template = create(:appearance_release_contract_template, :with_amendment_clause, project: project)
|
||||
not_signed_release = create(:appearance_release, person_first_name: "Firstn", contract_template: contract_template, project: project)
|
||||
expect(not_signed_release.amendment_signed?).to be_falsey
|
||||
|
||||
visit project_appearance_releases_path(project)
|
||||
|
||||
expect(page).to have_content "Firstn"
|
||||
expect(page).to have_css('i.fa.fa-square-o', count: 1)
|
||||
expect(page).to have_css('i.fa.fa-check-square', count: 0)
|
||||
|
||||
signed_release = create(:appearance_release, :amendment_signed, person_first_name: "Signedn", contract_template: contract_template, project: project)
|
||||
expect(signed_release.amendment_signed?).to be_truthy
|
||||
|
||||
visit project_appearance_releases_path(project)
|
||||
|
||||
expect(page).to have_content "Signedn"
|
||||
|
||||
expect(page).to have_css('i.fa.fa-square-o', count: 1)
|
||||
expect(page).to have_css('i.fa.fa-check-square-o', count: 1)
|
||||
end
|
||||
|
||||
scenario "amendment signing form has copy URL button when user is signed in", js: true do
|
||||
contract_template = create(:appearance_release_contract_template, :with_amendment_clause, project: project)
|
||||
release = create(:appearance_release, contract_template: contract_template, project: project)
|
||||
|
||||
visit new_account_project_contract_template_appearance_release_amendment_path(project.account, project, contract_template, release)
|
||||
|
||||
expect(page).to have_content copy_url_button
|
||||
end
|
||||
|
||||
scenario 'viewing the contract PDF when amendment is not yet signed' do
|
||||
appearance_release = create(:appearance_release_with_contract_template,
|
||||
:native,
|
||||
project: project,
|
||||
@@ -319,6 +436,7 @@ feature 'User managing appearance releases' do
|
||||
expect(content_type).to eq('application/pdf')
|
||||
expect(content_disposition).to include('inline')
|
||||
expect(pdf_filename).to include('doe-jane')
|
||||
expect(pdf_body).not_to have_content amendment_page_heading
|
||||
expect(pdf_body).to have_content('Jane Doe')
|
||||
expect(pdf_body).to have_content('NOTES')
|
||||
expect(pdf_body).to have_content('Note 1')
|
||||
@@ -333,6 +451,35 @@ feature 'User managing appearance releases' do
|
||||
expect(pdf_body).not_to have_content('Guardian Email')
|
||||
end
|
||||
|
||||
scenario "viewing the contract PDF when amendment is signed" do
|
||||
contract_template = create(:appearance_release_contract_template, :with_amendment_clause, project: project)
|
||||
appearance_release = create(:appearance_release,
|
||||
:amendment_signed,
|
||||
:native,
|
||||
contract_template: contract_template,
|
||||
project: project,
|
||||
person_first_name: "John",
|
||||
person_last_name: "Doe")
|
||||
|
||||
sign_in(current_user)
|
||||
visit project_appearance_releases_path(project)
|
||||
click_link *view_release_pdf_link_for(appearance_release)
|
||||
|
||||
expect(content_type).to eq("application/pdf")
|
||||
expect(content_disposition).to include("inline")
|
||||
expect(pdf_filename).to include("doe-john")
|
||||
|
||||
expect(pdf_body).to have_content("John Doe")
|
||||
|
||||
expect(pdf_body).to have_content amendment_page_heading.upcase
|
||||
expect(pdf_body).to have_content amendment_clause_label
|
||||
expect(pdf_body).to have_content amendment_signer_name_label
|
||||
expect(pdf_body).to have_content amendment_signature_label
|
||||
|
||||
expect(pdf_body).to have_content contract_template.amendment_clause.to_plain_text
|
||||
expect(pdf_body).to have_content appearance_release.amendment_signer_name
|
||||
end
|
||||
|
||||
scenario 'viewing contract PDF for a minor without guardian photo' do
|
||||
appearance_release = create(:appearance_release_with_contract_template, :native, :minor, project: project)
|
||||
|
||||
@@ -373,7 +520,7 @@ feature 'User managing appearance releases' do
|
||||
|
||||
visit project_appearance_releases_path(project)
|
||||
|
||||
click_on 'Manage'
|
||||
click_on manage_button
|
||||
accept_alert do
|
||||
click_link *destroy_link_for(appearance_release)
|
||||
end
|
||||
@@ -576,7 +723,7 @@ feature 'User managing appearance releases' do
|
||||
create(:appearance_release_with_contract_template, :native, project: project)
|
||||
|
||||
visit project_appearance_releases_path(project)
|
||||
click_on "Manage"
|
||||
click_on manage_button
|
||||
|
||||
expect(page).not_to have_link(review_action, exact: true)
|
||||
end
|
||||
@@ -594,7 +741,7 @@ feature 'User managing appearance releases' do
|
||||
|
||||
visit project_appearance_releases_path(project)
|
||||
|
||||
click_on 'Manage'
|
||||
click_on manage_button
|
||||
expect(page).not_to have_link('Download', exact: true)
|
||||
end
|
||||
|
||||
@@ -602,7 +749,7 @@ feature 'User managing appearance releases' do
|
||||
create(:appearance_release_with_contract_template, :native, project: project)
|
||||
|
||||
visit project_appearance_releases_path(project)
|
||||
click_on "Manage"
|
||||
click_on manage_button
|
||||
|
||||
expect(page).not_to have_link(review_action, exact: true)
|
||||
end
|
||||
@@ -866,4 +1013,56 @@ feature 'User managing appearance releases' do
|
||||
def date_issued
|
||||
t 'contracts.for_office_use_only.description_labels.date_issued'
|
||||
end
|
||||
|
||||
def amendments_heading
|
||||
t 'public.amendments.new.amendment.heading'
|
||||
end
|
||||
|
||||
def amendment_signer_name_field
|
||||
'appearance_release[amendment_signer_name]'
|
||||
end
|
||||
|
||||
def amendment_signature_field
|
||||
'appearance_release_amendment_signature_base64'
|
||||
end
|
||||
|
||||
def sign_amendment_button
|
||||
t 'shared.submit_release_long'
|
||||
end
|
||||
|
||||
def already_signed_message
|
||||
t 'public.amendments.create.amendment_already_signed_message'
|
||||
end
|
||||
|
||||
def signed_successfully_message
|
||||
t 'public.amendments.create.amendment_signed_message'
|
||||
end
|
||||
|
||||
def manage_button
|
||||
t 'appearance_releases.appearance_release.actions.manage'
|
||||
end
|
||||
|
||||
def sign_amendment_link
|
||||
t 'appearance_releases.appearance_release.actions.sign_amendment'
|
||||
end
|
||||
|
||||
def copy_url_button
|
||||
t 'public.amendments.new.copy_url'
|
||||
end
|
||||
|
||||
def amendment_page_heading
|
||||
t 'contracts.amendment_page.heading'
|
||||
end
|
||||
|
||||
def amendment_signer_name_label
|
||||
t 'contracts.amendment_page.description_labels.amendment_signer_name'
|
||||
end
|
||||
|
||||
def amendment_clause_label
|
||||
t 'contracts.amendment_page.description_labels.amendment_clause'
|
||||
end
|
||||
|
||||
def amendment_signature_label
|
||||
t 'contracts.amendment_page.description_labels.amendment_signature'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -376,7 +376,7 @@ feature "User managing location releases" do
|
||||
|
||||
expect(pdf_body).to have_content("Test Loc")
|
||||
|
||||
expect(pdf_body).to have_content amendment_page_heading
|
||||
expect(pdf_body).to have_content amendment_page_heading.upcase
|
||||
expect(pdf_body).to have_content amendment_clause_label
|
||||
expect(pdf_body).to have_content amendment_signer_name_label
|
||||
expect(pdf_body).to have_content amendment_signature_label
|
||||
|
||||
Reference in New Issue
Block a user