widget for vlog

This commit is contained in:
Harry Bomrah 2017-04-13 15:36:41 +08:00
parent c8a8ec1b49
commit b32bf6527f
1 changed files with 10 additions and 3 deletions

View File

@ -24,8 +24,15 @@ class VlogsController < ApplicationController
end
def widget
video = VLog.all.filter_by_widget_categories.sample(1).first
if vlog.type == "upload" && !vlog.v_log_video.nil?
video = "<video src='#{vlog.v_log_video.video.url}' controls> Your browser does not support the <code>video</code> element.</video>"
elsif vlog.type == "youtube" && !vlog.youtube_link.nil?
video = "<iframe src='#{vlog.youtube_link}' allowfullscreen frameborder='0'></iframe>"
end
{
"extras" => {}
"video" => video,
"extras" => {"widget-title"=>t(:web_resource),"more_url" => OrbitHelper.widget_more_url}
}
end