Added ability to delete videos

This commit is contained in:
Gregory Ballantine 2023-03-05 10:11:17 -05:00
parent 89ebf5c792
commit a2f2224b96

View File

@ -1,3 +1,5 @@
require 'fileutils'
namespace '/video' do
get '' do
@ -93,6 +95,15 @@ namespace '/video' do
redirect "/video/#{video.id}"
end
get '/:video_id/delete' do
# find the video and delete it
video = Video.where(id: params[:video_id]).first()
FileUtils.rm_rf(video.directory_path)
video.delete()
redirect '/video'
end
get '/:video_id/edit/script' do
video = Video.where(id: params[:video_id]).first()
erb :'video/edit-script', :locals => {