added widget to this module

This commit is contained in:
Harry Bomrah 2017-08-09 16:21:31 +08:00
parent 5afc74cb83
commit 59e2fef80a
1 changed files with 23 additions and 1 deletions

View File

@ -51,4 +51,26 @@ class HpsLearningsController < ApplicationController
}
}
end
end
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