From 59e2fef80ac3cbf655980900392a7bf04f695c3f Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Wed, 9 Aug 2017 16:21:31 +0800 Subject: [PATCH] added widget to this module --- app/controllers/hps_learnings_controller.rb | 24 ++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/app/controllers/hps_learnings_controller.rb b/app/controllers/hps_learnings_controller.rb index 9b72504..63cf396 100644 --- a/app/controllers/hps_learnings_controller.rb +++ b/app/controllers/hps_learnings_controller.rb @@ -51,4 +51,26 @@ class HpsLearningsController < ApplicationController } } end -end \ No newline at end of file + + def widget + tags = OrbitHelper.widget_tags + classes = HpsClass.filter_by_widget_categories.filter_by_tags(tags).collect do |hpsclass| + thumb = hpsclass.course_pic.thumb.url.nil? ? "http://www.placehold.it/150x150/EFEFEF/AAAAAA" : hpsclass.course_pic.thumb.url + { + "title" => hpsclass.title, + "thumb_url" => thumb, + "link_to_show" => OrbitHelper.url_to_show(hpsclass.to_param), + } + end + { + "classes" => classes, + "extras" => { + "more_url" => OrbitHelper.widget_more_url + } + } + end +end + + + +