diff --git a/app/assets/javascripts/bs_component_init.js b/app/assets/javascripts/bs_component_init.js
new file mode 100644
index 0000000..897d72b
--- /dev/null
+++ b/app/assets/javascripts/bs_component_init.js
@@ -0,0 +1,7 @@
+$(document).on("turbolinks:load", function() {
+ bsCustomFileInput.init();
+})
+
+$(document).on("turbolinks:load", function() {
+ $(".toast").toast('show');
+})
diff --git a/app/assets/javascripts/channels/broadcasts.coffee.erb b/app/assets/javascripts/channels/broadcasts.coffee.erb
index fddc672..25c32ec 100644
--- a/app/assets/javascripts/channels/broadcasts.coffee.erb
+++ b/app/assets/javascripts/channels/broadcasts.coffee.erb
@@ -43,6 +43,7 @@ $(document).on "turbolinks:load", ->
$(".flash-message").html data.flash_content
$("#broadcast_recordings").html data.recordings_content
$("#broadcast_recordings_nav").html data.recordings_nav_content
+ $(".toast").toast('show')
refreshBroadcastFilesTab: (data) ->
$("#broadcast_file_list_#{data.broadcast_token}").html data.files_content
diff --git a/app/assets/javascripts/channels/projects.coffee b/app/assets/javascripts/channels/projects.coffee
index 41061c9..8f6dad1 100644
--- a/app/assets/javascripts/channels/projects.coffee
+++ b/app/assets/javascripts/channels/projects.coffee
@@ -23,3 +23,4 @@ $(document).on "turbolinks:load", ->
showDownloadStatusUpdate: (content) ->
$(".flash-message").html content
+ $(".toast").toast('show')
diff --git a/app/assets/javascripts/custom_file_input.js b/app/assets/javascripts/custom_file_input.js
deleted file mode 100644
index e1a8203..0000000
--- a/app/assets/javascripts/custom_file_input.js
+++ /dev/null
@@ -1,3 +0,0 @@
-$(document).on("turbolinks:load", function() {
- bsCustomFileInput.init()
-})
diff --git a/app/assets/javascripts/stream_player.js.erb b/app/assets/javascripts/stream_player.js.erb
index b525d33..67296c6 100644
--- a/app/assets/javascripts/stream_player.js.erb
+++ b/app/assets/javascripts/stream_player.js.erb
@@ -24,4 +24,4 @@ $(document).on("click", "[data-behavior=play_stream]", function() {
function clearPlayingHighlight() {
$(".playing-highlight").removeClass("playing-highlight");
-}
\ No newline at end of file
+}
diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss
index 5dc9303..cd5fe7b 100644
--- a/app/assets/stylesheets/application.scss
+++ b/app/assets/stylesheets/application.scss
@@ -495,3 +495,30 @@ trix-toolbar {
.playing-highlight {
background-color: scale-color($primary, $lightness: 80%);
}
+
+// Toast min width and border radius
+.toast-min-w-border-radius {
+ min-width: 18rem;
+ border-radius: 0.8rem;
+}
+
+// Toast left border primary
+.toast-border-left-primary {
+ border-left: 8px solid $primary;
+}
+
+// Toast left border danger
+.toast-border-left-danger {
+ border-left: 8px solid $danger;
+}
+
+// Change link color to primary on toast notifications
+.toast {
+ a {
+ color: $primary;
+ }
+
+ a.btn {
+ color: white;
+ }
+}
\ No newline at end of file
diff --git a/app/controllers/broadcast_recording_starrings_controller.rb b/app/controllers/broadcast_recording_starrings_controller.rb
deleted file mode 100644
index 226ab60..0000000
--- a/app/controllers/broadcast_recording_starrings_controller.rb
+++ /dev/null
@@ -1,34 +0,0 @@
-class BroadcastRecordingStarringsController < ApplicationController
- layout "project"
-
- before_action :set_project
- before_action :set_broadcast
- before_action :set_recording
-
- def create
- @recording.toggle_star
- set_recordings
- end
-
- private
-
- def broadcast_recording_params
- params.require(:broadcast_recording).permit(:name, :description)
- end
-
- def set_project
- @project = policy_scope(Project).find(params[:project_id])
- end
-
- def set_broadcast
- @broadcast = authorize policy_scope(@project.broadcasts).find(params[:broadcast_id])
- end
-
- def set_recording
- @recording = authorize policy_scope(@broadcast.broadcast_recordings).find(params[:broadcast_recording_id])
- end
-
- def set_recordings
- @recordings = @broadcast.broadcast_recordings.visible.order_by_recent.paginate(page: params[:page])
- end
-end
diff --git a/app/controllers/broadcast_recordings_controller.rb b/app/controllers/broadcast_recordings_controller.rb
index 86d09f0..e253bff 100644
--- a/app/controllers/broadcast_recordings_controller.rb
+++ b/app/controllers/broadcast_recordings_controller.rb
@@ -5,14 +5,6 @@ class BroadcastRecordingsController < ApplicationController
before_action :set_broadcast
before_action :set_recording
- def edit
- end
-
- def update
- @recording.update(broadcast_recording_params)
- set_recordings
- end
-
def destroy
@recording.update(hidden: true)
set_recordings
@@ -20,10 +12,6 @@ class BroadcastRecordingsController < ApplicationController
private
- def broadcast_recording_params
- params.require(:broadcast_recording).permit(:name, :description)
- end
-
def set_project
@project = policy_scope(Project).find(params[:project_id])
end
diff --git a/app/controllers/public/broadcast_recording_starrings_controller.rb b/app/controllers/public/broadcast_recording_starrings_controller.rb
new file mode 100644
index 0000000..b46face
--- /dev/null
+++ b/app/controllers/public/broadcast_recording_starrings_controller.rb
@@ -0,0 +1,24 @@
+class Public::BroadcastRecordingStarringsController < Public::BaseController
+ skip_after_action :verify_authorized
+ before_action :set_broadcast
+ before_action :set_recording
+
+ def create
+ @recording.toggle_star
+ set_recordings
+ end
+
+ private
+
+ def set_broadcast
+ @broadcast = Broadcast.find_by_token(params[:broadcast_token])
+ end
+
+ def set_recording
+ @recording = @broadcast.broadcast_recordings.find(params[:broadcast_recording_id])
+ end
+
+ def set_recordings
+ @recordings = @broadcast.broadcast_recordings.visible.order_by_recent.paginate(page: params[:page])
+ end
+end
diff --git a/app/controllers/public/broadcast_recordings_controller.rb b/app/controllers/public/broadcast_recordings_controller.rb
new file mode 100644
index 0000000..01f93f6
--- /dev/null
+++ b/app/controllers/public/broadcast_recordings_controller.rb
@@ -0,0 +1,31 @@
+class Public::BroadcastRecordingsController < Public::BaseController
+ skip_after_action :verify_authorized
+ before_action :set_broadcast, only: [:edit, :update]
+ before_action :set_recording, only: [:edit, :update]
+
+ def edit
+ end
+
+ def update
+ @recording.update(broadcast_recording_params)
+ set_recordings
+ end
+
+ private
+
+ def broadcast_recording_params
+ params.require(:broadcast_recording).permit(:name, :description)
+ end
+
+ def set_broadcast
+ @broadcast = Broadcast.find_by_token(params[:broadcast_token])
+ end
+
+ def set_recording
+ @recording = @broadcast.broadcast_recordings.find(params[:id])
+ end
+
+ def set_recordings
+ @recordings = @broadcast.broadcast_recordings.visible.order_by_recent.paginate(page: params[:page])
+ end
+end
diff --git a/app/controllers/video_analyses/acquired_media_releases_controller.rb b/app/controllers/video_analyses/acquired_media_releases_controller.rb
index 12d8c37..57b3edf 100644
--- a/app/controllers/video_analyses/acquired_media_releases_controller.rb
+++ b/app/controllers/video_analyses/acquired_media_releases_controller.rb
@@ -2,7 +2,7 @@ class VideoAnalyses::AcquiredMediaReleasesController < ApplicationController
before_action :set_video
def index
- @acquired_media_file_infos = filtered_file_infos
+ @acquired_media_files = filtered_files
end
private
@@ -15,12 +15,12 @@ class VideoAnalyses::AcquiredMediaReleasesController < ApplicationController
params[:query]
end
- def filtered_file_infos
+ def filtered_files
releasables = policy_scope(@video.acquired_media_releases)
- results = FileInfo.where(releasable: releasables)
+ results = ActiveStorage::Attachment.where(record: releasables, name: "files")
if query_param.present?
- results = results.search_filename(query_param)
+ results = results.joins(:blob).where("active_storage_blobs.filename ILIKE ?", "%#{query_param}%")
end
results
diff --git a/app/controllers/video_release_confirmations_controller.rb b/app/controllers/video_release_confirmations_controller.rb
index b39760e..3b86bfc 100644
--- a/app/controllers/video_release_confirmations_controller.rb
+++ b/app/controllers/video_release_confirmations_controller.rb
@@ -74,6 +74,7 @@ class VideoReleaseConfirmationsController < ApplicationController
params.require(:video_release_confirmation).permit(
:time_elapsed,
:file_info_id,
+ :file_id,
:channel,
:timecode_in,
:timecode_out,
diff --git a/app/models/contract_template.rb b/app/models/contract_template.rb
index 2c39275..b5f2992 100644
--- a/app/models/contract_template.rb
+++ b/app/models/contract_template.rb
@@ -18,7 +18,7 @@ class ContractTemplate < ApplicationRecord
has_many :medical_releases, dependent: :restrict_with_error
has_many :misc_releases, dependent: :restrict_with_error
- monetize :fee_cents
+ monetize :fee_old_cents
has_rich_text :body
has_rich_text :guardian_clause
has_rich_text :signature_legal_text
@@ -29,7 +29,7 @@ class ContractTemplate < ApplicationRecord
validates :name, presence: true
validates :release_type, presence: true
- validates :fee_cents, numericality: {
+ validates :fee_old_cents, numericality: {
greater_than_or_equal_to: 0,
less_than_or_equal_to: 99_999_999_99
}
@@ -50,7 +50,11 @@ class ContractTemplate < ApplicationRecord
enum accessibility: [:public_template, :private_template]
def fee?
- !fee.zero?
+ fee.present?
+ end
+
+ def fee_old?
+ !fee_old.zero?
end
def releases
diff --git a/app/models/video_release_confirmation.rb b/app/models/video_release_confirmation.rb
index 0efb4d8..7026f02 100644
--- a/app/models/video_release_confirmation.rb
+++ b/app/models/video_release_confirmation.rb
@@ -9,6 +9,10 @@ class VideoReleaseConfirmation < ApplicationRecord
Timecode.from_seconds(time_elapsed.to_f).to_s
end
+ def file
+ ActiveStorage::Attachment.find(file_id)
+ end
+
private
class ReleaseRankOrder
diff --git a/app/views/application/_flash.html.erb b/app/views/application/_flash.html.erb
index 0da14bc..afba291 100644
--- a/app/views/application/_flash.html.erb
+++ b/app/views/application/_flash.html.erb
@@ -1,5 +1,22 @@
-<% if flash.alert.present? %>
-
<% if policy(BroadcastRecording).update? %>
- <%= link_to fa_icon("#{recording.starred ? 'star' : 'star-o'} fw"), [broadcast.project, broadcast, recording, :broadcast_recording_starrings], method: :post, class: "text-warning mr-2", remote: true %>
+ <%= link_to fa_icon("#{recording.starred ? 'star' : 'star-o'} fw"), broadcast_broadcast_recording_broadcast_recording_starrings_path(broadcast.token, recording), method: :post, class: "text-warning mr-3", remote: true %>
<% end %>
@@ -18,7 +18,7 @@
<% if policy(BroadcastRecording).edit? %>
- <%= link_to fa_icon('edit'), [:edit, broadcast.project, broadcast, recording], class: "mr-3", remote: true %>
+ <%= link_to fa_icon('edit'), edit_broadcast_broadcast_recording_path(broadcast.token, recording), remote: true %>
<% end %>
<%= link_to(fa_icon('download'), recording.download_url, target: "_blank") %>
diff --git a/app/views/broadcasts/_video.html.erb b/app/views/broadcasts/_video.html.erb
index e518594..d6db39b 100644
--- a/app/views/broadcasts/_video.html.erb
+++ b/app/views/broadcasts/_video.html.erb
@@ -1,5 +1,5 @@
-<% if broadcast.director_mode_video_embed.present? && params[:director_mode].present? %>
-
+<% if broadcast.director_mode_video_embed.present? && params[:non_director_mode].nil? %>
+
<%= raw broadcast.director_mode_video_embed %>
<% elsif broadcast.streamer_recording? && broadcast.active? %>
diff --git a/app/views/broadcasts/show.html.erb b/app/views/broadcasts/show.html.erb
index b987192..c8e24b8 100644
--- a/app/views/broadcasts/show.html.erb
+++ b/app/views/broadcasts/show.html.erb
@@ -41,17 +41,17 @@
<%= 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 %>
- <% if params[:director_mode] %>
+ <% if params[:non_director_mode] %>
<% if controller.class.module_parent.to_s == "Public" %>
- <%= link_to broadcast.name.titleize, url_for(params.permit!.merge(director_mode: true, token: broadcast.token)), data: { behavior: "play_stream"}, class: class_string("dropdown-item", "active" => @broadcast.id == broadcast.id) %>
+ <%= link_to broadcast.name.titleize, url_for(params.permit!.merge(non_director_mode: true, token: broadcast.token)), data: { behavior: "play_stream"}, class: class_string("dropdown-item", "active" => @broadcast.id == broadcast.id) %>
<% else %>
- <%= link_to broadcast.name.titleize, url_for(params.permit!.merge(director_mode: true, id: broadcast.id)), data: { behavior: "play_stream"}, class: class_string("dropdown-item", "active" => @broadcast.id == broadcast.id) %>
+ <%= link_to broadcast.name.titleize, url_for(params.permit!.merge(non_director_mode: true, id: broadcast.id)), data: { behavior: "play_stream"}, class: class_string("dropdown-item", "active" => @broadcast.id == broadcast.id) %>
<% end %>
<% else %>
<% if controller.class.module_parent.to_s == "Public" %>
- <%= link_to broadcast.name.titleize, url_for(params.permit!.merge(token: broadcast.token).except(:director_mode)), data: { behavior: "play_stream"}, class: class_string("dropdown-item", "active" => @broadcast.id == broadcast.id) %>
+ <%= link_to broadcast.name.titleize, url_for(params.permit!.merge(token: broadcast.token).except(:non_director_mode)), data: { behavior: "play_stream"}, class: class_string("dropdown-item", "active" => @broadcast.id == broadcast.id) %>
<% else %>
- <%= link_to broadcast.name.titleize, url_for(params.permit!.merge(id: broadcast.id).except(:director_mode)), data: { behavior: "play_stream"}, class: class_string("dropdown-item", "active" => @broadcast.id == broadcast.id) %>
+ <%= link_to broadcast.name.titleize, url_for(params.permit!.merge(id: broadcast.id).except(:non_director_mode)), data: { behavior: "play_stream"}, class: class_string("dropdown-item", "active" => @broadcast.id == broadcast.id) %>
<% end %>
<% end %>
<% end %>
@@ -59,18 +59,18 @@
<% if @broadcast.director_mode_video_embed.present? %>
- <% if params[:director_mode] %>
+ <% if params[:non_director_mode] %>
-
+
Director Mode
- <%= link_to "Disable Director Mode", url_for(params.permit!.except(:director_mode)), class: "d-none", id: "director_mode_link" %>
+ <%= link_to "Enable Director Mode", url_for(params.permit!.except(:non_director_mode)), class: "d-none", id: "director_mode_link" %>
<% else %>
-
+
Director Mode
- <%= link_to "Enable Director Mode", url_for(params.permit!.merge(director_mode: true)), class: "d-none", id: "director_mode_link" %>
+ <%= link_to "Disable Director Mode", url_for(params.permit!.merge(non_director_mode: true)), class: "d-none", id: "director_mode_link" %>
<% end %>
<% end %>
@@ -133,6 +133,21 @@
<%= render partial: 'broadcasts/live_take', locals: { broadcast: @broadcast } %>
+ <% if params[:non_director_mode] %>
+ <% if controller.class.module_parent.to_s == "Public" %>
+ <%= link_to "Play #{@broadcast.name.titleize}", url_for(params.permit!.merge(non_director_mode: true, token: @broadcast.token)), data: { behavior: "play_stream"}, class: "mt-2 btn btn-primary" %>
+ <% else %>
+ <%= link_to "Play #{@broadcast.name.titleize}", url_for(params.permit!.merge(non_director_mode: true, id: @broadcast.id)), data: { behavior: "play_stream"}, class: "mt-2 btn btn-primary" %>
+ <% end %>
+
+ <% else %>
+ <% if controller.class.module_parent.to_s == "Public" %>
+ <%= link_to "Play #{@broadcast.name.titleize}", url_for(params.permit!.merge(token: @broadcast.token).except(:non_director_mode)), data: { behavior: "play_stream"}, class: "mt-2 btn btn-primary" %>
+ <% else %>
+ <%= link_to "Play #{@broadcast.name.titleize}", url_for(params.permit!.merge(id: @broadcast.id).except(:non_director_mode)), data: { behavior: "play_stream"}, class: "mt-2 btn btn-primary" %>
+ <% end %>
+
+ <% end %>
<%= render partial: 'broadcasts/broadcast_recordings', locals: { recordings: @recordings, broadcast: @broadcast } %>
diff --git a/app/views/contract_templates/_contract_template.html.erb b/app/views/contract_templates/_contract_template.html.erb
index 0409f17..3f89605 100644
--- a/app/views/contract_templates/_contract_template.html.erb
+++ b/app/views/contract_templates/_contract_template.html.erb
@@ -5,7 +5,7 @@
<% if contract_template.fee? %>
- <%= number_to_currency(contract_template.fee) %>
+ <%= contract_template.fee %>
<% else %>
<%= t(".no_fee") %>
<% end %>
diff --git a/app/views/contract_templates/_form.html.erb b/app/views/contract_templates/_form.html.erb
index f00c9d5..15ab280 100644
--- a/app/views/contract_templates/_form.html.erb
+++ b/app/views/contract_templates/_form.html.erb
@@ -9,7 +9,7 @@
<%= form.radio_button :accessibility, :private_template, label: "Private" %>
- <%= form.number_field :fee, min:"0", max:"99999999", step: "0.01", prepend: "$", wrapper_class: "col-sm-6" %>
+ <%= form.text_field :fee, wrapper_class: "col-sm-6" %>
<% end %>
diff --git a/app/views/contracts/_signature_page.html.erb b/app/views/contracts/_signature_page.html.erb
index 90727d7..a87d8cb 100644
--- a/app/views/contracts/_signature_page.html.erb
+++ b/app/views/contracts/_signature_page.html.erb
@@ -36,7 +36,7 @@
<%= description_list_pair "Filming Hours:", releasable&.filming_hours %>
<% end %>
<% if contract_template.fee? %>
- <%= description_list_pair "Fee:", number_to_currency(contract_template.fee) %>
+ <%= description_list_pair "Fee:", contract_template.fee %>
<% end %>
<% if releasable.model_name == "MaterialRelease" %>
<%= description_list_pair "Description:", releasable.description %>
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index 912689e..402b50f 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -17,12 +17,12 @@
+
+ <%= render "flash" %>
+
<%= content_for?(:header) ? yield(:header) : render("header") %>
<%= render "masquerade" if masquerading? %>
-
- <%= render "flash" %>
-
<%= content_for?(:content) ? yield(:content) : yield %>
diff --git a/app/views/public/acquired_media_releases/new.html.erb b/app/views/public/acquired_media_releases/new.html.erb
index 17640b1..97b55b6 100644
--- a/app/views/public/acquired_media_releases/new.html.erb
+++ b/app/views/public/acquired_media_releases/new.html.erb
@@ -6,7 +6,7 @@
<%= @contract_template.body %>
<% if @contract_template.fee? %>
- Fee <%= number_to_currency @contract_template.fee %>
+ Fee <%= @contract_template.fee %>
<% end %>
<% end %>
diff --git a/app/views/public/appearance_releases/new.html.erb b/app/views/public/appearance_releases/new.html.erb
index 6183d91..9b38875 100644
--- a/app/views/public/appearance_releases/new.html.erb
+++ b/app/views/public/appearance_releases/new.html.erb
@@ -7,7 +7,7 @@
<%= @contract_template.body %>
<% if @contract_template.fee? %>
- Fee <%= number_to_currency @contract_template.fee %>
+ Fee <%= @contract_template.fee %>
<% end %>
<% end %>
diff --git a/app/views/broadcast_recording_starrings/create.js.erb b/app/views/public/broadcast_recording_starrings/create.js.erb
similarity index 82%
rename from app/views/broadcast_recording_starrings/create.js.erb
rename to app/views/public/broadcast_recording_starrings/create.js.erb
index 04272c7..0cb0a5a 100644
--- a/app/views/broadcast_recording_starrings/create.js.erb
+++ b/app/views/public/broadcast_recording_starrings/create.js.erb
@@ -1 +1 @@
-$("#broadcast_recordings").html("<%= j render(partial: 'broadcasts/broadcast_recordings', locals: { recordings: @recordings, broadcast: @broadcast }) %>");
\ No newline at end of file
+$("#broadcast_recordings").html("<%= j render(partial: 'broadcasts/broadcast_recordings', locals: { recordings: @recordings, broadcast: @broadcast }) %>");
diff --git a/app/views/broadcast_recordings/_edit_broadcast_recording_modal.html.erb b/app/views/public/broadcast_recordings/_edit_broadcast_recording_modal.html.erb
similarity index 83%
rename from app/views/broadcast_recordings/_edit_broadcast_recording_modal.html.erb
rename to app/views/public/broadcast_recordings/_edit_broadcast_recording_modal.html.erb
index 2228e8a..4f97a68 100644
--- a/app/views/broadcast_recordings/_edit_broadcast_recording_modal.html.erb
+++ b/app/views/public/broadcast_recordings/_edit_broadcast_recording_modal.html.erb
@@ -7,7 +7,7 @@
×
- <%= bootstrap_form_with model: [broadcast.project, broadcast, recording], layout: :horizontal, label_col: "col-3", control_col: "col-9" do |form| %>
+ <%= bootstrap_form_with model: [broadcast, recording], url: broadcast_broadcast_recording_path(broadcast.token, recording), layout: :horizontal, label_col: "col-3", control_col: "col-9" do |form| %>
<%= form.text_field :name %>
diff --git a/app/views/public/broadcast_recordings/_refresh_recordings_list.js.erb b/app/views/public/broadcast_recordings/_refresh_recordings_list.js.erb
new file mode 100644
index 0000000..890d685
--- /dev/null
+++ b/app/views/public/broadcast_recordings/_refresh_recordings_list.js.erb
@@ -0,0 +1,11 @@
+$('[data-id="<%= dom_id(@recording) %>"]').remove();
+<% if @recordings.empty? %>
+ $("#broadcast_recordings_nav").append('
Recordings will appear here
')
+<% end %>
+$("#broadcast_recordings").html("<%= j render(partial: 'broadcasts/broadcast_recordings', locals: { recordings: @recordings, broadcast: @broadcast }) %>");
+
+// Close and remove the modal
+$("#edit_broadcast_recording_modal").on("hidden.bs.modal", function (e) {
+ $("#edit_broadcast_recording_modal").remove();
+});
+$("#edit_broadcast_recording_modal").modal("hide");
diff --git a/app/views/broadcast_recordings/edit.js.erb b/app/views/public/broadcast_recordings/edit.js.erb
similarity index 72%
rename from app/views/broadcast_recordings/edit.js.erb
rename to app/views/public/broadcast_recordings/edit.js.erb
index 0e5c0c1..b03da5e 100644
--- a/app/views/broadcast_recordings/edit.js.erb
+++ b/app/views/public/broadcast_recordings/edit.js.erb
@@ -2,5 +2,5 @@
$("#edit_broadcast_recording_modal").remove();
<% # Create and show the modal %>
-$("body").append("<%= j render(partial: 'edit_broadcast_recording_modal', locals: { project: @project, broadcast: @broadcast, recording: @recording }) %>");
+$("body").append("<%= j render(partial: 'edit_broadcast_recording_modal', locals: { broadcast: @broadcast, recording: @recording }) %>");
$("#edit_broadcast_recording_modal").modal("toggle");
diff --git a/app/views/public/broadcast_recordings/update.js.erb b/app/views/public/broadcast_recordings/update.js.erb
new file mode 100644
index 0000000..7abe7d5
--- /dev/null
+++ b/app/views/public/broadcast_recordings/update.js.erb
@@ -0,0 +1 @@
+<%= render("public/broadcast_recordings/refresh_recordings_list") %>
diff --git a/app/views/public/location_releases/new.html.erb b/app/views/public/location_releases/new.html.erb
index 57b6bde..7fd701f 100644
--- a/app/views/public/location_releases/new.html.erb
+++ b/app/views/public/location_releases/new.html.erb
@@ -6,7 +6,7 @@
<%= @contract_template.body %>
<% if @contract_template.fee? %>
- Fee <%= number_to_currency @contract_template.fee %>
+ Fee <%= @contract_template.fee %>
<% end %>
<% end %>
diff --git a/app/views/public/material_releases/new.html.erb b/app/views/public/material_releases/new.html.erb
index 32dfcc5..b421fe2 100644
--- a/app/views/public/material_releases/new.html.erb
+++ b/app/views/public/material_releases/new.html.erb
@@ -6,7 +6,7 @@
<%= @contract_template.body %>
<% if @contract_template.fee? %>
- Fee <%= number_to_currency @contract_template.fee %>
+ Fee <%= @contract_template.fee %>
<% end %>
<% end %>
diff --git a/app/views/public/medical_releases/new.html.erb b/app/views/public/medical_releases/new.html.erb
index 3218caa..8c897e4 100644
--- a/app/views/public/medical_releases/new.html.erb
+++ b/app/views/public/medical_releases/new.html.erb
@@ -7,7 +7,7 @@
<%= @contract_template.body %>
<% if @contract_template.fee? %>
- Fee <%= number_to_currency @contract_template.fee %>
+ Fee <%= @contract_template.fee %>
<% end %>
<% end %>
@@ -24,7 +24,7 @@
<% end %>
<% end %>
-
+
<% if (1..MedicalRelease::NUMBER_OF_CUSTOM_FIELDS).map {|n| @contract_template.public_send("question_#{n}_text").presence }.compact.any? %>
<%= card_field_set_tag t(".questionnaire.heading") do %>
<% (1..MedicalRelease::NUMBER_OF_CUSTOM_FIELDS).each do |n| %>
diff --git a/app/views/public/talent_releases/new.html.erb b/app/views/public/talent_releases/new.html.erb
index e3ba06a..3da751c 100644
--- a/app/views/public/talent_releases/new.html.erb
+++ b/app/views/public/talent_releases/new.html.erb
@@ -7,7 +7,7 @@
<%= @contract_template.body %>
<% if @contract_template.fee? %>
- Fee <%= number_to_currency @contract_template.fee %>
+ Fee <%= @contract_template.fee %>
<% end %>
<% end %>
@@ -139,4 +139,4 @@
<% end %>
-
\ No newline at end of file
+
diff --git a/app/views/video_analyses/_acquired_media_file_infos.html.erb b/app/views/video_analyses/_acquired_media_files.html.erb
similarity index 63%
rename from app/views/video_analyses/_acquired_media_file_infos.html.erb
rename to app/views/video_analyses/_acquired_media_files.html.erb
index a9e4891..dcd61fc 100644
--- a/app/views/video_analyses/_acquired_media_file_infos.html.erb
+++ b/app/views/video_analyses/_acquired_media_files.html.erb
@@ -1,7 +1,7 @@
-<% if acquired_media_file_infos.any? %>
- <% acquired_media_file_infos.each do |file_info| %>
-
- <%= render "video_analyses/file_info_releasable", releasable: file_info.releasable, video: video, file_info: file_info %>
+<% if acquired_media_files.any? %>
+ <% acquired_media_files.each do |file| %>
+
+ <%= render "video_analyses/file_releasable", releasable: file.record, video: video, file: file %>
<% end %>
<% else %>
diff --git a/app/views/video_analyses/_acquired_media_release.html.erb b/app/views/video_analyses/_acquired_media_release.html.erb
index cf46b6f..3987c83 100644
--- a/app/views/video_analyses/_acquired_media_release.html.erb
+++ b/app/views/video_analyses/_acquired_media_release.html.erb
@@ -1,7 +1,7 @@
-<% if acquired_media_release.file_infos.any? %>
- <% acquired_media_release.file_infos.each do |file_info| %>
- " data-confirmed="<%= video.has_confirmed_release?(acquired_media_release) && video.video_release_confirmations.any? { |video_release_confirmation| video_release_confirmation.file_info_id == file_info.id } %>" data-hidden="false">
- <%= render "video_analyses/file_info_releasable", releasable: acquired_media_release, video: video, file_info: file_info %>
+<% if acquired_media_release.files.any? %>
+ <% acquired_media_release.files.each do |file| %>
+ " data-confirmed="<%= video.has_confirmed_release?(acquired_media_release) && video.video_release_confirmations.any? { |video_release_confirmation| video_release_confirmation.file_id == file.id } %>" data-hidden="false">
+ <%= render "video_analyses/file_releasable", releasable: acquired_media_release, video: video, file: file %>
<% end %>
<% else %>
diff --git a/app/views/video_analyses/_file_info_releasable.html.erb b/app/views/video_analyses/_file_info_releasable.html.erb
deleted file mode 100644
index 036e87f..0000000
--- a/app/views/video_analyses/_file_info_releasable.html.erb
+++ /dev/null
@@ -1,8 +0,0 @@
-<%= button_to_video_release_confirmation video, releasable, additional_video_release_params: { file_info_id: file_info.id } do %>
-
-
- <%= file_info.filename %>
-
- <%= truncate releasable.name, length: 25 %>
-
-<% end %>
diff --git a/app/views/video_analyses/_file_releasable.html.erb b/app/views/video_analyses/_file_releasable.html.erb
new file mode 100644
index 0000000..ff5ebae
--- /dev/null
+++ b/app/views/video_analyses/_file_releasable.html.erb
@@ -0,0 +1,12 @@
+<%= button_to_video_release_confirmation video, releasable, additional_video_release_params: { file_id: file.id } do %>
+
+ <% if file.content_type.include? "image" %>
+ <%= image_tag large_variant(file), class: "figure-img border", style: "width:200px;height:200px;" %>
+ <% else %>
+
+ <%= file.filename %>
+
+ <% end %>
+ <%= truncate releasable.name, length: 25 %>
+
+<% end %>
diff --git a/app/views/video_analyses/_material_release.html.erb b/app/views/video_analyses/_material_release.html.erb
index f12c03b..e7f6065 100644
--- a/app/views/video_analyses/_material_release.html.erb
+++ b/app/views/video_analyses/_material_release.html.erb
@@ -1,3 +1,18 @@
-
- <%= render "video_analyses/releasable", releasable: material_release, video: video %>
-
+<% if material_release.files.any? %>
+ <% material_release.files.each do |file| %>
+ " data-confirmed="<%= video.confirmed_material_releases.include?(material_release) %>" data-hidden="<%= video.confirmed_material_releases.include?(material_release) %>">
+ <%= render "video_analyses/file_releasable", releasable: material_release, video: video, file: file %>
+
+ <% end %>
+<% else %>
+
+
+
+
+ No File Uploaded
+
+
+ <%= truncate material_release.name, length: 25 %>
+
+
+<% end %>
diff --git a/app/views/video_analyses/_video_release_confirmations.html.erb b/app/views/video_analyses/_video_release_confirmations.html.erb
index a4d3199..65103ad 100644
--- a/app/views/video_analyses/_video_release_confirmations.html.erb
+++ b/app/views/video_analyses/_video_release_confirmations.html.erb
@@ -22,8 +22,8 @@
<%= confirmation.appears_at %>
<%= confirmation.releasable.name %>
- <% if confirmation.file_info.present? %>
- <%= confirmation.file_info.filename %>
+ <% if confirmation.file_id.present? %>
+ <%= confirmation.file.filename %>
<% elsif confirmation.releasable.respond_to?(:photo) && confirmation.releasable.photo.attached? %>
<%= image_tag thumbnail_variant(confirmation.releasable.photo), class: "img-fluid figure-img" %>
<% else %>
diff --git a/app/views/video_analyses/acquired_media_releases/index.js.erb b/app/views/video_analyses/acquired_media_releases/index.js.erb
index 651a8f3..5cefd48 100644
--- a/app/views/video_analyses/acquired_media_releases/index.js.erb
+++ b/app/views/video_analyses/acquired_media_releases/index.js.erb
@@ -2,7 +2,7 @@
$("#acquired_media_releases [data-toggle=tooltip]").tooltip("dispose");
// Update the release list
-$("#acquired_media_releases").html("<%= j render("video_analyses/acquired_media_file_infos", acquired_media_file_infos: @acquired_media_file_infos, video: @video) %>");
+$("#acquired_media_releases").html("<%= j render("video_analyses/acquired_media_files", acquired_media_files: @acquired_media_files, video: @video) %>");
// # Reset the search form
$("#acquired_media_releases_section form input[name='query']").val("<%= params[:query] %>");
diff --git a/app/views/video_release_confirmations/_new_video_release_confirmation_modal.html.erb b/app/views/video_release_confirmations/_new_video_release_confirmation_modal.html.erb
index 400c64b..4e7df7f 100644
--- a/app/views/video_release_confirmations/_new_video_release_confirmation_modal.html.erb
+++ b/app/views/video_release_confirmations/_new_video_release_confirmation_modal.html.erb
@@ -14,7 +14,7 @@
<%= form.hidden_field :time_elapsed, value: video_release_confirmation.time_elapsed %>
- <%= form.hidden_field :file_info_id, value: video_release_confirmation.file_info_id %>
+ <%= form.hidden_field :file_id, value: video_release_confirmation.file_id %>
<%= form.static_control nil, name: nil, label: "Video Timecode", value: video_release_confirmation.appears_at %>
<%= form.text_field :channel %>
<%= form.text_field :timecode_in %>
diff --git a/app/views/video_release_confirmations/create.js.erb b/app/views/video_release_confirmations/create.js.erb
index 898acf3..21e09c3 100644
--- a/app/views/video_release_confirmations/create.js.erb
+++ b/app/views/video_release_confirmations/create.js.erb
@@ -1,8 +1,8 @@
var hideConfirmed = $("input[name=hide_confirmed]:checked").length > 0;
// Mark the release as confirmed
-if (<%= @releasable.respond_to?(:file_infos) %>) {
- $("[data-ujs-target=<%= dom_id(@releasable, "file_info_#{@video_release_confirmation.file_info_id}") %>]").attr("data-confirmed", true).data("confirmed", true)
+if (<%= @releasable.respond_to?(:files) %>) {
+ $("[data-ujs-target=<%= dom_id(@releasable, "attachment_#{@video_release_confirmation.file_id}") %>]").attr("data-confirmed", true).data("confirmed", true)
} else {
$("#<%= dom_id(@releasable) %>").attr("data-confirmed", true).data("confirmed", true)
}
diff --git a/app/views/video_release_confirmations/destroy.js.erb b/app/views/video_release_confirmations/destroy.js.erb
index 17d41dc..6c635ee 100644
--- a/app/views/video_release_confirmations/destroy.js.erb
+++ b/app/views/video_release_confirmations/destroy.js.erb
@@ -1,7 +1,7 @@
// Mark the release as no longer confirmed and show
-if (<%= @releasable.respond_to?(:file_infos) && @video_release_confirmation.respond_to?(:file_info_id) %>) {
- if (<%= @video_release_confirmations.none? { |video_release_confirmation| video_release_confirmation.respond_to?(:file_info_id) && video_release_confirmation.file_info_id == @video_release_confirmation.file_info_id } %>) {
- $("[data-ujs-target=<%= dom_id(@releasable, "file_info_#{@video_release_confirmation.file_info_id}") %>]")
+if (<%= @releasable.respond_to?(:files) && @video_release_confirmation.respond_to?(:file_id) %>) {
+ if (<%= @video_release_confirmations.none? { |video_release_confirmation| video_release_confirmation.respond_to?(:file_id) && video_release_confirmation.file_id == @video_release_confirmation.file_id } %>) {
+ $("[data-ujs-target=<%= dom_id(@releasable, "attachment_#{@video_release_confirmation.file_id}") %>]")
.attr("data-confirmed", false).data("confirmed", false)
.attr("data-hidden", false).data("hidden", false);
}
diff --git a/config/locales/en.yml b/config/locales/en.yml
index f7aa204..d390728 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -457,7 +457,7 @@ en:
help:
contract_template:
amendment_clause: Leave blank if not required for this contract
- fee: Leave at $0.00 for no-fee
+ fee: Please enter all necessary details about fees. Leave it blank for no-fee
guardian_clause: Leave blank if not required for this contract
questionnaire_legal_text: Leave blank if not required for this contract
signature_legal_text: Leave blank if not required for this contract
diff --git a/config/routes.rb b/config/routes.rb
index 4ef5dbe..d93745c 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -105,9 +105,7 @@ Rails.application.routes.draw do
delete :destroy_file
end
resource :zoom_meeting, only: [:show]
- resources :broadcast_recordings, only: [:destroy, :edit, :update] do
- resources :broadcast_recording_starrings, only: :create
- end
+ resources :broadcast_recordings, only: [:destroy]
end
resources :directories, except: [:index] do
member do
@@ -152,6 +150,9 @@ Rails.application.routes.draw do
end
resources :broadcasts, param: :token, only: [:show, :update] do
resource :zoom_meeting, only: [:show]
+ resources :broadcast_recordings, only: [:edit, :update] do
+ resources :broadcast_recording_starrings, only: :create
+ end
end
end
diff --git a/db/data_migrations/20200914163508_set_fee_from_fee_cents_and_currency.rb b/db/data_migrations/20200914163508_set_fee_from_fee_cents_and_currency.rb
new file mode 100644
index 0000000..39cdad1
--- /dev/null
+++ b/db/data_migrations/20200914163508_set_fee_from_fee_cents_and_currency.rb
@@ -0,0 +1,14 @@
+class SetFeeFromFeeCentsAndCurrency < ActiveRecord::DataMigration
+ def up
+ ContractTemplate.find_each do |contract_template|
+ if contract_template.fee_old?
+ fee = contract_template.fee_old.format
+ contract_template.update_column(:fee, fee)
+ end
+ end
+ end
+
+ def down
+ ContractTemplate.update_all(fee: nil)
+ end
+end
diff --git a/db/migrate/20200810185526_add_file_id_to_video_release_confirmations.rb b/db/migrate/20200810185526_add_file_id_to_video_release_confirmations.rb
new file mode 100644
index 0000000..bb8d400
--- /dev/null
+++ b/db/migrate/20200810185526_add_file_id_to_video_release_confirmations.rb
@@ -0,0 +1,9 @@
+class AddFileIdToVideoReleaseConfirmations < ActiveRecord::Migration[6.0]
+ def up
+ add_column :video_release_confirmations, :file_id, :bigint, index: true
+ end
+
+ def down
+ remove_column :video_release_confirmations, :file_id
+ end
+end
diff --git a/db/migrate/20200914163203_convert_fee_to_string_type.rb b/db/migrate/20200914163203_convert_fee_to_string_type.rb
new file mode 100644
index 0000000..114e8c2
--- /dev/null
+++ b/db/migrate/20200914163203_convert_fee_to_string_type.rb
@@ -0,0 +1,7 @@
+class ConvertFeeToStringType < ActiveRecord::Migration[6.0]
+ def change
+ rename_column :contract_templates, :fee_cents, :fee_old_cents
+ rename_column :contract_templates, :fee_currency, :fee_old_currency
+ add_column :contract_templates, :fee, :string
+ end
+end
diff --git a/db/structure.sql b/db/structure.sql
index a48aad1..6b2c2a8 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -658,8 +658,8 @@ CREATE TABLE public.contract_templates (
name character varying,
body text,
guardian_clause text,
- fee_cents bigint DEFAULT 0 NOT NULL,
- fee_currency character varying DEFAULT 'USD'::character varying NOT NULL,
+ fee_old_cents bigint DEFAULT 0 NOT NULL,
+ fee_old_currency character varying DEFAULT 'USD'::character varying NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
release_type character varying,
@@ -692,7 +692,8 @@ CREATE TABLE public.contract_templates (
exhibit_a_legal_text text,
exhibit_a_question_text text,
exhibit_b_legal_text text,
- exhibit_b_question_text text
+ exhibit_b_question_text text,
+ fee character varying
);
@@ -715,6 +716,15 @@ CREATE SEQUENCE public.contract_templates_id_seq
ALTER SEQUENCE public.contract_templates_id_seq OWNED BY public.contract_templates.id;
+--
+-- Name: data_migrations; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.data_migrations (
+ version character varying NOT NULL
+);
+
+
--
-- Name: directories; Type: TABLE; Schema: public; Owner: -
--
@@ -1847,7 +1857,8 @@ CREATE TABLE public.video_release_confirmations (
source_file_name character varying,
clip_name character varying,
description character varying,
- channel character varying
+ channel character varying,
+ file_id bigint
);
@@ -2400,6 +2411,14 @@ ALTER TABLE ONLY public.contract_templates
ADD CONSTRAINT contract_templates_pkey PRIMARY KEY (id);
+--
+-- Name: data_migrations data_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.data_migrations
+ ADD CONSTRAINT data_migrations_pkey PRIMARY KEY (version);
+
+
--
-- Name: directories directories_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
@@ -3248,7 +3267,6 @@ CREATE UNIQUE INDEX index_users_on_email ON public.users USING btree (email);
CREATE UNIQUE INDEX index_users_on_password_reset_token ON public.users USING btree (password_reset_token);
-
--
-- Name: index_video_release_confirmations_on_file_info_id; Type: INDEX; Schema: public; Owner: -
--
@@ -3454,14 +3472,6 @@ ALTER TABLE ONLY public.contract_templates
ADD CONSTRAINT fk_rails_21d503cdcd FOREIGN KEY (project_id) REFERENCES public.projects(id);
---
--- Name: video_release_confirmations fk_rails_2787252ceb; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.video_release_confirmations
- ADD CONSTRAINT fk_rails_2787252ceb FOREIGN KEY (file_info_id) REFERENCES public.file_infos(id);
-
-
--
-- Name: medical_releases fk_rails_325442c794; Type: FK CONSTRAINT; Schema: public; Owner: -
--
@@ -4024,11 +4034,13 @@ INSERT INTO "schema_migrations" (version) VALUES
('20200803150138'),
('20200804093409'),
('20200807190607'),
+('20200810185526'),
('20200811102720'),
('20200812060406'),
('20200819070738'),
('20200820082501'),
('20200824171649'),
-('20200908085319');
+('20200908085319'),
+('20200914163203');
diff --git a/spec/controllers/broadcast_recordings_controller_spec.rb b/spec/controllers/broadcast_recordings_controller_spec.rb
index f6314bc..cceefd3 100644
--- a/spec/controllers/broadcast_recordings_controller_spec.rb
+++ b/spec/controllers/broadcast_recordings_controller_spec.rb
@@ -12,59 +12,6 @@ RSpec.describe BroadcastRecordingsController, type: :controller do
stub_mux_live_stream
end
- describe "#edit" do
- let(:broadcast) { create(:broadcast, project: project, name: "New Broadcast") }
- let(:recording) { create(:broadcast_recording, broadcast: broadcast) }
-
- before do
- stub_mux_live_stream
- end
-
- it "assigns project, broadcast, broadcast recording" do
- get :edit, params: { project_id: project, broadcast_id: broadcast, id: recording }, xhr: true
-
- expect(assigns(:project)).to have_attributes({
- id: project.id,
- name: project.name,
- account_id: project.account_id
- })
-
- expect(assigns(:broadcast)).to have_attributes({
- id: broadcast.id,
- name: broadcast.name,
- project_id: project.id
- })
-
- expect(assigns(:recording)).to have_attributes({
- id: recording.id,
- broadcast_id: broadcast.id,
- file_name: "high.mp4"
- })
- end
- end
-
- describe "#update" do
- let(:broadcast) { create(:broadcast, project: project, name: "New Broadcast") }
- let(:recording) { create(:broadcast_recording, broadcast: broadcast) }
- let(:recordings) { create_list(:broadcast_recording, 5, :with_random_asset_uid, broadcast: broadcast) }
- let(:starred_recordings) { create_list(:broadcast_recording, 5, :with_random_asset_uid, broadcast: broadcast, starred: true) }
-
- before do
- stub_mux_live_stream
- end
-
- it "updates the recording's name and description" do
- expect(recording.name).to eq(recording.download_file_name)
- expect(recording.description).to eq("No description provided for this recording.")
-
- patch :update, params: { project_id: project, broadcast_id: broadcast, id: recording, broadcast_recording: { name: "Just for fun", description: "I had fun while making this stream." } }, xhr: true
- recording.reload
-
- expect(recording.name).to eq("Just for fun")
- expect(recording.description).to eq("I had fun while making this stream.")
- end
- end
-
describe "#destroy" do
let(:broadcast) { create(:broadcast, project: project, name: "New Broadcast") }
let(:recording) { create(:broadcast_recording, broadcast: broadcast) }
diff --git a/spec/controllers/broadcasts_controller_spec.rb b/spec/controllers/broadcasts_controller_spec.rb
index e9ec4eb..0733861 100644
--- a/spec/controllers/broadcasts_controller_spec.rb
+++ b/spec/controllers/broadcasts_controller_spec.rb
@@ -195,15 +195,15 @@ RSpec.describe BroadcastsController, type: :controller do
expect(response.body).to have_selector(".custom-control-label", text: "Director Mode")
end
- context "when director mode is enabled" do
+ context "director mode is enabled by default" do
it "shows the video embed" do
- get :show, params: { project_id: project, id: broadcast, director_mode: true }
+ get :show, params: { project_id: project, id: broadcast }
expect(response.body).to have_selector("iframe", text: "video player")
end
it "renders the view dropdown with a director mode disable option" do
- get :show, params: { project_id: project, id: broadcast, director_mode: true }
+ get :show, params: { project_id: project, id: broadcast }
expect(response.body).to have_content broadcast.name
expect(response.body).to have_selector(".custom-control-label", text: "Director Mode")
diff --git a/spec/controllers/broadcast_recording_starrings_controller_spec.rb b/spec/controllers/public/broadcast_recording_starrings_controller_spec.rb
similarity index 77%
rename from spec/controllers/broadcast_recording_starrings_controller_spec.rb
rename to spec/controllers/public/broadcast_recording_starrings_controller_spec.rb
index a687f83..2812ae6 100644
--- a/spec/controllers/broadcast_recording_starrings_controller_spec.rb
+++ b/spec/controllers/public/broadcast_recording_starrings_controller_spec.rb
@@ -1,6 +1,6 @@
require 'rails_helper'
-RSpec.describe BroadcastRecordingStarringsController, type: :controller do
+RSpec.describe Public::BroadcastRecordingStarringsController, type: :controller do
render_views
let(:user) { create(:user) }
@@ -8,7 +8,6 @@ RSpec.describe BroadcastRecordingStarringsController, type: :controller do
let(:project) { create(:project, account: user.primary_account) }
before do
- sign_in user
stub_mux_live_stream
end
@@ -22,7 +21,7 @@ RSpec.describe BroadcastRecordingStarringsController, type: :controller do
expect(recording.starred).to be_falsey
end
- post :create, params: { project_id: project, broadcast_id: broadcast, broadcast_recording_id: recordings.first.id }, xhr: true
+ post :create, params: { broadcast_token: broadcast.token, broadcast_recording_id: recordings.first.id }, xhr: true
expect(recordings.first.reload.starred).to eq true
@@ -36,7 +35,7 @@ RSpec.describe BroadcastRecordingStarringsController, type: :controller do
expect(recording.starred).to be_truthy
end
- post :create, params: { project_id: project, broadcast_id: broadcast, broadcast_recording_id: starred_recordings.first.id }, xhr: true
+ post :create, params: { broadcast_token: broadcast.token, broadcast_recording_id: starred_recordings.first.id }, xhr: true
expect(starred_recordings.first.reload.starred).to eq false
diff --git a/spec/controllers/public/broadcast_recordings_controller_spec.rb b/spec/controllers/public/broadcast_recordings_controller_spec.rb
new file mode 100644
index 0000000..5c31bd9
--- /dev/null
+++ b/spec/controllers/public/broadcast_recordings_controller_spec.rb
@@ -0,0 +1,59 @@
+require 'rails_helper'
+
+RSpec.describe Public::BroadcastRecordingsController, type: :controller do
+ render_views
+
+ let(:user) { create(:user) }
+ let(:account) { user.primary_account }
+ let(:project) { create(:project, account: user.primary_account) }
+
+ before do
+ stub_mux_live_stream
+ end
+
+ describe "#edit" do
+ let(:broadcast) { create(:broadcast, project: project, name: "New Broadcast") }
+ let(:recording) { create(:broadcast_recording, broadcast: broadcast) }
+
+ before do
+ stub_mux_live_stream
+ end
+
+ it "assigns project, broadcast, broadcast recording" do
+ get :edit, params: { broadcast_token: broadcast.token, id: recording }, xhr: true
+
+ expect(assigns(:broadcast)).to have_attributes({
+ id: broadcast.id,
+ name: broadcast.name,
+ project_id: project.id
+ })
+
+ expect(assigns(:recording)).to have_attributes({
+ id: recording.id,
+ broadcast_id: broadcast.id,
+ file_name: "high.mp4"
+ })
+ end
+ end
+
+ describe "#update" do
+ let(:broadcast) { create(:broadcast, project: project, name: "New Broadcast") }
+ let(:recording) { create(:broadcast_recording, broadcast: broadcast) }
+ let(:recordings) { create_list(:broadcast_recording, 5, :with_random_asset_uid, broadcast: broadcast) }
+
+ before do
+ stub_mux_live_stream
+ end
+
+ it "updates the recording's name and description" do
+ expect(recording.name).to eq(recording.download_file_name)
+ expect(recording.description).to eq("No description provided for this recording.")
+
+ patch :update, params: { broadcast_token: broadcast.token, id: recording, broadcast_recording: { name: "Just for fun", description: "I had fun while making this stream." } }, xhr: true
+ recording.reload
+
+ expect(recording.name).to eq("Just for fun")
+ expect(recording.description).to eq("I had fun while making this stream.")
+ end
+ end
+end
diff --git a/spec/controllers/video_release_confirmations_controller_spec.rb b/spec/controllers/video_release_confirmations_controller_spec.rb
index 49cb2dd..8e2b960 100644
--- a/spec/controllers/video_release_confirmations_controller_spec.rb
+++ b/spec/controllers/video_release_confirmations_controller_spec.rb
@@ -10,7 +10,7 @@ RSpec.describe VideoReleaseConfirmationsController, type: :controller do
end
describe "acquired_media_release" do
- let(:acquired_media_release) { create(:acquired_media_release) }
+ let(:acquired_media_release) { create(:acquired_media_release, :with_files) }
describe "#new" do
let(:edl_event_gateway) { instance_double(EdlEventGateway) }
@@ -21,8 +21,6 @@ RSpec.describe VideoReleaseConfirmationsController, type: :controller do
end
it "assigns video_release_confirmation, video, edl_events_data" do
- file_info = create(:file_info)
-
post :new,
params: {
video_id: video,
@@ -35,7 +33,7 @@ RSpec.describe VideoReleaseConfirmationsController, type: :controller do
source_file_name: nil,
clip_name: nil,
description: nil,
- file_info_id: file_info,
+ file_id: acquired_media_release.files.first.id,
},
use_route: new_video_acquired_media_release_video_release_confirmation_path(video, acquired_media_release)
},
@@ -53,7 +51,7 @@ RSpec.describe VideoReleaseConfirmationsController, type: :controller do
source_file_name: "source_file_name",
clip_name: "clip_name",
description: "description",
- file_info_id: file_info.id,
+ file_id: acquired_media_release.files.first.id,
})
expect(assigns(:video)).to have_attributes({
id: video.id,
@@ -82,8 +80,6 @@ RSpec.describe VideoReleaseConfirmationsController, type: :controller do
describe "#create" do
it "assigns video_release_confirmations, video_release_confirmation" do
- file_info = create(:file_info)
-
post :create,
params: {
video_id: video,
@@ -97,7 +93,7 @@ RSpec.describe VideoReleaseConfirmationsController, type: :controller do
source_file_name: "DISCLAIMER.AVI",
clip_name: "DISCLAIMER.AVI.NEW.02",
description: "Boat",
- file_info_id: file_info,
+ file_id: acquired_media_release.files.first.id,
},
use_route: video_acquired_media_release_video_release_confirmations_path(video, acquired_media_release)
},
@@ -112,7 +108,7 @@ RSpec.describe VideoReleaseConfirmationsController, type: :controller do
source_file_name: "DISCLAIMER.AVI",
clip_name: "DISCLAIMER.AVI.NEW.02",
description: "Boat",
- file_info_id: file_info.id,
+ file_id: acquired_media_release.files.first.id,
})
end
diff --git a/spec/factories/acquired_media_releases.rb b/spec/factories/acquired_media_releases.rb
index b45c57e..1632435 100644
--- a/spec/factories/acquired_media_releases.rb
+++ b/spec/factories/acquired_media_releases.rb
@@ -44,6 +44,16 @@ FactoryBot.define do
guardian_2_phone "2222"
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
+ end
+
factory :acquired_media_release_with_contract_template do
after(:build) do |acquired_media_release, _|
acquired_media_release.contract_template = build(:acquired_media_release_contract_template)
diff --git a/spec/features/user_manages_contract_templates_spec.rb b/spec/features/user_manages_contract_templates_spec.rb
index 305bcfd..4f7fab9 100644
--- a/spec/features/user_manages_contract_templates_spec.rb
+++ b/spec/features/user_manages_contract_templates_spec.rb
@@ -205,34 +205,6 @@ RSpec.feature 'User manages contract templates', type: :feature do
expect(pdf_body).to have_content('Guardian')
end
- context 'preventing creation of release template with wrong fee value' do
- before do
- visit new_project_contract_template_path(project)
-
- fill_in 'Name', with: 'My Release Template'
- select 'Appearance Release', from: 'Release type'
- fill_in_trix body_field, with: 'You agree to this release.'
- fill_hidden guardian_clause_field, with: 'Your minor agrees to this release.'
- select 'All', from: 'Applicable Media'
- select 'Other', from: 'Territory'
- fill_in 'Describe other territory', with: 'North America only'
- select 'In perpetuity', from: 'Term'
- select 'None', from: 'Restriction'
- end
-
- scenario 'Should not allow negative fees' do
- fill_in 'Fee', with: '-200'
- click_on create_release_template_button
- 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
- expect(page).not_to have_content(create_contract_template_success_message)
- end
- end
-
scenario 'contract template preview is shown before printing' do
create(:appearance_release_contract_template, body: 'Contract legal language', project: project)
visit project_contract_templates_path(project)
diff --git a/spec/features/user_managing_broadcasts_spec.rb b/spec/features/user_managing_broadcasts_spec.rb
index 25d8684..e781f24 100644
--- a/spec/features/user_managing_broadcasts_spec.rb
+++ b/spec/features/user_managing_broadcasts_spec.rb
@@ -186,6 +186,30 @@ feature 'User managing broadcasts' do
expect(page).not_to have_selector("li.media.playing-highlight")
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
let(:current_user) { create(:user, :associate) }
diff --git a/spec/features/user_performs_video_analysis_spec.rb b/spec/features/user_performs_video_analysis_spec.rb
index b5036e7..479ffbe 100644
--- a/spec/features/user_performs_video_analysis_spec.rb
+++ b/spec/features/user_performs_video_analysis_spec.rb
@@ -83,11 +83,7 @@ feature "User performs video analysis" do
create(:material_release, name: "Apple MacBook Air", project: project),
create(:material_release, name: "Microsoft Surface Pro", project: project)
]
- acquired_media = create(:acquired_media_release, project: project)
- acquired_file_info_1, acquired_file_info_2 = [
- create(:file_info, filename: "Still Image", releasable: acquired_media),
- create(:file_info, filename: "Artwork", releasable: acquired_media)
- ]
+ acquired_media = create(:acquired_media_release, :with_files, project: project)
music_release = create(:music_release, project: project)
music_file_info_1, music_file_info_2 = [
create(:file_info, filename: "I'm not afraid", releasable: music_release),
@@ -116,9 +112,10 @@ feature "User performs video analysis" do
end
within "#acquired_media_releases_section" do
- search_for(:acquired_media_releases, text: "till")
- expect(page).to have_content("Still Image")
- expect(page).not_to have_content("Artwork")
+ search_for(:acquired_media_releases, text: "cont")
+ expect(page).to have_content("contract.pdf")
+ expect(page).not_to have_content("audio.mp3")
+ expect(page).not_to have_content("video_file.mp4")
end
within "#music_releases_section" do
@@ -350,34 +347,31 @@ feature "User performs video analysis" do
end
scenario "confirming an acquired media release", js: true do
- acquired_media_release = create(:acquired_media_release_with_file_infos, project: project)
- acquired_media_release.file_infos.first.update(filename: "shark jumping")
- acquired_media_release.file_infos.second.update(filename: "pig flying")
- acquired_media_release.file_infos.third.update(filename: "panda sneezing")
+ acquired_media_release = create(:acquired_media_release, :with_files, project: project)
sign_in current_user
visit video_video_analyses_path(video)
- expect(page).to have_unconfirmed_file_info_release(acquired_media_release, "shark jumping", count: 1)
- expect(page).to have_unconfirmed_file_info_release(acquired_media_release, "pig flying", count: 1)
- expect(page).to have_unconfirmed_file_info_release(acquired_media_release, "panda sneezing", count: 1)
+ expect(page).to have_unconfirmed_file_info_release(acquired_media_release, "contract.pdf", count: 1)
+ expect(page).to have_unconfirmed_file_info_release(acquired_media_release, "audio.mp3", count: 1)
+ expect(page).to have_unconfirmed_file_info_release(acquired_media_release, "video_file.mp4", count: 1)
- confirm_first_release_using_edl_modal(video, acquired_media_release, text: "shark jumping")
+ confirm_first_release_using_edl_modal(video, acquired_media_release, text: "contract.pdf")
- expect(page).to have_confirmed_release(acquired_media_release, text: "shark jumping")
- expect(page).to have_unconfirmed_file_info_release(acquired_media_release, "pig flying", count: 1)
- expect(page).to have_unconfirmed_file_info_release(acquired_media_release, "panda sneezing", count: 1)
+ expect(page).to have_confirmed_release(acquired_media_release, text: "contract.pdf")
+ expect(page).to have_unconfirmed_file_info_release(acquired_media_release, "audio.mp3", count: 1)
+ expect(page).to have_unconfirmed_file_info_release(acquired_media_release, "video_file.mp4", count: 1)
unconfirm_release(VideoReleaseConfirmation.last)
- expect(page).not_to have_confirmed_release(acquired_media_release, text: "shark jumping")
- expect(page).to have_unconfirmed_file_info_release(acquired_media_release, "shark jumping", count: 1)
- expect(page).to have_unconfirmed_file_info_release(acquired_media_release, "pig flying", count: 1)
- expect(page).to have_unconfirmed_file_info_release(acquired_media_release, "panda sneezing", count: 1)
+ expect(page).not_to have_confirmed_release(acquired_media_release, text: "contract.pdf")
+ expect(page).to have_unconfirmed_file_info_release(acquired_media_release, "contract.pdf", count: 1)
+ expect(page).to have_unconfirmed_file_info_release(acquired_media_release, "audio.mp3", count: 1)
+ expect(page).to have_unconfirmed_file_info_release(acquired_media_release, "video_file.mp4", count: 1)
end
scenario "confirming a material release", js: true do
- material_release = create(:material_release, project: project)
+ material_release = create(:material_release, :with_file, project: project)
sign_in current_user
visit video_video_analyses_path(video)
@@ -387,7 +381,6 @@ feature "User performs video analysis" do
confirm_first_release_using_edl_modal(video, material_release)
expect(page).to have_confirmed_release(material_release)
- expect(page).not_to have_unconfirmed_release(material_release)
unconfirm_release(VideoReleaseConfirmation.last)
diff --git a/spec/models/contract_template_spec.rb b/spec/models/contract_template_spec.rb
index 4e9d2ec..b674398 100644
--- a/spec/models/contract_template_spec.rb
+++ b/spec/models/contract_template_spec.rb
@@ -22,14 +22,10 @@ describe ContractTemplate do
it { is_expected.to validate_presence_of(:release_type) }
end
- describe '#fee' do
- it { is_expected.to monetize(:fee) }
- end
-
describe '#fee?' do
it 'returns true when there is a fee amount' do
fee_contract = build(:contract_template, fee: 500)
- no_fee_contract = build(:contract_template, fee: 0)
+ no_fee_contract = build(:contract_template, fee: nil)
expect(fee_contract).to be_fee
expect(no_fee_contract).not_to be_fee
diff --git a/spec/models/video_release_confirmation_spec.rb b/spec/models/video_release_confirmation_spec.rb
index 4b9c15f..893b7f7 100644
--- a/spec/models/video_release_confirmation_spec.rb
+++ b/spec/models/video_release_confirmation_spec.rb
@@ -4,7 +4,6 @@ RSpec.describe VideoReleaseConfirmation do
describe "associations" do
it { is_expected.to belong_to(:releasable) }
it { is_expected.to belong_to(:video) }
- it { is_expected.to belong_to(:file_info).optional }
end
describe "#appears_at" do