Compare commits

..

8 Commits

Author SHA1 Message Date
Bilal
744480740e rebase 2020-07-14 14:16:55 +02:00
Bilal
bc1ff4cf39 add specs 2020-07-14 14:15:31 +02:00
Bilal
7d4ff7cdb8 sort translations 2020-07-14 14:15:31 +02:00
Bilal
e41d7603d0 implement duplication 2020-07-14 14:15:31 +02:00
Bilal
0741f8a230 fix new and edit form models 2020-07-14 14:15:31 +02:00
Bilal
f44eca5328 prevent update if template is in use 2020-07-14 14:15:31 +02:00
Bilal
cefa30b331 add Edit button 2020-07-14 14:14:47 +02:00
Bilal
2b95849229 add edit page for contract templates 2020-07-14 14:14:47 +02:00
10 changed files with 12 additions and 111 deletions

View File

@@ -21,8 +21,7 @@ $(document).on "turbolinks:load", ->
refreshBroadcastVideo: (data) ->
$("#broadcast_updates").html data.status_content
stream_selected = $("#broadcast_video").attr('video-type') == 'stream';
if data.streamer_status == 'recording' && data.status == 'active' && stream_selected
if data.streamer_status == 'recording' && data.status == 'active'
$("#broadcast_video").html data.video_content
new (Clappr.Player)(
parentId: '#broadcast_video'

View File

@@ -3,7 +3,7 @@ $(document).on("click", "[data-behavior=play_recording]", function() {
return false;
}
$("#broadcast_video").attr('video-type', 'recording');
console.warn('Play prev : ', playback_url);
var playback_url = $(this).attr("data-playback-url")
$("#broadcast_video").empty();
@@ -23,6 +23,4 @@ $(document).on("click", "[data-behavior=play_recording]", function() {
$(this).siblings().children("i").remove();
$(this).addClass('active');
$(this).prepend('<i class="fa fa-check">&nbsp;</i>');
});
$(document).on("click", "[data-behavior=play_stream]", function() { $("#broadcast_video").attr('video-type', 'stream'); });
});

View File

@@ -33,11 +33,6 @@ 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)

View File

@@ -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), "#", data: { behavior: "play_stream"}, class: "dropdown-item active" %>
<%= link_to fa_icon("check", text: @broadcast.name.titleize), "#", class: "dropdown-item active" %>
<% @multi_view_broadcasts.each do |broadcast| %>
<% if 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) %>
<%= link_to broadcast.name.titleize, broadcast.url, class: class_string("dropdown-item", "active" => @broadcast.id == broadcast.id) %>
<% end %>
<% end %>
<h5 class="dropdown-header">Previous Sessions</h5>
@@ -102,7 +102,6 @@
<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>
@@ -111,7 +110,6 @@
<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>

View File

@@ -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.issued_to'), releasable.name %>
<%= description_list_pair t('.description_labels.employee_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>

View File

@@ -217,9 +217,6 @@ en:
new:
heading:
Create Live Stream
show:
actions:
reset_url: Reset URL
splash:
actions:
book_demo: Schedule a Demo
@@ -238,8 +235,6 @@ 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
@@ -317,8 +312,8 @@ en:
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

View File

@@ -81,9 +81,6 @@ 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
@@ -102,8 +99,6 @@ 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:
@@ -151,8 +146,8 @@ es:
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)

View File

@@ -203,15 +203,6 @@ 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
@@ -261,8 +252,4 @@ 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

View File

@@ -63,54 +63,6 @@ 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)
@@ -237,22 +189,4 @@ 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

View File

@@ -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 issued_to_label
expect(pdf_body).to have_content employee_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 issued_to_label
expect(pdf_body).not_to have_content employee_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 issued_to_label
t 'contracts.for_office_use_only.description_labels.issued_to'
def employee_issued_to_label
t 'contracts.for_office_use_only.description_labels.employee_issued_to'
end
def issued_by_label