Tapes are now Clips, also they have categories
This commit is contained in:
parent
86c489be72
commit
c8732b6332
41 changed files with 347 additions and 148 deletions
10
app/views/categories/_form.html.erb
Normal file
10
app/views/categories/_form.html.erb
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<%= form_with model: category do |form| %>
|
||||
<div>
|
||||
<%= form.label :name %>
|
||||
<%= form.text_field :name %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= form.submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
4
app/views/categories/edit.html.erb
Normal file
4
app/views/categories/edit.html.erb
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<h1>Edit category</h1>
|
||||
|
||||
<%= render "form", category: @category %>
|
||||
<%= link_to "Cancel", @category %>
|
||||
9
app/views/categories/index.html.erb
Normal file
9
app/views/categories/index.html.erb
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<h1>Categories</h1>
|
||||
|
||||
<%= link_to "New category", new_category_path if authenticated? %>
|
||||
|
||||
<ul id="categories">
|
||||
<% @categories.each do |category| %>
|
||||
<li><%= link_to category.name, category %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
4
app/views/categories/new.html.erb
Normal file
4
app/views/categories/new.html.erb
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<h1>New Category</h1>
|
||||
|
||||
<%= render "form", category: @category %>
|
||||
<%= link_to "Cancel", categories_path %>
|
||||
42
app/views/categories/show.html.erb
Normal file
42
app/views/categories/show.html.erb
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<% cache @category do %>
|
||||
<h1><%= @category.name %></h1>
|
||||
<% end %>
|
||||
|
||||
<table id="clips" border="1">
|
||||
<tr>
|
||||
<th>Preview</th>
|
||||
<th>Title</th>
|
||||
<th>Duration</th>
|
||||
<th>Category</th>
|
||||
<th>Updated at</th>
|
||||
<th>Created at</th>
|
||||
</tr>
|
||||
<% @clips.each do |clip| %>
|
||||
<tr>
|
||||
<td>
|
||||
<%= link_to (image_tag url_for(clip.video.preview(resize_to_limit: [160, 120]).processed)), clip %>
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to clip.title, clip %>
|
||||
</td>
|
||||
<td>
|
||||
<%= seconds_to_time(clip.video.metadata["duration"]) %>
|
||||
</td>
|
||||
<td>
|
||||
<%= clip.category.name %>
|
||||
</td>
|
||||
<td>
|
||||
<%= clip.updated_at %>
|
||||
</td>
|
||||
<td>
|
||||
<%= clip.created_at %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<%= link_to "Back", categories_path%>
|
||||
<% if authenticated? %>
|
||||
<%= link_to "Edit", edit_category_path(@category) %>
|
||||
<%= button_to "Delete", @category, method: :delete, data: { turbo_confirm: "Are you sure?" } %>
|
||||
<% end %>
|
||||
Loading…
Add table
Add a link
Reference in a new issue