Initial commit
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<%= content_tag :div, class: "modal modal-right", id: "#{dom_id(video_release_confirmation)}_modal", aria: { labelledby: "modalLabel", hidden: true }, role: "dialog", tabindex: -1 do %>
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="modalLabel">Add to Report</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<%= bootstrap_form_with model: [video_release_confirmation.video, video_release_confirmation.releasable, video_release_confirmation], layout: :horizontal, label_col: "col-3", control_col: "col-9" do |form| %>
|
||||
<div class="modal-body">
|
||||
|
||||
<%= render "video_analyses/show_hide_edl_events", edl_events_data: @edl_events_data, model_name: "video_release_confirmation" %>
|
||||
|
||||
<div id="video_release_confirmation_fields">
|
||||
<%= 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.static_control nil, name: nil, label: "Video Timecode", value: video_release_confirmation.appears_at %>
|
||||
<%= form.text_field :channel %>
|
||||
<%= form.text_field :timecode_in %>
|
||||
<%= form.text_field :timecode_out %>
|
||||
<%= form.text_field :duration %>
|
||||
<%= form.text_field :source_file_name %>
|
||||
<%= form.text_field :clip_name %>
|
||||
<%= form.text_field :description %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<%= form.button "Close", class: "btn btn-secondary", data: { dismiss: "modal" } %>
|
||||
<%= form.submit "Confirm Release", class: "btn btn-primary", data: { disable_with: t("shared.disable_with") } %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
20
app/views/video_release_confirmations/create.js.erb
Normal file
20
app/views/video_release_confirmations/create.js.erb
Normal file
@@ -0,0 +1,20 @@
|
||||
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)
|
||||
} else {
|
||||
$("#<%= dom_id(@releasable) %>").attr("data-confirmed", true).data("confirmed", true)
|
||||
}
|
||||
|
||||
// Hide if necessary
|
||||
$("#appearance_releases_section #<%= dom_id(@releasable) %>").attr("data-hidden", hideConfirmed).data("hidden", hideConfirmed);
|
||||
|
||||
// Refresh the confirmed releases list
|
||||
$("#video_release_confirmations").html("<%= j render("video_analyses/video_release_confirmations", video_release_confirmations: @video_release_confirmations) %>");
|
||||
|
||||
// Close and remove the modal
|
||||
$("#new_video_release_confirmation_modal").on("hidden.bs.modal", function (e) {
|
||||
$("#new_video_release_confirmation_modal").remove();
|
||||
});
|
||||
$("#new_video_release_confirmation_modal").modal("hide");
|
||||
20
app/views/video_release_confirmations/destroy.js.erb
Normal file
20
app/views/video_release_confirmations/destroy.js.erb
Normal file
@@ -0,0 +1,20 @@
|
||||
// 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}") %>]")
|
||||
.attr("data-confirmed", false).data("confirmed", false)
|
||||
.attr("data-hidden", false).data("hidden", false);
|
||||
}
|
||||
} else {
|
||||
if (<%= @video_release_confirmations.none? { |video_release_confirmation| video_release_confirmation.releasable_id == @video_release_confirmation.releasable_id && video_release_confirmation.releasable_type == @video_release_confirmation.releasable_type } %>) {
|
||||
$("#<%= dom_id(@releasable) %>")
|
||||
.attr("data-confirmed", false).data("confirmed", false)
|
||||
.attr("data-hidden", false).data("hidden", false);
|
||||
}
|
||||
}
|
||||
|
||||
// Hide any open tooltips before removing elements from the DOM
|
||||
$("#<%= dom_id(@video_release_confirmation) %> [data-toggle=tooltip]").tooltip("dispose");
|
||||
|
||||
// Refresh the confirmed releases list
|
||||
$("#video_release_confirmations").html("<%= j render("video_analyses/video_release_confirmations", video_release_confirmations: @video_release_confirmations) %>");
|
||||
7
app/views/video_release_confirmations/new.js.erb
Normal file
7
app/views/video_release_confirmations/new.js.erb
Normal file
@@ -0,0 +1,7 @@
|
||||
$("[data-toggle=tooltip]").tooltip("dispose");
|
||||
<% # Remove the modal if it already exists %>
|
||||
$("#new_video_release_confirmation_modal").remove();
|
||||
|
||||
<% # Create and show the modal %>
|
||||
$("body").append("<%= j render('new_video_release_confirmation_modal', video_release_confirmation: @video_release_confirmation) %>");
|
||||
$("#new_video_release_confirmation_modal").modal("toggle");
|
||||
Reference in New Issue
Block a user