Compare commits

..

4 Commits

Author SHA1 Message Date
Bilal
9edfe3d291 fix MR comments 2020-07-24 14:58:44 +02:00
Bilal
7ef27d4c1d fix MR comments 2020-07-24 14:57:35 +02:00
Bilal
f8bdc5bce5 fix 2020-07-22 23:51:55 +02:00
Bilal
86e441eebd add delete button to the files in broadcast page 2020-07-22 22:10:33 +02:00
31 changed files with 48 additions and 656 deletions

View File

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

View File

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

View File

@@ -82,7 +82,7 @@ class ContractTemplatesController < ApplicationController
params
.require(:contract_template)
.permit(:name, :release_type, :body, :guardian_clause,
:signature_legal_text, :fee, :amendment_clause,
:signature_legal_text, :fee,
:applicable_medium_id, :applicable_medium_text,
:territory_id, :territory_text,
:term_id, :term_text, :accessibility,

View File

@@ -1,47 +0,0 @@
class Public::AmendmentsController < Public::BaseController
skip_after_action :verify_authorized, :verify_policy_scoped
before_action :set_account, :set_project, :set_contract_template, :set_release
def new
if @release.amendment_signed?
render :create, locals: { already_signed: true }
end
end
def create
if @release.amendment_signed?
render :create, locals: { already_signed: true }
return
end
@release.attributes = amendment_params
render :new unless @release.save(context: :amendment)
end
private
def amendment_params
params.require(releasable_param.name).permit(:amendment_signer_name, :amendment_signature_base64)
end
def releasable_param
@releasable_param ||= ReleasableParam.new(params.to_unsafe_h)
end
def set_release
@release = @contract_template.releases.find(releasable_param.id)
end
def set_contract_template
@contract_template = @project.contract_templates.find(params[:contract_template_id])
end
def set_project
@project = @account.projects.find(params[:project_id])
end
def set_account
@account = Account.find_by(slug: params[:account_id])
end
end

View File

@@ -1,32 +0,0 @@
module Amendmenable
extend ActiveSupport::Concern
included do
include ActiveStorageSupport::SupportForBase64
has_one_base64_attached :amendment_signature
with_options on: :amendment do
validates :amendment_signer_name, presence: true
validates :amendment_signature, attached: true
end
end
def amendment_signable?
contract_template.present? && contract_template.amendment_clause.present?
end
def amendment_signed?
amendment_signature.attached?
end
def amendment_signature_base64
nil
end
def amendment_signature_base64=(data_uri)
return if data_uri.blank?
amendment_signature.attach(data: data_uri, filename: "amendment_signature.png", content_type: "image/png", identify: "false")
end
end

View File

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

View File

@@ -12,7 +12,6 @@ class LocationRelease < ApplicationRecord
include PersonName
include CsvExportable
include Approvable
include Amendmenable
class << self
def custom_csv_exportable_headers

View File

@@ -39,10 +39,6 @@ class LocationReleasePolicy < ReleasePolicy
user.account_manager?
end
def sign_amendment?
user.manager? || user.account_manager?
end
def approve?
review?
end

View File

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

View File

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

View File

@@ -6,8 +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(ContractTemplate).new? %>
<%= link_to t(".actions.create_template"), [:new, @project, :contract_template], class: "btn btn-success border align-self-center h-50 mr-2 pb-2" %>
<%= link_to t(".actions.import_template"), [:new, @project, :release_template_imports], class: "btn btn-light border align-self-center h-50 pb-2" %>
<%= link_to t(".actions.create_template"), [:new, @project, :contract_template], class: "btn btn-success border align-self-center h-50 pb-2" %>
<% end %>
</div>
@@ -48,4 +47,4 @@
</div>
</div>
</div>
</div>
</div>

View File

@@ -1,19 +0,0 @@
<% if preview %>
<h1>PREVIEW ONLY</h1>
<% end %>
<p class="heading"><strong><u><%= t '.heading' %></u></strong></p>
<dl>
<%= description_list_pair "#{t('.description_labels.amendment_clause')}:", releasable.contract_template.amendment_clause %>
<%= description_list_pair "#{t('.description_labels.amendment_signer_name')}:", releasable.amendment_signer_name %>
<dt><%= t('.description_labels.amendment_signature') %>:</dt>
<dd>
<% if preview %>
<%= image_tag dummy_signature %>
<% elsif releasable.amendment_signature.attached? %>
<%= image_tag releasable.amendment_signature.variant(auto_orient: true, resize: "200x200") %>
<% end %>
</dd>
</dl>

View File

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

View File

@@ -26,12 +26,6 @@
<%= render "contracts/signature_page", releasable: releasable, contract_template: contract_template, preview: preview %>
</div>
<% if releasable.respond_to?(:amendment_signed?) && releasable.amendment_signed? %>
<div class="page">
<%= render "contracts/amendment_page", releasable: releasable, preview: preview %>
</div>
<%end %>
<% if releasable.respond_to?(:approved?) && releasable.approved? %>
<div class="page">
<%= render "contracts/for_office_use_only", releasable: releasable, preview: preview %>

View File

@@ -30,17 +30,6 @@
<td>
<%= location_release.signed_on %>
</td>
<td class="text-center">
<% if location_release.amendment_signed? %>
<i class="fa fa-check-square-o text-dark"
data-toggle="tooltip"
title="<%= t '.messages.amendment_signed_tooltip' %>"></i>
<% elsif location_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">
@@ -55,9 +44,6 @@
<% if policy(location_release).edit_photos? %>
<%= link_to fa_icon("picture-o fw", text: "Photos"), [:edit, location_release, :photos], class: "dropdown-item" %>
<% end %>
<% if policy(location_release).sign_amendment? && location_release.amendment_signable? && !location_release.amendment_signed? %>
<%= link_to fa_icon("file-text fw", text: t('.actions.sign_amendment')), [:new, location_release.project.account, location_release.project, location_release.contract_template, location_release, :amendment], class: "dropdown-item", target: "_blank" %>
<% end %>
<% if policy(Contract).show? && (location_release.contract.attached? || location_release.contract_template.present?) %>
<%= link_to fa_icon("download fw", text: "Download"), [location_release, :contracts, format: "pdf"], class: "dropdown-item", target: "_blank" %>
<% end %>

View File

@@ -28,12 +28,12 @@
<th data-behavior="all-selectable"><%= check_box_tag "location_release_ids[]", false, false %></th>
<th><%= t '.table_headers.approved'%></th>
<th></th>
<th><%= t(".table_headers.name") %></th>
<th><%= LocationRelease.human_attribute_name(:name) %></th>
<th><%= t(".table_headers.address") %>
<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><%= t(".table_headers.signed_at") %></th>
<th></th>
</tr>
</thead>

View File

@@ -1,3 +0,0 @@
<% message = local_assigns[:already_signed] ? t('.amendment_already_signed_message') : t('.amendment_signed_message') %>
<% alert_type = local_assigns[:already_signed] ? "alert-warning" : "alert-success" %>
<p class="alert <%= alert_type %> p-3 lead text-center"><%= message %></p>

View File

@@ -1,30 +0,0 @@
<button type="button" class="btn btn-success mb-3" data-behavior="clipboard" href="<%= polymorphic_url [:new, @account, @project, @contract_template, @release, :amendment] %>">
<i class="fa fa-clipboard"></i>
<%= t '.copy_url' %>
</button>
<div class="card shadow-sm">
<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(".amendment.heading") do %>
<p><%= @contract_template.amendment_clause %></p>
<% end %>
<hr>
<div class="form-row">
<%= form.text_field :amendment_signer_name, required: true, wrapper_class: "col-sm-6" %>
</div>
<%= card_field_set_tag t(".signature.heading") do %>
<%= render "shared/signature_fields", signature_field: :amendment_signature_base64, form: form %>
<% 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") } %>
</div>
<% end %>
</div>
</div>

View File

@@ -1,4 +1,3 @@
<% signature_field = local_assigns[:signature_field] ? local_assigns[:signature_field] : :signature_base64 %>
<canvas class="border bg-light w-100" data-behavior="digital-signature" data-signature-input="[data-ujs-target=signature-input]" style="height: 150px"></canvas>
<% if local_assigns[:instruction] %>
@@ -7,7 +6,7 @@
</small>
<% end %>
<%= form.hidden_field signature_field, data: { ujs_target: "signature-input" } %>
<%= form.hidden_field :signature_base64, data: { ujs_target: "signature-input" } %>
<div class="text-right">
<%= button_tag class: "btn btn-sm btn-danger", data: { behavior: "clear-digital-signature" } do %>
<%= fa_icon "refresh" %> <%= t "shared.clear" %>

View File

@@ -311,7 +311,6 @@ en:
actions:
book_demo: Schedule a Demo
create_template: Create New Release Template
import_template: Import Template
headings:
benefits: Benefits
how_it_works: How It Works
@@ -328,12 +327,6 @@ en:
update:
notice: The release template has been updated
contracts:
amendment_page:
description_labels:
amendment_clause: Amendment Clause
amendment_signature: Amendment Signature
amendment_signer_name: Amendment Signer Name
heading: Amendment
for_office_use_only:
description_labels:
date_issued: Date Issued
@@ -358,12 +351,6 @@ en:
signature_page:
heading: Signature Page
instructions: "By signing this signature page, as of the date listed below, I hereby agree, acknowledge and accept the terms and conditions listed in this %{releasable_name}."
labels:
location_release:
contact_person_address: Owner Address
contact_person_email: Owner Email
contact_person_phone: Owner Phone
name: Location Name
directories:
destroy:
alert: The folder has been deleted
@@ -422,7 +409,6 @@ en:
helpers:
help:
contract_template:
amendment_clause: Leave blank if not required for this contract
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
@@ -789,9 +775,8 @@ en:
empty: Location Releases will appear here
table_headers:
address: Address
amendment_signed: Amendment
approved: Approved
name: Location Name
name: Name
notes: Notes
signed_at: Date Signed
tags: Tags
@@ -799,10 +784,7 @@ en:
actions:
manage: Manage
review: Review
sign_amendment: Sign Amendment
messages:
amendment_not_signed_tooltip: Amendment not yet signed
amendment_signed_tooltip: Amendment Signed
approved_tooltip: Approved by %{user} on %{timestamp}
no_photos: Needs Photo
new:
@@ -1049,16 +1031,6 @@ en:
heading: Licensor/Owner Contact Information
signature:
heading: Signature
amendments:
create:
amendment_already_signed_message: Release amendment is already signed!
amendment_signed_message: Release amendment signed successfully! Thank you
new:
amendment:
heading: Amendment
copy_url: Copy sign amendment URL
signature:
heading: Signature
appearance_releases:
create:
notice: Your release has been signed. Thank you!

View File

@@ -152,12 +152,6 @@ es:
update:
notice: The release template has been updated (ES)
contracts:
amendment_page:
description_labels:
amendment_clause: Amendment Clause (ES)
amendment_signature: Amendment Signature (ES)
amendment_signer_name: Amendment Signer Name (ES)
heading: Amendment (ES)
for_office_use_only:
description_labels:
date_issued: Date Issued (ES)
@@ -217,7 +211,6 @@ es:
helpers:
help:
contract_template:
amendment_clause: Leave blank if not required for this contract (ES)
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)
@@ -346,16 +339,9 @@ es:
index:
table_headers:
address: Address (ES)
amendment_signed: Amendment (ES)
notes: Notes (ES)
signed_at: Date Signed (ES)
tags: Tags (ES)
location_release:
actions:
sign_amendment: Sign Amendment (ES)
messages:
amendment_not_signed_tooltip: Amendment not yet signed (ES)
amendment_signed_tooltip: Amendment Signed (ES)
material_releases:
form:
photos:
@@ -402,16 +388,6 @@ es:
signed_at: Date Signed (ES)
tags: Tags (ES)
public:
amendments:
create:
amendment_already_signed_message: Release amendment is already signed! (ES)
amendment_signed_message: Release amendment signed successfully! Thank you (ES)
new:
amendment:
heading: Amendment
copy_url: Copy sign amendment URL (ES)
signature:
heading: Signature (ES)
appearance_releases:
create:
notice: La autorización está firmada. ¡Gracias!

