Updated sorting for channel's videos on view page

This commit is contained in:
Gregory Ballantine 2023-03-04 10:59:30 -05:00
parent 5ed1771b18
commit 9ab06f0e9c
4 changed files with 12 additions and 5 deletions

View File

@ -21,6 +21,10 @@ hr{
margin-bottom: 20px;
}
#main-wrapper{
max-width: 1120px;
}
#main-nav{
position: fixed;
top: 0;

View File

@ -10,7 +10,7 @@ helpers do
def date_format(date)
dt = date.to_datetime
return dt.strftime('%B %d, %Y @ %I:%M:%S %p %Z')
return dt.strftime('%B %d, %Y, %I:%M:%S %p')
end
def date_format_input(date)

View File

@ -31,10 +31,11 @@ namespace '/channel' do
get '/:channel_id' do
channel = Channel.where(id: params[:channel_id]).first()
puts "#{channel.name}"
channel_videos = channel.videos_dataset.reverse(:updated_at).limit(10).all()
erb :'channel/view', :locals => {
:title => channel.name,
:channel => channel
:channel => channel,
:channel_videos => channel_videos
}
end

View File

@ -30,7 +30,7 @@
<div class="row">
<div class="twelve columns">
<h3>Channel videos</h3>
<h3>Recently updated channel videos:</h3>
<% if channel.videos.length > 0 %>
<table class="u-full-width">
<thead>
@ -38,14 +38,16 @@
<th>Video name</th>
<th>Video serial</th>
<th>Video description</th>
<th>Last updated</th>
</tr>
</thead>
<tbody>
<% channel.videos.each do |v| %>
<% channel_videos.each do |v| %>
<tr>
<td><a href="/video/<%= v.id %>"><%= v.name %></a></td>
<td><%= serialize(v.serial) %></td>
<td><%= v.description %></td>
<td><%= date_format(v.updated_at) %></td>
</tr>
<% end %>
</tbody>