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,9 +24,16 @@ class VlogsController < ApplicationController
end end
def widget def widget
{ video = VLog.all.filter_by_widget_categories.sample(1).first
"extras" => {} 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
{
"video" => video,
"extras" => {"widget-title"=>t(:web_resource),"more_url" => OrbitHelper.widget_more_url}
}
end end
def show def show