View File

@@ -131,9 +131,7 @@ Rails.application.routes.draw do
resources :talent_releases, only: [:new, :create]
resources :appearance_releases, only: [:new, :create]
resources :acquired_media_releases, only: [:new, :create]
resources :location_releases, only: [:new, :create] do
resources :amendments, only: [:new, :create]
end
resources :location_releases, only: [:new, :create]
resources :material_releases, only: [:new, :create]
resources :medical_releases, only: [:new, :create]
resources :misc_releases, only: [:new, :create]

View File

@@ -1,5 +0,0 @@
class AddAmendmentSignerDetailsToLocationReleases < ActiveRecord::Migration[6.0]
def change
add_column :location_releases, :amendment_signer_name, :string
end
end

View File

@@ -888,8 +888,7 @@ CREATE TABLE public.location_releases (
filming_hours text,
approved_by_user_name text,
approved_by_user_email text,
approved_at timestamp without time zone,
amendment_signer_name character varying
approved_at timestamp without time zone
);
@@ -3943,7 +3942,6 @@ INSERT INTO "schema_migrations" (version) VALUES
('20200716103525'),
('20200716105723'),
('20200720051634'),
('20200720131309'),
('20200721140821');
('20200720131309');

View File

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

View File

@@ -1,112 +0,0 @@
require 'rails_helper'
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
get :new, params: {
account_id: account,
project_id: project,
contract_template_id: location_release.contract_template,
location_release_id: location_release
}
expect(response).to be_successful
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
signed_release = create(:location_release, :amendment_signed, contract_template: contract_template, project: project)
expect(signed_release.amendment_signed?).to be_truthy
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
body = CGI.unescape_html(response.body)
expect(body).to match already_signed_message
end
end
describe "#create" do
it "signs amendment" do
expect(location_release.amendment_signed?).to be_falsey
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
}
}
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
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
end
private
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 signature_base64
@signature_base64 ||= Base64Image.from_image(file_fixture('signature.png')).data_uri
end
end

