Added script attribute for videos

This commit is contained in:
Gregory Ballantine 2023-03-04 11:14:54 -05:00
parent 9ab06f0e9c
commit 51ee9f00fb
6 changed files with 35 additions and 1 deletions

View File

@ -7,6 +7,8 @@ gem 'puma', '~> 6.1'
gem 'sequel', '~> 5.66'
gem 'sqlite3', '~> 1.6'
gem 'kramdown', '~> 2.4'
# Use rerun gem to auto-reload app
gem 'rerun'

View File

@ -2,6 +2,8 @@ GEM
remote: https://rubygems.org/
specs:
ffi (1.15.5)
kramdown (2.4.0)
rexml
listen (3.8.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
@ -19,6 +21,7 @@ GEM
ffi (~> 1.0)
rerun (0.14.0)
listen (~> 3.0)
rexml (3.2.5)
ruby2_keywords (0.0.5)
sequel (5.66.0)
sinatra (3.0.5)
@ -39,6 +42,7 @@ PLATFORMS
x86_64-linux
DEPENDENCIES
kramdown (~> 2.4)
puma (~> 6.1)
rerun
sequel (~> 5.66)

View File

@ -0,0 +1,11 @@
Sequel.migration do
up do
add_column(:videos, :script, String)
end
down do
drop_column(:videos, :script)
end
end

View File

@ -1,5 +1,11 @@
require 'kramdown'
class Video < Sequel::Model
many_to_one :channel
def parseScript()
return Kramdown::Document.new(@values[:script]).to_html
end
end

View File

@ -31,7 +31,8 @@ namespace '/video' do
name: params[:video_name],
channel_id: params[:video_channel],
directory_path: video_path,
description: params[:video_description]
description: params[:video_description],
script: "# Introduction\n\n# Body\n\n# Conclusions"
)
Dir.mkdir(video_path)

View File

@ -25,3 +25,13 @@
</div>
</div>
</div>
<div id="video-script" class="row">
<div class="twelve columns">
<h3>Video script</h3>
<hr>
<%= video.parseScript() %>
</div>
</div>