Compare commits

..

2 Commits

Author SHA1 Message Date
Bilal
b03026f19c rebase 2020-09-01 21:56:08 +03:00
Bilal
3cbff1b0f1 structure 2020-09-01 21:56:08 +03:00
5 changed files with 12 additions and 33 deletions

View File

@@ -1,5 +1,5 @@
<% if broadcast.director_mode_video_embed.present? && params[:director_mode].nil? %> <% if broadcast.director_mode_video_embed.present? && params[:director_mode].present? %>
<div id="director_broadcast_video" class="embed-responsive-item" data-video-type="stream"> <div class="embed-responsive-item" data-video-type="stream">
<%= raw broadcast.director_mode_video_embed %> <%= raw broadcast.director_mode_video_embed %>
</div> </div>
<% elsif broadcast.streamer_recording? && broadcast.active? %> <% elsif broadcast.streamer_recording? && broadcast.active? %>

View File

@@ -48,18 +48,18 @@
</div> </div>
</div> </div>
<% if @broadcast.director_mode_video_embed.present? %> <% if @broadcast.director_mode_video_embed.present? %>
<% unless params[:director_mode] %> <% if params[:director_mode] %>
<div class="custom-control custom-switch ml-auto"> <div class="custom-control custom-switch ml-auto">
<input type="checkbox" name="director_mode" value="true" class="custom-control-input" id="director_mode_switch" checked="checked" /> <input type="checkbox" name="director_mode" value="true" class="custom-control-input" id="director_mode_switch" checked="checked" />
<label class="custom-control-label text-white override-custom-control-label" for="director_mode_switch">Director Mode</label> <label class="custom-control-label text-white override-custom-control-label" for="director_mode_switch">Director Mode</label>
</div> </div>
<%= link_to "Disable Director Mode", [@broadcast.project, @broadcast, director_mode: false], class: "d-none", id: "director_mode_link" %> <%= link_to "Disable Director Mode", url_for(params.permit!.except(:director_mode)), class: "d-none", id: "director_mode_link" %>
<% else %> <% else %>
<div class="custom-control custom-switch ml-auto"> <div class="custom-control custom-switch ml-auto">
<input type="checkbox" name="director_mode" value="true" class="custom-control-input" id="director_mode_switch" /> <input type="checkbox" name="director_mode" value="true" class="custom-control-input" id="director_mode_switch" />
<label class="custom-control-label text-white override-custom-control-label" for="director_mode_switch">Director Mode</label> <label class="custom-control-label text-white override-custom-control-label" for="director_mode_switch">Director Mode</label>
</div> </div>
<%= link_to "Enable Director Mode", [@broadcast.project, @broadcast], class: "d-none", id: "director_mode_link" %> <%= link_to "Enable Director Mode", url_for(params.permit!.merge(director_mode: true)), class: "d-none", id: "director_mode_link" %>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>

View File

@@ -542,9 +542,9 @@ CREATE TABLE public.broadcast_recordings (
updated_at timestamp(6) without time zone NOT NULL, updated_at timestamp(6) without time zone NOT NULL,
duration double precision, duration double precision,
hidden boolean DEFAULT false, hidden boolean DEFAULT false,
starred boolean DEFAULT false,
name character varying, name character varying,
description text description text,
starred boolean DEFAULT false
); );
@@ -1492,6 +1492,7 @@ CREATE TABLE public.settings (
-- --
CREATE SEQUENCE public.settings_id_seq CREATE SEQUENCE public.settings_id_seq
AS integer
START WITH 1 START WITH 1
INCREMENT BY 1 INCREMENT BY 1
NO MINVALUE NO MINVALUE
@@ -1527,6 +1528,7 @@ CREATE TABLE public.taggings (
-- --
CREATE SEQUENCE public.taggings_id_seq CREATE SEQUENCE public.taggings_id_seq
AS integer
START WITH 1 START WITH 1
INCREMENT BY 1 INCREMENT BY 1
NO MINVALUE NO MINVALUE
@@ -1557,6 +1559,7 @@ CREATE TABLE public.tags (
-- --
CREATE SEQUENCE public.tags_id_seq CREATE SEQUENCE public.tags_id_seq
AS integer
START WITH 1 START WITH 1
INCREMENT BY 1 INCREMENT BY 1
NO MINVALUE NO MINVALUE

View File

@@ -197,13 +197,13 @@ RSpec.describe BroadcastsController, type: :controller do
context "when director mode is enabled" do context "when director mode is enabled" do
it "shows the video embed" do it "shows the video embed" do
get :show, params: { project_id: project, id: broadcast } get :show, params: { project_id: project, id: broadcast, director_mode: true }
expect(response.body).to have_selector("iframe", text: "video player") expect(response.body).to have_selector("iframe", text: "video player")
end end
it "renders the view dropdown with a director mode disable option" do it "renders the view dropdown with a director mode disable option" do
get :show, params: { project_id: project, id: broadcast } get :show, params: { project_id: project, id: broadcast, director_mode: true }
expect(response.body).to have_content broadcast.name expect(response.body).to have_content broadcast.name
expect(response.body).to have_selector(".custom-control-label", text: "Director Mode") expect(response.body).to have_selector(".custom-control-label", text: "Director Mode")

View File

@@ -151,30 +151,6 @@ feature 'User managing broadcasts' do
end end
end end
scenario 'opening broadcast page starts in normal mode if director mode is not available' do
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
broadcast.director_mode_video_embed = nil
broadcast.save
visit project_broadcast_path(project, broadcast)
expect(page).not_to have_selector('#director_broadcast_video')
expect(page).to have_selector('#broadcast_video')
expect(page).not_to have_selector('#director_mode_switch')
end
scenario 'opening broadcast page starts in director mode if available' do
broadcast = create(:broadcast, :with_stream, :with_files, project: project, director_mode_video_embed: 'director_mode')
visit project_broadcast_path(project, broadcast)
expect(page).not_to have_selector('#broadcast_video')
expect(page).to have_selector('#director_broadcast_video')
expect(page).to have_selector('#director_mode_switch')
end
context 'When the user is associate' do context 'When the user is associate' do
let(:current_user) { create(:user, :associate) } let(:current_user) { create(:user, :associate) }