View File

@@ -13,10 +13,6 @@ FactoryBot.define do
archived_at Time.zone.now
end
trait :with_amendment_clause do
amendment_clause "Amendment Legal Language"
end
factory :appearance_release_contract_template do
release_type "appearance"
end

View File

@@ -22,14 +22,6 @@ 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 :non_native do
contract do
path = Rails.root.join("spec", "fixtures", "files", "contract.pdf")

View File

@@ -11,12 +11,11 @@ RSpec.feature 'User manages contract templates', type: :feature do
sign_in(current_user)
end
scenario 'splash page is shown if there are no contract templates' do
scenario 'splash page is shown if tehre are no contract templates' do
visit project_contract_templates_path(project)
expect(page).to have_content schedule_demo
expect(page).to have_content create_release_template
expect(page).to have_content import_release_template
end
scenario 'creating a new release template' do
@@ -31,7 +30,7 @@ RSpec.feature 'User manages contract templates', type: :feature do
fill_in 'Describe other territory', with: 'North America only'
select 'In perpetuity', from: 'Term'
select 'None', from: 'Restriction'
click_on create_release_template_button
click_on 'Create Release Template'
expect(page).to have_content(create_contract_template_success_message)
end
@@ -49,30 +48,18 @@ RSpec.feature 'User manages contract templates', type: :feature do
fill_in_trix signature_legal_text_field, with: 'LL'
expect do
click_on create_release_template_button
click_on 'Create Release Template'
end.to change(ContractTemplate, :count).by(1)
end
end
scenario 'location release template has a amendment clause field' do
visit new_project_contract_template_path(project)
fill_in 'Name', with: 'My Release Template'
select 'Location 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)
fill_in 'Name', with: 'My Release Template'
select 'Medical Release', from: 'Release type'
fill_hidden guardian_clause_field, with: 'Guardian clause text'
click_on create_release_template_button
click_on 'Create Release Template'
expect(page).to have_content(create_contract_template_success_message)
expect(ContractTemplate.last.guardian_clause.body.to_s).to match /Guardian clause text/
@@ -91,7 +78,7 @@ RSpec.feature 'User manages contract templates', type: :feature do
fill_in_trix 'contract_template_guardian_clause', with: 'Guardian clause text'
fill_in question_field(1), with: 'How much experience do you have in the industry?'
click_on create_release_template_button
click_on 'Create Release Template'
expect(page).to have_content(create_contract_template_success_message)
end
@@ -198,13 +185,13 @@ RSpec.feature 'User manages contract templates', type: :feature do
scenario 'Should not allow negative fees' do
fill_in 'Fee', with: '-200'
click_on create_release_template_button
click_on 'Create Release Template'
expect(page).not_to have_content(create_contract_template_success_message)
end
scenario 'Should not allow fees with more than 9 digits' do
fill_in 'Fee', with: '9999999999'
click_on create_release_template_button
click_on 'Create Release Template'
expect(page).not_to have_content(create_contract_template_success_message)
end
end
@@ -379,7 +366,6 @@ RSpec.feature 'User manages contract templates', type: :feature do
expect(page).to have_content schedule_demo
expect(page).not_to have_content create_release_template
expect(page).not_to have_content import_release_template
end
it 'does not show edit button' do
@@ -411,12 +397,11 @@ RSpec.feature 'User manages contract templates', type: :feature do
expect(page).to have_content('Delete')
end
it 'shows create release button on splash page' do
it 'does not show create release button on splash page' do
visit project_contract_templates_path(project)
expect(page).to have_content schedule_demo
expect(page).to have_content create_release_template
expect(page).to have_content import_release_template
end
it 'shows edit button when contract template is not signed' do
@@ -480,10 +465,6 @@ RSpec.feature 'User manages contract templates', type: :feature do
'contract_template_guardian_clause_trix_input_contract_template'
end
def amendment_clause_field
'contract_template_amendment_clause_trix_input_contract_template'
end
def signature_legal_text_field
'contract_template_signature_legal_text'
end
@@ -508,10 +489,6 @@ RSpec.feature 'User manages contract templates', type: :feature do
t 'contract_templates.splash.actions.create_template'
end
def import_release_template
t 'contract_templates.splash.actions.import_template'
end
def signature_legal_text_trix_field
'Signature legal text'
end
@@ -539,8 +516,4 @@ RSpec.feature 'User manages contract templates', type: :feature do
def duplicate_release_name(template_name = '')
t 'contract_templates.duplicate.name_prefix', template_name: template_name
end
def create_release_template_button
'Create Release Template'
end
end

