added a epaper list

This commit is contained in:
Harry Bomrah 2017-08-09 18:35:21 +08:00
parent c53e474ee7
commit d994a4fe78
2 changed files with 21 additions and 1 deletions

View File

@ -91,6 +91,26 @@ class EPapersController < ApplicationController
{}
end
def widget
tags = OrbitHelper.widget_tags
papers = Paper.filter_by_widget_categories.filter_by_tags(tags).collect do |paper|
paper_thumb = !paper.image.nil? && !paper.image.url.nil? ? paper.image.thumb.url : "http://www.placehold.it/400x400/EFEFEF/AAAAAA"
{
"title" => paper.title,
"date" => paper.period,
"description" => paper.description,
"image_thumb" => paper_thumb,
"link_to_show" => OrbitHelper.url_to_show(paper.to_param)
}
end
{
"papers" => papers,
"extras" => {
"more_url" => OrbitHelper.widget_more_url
}
}
end
def subscribeuser
if Subscriber.where(:email => params[:email]).count == 0
subscriber = Subscriber.new

View File

@ -4,7 +4,7 @@ module EPaper
OrbitApp.registration "EPaper", :type => "ModuleApp" do
module_label "e_paper.e_paper"
base_url File.expand_path File.dirname(__FILE__)
widget_methods ['subscriber_widget']
widget_methods ['subscriber_widget', 'widget']
widget_settings [{"data_count"=>10}]
taggable "Paper"
categorizable