diff --git a/app/routes/index.rb b/app/routes/index.rb index 8eb3c06..fe3f8e5 100644 --- a/app/routes/index.rb +++ b/app/routes/index.rb @@ -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 diff --git a/assets/coffee/wyrm.coffee b/assets/coffee/wyrm.coffee index 036764d..d59a055 100644 --- a/assets/coffee/wyrm.coffee +++ b/assets/coffee/wyrm.coffee @@ -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 diff --git a/assets/styles/drake.scss b/assets/styles/drake.scss index 9d1467a..1fc849d 100644 --- a/assets/styles/drake.scss +++ b/assets/styles/drake.scss @@ -156,9 +156,7 @@ hr{ } } - .channel-path, - .video-status, - .video-serial{ + .clickable-attr{ transition: background 230ms ease-in-out; &:hover{ diff --git a/config/defaults.yaml b/config/defaults.yaml index 5375033..9ffdf1c 100644 --- a/config/defaults.yaml +++ b/config/defaults.yaml @@ -1,5 +1,6 @@ stgm: base_directory: '/srv/videos' + max_stars: 5 server: address: '127.0.0.1' diff --git a/db/migrations/0007_add_video_star.rb b/db/migrations/0007_add_video_star.rb new file mode 100644 index 0000000..1216fe0 --- /dev/null +++ b/db/migrations/0007_add_video_star.rb @@ -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 diff --git a/views/channel/view.erb b/views/channel/view.erb index 428d694..0cc6e4c 100644 --- a/views/channel/view.erb +++ b/views/channel/view.erb @@ -16,7 +16,7 @@ Edit Delete -
+

<%= channel.directory_path %>

diff --git a/views/index.erb b/views/index.erb index cba555a..5b3a2c4 100644 --- a/views/index.erb +++ b/views/index.erb @@ -8,6 +8,31 @@
+

Active projects:

+ + + + + + + + + + + <% active_projects.each do |v| %> + + + + + + + <% end %> + +
Video nameVideo serialVideo channelLast updated
<%= v.name %><%= serialize(v.serial) %><%= v.channel.name %><%= date_format(v.updated_at) %>
+ +
+ +

Recently updated videos:

@@ -29,6 +54,7 @@
+

Recently updated channels:

diff --git a/views/video/view.erb b/views/video/view.erb index 062e66b..c4d432d 100644 --- a/views/video/view.erb +++ b/views/video/view.erb @@ -15,13 +15,16 @@ Edit <% unless video.archived %>Archive <% else %>Unarchive <% end %> +
+

Active: <%= video.starred ? 'True' : 'False' %>

+
-
+

Serial: <%= serialize(video.serial) %>

-
+

Status: <%= video.status.capitalize() %>