View File

@@ -93,7 +93,7 @@ feature 'User managing broadcasts' do
BroadcastsChannel.broadcast_stream_updates(broadcast)
expect(page).to have_content stream_begun_message
expect(page).to have_selector('div#broadcast_video', count: 2)
expect(page).to have_selector('div#broadcast_video', count: 1)
broadcast.streamer_status = :idle
broadcast.status = :idle

View File

@@ -78,47 +78,6 @@ feature "User managing location 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(:location_release_contract_template, :with_amendment_clause, project: project)
release = create(:location_release, contract_template: contract_template, project: project)
expect(release.amendment_signed?).to be_falsey
visit new_account_project_contract_template_location_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(LocationRelease.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(:location_release_contract_template, :with_amendment_clause, project: project)
release = create(:location_release, :amendment_signed, contract_template: contract_template, project: project)
expect(release.amendment_signed?).to be_truthy
visit new_account_project_contract_template_location_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(:location_release_contract_template, :with_amendment_clause, project: project)
release = create(:location_release, contract_template: contract_template, project: project)
visit new_account_project_contract_template_location_release_amendment_path(project.account, project, contract_template, release)
expect(page).to have_content copy_url_button
end
end
context "when signed in" do
@@ -127,14 +86,6 @@ 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)
@@ -157,9 +108,9 @@ feature "User managing location releases" do
fill_in filming_hours_field, with: "04:00 - 22:00"
click_button create_release_button
expect(page).to have_content(create_release_notice)
expect(page).to have_photo("location_photo.png", visible: :all)
expect(page).to have_photo("location_photo.png")
click_on manage_button
click_on "Manage"
expect(page).to have_link("Download")
end
end
@@ -168,7 +119,7 @@ feature "User managing location releases" do
location_release = create(:location_release_with_photo, :non_native, project: project)
visit project_location_releases_path(project)
click_on manage_button
click_on "Manage"
click_link *update_location_release_link(location_release)
within ".dropzone" do
@@ -188,7 +139,7 @@ feature "User managing location releases" do
location_release = create(:location_release, project: project)
visit project_location_releases_path(project)
click_on manage_button
click_on "Manage"
accept_alert do
click_link *destroy_location_release_link(location_release)
@@ -221,7 +172,7 @@ feature "User managing location releases" do
expect(page).to have_content("Needs Photo")
click_on manage_button
click_on "Manage"
click_on "Photos"
expect(page).to have_content("Add Photos")
@@ -231,85 +182,11 @@ feature "User managing location releases" do
click_on "Save Changes"
expect(page).to have_content("The release has been updated")
expect(page).to have_photo("location_photo.png", visible: :all)
end
scenario "signing amendment for a not-signed amendment release", js: true do
contract_template = create(:location_release_contract_template, :with_amendment_clause, project: project)
release = create(:location_release, name: "Test Loc", contract_template: contract_template, project: project)
expect(release.amendment_signed?).to be_falsey
visit project_location_releases_path(project)
expect(page).to have_content "Test Loc"
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(LocationRelease.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(:location_release_contract_template, :with_amendment_clause, project: project)
release = create(:location_release, :amendment_signed, name: "Test Loc", contract_template: contract_template, project: project)
expect(release.amendment_signed?).to be_truthy
visit project_location_releases_path(project)
expect(page).to have_content "Test Loc"
click_on manage_button
expect(page).not_to have_link sign_amendment_link
end
scenario "signed amendment release have checked box in location releases index table", js: true do
contract_template = create(:location_release_contract_template, :with_amendment_clause, project: project)
not_signed_release = create(:location_release, name: "Not Yet Loc", contract_template: contract_template, project: project)
expect(not_signed_release.amendment_signed?).to be_falsey
visit project_location_releases_path(project)
expect(page).to have_content "Not Yet Loc"
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(:location_release, :amendment_signed, name: "Signed A Loc", contract_template: contract_template, project: project)
expect(signed_release.amendment_signed?).to be_truthy
visit project_location_releases_path(project)
expect(page).to have_content "Signed A Loc"
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(:location_release_contract_template, :with_amendment_clause, project: project)
release = create(:location_release, contract_template: contract_template, project: project)
visit new_account_project_contract_template_location_release_amendment_path(project.account, project, contract_template, release)
expect(page).to have_content copy_url_button
expect(page).to have_photo("location_photo.png")
end
end
scenario "viewing the contract PDF when amendment is not yet signed" do
scenario "viewing the contract PDF" do
location_release = create(:location_release_with_contract_template_and_photo,
:native,
project: project,
@@ -321,13 +198,16 @@ feature "User managing location releases" do
content: "Note 1",
user: build(:user, email: "jane.doe@test.com"),
email: "jane.doe@test.com",
created_at: DateTime.new(2020, 2, 21, 12, 0, 0),),
created_at: DateTime.new(2020, 2, 21, 12, 0, 0),
),
build(:note,
content: "Note 2",
user: build(:user, email: "john.doe@test.com"),
email: "john.doe@test.com",
created_at: DateTime.new(2020, 2, 20, 11, 0, 0),),
])
created_at: DateTime.new(2020, 2, 20, 11, 0, 0),
),
]
)
sign_in(current_user)
visit project_location_releases_path(project)
@@ -336,8 +216,6 @@ feature "User managing location releases" do
expect(content_type).to eq("application/pdf")
expect(content_disposition).to include("inline")
expect(pdf_filename).to include("benny-s-burritos")
expect(pdf_body).not_to have_content amendment_page_heading
expect(pdf_body).to have_content("Benny's Burritos")
expect(pdf_body).to have_content("NOTES")
expect(pdf_body).to have_content("Note 1")
@@ -354,34 +232,6 @@ feature "User managing location releases" do
expect(pdf_body).to have_content("06:00 - 20:00")
end
scenario "viewing the contract PDF when amendment is signed" do
contract_template = create(:location_release_contract_template, :with_amendment_clause, project: project)
location_release = create(:location_release,
:amendment_signed,
:native,
contract_template: contract_template,
project: project,
name: "Test Loc")
sign_in(current_user)
visit project_location_releases_path(project)
click_link *view_release_pdf_link_for(location_release)
expect(content_type).to eq("application/pdf")
expect(content_disposition).to include("inline")
expect(pdf_filename).to include("test-loc")
expect(pdf_body).to have_content("Test Loc")
expect(pdf_body).to have_content amendment_page_heading
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 location_release.amendment_signer_name
end
context "when the user is account manager" do
let(:current_user) { create(:user, :account_manager) }
@@ -477,7 +327,7 @@ feature "User managing location releases" do
create(:location_release_with_contract_template, :native, project: project)
visit project_location_releases_path(project)
click_on manage_button
click_on "Manage"
expect(page).not_to have_link(review_action, exact: true)
end
@@ -495,7 +345,7 @@ feature "User managing location releases" do
visit project_location_releases_path(project)
click_on manage_button
click_on "Manage"
expect(page).not_to have_link("Download", exact: true)
end
@@ -503,7 +353,7 @@ feature "User managing location releases" do
create(:location_release_with_contract_template, :native, project: project)
visit project_location_releases_path(project)
click_on manage_button
click_on "Manage"
expect(page).not_to have_link(review_action, exact: true)
end
@@ -587,8 +437,8 @@ feature "User managing location releases" do
"location_release[filming_hours]"
end
def have_photo(filename, attr: "src", visible: true)
have_selector("img[#{attr}*='#{filename}']", visible: visible)
def have_photo(filename, attr: "src")
have_selector("img[#{attr}*='#{filename}']")
end
def import_location_release_link(project)
@@ -685,68 +535,4 @@ feature "User managing location 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
'location_release[amendment_signer_name]'
end
def amendment_signature_field
'location_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 'location_releases.location_release.actions.manage'
end
def sign_amendment_link
t 'location_releases.location_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
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