Compare commits
10 Commits
add-approv
...
add-amendm
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
970b53d4ef | ||
|
|
aa914102d1 | ||
|
|
f3f3a52332 | ||
|
|
534760e6f5 | ||
|
|
1b5729ce34 | ||
|
|
55ffa3be7f | ||
|
|
eefc991207 | ||
|
|
141ab42d4b | ||
|
|
8d16c310df | ||
|
|
9bf68d8fd6 |
@@ -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%',
|
||||
@@ -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"> </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'); });
|
||||
@@ -3,7 +3,7 @@ class BroadcastsController < ApplicationController
|
||||
|
||||
before_action :set_project
|
||||
before_action :build_broadcast, only: [:new, :create]
|
||||
before_action :set_broadcast, only: [:show, :destroy, :update, :destroy_file]
|
||||
before_action :set_broadcast, only: [:show, :destroy, :update]
|
||||
before_action :set_multi_view_broadcasts, only: [:show]
|
||||
before_action :show_splash_screen, only: :index
|
||||
|
||||
@@ -39,7 +39,10 @@ class BroadcastsController < ApplicationController
|
||||
end
|
||||
|
||||
@broadcast.update(broadcast_params)
|
||||
update_files_section
|
||||
@files = @broadcast.files.order("created_at DESC").paginate(page: 1)
|
||||
|
||||
pagination_content = ApplicationController.render html: helpers.will_paginate(@files, params: { active_tab: params[:active_tab], page: params[:page], active_files_tab: params[:active_files_tab] })
|
||||
BroadcastsChannel.broadcast_file_upload_updates(@broadcast, @files, pagination_content)
|
||||
end
|
||||
|
||||
def destroy
|
||||
@@ -50,23 +53,8 @@ class BroadcastsController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def destroy_file
|
||||
authorize Broadcast
|
||||
file = ActiveStorage::Attachment.find(params[:file_id])
|
||||
file.destroy
|
||||
|
||||
update_files_section
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def update_files_section
|
||||
@files = @broadcast.files.order("created_at DESC").paginate(page: 1)
|
||||
|
||||
pagination_content = ApplicationController.render html: helpers.will_paginate(@files, params: { active_tab: params[:active_tab], page: params[:page], active_files_tab: params[:active_files_tab] })
|
||||
BroadcastsChannel.broadcast_file_upload_updates(@broadcast, @files, pagination_content)
|
||||
end
|
||||
|
||||
def show_splash_screen
|
||||
render :splash if broadcasts.count.zero?
|
||||
end
|
||||
|
||||
@@ -18,12 +18,4 @@ class BroadcastPolicy < ApplicationPolicy
|
||||
def update?
|
||||
true
|
||||
end
|
||||
|
||||
def destroy_file?
|
||||
if user.nil? || user.user.nil?
|
||||
return false
|
||||
end
|
||||
|
||||
user.manager? || user.account_manager?
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,25 +1,12 @@
|
||||
<div class="row">
|
||||
<% broadcast = file.record %>
|
||||
<% show_delete = controller.class.module_parent.to_s == "Public" ? false : policy(broadcast).destroy_file? %>
|
||||
<% file_class = show_delete ? "col-8" : "col-12" %>
|
||||
<div class="<%= file_class %>">
|
||||
<li class="my-2" id="<%= dom_id(file) %>">
|
||||
<% if file.variable? %>
|
||||
<%= link_to image_tag(file.variant(resize_and_pad: [300, 300, background: "#F7F8F9"]), class: "bg-light img-thumbnail img-fluid"), file, target: "_blank" %>
|
||||
<% else %>
|
||||
<div class="border rounded bg-light text-muted d-flex justify-content-center align-items-center img-fluid fix-h-and-w">
|
||||
<%= link_to file, target: "_blank" do %>
|
||||
<%= fa_icon("file", style: "font-size: 2rem") %>
|
||||
<div class="mt-2"><%= file.filename %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<li class="my-2" id="<%= dom_id(file) %>">
|
||||
<% if file.variable? %>
|
||||
<%= link_to image_tag(file.variant(resize_and_pad: [300, 300, background: "#F7F8F9"]), class: "bg-light img-thumbnail img-fluid"), file, target: "_blank" %>
|
||||
<% else %>
|
||||
<div class="border rounded bg-light text-muted d-flex justify-content-center align-items-center fix-h-and-w">
|
||||
<%= link_to file, target: "_blank" do %>
|
||||
<%= fa_icon("file", style: "font-size: 2rem") %>
|
||||
<div class="mt-2"><%= file.filename %></div>
|
||||
<% end %>
|
||||
</li>
|
||||
</div>
|
||||
<% if show_delete %>
|
||||
<div class="col-4 align-self-center p-0 m-0">
|
||||
<% url = url_for [:destroy_file, broadcast.project, broadcast, { file_id: file.id }] %>
|
||||
<%= link_to fa_icon("trash fw", text: t('.actions.delete_file')), url, class: "btn btn-danger", remote: true, method: :delete, data: { confirm: t('.confirm_delete') } %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
@@ -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 %>
|
||||
|
||||
@@ -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></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@@ -214,10 +214,6 @@ en:
|
||||
destroy:
|
||||
alert: A live stream has been deleted
|
||||
api_error: Something went wrong, please try again later after some time
|
||||
file:
|
||||
actions:
|
||||
delete_file: Delete
|
||||
confirm_delete: Are you sure?
|
||||
index:
|
||||
actions:
|
||||
new: Create New Live Stream
|
||||
@@ -311,7 +307,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
|
||||
@@ -358,12 +353,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
|
||||
@@ -789,9 +778,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
|
||||
|
||||
@@ -81,10 +81,6 @@ es:
|
||||
do_not_copy_warning: "Do not copy (ES)"
|
||||
serial_number_label: "Serial Number (ES)"
|
||||
broadcasts:
|
||||
file:
|
||||
actions:
|
||||
delete_file: Delete
|
||||
confirm_delete: Are you sure? (ES)
|
||||
show:
|
||||
actions:
|
||||
reset_url: Reset URL (ES)
|
||||
@@ -346,7 +342,6 @@ es:
|
||||
index:
|
||||
table_headers:
|
||||
address: Address (ES)
|
||||
amendment_signed: Amendment (ES)
|
||||
notes: Notes (ES)
|
||||
signed_at: Date Signed (ES)
|
||||
tags: Tags (ES)
|
||||
|
||||
@@ -96,9 +96,6 @@ Rails.application.routes.draw do
|
||||
end
|
||||
resources :projects, only: [] do
|
||||
resources :broadcasts, except: [:edit] do
|
||||
member do
|
||||
delete :destroy_file
|
||||
end
|
||||
resource :zoom_meeting, only: [:show]
|
||||
end
|
||||
resources :directories, except: [:index] do
|
||||
|
||||
@@ -106,7 +106,7 @@ RSpec.describe Api::BroadcastsController, type: :controller do
|
||||
included = JSON.parse(response.body).dig('included')
|
||||
|
||||
expect(relationships.keys).to include('files')
|
||||
expect(included.size).to eq 3
|
||||
expect(included.size).to eq 1
|
||||
expect(included.first.dig("id")).to eq broadcast.files.first.id.to_s
|
||||
expect(included.first.dig("type")).to eq 'active_storage_attachment'
|
||||
end
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -87,7 +87,6 @@ RSpec.describe Public::BroadcastsController, type: :controller do
|
||||
let!(:broadcast) { create(:broadcast, :with_stream, skip_create_callback: true, project: project ) }
|
||||
|
||||
it "uploads files to broadcast" do
|
||||
allow(BroadcastsChannel).to receive(:broadcast_file_upload_updates)
|
||||
patch :update, params: { token: broadcast.token, broadcast: file_params }, xhr: true
|
||||
|
||||
expect(broadcast.files.count).to eq(1)
|
||||
|
||||
@@ -17,13 +17,7 @@ FactoryBot.define do
|
||||
end
|
||||
|
||||
trait :with_files do
|
||||
files do
|
||||
[
|
||||
Rack::Test::UploadedFile.new('spec/fixtures/files/contract.pdf', 'application/pdf'),
|
||||
Rack::Test::UploadedFile.new('spec/fixtures/files/audio.mp3', 'audio/mpeg'),
|
||||
Rack::Test::UploadedFile.new('spec/fixtures/files/video_file.mp4', 'video/mp4')
|
||||
]
|
||||
end
|
||||
files { [Rack::Test::UploadedFile.new('spec/fixtures/files/contract.pdf', 'application/pdf')] }
|
||||
end
|
||||
|
||||
after(:build) do |broadcast, evaluator|
|
||||
|
||||
@@ -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
|
||||
@@ -379,7 +378,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 +409,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
|
||||
@@ -508,10 +505,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
|
||||
|
||||
@@ -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
|
||||
@@ -164,21 +164,6 @@ feature 'User managing broadcasts' do
|
||||
click_on add_file_button
|
||||
end
|
||||
|
||||
scenario 'manager user can click delete button next to the file and delete file', js: true do
|
||||
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
|
||||
|
||||
visit project_broadcast_path(project, broadcast)
|
||||
|
||||
expect(page).to have_content delete_file_button, count: 3
|
||||
|
||||
accept_alert do
|
||||
first('a', text: delete_file_button).click
|
||||
end
|
||||
|
||||
expect(page).to have_content delete_file_button, count: 2
|
||||
expect(Broadcast.find(broadcast.id).files.count).to eq 2
|
||||
end
|
||||
|
||||
scenario 'visit multi-view broadcast page', js: true do
|
||||
broadcast_one = create(:broadcast, :with_stream, :with_files, name: 'Broadcast 1', project: project)
|
||||
broadcast_two = create(:broadcast, :with_stream, :with_files, name: 'Broadcast 2', project: project)
|
||||
@@ -213,14 +198,6 @@ feature 'User managing broadcasts' do
|
||||
expect(page).to have_content schedule_demo
|
||||
expect(page).not_to have_content create_stream
|
||||
end
|
||||
|
||||
scenario 'associate user does not see delete button next to the file', js: true do
|
||||
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
|
||||
|
||||
visit project_broadcast_path(project, broadcast)
|
||||
|
||||
expect(page).to have_content delete_file_button, count: 0
|
||||
end
|
||||
end
|
||||
|
||||
context 'When the user is account manager' do
|
||||
@@ -232,21 +209,6 @@ feature 'User managing broadcasts' do
|
||||
expect(page).to have_content schedule_demo
|
||||
expect(page).to have_content create_stream
|
||||
end
|
||||
|
||||
scenario 'account manager user can click delete button next to the file and delete file', js: true do
|
||||
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
|
||||
|
||||
visit project_broadcast_path(project, broadcast)
|
||||
|
||||
expect(page).to have_content delete_file_button, count: 3
|
||||
|
||||
accept_alert do
|
||||
first('a', text: delete_file_button).click
|
||||
end
|
||||
|
||||
expect(page).to have_content delete_file_button, count: 2
|
||||
expect(Broadcast.find(broadcast.id).files.count).to eq 2
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -300,9 +262,5 @@ feature 'User managing broadcasts' do
|
||||
'Live stream is waiting to begin'
|
||||
end
|
||||
|
||||
def delete_file_button
|
||||
t 'broadcasts.file.actions.delete_file'
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
@@ -127,14 +127,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)
|
||||
|
||||
@@ -737,16 +729,4 @@ feature "User managing location releases" do
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user