Added ability to mark or 'star' a video to keep a short list of active video projects
This commit is contained in:
parent
85750b4de4
commit
f27154b705
@ -4,10 +4,12 @@ class StageManager
|
||||
get '/' do
|
||||
channels = Channel.reverse(:updated_at).limit(10).all()
|
||||
videos = Video.reverse(:updated_at).limit(10).all()
|
||||
active_projects = Video.where(starred: true).reverse(:updated_at).limit($conf.get('stgm.max_stars'))
|
||||
erb :index, :locals => {
|
||||
:title => 'Dashboard',
|
||||
:channels => channels,
|
||||
:videos => videos
|
||||
:videos => videos,
|
||||
:active_projects => active_projects
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
$(document).ready(() ->
|
||||
$('.channel-path').click(updateAttribute)
|
||||
|
||||
$('.video-active').click(updateAttribute)
|
||||
|
||||
$('.video-status').click(updateAttribute)
|
||||
|
||||
$('.video-serial').click(updateAttribute)
|
||||
@ -14,6 +16,8 @@ updateAttribute = (e) ->
|
||||
if newValue
|
||||
if attr == 'status'
|
||||
newValue = newValue.toLowerCase()
|
||||
if attr == 'starred'
|
||||
newValue = (String(newValue).toLowerCase() == 'true')
|
||||
payload =
|
||||
value: newValue
|
||||
objectId = $('#' + type + '-id').val()
|
||||
@ -22,6 +26,8 @@ updateAttribute = (e) ->
|
||||
if data == 'success'
|
||||
if attr == 'status'
|
||||
newValue = capitalizeWord(newValue)
|
||||
if attr == 'starred'
|
||||
newValue = if newValue then 'True' else 'False'
|
||||
elem.find('span').text(newValue)
|
||||
)
|
||||
else
|
||||
|
@ -156,9 +156,7 @@ hr{
|
||||
}
|
||||
}
|
||||
|
||||
.channel-path,
|
||||
.video-status,
|
||||
.video-serial{
|
||||
.clickable-attr{
|
||||
transition: background 230ms ease-in-out;
|
||||
|
||||
&:hover{
|
||||
|
@ -1,5 +1,6 @@
|
||||
stgm:
|
||||
base_directory: '/srv/videos'
|
||||
max_stars: 5
|
||||
|
||||
server:
|
||||
address: '127.0.0.1'
|
||||
|
11
db/migrations/0007_add_video_star.rb
Normal file
11
db/migrations/0007_add_video_star.rb
Normal file
@ -0,0 +1,11 @@
|
||||
Sequel.migration do
|
||||
|
||||
up do
|
||||
add_column(:videos, :starred, TrueClass, default: false)
|
||||
end
|
||||
|
||||
down do
|
||||
drop_column(:videos, :starred)
|
||||
end
|
||||
|
||||
end
|
@ -16,7 +16,7 @@
|
||||
<span><a href="/channel/<%= channel.id %>/edit">Edit <i class="fa-solid fa-pen-to-square"></i></a></span><span>
|
||||
<a href="/channel/<%= channel.id %>/delete">Delete <i class="fa-solid fa-trash"></i></a></span>
|
||||
</div>
|
||||
<div class="channel-path" data-attribute="directory_path" data-type="channel">
|
||||
<div class="channel-path clickable-attr" data-attribute="directory_path" data-type="channel">
|
||||
<p><span><%= channel.directory_path %></span></p>
|
||||
</div>
|
||||
<div class="channel-open">
|
||||
|
@ -8,6 +8,31 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="twelve columns">
|
||||
<h3>Active projects:</h3>
|
||||
<table class="u-full-width">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Video name</th>
|
||||
<th>Video serial</th>
|
||||
<th>Video channel</th>
|
||||
<th>Last updated</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% active_projects.each do |v| %>
|
||||
<tr>
|
||||
<td><a href="/video/<%= v.id %>"><%= v.name %></a></td>
|
||||
<td><%= serialize(v.serial) %></td>
|
||||
<td><%= v.channel.name %></td>
|
||||
<td><%= date_format(v.updated_at) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<hr>
|
||||
|
||||
<h3>Recently updated videos:</h3>
|
||||
<table class="u-full-width">
|
||||
<thead>
|
||||
<tr>
|
||||
@ -29,6 +54,7 @@
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h3>Recently updated channels:</h3>
|
||||
<table class="u-full-width">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -15,13 +15,16 @@
|
||||
<span><a href="/video/<%= video.id %>/edit">Edit <i class="fa-solid fa-pen-to-square"></i></a></span><% unless video.archived %><span><a href="/video/<%= video.id %>/archive">Archive <i class="fa-solid fa-box-archive"></i></a></span><% else %><span><a href="/video/<%= video.id %>/unarchive">Unarchive <i class="fa-solid fa-box-archive"></i></a></span>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="video-active clickable-attr" data-attribute="starred" data-type="video">
|
||||
<p>Active: <span><%= video.starred ? 'True' : 'False' %></span></p>
|
||||
</div>
|
||||
<div class="video-channel">
|
||||
<p>Channel: <a href="/channel/<%= video.channel.id %>"><span><%= video.channel.name %></span></a></p>
|
||||
</div>
|
||||
<div class="video-serial" data-attribute="serial" data-type="video">
|
||||
<div class="video-serial clickable-attr" data-attribute="serial" data-type="video">
|
||||
<p>Serial: <span><%= serialize(video.serial) %></span></p>
|
||||
</div>
|
||||
<div class="video-status" data-attribute="status" data-type="video">
|
||||
<div class="video-status clickable-attr" data-attribute="status" data-type="video">
|
||||
<p>Status: <span><%= video.status.capitalize() %></span></p>
|
||||
</div>
|
||||
<div class="script-controls">
|
||||
|
Loading…
Reference in New Issue
Block a user