Compare commits
9 Commits
implement-
...
do-not-cha
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe61e5bc47 | ||
|
|
d9f5e2cd10 | ||
|
|
a076edcf8b | ||
|
|
dcc1d098d2 | ||
|
|
830a5eb3e4 | ||
|
|
add8304eab | ||
|
|
f04d34d337 | ||
|
|
c033f5df17 | ||
|
|
7f49f31ebf |
@@ -21,7 +21,8 @@ $(document).on "turbolinks:load", ->
|
||||
|
||||
refreshBroadcastVideo: (data) ->
|
||||
$("#broadcast_updates").html data.status_content
|
||||
if data.streamer_status == 'recording' && data.status == 'active'
|
||||
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)(
|
||||
parentId: '#broadcast_video'
|
||||
|
||||
@@ -3,7 +3,7 @@ $(document).on("click", "[data-behavior=play_recording]", function() {
|
||||
return false;
|
||||
}
|
||||
|
||||
console.warn('Play prev : ', playback_url);
|
||||
$("#broadcast_video").attr('video-type', 'recording');
|
||||
|
||||
var playback_url = $(this).attr("data-playback-url")
|
||||
$("#broadcast_video").empty();
|
||||
@@ -23,4 +23,6 @@ $(document).on("click", "[data-behavior=play_recording]", function() {
|
||||
$(this).siblings().children("i").remove();
|
||||
$(this).addClass('active');
|
||||
$(this).prepend('<i class="fa fa-check"> </i>');
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on("click", "[data-behavior=play_stream]", function() { $("#broadcast_video").attr('video-type', 'stream'); });
|
||||
@@ -33,6 +33,11 @@ class BroadcastsController < ApplicationController
|
||||
end
|
||||
|
||||
def update
|
||||
unless params.has_key?(:broadcast)
|
||||
@broadcast.regenerate_token
|
||||
redirect_to([@project, @broadcast], notice: t('.reset_notice')) and return
|
||||
end
|
||||
|
||||
@broadcast.update(broadcast_params)
|
||||
@files = @broadcast.files.order("created_at DESC").paginate(page: 1)
|
||||
|
||||
|
||||
33
app/controllers/contract_templates/duplicates_controller.rb
Normal file
33
app/controllers/contract_templates/duplicates_controller.rb
Normal file
@@ -0,0 +1,33 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ContractTemplates::DuplicatesController < ApplicationController
|
||||
before_action :set_contract_template
|
||||
|
||||
def create
|
||||
authorize(ContractTemplate)
|
||||
new_contract_template = @contract_template.dup
|
||||
new_contract_template.name = I18n.t('contract_templates.duplicate.name_prefix', template_name: @contract_template.name)
|
||||
|
||||
# Duplicate rich text fields
|
||||
|
||||
new_contract_template.body = @contract_template.body
|
||||
new_contract_template.guardian_clause = @contract_template.guardian_clause
|
||||
new_contract_template.signature_legal_text = @contract_template.signature_legal_text
|
||||
|
||||
if new_contract_template.save
|
||||
redirect_to [:edit, new_contract_template]
|
||||
else
|
||||
redirect_to [@contract_template.project, :contract_templates], alert: t('.error')
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def contract_templates
|
||||
policy_scope(ContractTemplate)
|
||||
end
|
||||
|
||||
def set_contract_template
|
||||
@contract_template = contract_templates.find(params[:contract_template_id])
|
||||
end
|
||||
end
|
||||
@@ -5,8 +5,9 @@ class ContractTemplatesController < ApplicationController
|
||||
|
||||
layout 'project'
|
||||
|
||||
before_action :set_project, except: [:destroy]
|
||||
before_action :set_contract_template, only: [:destroy]
|
||||
before_action :set_project, except: [:destroy, :edit, :update]
|
||||
before_action :set_contract_template, only: [:destroy, :edit, :update]
|
||||
before_action :set_project_from_contract_template, only: [:edit, :update]
|
||||
before_action :show_splash_screen, only: :index
|
||||
|
||||
def index
|
||||
@@ -32,6 +33,20 @@ class ContractTemplatesController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@release_type = @contract_template.release_type
|
||||
end
|
||||
|
||||
def update
|
||||
@contract_template.attributes = contract_template_params
|
||||
|
||||
if @contract_template.save
|
||||
redirect_to [@project, :contract_templates], notice: t('.notice')
|
||||
else
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@contract_template.archive
|
||||
redirect_to [@contract_template.project, :contract_templates], alert: t('.archived_notice')
|
||||
@@ -39,6 +54,10 @@ class ContractTemplatesController < ApplicationController
|
||||
|
||||
private
|
||||
|
||||
def set_project_from_contract_template
|
||||
@project = @contract_template.project
|
||||
end
|
||||
|
||||
def show_splash_screen
|
||||
render :splash if contract_templates.non_archived.count.zero?
|
||||
end
|
||||
|
||||
@@ -69,9 +69,13 @@ class ContractTemplate < ApplicationRecord
|
||||
(1..NUMBER_OF_CUSTOM_FIELDS).any? { |n| public_send("question_#{n}_text").presence }
|
||||
end
|
||||
|
||||
def editable?
|
||||
releases.size.zero?
|
||||
end
|
||||
|
||||
def attributes
|
||||
result = super()
|
||||
result[:signature_legal_text] = signature_legal_text.as_json
|
||||
result[:signature_legal_text] = signature_legal_text.as_json
|
||||
result
|
||||
end
|
||||
end
|
||||
|
||||
@@ -23,6 +23,18 @@ class ContractTemplatePolicy < ApplicationPolicy
|
||||
create?
|
||||
end
|
||||
|
||||
def edit?
|
||||
record.editable? && create?
|
||||
end
|
||||
|
||||
def update?
|
||||
edit?
|
||||
end
|
||||
|
||||
def duplicate?
|
||||
create?
|
||||
end
|
||||
|
||||
def import?
|
||||
if user.account_manager?
|
||||
record.project.account = user.account
|
||||
|
||||
@@ -33,10 +33,10 @@
|
||||
<%= link_to "Switch View", "#", class: "btn btn-light border dropdown-toggle", role: "button", id: "dropdownMenuLink", data: { toggle: "dropdown" }, aria: { haspopup: "true", expanded: "false" } %>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
|
||||
<h5 class="dropdown-header">Live Streams</h5>
|
||||
<%= link_to fa_icon("check", text: @broadcast.name.titleize), "#", class: "dropdown-item active" %>
|
||||
<%= link_to fa_icon("check", text: @broadcast.name.titleize), "#", data: { behavior: "play_stream"}, class: "dropdown-item active" %>
|
||||
<% @multi_view_broadcasts.each do |broadcast| %>
|
||||
<% if broadcast.id != @broadcast.id %>
|
||||
<%= link_to broadcast.name.titleize, broadcast.url, class: class_string("dropdown-item", "active" => @broadcast.id == broadcast.id) %>
|
||||
<%= link_to broadcast.name.titleize, broadcast.url, data: { behavior: "play_stream"}, class: class_string("dropdown-item", "active" => @broadcast.id == broadcast.id) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<h5 class="dropdown-header">Previous Sessions</h5>
|
||||
@@ -102,6 +102,7 @@
|
||||
<i class="fa fa-clipboard"></i>
|
||||
Copy URL
|
||||
</button>
|
||||
<%= link_to t('.actions.reset_url'), [@project, @broadcast], method: :patch, class: "btn btn-danger" %>
|
||||
</div>
|
||||
<% else %>
|
||||
<input type="text" class="form-control" value="<%= broadcast_url(@broadcast.token) %>" readonly>
|
||||
@@ -110,6 +111,7 @@
|
||||
<i class="fa fa-clipboard"></i>
|
||||
Copy URL
|
||||
</button>
|
||||
<%= link_to t('.actions.reset_url'), [@project, @broadcast], method: :patch, class: "btn btn-danger" %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -19,6 +19,12 @@
|
||||
<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 } %>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<% if policy(contract_template).edit? %>
|
||||
<%= link_to fa_icon("pencil fw", text: t(".actions.edit")), [:edit, contract_template], class: "dropdown-item" %>
|
||||
<% end %>
|
||||
<% if policy(ContractTemplate).duplicate? %>
|
||||
<%= link_to fa_icon("clone fw", text: t(".actions.duplicate")), contract_template_duplicates_path(contract_template), method: :post, class: "dropdown-item" %>
|
||||
<% end %>
|
||||
<% if policy(QrCode).show? %>
|
||||
<%= link_to fa_icon("qrcode", text: t(".actions.qr_code")), [contract_template, :qr_codes], class: "dropdown-item", target: :_blank %>
|
||||
<% end %>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<%= bootstrap_form_with model: [project, contract_template], local: true do |form| %>
|
||||
<%= bootstrap_form_with model: model, local: true do |form| %>
|
||||
<%= 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" %>
|
||||
|
||||
6
app/views/contract_templates/edit.html.erb
Normal file
6
app/views/contract_templates/edit.html.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
<div class="card shadow-sm">
|
||||
<%= card_header text: t(".heading"), close_action_path: [@project, :contract_templates] %>
|
||||
<div class="card-body">
|
||||
<%= render "form", model: @contract_template, project: @project, contract_template: @contract_template %>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,6 +1,6 @@
|
||||
<div class="card shadow-sm">
|
||||
<%= card_header text: t(".heading"), close_action_path: [@project, :contract_templates] %>
|
||||
<div class="card-body">
|
||||
<%= render "form", project: @project, contract_template: @contract_template %>
|
||||
<%= render "form", model: [@project, @contract_template], project: @project, contract_template: @contract_template %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<dl>
|
||||
<%= description_list_pair t('.description_labels.producer'), releasable.project.account.name %>
|
||||
<%= description_list_pair t('.description_labels.production'), releasable.project.name %>
|
||||
<%= description_list_pair t('.description_labels.employee_issued_to'), releasable.name %>
|
||||
<%= description_list_pair t('.description_labels.issued_to'), releasable.name %>
|
||||
<%= description_list_pair t('.description_labels.issued_by'), releasable.approved_by_user_name %>
|
||||
<%= description_list_pair t('.description_labels.date_issued'), releasable.approved_at %>
|
||||
</dl>
|
||||
@@ -217,6 +217,9 @@ en:
|
||||
new:
|
||||
heading:
|
||||
Create Live Stream
|
||||
show:
|
||||
actions:
|
||||
reset_url: Reset URL
|
||||
splash:
|
||||
actions:
|
||||
book_demo: Schedule a Demo
|
||||
@@ -235,6 +238,8 @@ en:
|
||||
share_stream: Share live stream link with clients
|
||||
stream_from_mobile_app: Stream from ME Suite Mobile app, or via a professional camera
|
||||
stream_multiple_cameras: Stream multiple cameras at one time
|
||||
update:
|
||||
reset_notice: The Share URL has been reset, and the previous URL will no longer work. Please click "Copy URL" and share it again with those who you want to have access to this live stream
|
||||
bulk_taggings:
|
||||
new_bulk_tag_modal:
|
||||
submit: Add
|
||||
@@ -250,6 +255,8 @@ en:
|
||||
contract_template:
|
||||
actions:
|
||||
copy_url: Copy Release URL
|
||||
duplicate: Duplicate
|
||||
edit: Edit
|
||||
manage: Manage
|
||||
qr_code: QR Code
|
||||
sign: Sign
|
||||
@@ -259,6 +266,13 @@ en:
|
||||
destroy:
|
||||
archived_failure: Failed to archive the release template
|
||||
archived_notice: The release template has been archived
|
||||
duplicate:
|
||||
name_prefix: Copy of %{template_name}
|
||||
duplicates:
|
||||
create:
|
||||
error: Failed to duplicate release template
|
||||
edit:
|
||||
heading: Edit Contract Template
|
||||
form:
|
||||
custom_fields:
|
||||
heading: Questionnaire
|
||||
@@ -297,12 +311,14 @@ en:
|
||||
manage_large_audience: Easily manage large audiences with the crowd control feature
|
||||
print_QR_code: Print out release QR codes
|
||||
releases_automatically_organized: Releases are automatically organized as they’re submitted
|
||||
update:
|
||||
notice: The release template has been updated
|
||||
contracts:
|
||||
for_office_use_only:
|
||||
description_labels:
|
||||
date_issued: Date Issued
|
||||
employee_issued_to: Employee Issued To
|
||||
issued_by: Issued By
|
||||
issued_to: Issued To
|
||||
producer: Producer
|
||||
production: Production
|
||||
heading: For Office Use Only
|
||||
@@ -689,6 +705,7 @@ en:
|
||||
update: Save Changes
|
||||
contract_template:
|
||||
create: Create Release Template
|
||||
update: Save Changes
|
||||
directory:
|
||||
create: Create Folder
|
||||
new_file: Upload Files
|
||||
|
||||
@@ -81,6 +81,9 @@ es:
|
||||
do_not_copy_warning: "Do not copy (ES)"
|
||||
serial_number_label: "Serial Number (ES)"
|
||||
broadcasts:
|
||||
show:
|
||||
actions:
|
||||
reset_url: Reset URL (ES)
|
||||
splash:
|
||||
actions:
|
||||
book_demo: Schedule a Demo
|
||||
@@ -99,10 +102,23 @@ es:
|
||||
share_stream: Share live stream link with clients
|
||||
stream_from_mobile_app: Stream from ME Suite Mobile app, or via a professional camera
|
||||
stream_multiple_cameras: Stream multiple cameras at one time
|
||||
update:
|
||||
reset_notice: The Share URL has been reset, and the previous URL will no longer work. Please click "Copy URL" and share it again with those who you want to have access to this live stream
|
||||
contract_templates:
|
||||
blank_contracts:
|
||||
create:
|
||||
number_of_copies_invalid_notice: Please enter valid number greater than 0 (ES)
|
||||
contract_template:
|
||||
actions:
|
||||
duplicate: Duplicate (ES)
|
||||
edit: Edit (ES)
|
||||
duplicate:
|
||||
name_prefix: Copy of %{template_name} (ES)
|
||||
duplicates:
|
||||
create:
|
||||
error: Failed to duplicate release template (ES)
|
||||
edit:
|
||||
heading: Edit Contract Template (ES)
|
||||
form:
|
||||
custom_fields:
|
||||
heading: Medical Questionnaire (ES)
|
||||
@@ -129,12 +145,14 @@ es:
|
||||
manage_large_audience: Easily manage large audiences with the crowd control feature (ES)
|
||||
print_QR_code: Print out release QR codes (ES)
|
||||
releases_automatically_organized: Releases are automatically organized as they’re submitted (ES)
|
||||
update:
|
||||
notice: The release template has been updated (ES)
|
||||
contracts:
|
||||
for_office_use_only:
|
||||
description_labels:
|
||||
date_issued: Date Issued (ES)
|
||||
employee_issued_to: Employee Issued To (ES)
|
||||
issued_by: Issued By (ES)
|
||||
issued_to: Issued To (ES)
|
||||
producer: Producer (ES)
|
||||
production: Production (ES)
|
||||
heading: For Office Use Only (ES)
|
||||
@@ -304,6 +322,8 @@ es:
|
||||
broadcast:
|
||||
create: Create Live Stream (ES)
|
||||
update: Save Changes (ES)
|
||||
contract_template:
|
||||
update: Save changes (ES)
|
||||
create: 'Crear %{model}'
|
||||
medical_release:
|
||||
update: Approve (ES)
|
||||
|
||||
@@ -56,9 +56,10 @@ Rails.application.routes.draw do
|
||||
resources :talent_releases, except: [:show], concerns: [:contractable, :notable, :photoable]
|
||||
resources :medical_releases, except: [:show], concerns: [:contractable, :notable, :photoable]
|
||||
resources :misc_releases, except: [:show], concerns: [:contractable, :notable, :photoable]
|
||||
resources :contract_templates, only: [:index, :new, :create, :destroy] do
|
||||
resources :contract_templates, only: [:index, :new, :create, :edit, :update, :destroy] do
|
||||
resource :qr_codes, only: [:show], controller: "contract_templates/qr_codes"
|
||||
resource :blank_contracts, only: [:show, :new, :create], controller: "contract_templates/blank_contracts"
|
||||
resource :duplicates, only: [:create], controller: "contract_templates/duplicates"
|
||||
end
|
||||
resource :release_template_imports, only: [:new, :create]
|
||||
resources :project_memberships, only: [:index, :create, :destroy]
|
||||
|
||||
@@ -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: -
|
||||
--
|
||||
|
||||
@@ -203,6 +203,15 @@ RSpec.describe BroadcastsController, type: :controller do
|
||||
|
||||
expect(BroadcastsChannel).to have_received(:broadcast_file_upload_updates)
|
||||
end
|
||||
|
||||
it "regenerates token if #update is called without broadcast param" do
|
||||
old_token = broadcast.token
|
||||
patch :update, params: { project_id: project.id, id: broadcast.id }
|
||||
|
||||
expect(response).to redirect_to [project, broadcast]
|
||||
expect(flash.notice).to eq token_reset_notice
|
||||
expect(Broadcast.last.token).not_to eq old_token
|
||||
end
|
||||
end
|
||||
|
||||
describe "#destroy" do
|
||||
@@ -252,4 +261,8 @@ RSpec.describe BroadcastsController, type: :controller do
|
||||
def create_stream
|
||||
t 'broadcasts.splash.actions.create_stream'
|
||||
end
|
||||
|
||||
def token_reset_notice
|
||||
t 'broadcasts.update.reset_notice'
|
||||
end
|
||||
end
|
||||
|
||||
30
spec/controllers/contract_templates/duplicates_controller.rb
Normal file
30
spec/controllers/contract_templates/duplicates_controller.rb
Normal file
@@ -0,0 +1,30 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe ContractTemplates::DuplicatesController do
|
||||
let(:account) { build(:account) }
|
||||
let(:current_user) { create(:user, :manager, primary_account: account) }
|
||||
let(:project) { create(:project, members: [current_user], account: account) }
|
||||
|
||||
before do
|
||||
sign_in(current_user)
|
||||
end
|
||||
|
||||
describe '#create' do
|
||||
it "responds with redirect to the edit page for newly created duplicate" do
|
||||
contract_template = create(:contract_template, project: project)
|
||||
|
||||
expect do
|
||||
post :create, params: { contract_template_id: contract_template }
|
||||
end.to change(ContractTemplate, :count).by(1)
|
||||
|
||||
new_ct = ContractTemplate.last
|
||||
|
||||
expect(new_ct.name).to eq t('contract_templates.duplicate.name_prefix', template_name: contract_template.name)
|
||||
expect(new_ct.release_type).to eq contract_template.release_type
|
||||
|
||||
expect(response).to redirect_to [:edit, new_ct]
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -118,6 +118,57 @@ describe ContractTemplatesController do
|
||||
end
|
||||
end
|
||||
|
||||
describe '#edit' do
|
||||
let(:contract_template) do
|
||||
create(:contract_template,
|
||||
name: 'My Contract Template', fee: 50, release_type: 'appearance',
|
||||
project: project)
|
||||
end
|
||||
|
||||
it 'responds ok' do
|
||||
get :edit, params: { project_id: project, id: contract_template }
|
||||
|
||||
expect(response).to be_successful
|
||||
end
|
||||
|
||||
context 'when current user is an associate' do
|
||||
let(:current_user) { create(:user, :associate) }
|
||||
|
||||
it 'raises exception' do
|
||||
expect do
|
||||
get :edit, params: { project_id: project, id: contract_template }
|
||||
end.to raise_error(Pundit::NotAuthorizedError)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
describe '#update' do
|
||||
let(:contract_template) do
|
||||
create(:contract_template,
|
||||
name: 'My Contract Template', fee: 50, release_type: 'appearance',
|
||||
project: project)
|
||||
end
|
||||
|
||||
it 'redirects' do
|
||||
patch :update, params: { project_id: project, id: contract_template, contract_template: contract_template_params }
|
||||
|
||||
expect(response).to redirect_to(project_contract_templates_path(project))
|
||||
end
|
||||
|
||||
|
||||
context 'when current user is an associate' do
|
||||
let(:current_user) { create(:user, :associate) }
|
||||
|
||||
it 'raises exception' do
|
||||
expect do
|
||||
patch :update, params: { project_id: project, id: contract_template, contract_template: contract_template_params }
|
||||
end.to raise_error(Pundit::NotAuthorizedError)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#destroy' do
|
||||
let!(:contract_template) { create(:contract_template, project: project) }
|
||||
|
||||
|
||||
@@ -262,6 +262,93 @@ RSpec.feature 'User manages contract templates', type: :feature do
|
||||
expect(page).to have_content('Active template')
|
||||
end
|
||||
|
||||
scenario 'edit button is visible for not-signed contract template' do
|
||||
create(:contract_template, project: project)
|
||||
|
||||
visit project_contract_templates_path(project)
|
||||
|
||||
expect(page).to have_link(edit_button_label, exact: true, count: 1)
|
||||
end
|
||||
|
||||
scenario 'edit button is not visible for signed contract template' do
|
||||
ct = create(:contract_template, project: project)
|
||||
create(:appearance_release, contract_template: ct)
|
||||
|
||||
visit project_contract_templates_path(project)
|
||||
|
||||
expect(page).to have_link(edit_button_label, exact: true, count: 0)
|
||||
end
|
||||
|
||||
scenario 'duplicate button is visible for not signed contract template' do
|
||||
create(:contract_template, project: project)
|
||||
|
||||
visit project_contract_templates_path(project)
|
||||
|
||||
expect(page).to have_link(duplicate_button_label, exact: true, count: 1)
|
||||
end
|
||||
|
||||
scenario 'duplicate button is visible for signed contract template' do
|
||||
ct = create(:contract_template, project: project)
|
||||
create(:appearance_release, contract_template: ct)
|
||||
|
||||
visit project_contract_templates_path(project)
|
||||
|
||||
expect(page).to have_link(duplicate_button_label, exact: true, count: 1)
|
||||
end
|
||||
|
||||
scenario 'clicking edit button opens edit page for contract template' do
|
||||
ct = create(:contract_template, project: project)
|
||||
|
||||
visit project_contract_templates_path(project)
|
||||
|
||||
expect(page).to have_content ct.name
|
||||
|
||||
expect(page).not_to have_content 'Updated CT'
|
||||
expect(page).not_to have_content 'Medical'
|
||||
|
||||
click_link edit_button_label
|
||||
|
||||
expect(page).to have_content edit_page_heading
|
||||
|
||||
fill_in name_field, with: 'Updated CT'
|
||||
select 'Medical Release', from: 'Release type'
|
||||
fill_in_trix body_field, with: 'Updated legal text'
|
||||
click_on update_contract_template_button_label
|
||||
|
||||
expect(page).to have_content 'Updated CT'
|
||||
expect(page).to have_content 'Medical'
|
||||
end
|
||||
|
||||
scenario 'clicking duplicate button opens edit page for newly created contract template' do
|
||||
ct = create(:contract_template, project: project)
|
||||
|
||||
visit project_contract_templates_path(project)
|
||||
|
||||
expect(page).to have_content ct.name
|
||||
|
||||
expect(page).not_to have_content 'Modified duplicate'
|
||||
expect(page).not_to have_content 'Misc'
|
||||
|
||||
expect do
|
||||
click_link duplicate_button_label
|
||||
end.to change(ContractTemplate, :count).by(1)
|
||||
|
||||
expect(page).to have_content edit_page_heading
|
||||
name_input = find("##{name_field}")
|
||||
expect(name_input.value).to eq duplicate_release_name(ct.name)
|
||||
|
||||
fill_in name_field, with: 'Modified duplicate'
|
||||
select 'Misc Release', from: 'Release type'
|
||||
fill_in_trix body_field, with: 'Legal text for duplicate'
|
||||
click_on update_contract_template_button_label
|
||||
|
||||
expect(page).to have_content 'Modified duplicate'
|
||||
expect(page).to have_content 'Misc'
|
||||
expect(ct.body.id).not_to eq ContractTemplate.last.body.id
|
||||
expect(ct.guardian_clause.id).not_to eq ContractTemplate.last.guardian_clause.id
|
||||
expect(ct.signature_legal_text.id).not_to eq ContractTemplate.last.signature_legal_text.id
|
||||
end
|
||||
|
||||
context 'When the user is associate' do
|
||||
let(:current_user) { create(:user, :associate) }
|
||||
|
||||
@@ -280,6 +367,22 @@ 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
|
||||
end
|
||||
|
||||
it 'does not show edit button' do
|
||||
create(:contract_template, project: project)
|
||||
|
||||
visit project_contract_templates_path(project)
|
||||
|
||||
expect(page).to have_link(edit_button_label, exact: true, count: 0)
|
||||
end
|
||||
|
||||
it 'does not show duplicate button' do
|
||||
create(:contract_template, project: project)
|
||||
|
||||
visit project_contract_templates_path(project)
|
||||
|
||||
expect(page).to have_link(duplicate_button_label, exact: true, count: 0)
|
||||
end
|
||||
end
|
||||
|
||||
context 'When the user is account manager' do
|
||||
@@ -300,6 +403,40 @@ RSpec.feature 'User manages contract templates', type: :feature do
|
||||
expect(page).to have_content schedule_demo
|
||||
expect(page).to have_content create_release_template
|
||||
end
|
||||
|
||||
it 'shows edit button when contract template is not signed' do
|
||||
create(:contract_template, project: project)
|
||||
|
||||
visit project_contract_templates_path(project)
|
||||
|
||||
expect(page).to have_link(edit_button_label, exact: true, count: 1)
|
||||
end
|
||||
|
||||
it 'does not show edit button when contract template is signed' do
|
||||
ct = create(:contract_template, project: project)
|
||||
create(:appearance_release, contract_template: ct)
|
||||
|
||||
visit project_contract_templates_path(project)
|
||||
|
||||
expect(page).to have_link(edit_button_label, exact: true, count: 0)
|
||||
end
|
||||
|
||||
it 'shows duplicate button when contract template is not signed' do
|
||||
create(:contract_template, project: project)
|
||||
|
||||
visit project_contract_templates_path(project)
|
||||
|
||||
expect(page).to have_link(duplicate_button_label, exact: true, count: 1)
|
||||
end
|
||||
|
||||
it 'shows duplicate button when contract template is signed' do
|
||||
ct = create(:contract_template, project: project)
|
||||
create(:appearance_release, contract_template: ct)
|
||||
|
||||
visit project_contract_templates_path(project)
|
||||
|
||||
expect(page).to have_link(duplicate_button_label, exact: true, count: 1)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
@@ -355,4 +492,28 @@ RSpec.feature 'User manages contract templates', type: :feature do
|
||||
def signature_legal_text_trix_field
|
||||
'Signature legal text'
|
||||
end
|
||||
|
||||
def edit_button_label
|
||||
t 'contract_templates.contract_template.actions.edit'
|
||||
end
|
||||
|
||||
def duplicate_button_label
|
||||
t 'contract_templates.contract_template.actions.duplicate'
|
||||
end
|
||||
|
||||
def edit_page_heading
|
||||
t 'contract_templates.edit.heading'
|
||||
end
|
||||
|
||||
def name_field
|
||||
'contract_template_name'
|
||||
end
|
||||
|
||||
def update_contract_template_button_label
|
||||
t 'helpers.submit.contract_template.update'
|
||||
end
|
||||
|
||||
def duplicate_release_name(template_name = '')
|
||||
t 'contract_templates.duplicate.name_prefix', template_name: template_name
|
||||
end
|
||||
end
|
||||
|
||||
@@ -63,6 +63,54 @@ feature 'User managing broadcasts' do
|
||||
expect(page).to have_content(recording.download_file_name)
|
||||
end
|
||||
|
||||
scenario 'Clicking Reset URL regenerates broadcast token' do
|
||||
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
|
||||
old_token = broadcast.token
|
||||
|
||||
visit project_broadcast_path(project, broadcast)
|
||||
|
||||
expect(page).to have_content reset_url
|
||||
expect(page).to have_xpath "//input[@readonly][@value='#{broadcast_url(old_token)}']"
|
||||
|
||||
click_link reset_url
|
||||
expect(Broadcast.last.token).not_to eq old_token
|
||||
expect(page).to have_xpath "//input[@readonly][@value='#{broadcast_url(Broadcast.last.token)}']"
|
||||
expect(page).to have_content token_reset_notice
|
||||
end
|
||||
|
||||
scenario 'Player will not reload if stream is reactivated while user is watching previous recording', js: true do
|
||||
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
|
||||
recording = create(:broadcast_recording, broadcast: broadcast)
|
||||
|
||||
visit project_broadcast_path(project, broadcast)
|
||||
|
||||
expect(page).to have_content stream_idle_message
|
||||
|
||||
broadcast.streamer_status = :recording
|
||||
broadcast.status = :active
|
||||
BroadcastsChannel.broadcast_stream_updates(broadcast)
|
||||
|
||||
expect(page).to have_content stream_begun_message
|
||||
expect(page).to have_selector('div#broadcast_video', count: 1)
|
||||
|
||||
broadcast.streamer_status = :idle
|
||||
broadcast.status = :idle
|
||||
BroadcastsChannel.broadcast_stream_updates(broadcast)
|
||||
|
||||
click_on switch_view_dropdown
|
||||
click_on recording.download_file_name
|
||||
|
||||
expect(page).to have_content stream_idle_message
|
||||
expect(page).to have_selector('div#broadcast_video', count: 1)
|
||||
|
||||
broadcast.streamer_status = :recording
|
||||
broadcast.status = :active
|
||||
BroadcastsChannel.broadcast_stream_updates(broadcast)
|
||||
|
||||
expect(page).to have_content stream_begun_message
|
||||
expect(page).to have_selector('div#broadcast_video', count: 1)
|
||||
end
|
||||
|
||||
scenario 'user can go back and forth between live session and previous sessions', js: true do
|
||||
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
|
||||
recording = create(:broadcast_recording, broadcast: broadcast)
|
||||
@@ -189,4 +237,22 @@ feature 'User managing broadcasts' do
|
||||
def create_stream
|
||||
t 'broadcasts.splash.actions.create_stream'
|
||||
end
|
||||
|
||||
def reset_url
|
||||
t 'broadcasts.show.actions.reset_url'
|
||||
end
|
||||
|
||||
def token_reset_notice
|
||||
t 'broadcasts.update.reset_notice'
|
||||
end
|
||||
|
||||
def stream_begun_message
|
||||
'Live stream has begun, click play to watch it'
|
||||
end
|
||||
|
||||
def stream_idle_message
|
||||
'Live stream is waiting to begin'
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
@@ -260,7 +260,7 @@ feature "User managing medical releases" do
|
||||
expect(pdf_body).to have_content for_office_use_only.upcase
|
||||
expect(pdf_body).to have_content producer_label
|
||||
expect(pdf_body).to have_content production_label
|
||||
expect(pdf_body).to have_content employee_issued_to_label
|
||||
expect(pdf_body).to have_content issued_to_label
|
||||
expect(pdf_body).to have_content issued_by_label
|
||||
expect(pdf_body).to have_content date_issued
|
||||
expect(pdf_body).to have_content 'Big Joe'
|
||||
@@ -282,7 +282,7 @@ feature "User managing medical releases" do
|
||||
expect(pdf_body).not_to have_content for_office_use_only.upcase
|
||||
expect(pdf_body).not_to have_content producer_label
|
||||
expect(pdf_body).not_to have_content production_label
|
||||
expect(pdf_body).not_to have_content employee_issued_to_label
|
||||
expect(pdf_body).not_to have_content issued_to_label
|
||||
expect(pdf_body).not_to have_content issued_by_label
|
||||
expect(pdf_body).not_to have_content date_issued
|
||||
expect(pdf_body).not_to have_content 'Big Joe'
|
||||
@@ -580,8 +580,8 @@ feature "User managing medical releases" do
|
||||
t 'contracts.for_office_use_only.description_labels.production'
|
||||
end
|
||||
|
||||
def employee_issued_to_label
|
||||
t 'contracts.for_office_use_only.description_labels.employee_issued_to'
|
||||
def issued_to_label
|
||||
t 'contracts.for_office_use_only.description_labels.issued_to'
|
||||
end
|
||||
|
||||
def issued_by_label
|
||||
|
||||
Reference in New Issue
Block a user