Show clips list in tag viewer

This commit is contained in:
Roscoe 2026-01-30 02:20:14 +00:00
commit bacef8db2c
Signed by: RoscoeDaWah
SSH key fingerprint: SHA256:Hqn452XQ1ETzUt/FthJu6+OFkS4NBxCv5VQSEvuk7CE
2 changed files with 35 additions and 1 deletions

View file

@ -6,6 +6,7 @@ class TagsController < ApplicationController
end end
def show def show
@clips = Clip.joins(:tags).where(tags: { id: @tag.id })
end end
def new def new

View file

@ -1,7 +1,40 @@
<% cache @tag do %> <% cache @tag do %>
<h1><%= @tag.name %></h1> <h1>Clips tagged with <pre><%= @tag.name %></pre></h1>
<% end %> <% 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%> <%= link_to "Back", tags_path%>
<% if authenticated? %> <% if authenticated? %>
<%= link_to "Edit", edit_tag_path(@tag) %> <%= link_to "Edit", edit_tag_path(@tag) %>