Show clips list in tag viewer
This commit is contained in:
parent
5fc6913551
commit
bacef8db2c
2 changed files with 35 additions and 1 deletions
|
|
@ -6,6 +6,7 @@ class TagsController < ApplicationController
|
|||
end
|
||||
|
||||
def show
|
||||
@clips = Clip.joins(:tags).where(tags: { id: @tag.id })
|
||||
end
|
||||
|
||||
def new
|
||||
|
|
|
|||
|
|
@ -1,7 +1,40 @@
|
|||
<% cache @tag do %>
|
||||
<h1><%= @tag.name %></h1>
|
||||
<h1>Clips tagged with <pre><%= @tag.name %></pre></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", tags_path%>
|
||||
<% if authenticated? %>
|
||||
<%= link_to "Edit", edit_tag_path(@tag) %>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue