From b32bf6527faa4ef96892b11d876b53b7d780da79 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Thu, 13 Apr 2017 15:36:41 +0800 Subject: [PATCH] widget for vlog --- app/controllers/vlogs_controller.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/controllers/vlogs_controller.rb b/app/controllers/vlogs_controller.rb index 1e75858..1af4f8c 100644 --- a/app/controllers/vlogs_controller.rb +++ b/app/controllers/vlogs_controller.rb @@ -24,9 +24,16 @@ class VlogsController < ApplicationController end def widget - { - "extras" => {} - } + video = VLog.all.filter_by_widget_categories.sample(1).first + if vlog.type == "upload" && !vlog.v_log_video.nil? + video = "" + elsif vlog.type == "youtube" && !vlog.youtube_link.nil? + video = "" + end + { + "video" => video, + "extras" => {"widget-title"=>t(:web_resource),"more_url" => OrbitHelper.widget_more_url} + } end def show