Initial commit
This commit is contained in:
26
app/views/bookmarks/_bookmark.html.erb
Normal file
26
app/views/bookmarks/_bookmark.html.erb
Normal file
@@ -0,0 +1,26 @@
|
||||
<tr id="<%= dom_id(bookmark) %>">
|
||||
<td>
|
||||
<%= bookmark.category %>
|
||||
</td>
|
||||
<td>
|
||||
<%= bookmark.notes %>
|
||||
</td>
|
||||
<td>
|
||||
<a data-behavior="seekable-timecode">
|
||||
<%= bookmark.appears_at %>
|
||||
</a>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div class="dropdown">
|
||||
<%= button_tag t(".actions.manage"), class: "btn btn-light btn-sm dropdown-toggle border", data: { toggle: "dropdown", boundary: "window" }, aria: { haspopup: true, expanded: false } %>
|
||||
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenuButton">
|
||||
<% if policy(bookmark).edit? %>
|
||||
<%= link_to fa_icon("pencil fw", text: "Edit"), [:edit, bookmark], class: "dropdown-item", remote: true %>
|
||||
<% end %>
|
||||
<% if policy(bookmark).destroy? %>
|
||||
<%= link_to fa_icon("trash fw", text: "Delete"), [bookmark], class: "dropdown-item", method: :delete, remote: true %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
13
app/views/bookmarks/_edit_bookmark_modal.html.erb
Normal file
13
app/views/bookmarks/_edit_bookmark_modal.html.erb
Normal file
@@ -0,0 +1,13 @@
|
||||
<%= content_tag :div, class: "modal modal-right", id: "edit_bookmark_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">Edit Note</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<%= render "form", bookmark: bookmark, model: [bookmark] %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
3
app/views/bookmarks/_empty_bookmarks.html.erb
Normal file
3
app/views/bookmarks/_empty_bookmarks.html.erb
Normal file
@@ -0,0 +1,3 @@
|
||||
<tr>
|
||||
<td colspan="4" class="py-4 text-center text-muted"><%= t(".empty") %></td>
|
||||
</tr>
|
||||
18
app/views/bookmarks/_form.html.erb
Normal file
18
app/views/bookmarks/_form.html.erb
Normal file
@@ -0,0 +1,18 @@
|
||||
<%= bootstrap_form_with model: model, layout: :horizontal, label_col: "col-3", control_col: "col-9" do |form| %>
|
||||
<div class="modal-body">
|
||||
<%= form.hidden_field :time_elapsed, value: bookmark.time_elapsed %>
|
||||
<%= form.static_control nil, name: nil, label: "Video Timecode", value: bookmark.appears_at %>
|
||||
|
||||
<% Bookmark.categories.keys.each do |category| %>
|
||||
<%= form.radio_button :category, category, label: category %>
|
||||
<% end %>
|
||||
|
||||
<div class="mt-3">
|
||||
<%= form.text_area :notes, control_col: "col-12", hide_label: true, placeholder: true, rows: 4 %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<%= form.button "Close", class: "btn btn-secondary", data: { dismiss: "modal" } %>
|
||||
<%= form.submit class: "btn btn-primary", data: { disable_with: t("shared.disable_with") } %>
|
||||
</div>
|
||||
<% end %>
|
||||
13
app/views/bookmarks/_new_bookmark_modal.html.erb
Normal file
13
app/views/bookmarks/_new_bookmark_modal.html.erb
Normal file
@@ -0,0 +1,13 @@
|
||||
<%= content_tag :div, class: "modal modal-right", id: "new_bookmark_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">New Note</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<%= render "form", bookmark: bookmark, model: [bookmark.video, bookmark] %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
7
app/views/bookmarks/create.js.erb
Normal file
7
app/views/bookmarks/create.js.erb
Normal file
@@ -0,0 +1,7 @@
|
||||
<% # Add a marker to the timeline %>
|
||||
$(document).trigger("addBookmark-<%= @video.id %>", [<%= raw @bookmark.to_json %>]);
|
||||
|
||||
<% # Close the bookmark modal %>
|
||||
$("#new_bookmark_modal").modal("toggle");
|
||||
|
||||
$("#video_bookmarks").html("<%= j render @bookmarks %>");
|
||||
5
app/views/bookmarks/destroy.js.erb
Normal file
5
app/views/bookmarks/destroy.js.erb
Normal file
@@ -0,0 +1,5 @@
|
||||
$("#video_bookmarks tr#<%= dom_id(@bookmark) %>").remove();
|
||||
|
||||
<% unless @bookmarks.any? %>
|
||||
$("#video_bookmarks").html("<%= j render(partial: 'empty_bookmarks') %>");
|
||||
<% end %>
|
||||
9
app/views/bookmarks/edit.js.erb
Normal file
9
app/views/bookmarks/edit.js.erb
Normal file
@@ -0,0 +1,9 @@
|
||||
$("[data-toggle=tooltip]").tooltip("dispose");
|
||||
<% # Remove the modal if it already exists %>
|
||||
|
||||
$("#edit_bookmark_modal").remove();
|
||||
$("#new_bookmark_modal").remove();
|
||||
|
||||
<% # Create and show the modal %>
|
||||
$("body").append("<%= j render('edit_bookmark_modal', bookmark: @bookmark) %>");
|
||||
$("#edit_bookmark_modal").modal("toggle");
|
||||
8
app/views/bookmarks/new.js.erb
Normal file
8
app/views/bookmarks/new.js.erb
Normal file
@@ -0,0 +1,8 @@
|
||||
$("[data-toggle=tooltip]").tooltip("dispose");
|
||||
<% # Remove the modal if it already exists %>
|
||||
$("#new_bookmark_modal").remove();
|
||||
$("#edit_bookmark_modal").remove();
|
||||
|
||||
<% # Create and show the modal %>
|
||||
$("body").append("<%= j render('new_bookmark_modal', bookmark: @bookmark) %>");
|
||||
$("#new_bookmark_modal").modal("toggle");
|
||||
8
app/views/bookmarks/update.js.erb
Normal file
8
app/views/bookmarks/update.js.erb
Normal file
@@ -0,0 +1,8 @@
|
||||
<% # Remove the modal if it already exists %>
|
||||
$("#edit_bookmark_modal").toggle();
|
||||
$(".modal-backdrop").remove();
|
||||
<% # Create and show the modal %>
|
||||
$("#video_bookmarks").html("<%= j render @bookmarks %>");
|
||||
|
||||
<%# Replacing html removes the scroll bar %>
|
||||
$("body").css({"overflow": "visible"});
|
||||
Reference in New Issue
Block a user