Initial commit

This commit is contained in:
Senad Uka
2020-05-31 22:38:19 +02:00
commit 858fafc3c5
1280 changed files with 65918 additions and 0 deletions

View 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>

View 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">&times;</span>
</button>
</div>
<%= render "form", bookmark: bookmark, model: [bookmark] %>
</div>
</div>
<% end %>

View File

@@ -0,0 +1,3 @@
<tr>
<td colspan="4" class="py-4 text-center text-muted"><%= t(".empty") %></td>
</tr>

View 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 %>

View 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">&times;</span>
</button>
</div>
<%= render "form", bookmark: bookmark, model: [bookmark.video, bookmark] %>
</div>
</div>
<% end %>

View 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 %>");

View File

@@ -0,0 +1,5 @@
$("#video_bookmarks tr#<%= dom_id(@bookmark) %>").remove();
<% unless @bookmarks.any? %>
$("#video_bookmarks").html("<%= j render(partial: 'empty_bookmarks') %>");
<% end %>

View 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");

View 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");

View 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"});