changed engine settings and added widget

This commit is contained in:
Harry Bomrah 2014-05-23 13:56:28 +08:00
parent b11f537a67
commit 81abc73163
2 changed files with 7 additions and 3 deletions

View File

@ -20,17 +20,19 @@ class AnnouncementsController < ApplicationController
end
def widget
announcements = Bulletin.can_display.order_by(:created_at=>'desc').filter_by_categories
announcements = Bulletin.can_display.order_by(:created_at=>'desc').filter_by_widget_categories
anns = announcements.collect do |a|
{
"title" => a.title,
"subtitle" => a.subtitle,
"postdate" => a.postdate.strftime("%b %d, %Y at %I:%M %p"),
"link_to_show" => OrbitHelper.url_to_show(a.to_param),
"more" => "More",
"img_src" => a.image.thumb.url || "http://placehold.it/100x100",
}
end
{
"data" => anns
"announcements" => anns,
"extras" => {"widget-title"=>"Announcements"}
}
end

View File

@ -5,6 +5,8 @@ module Announcement
module_label "announcement.announcement"
base_url File.expand_path File.dirname(__FILE__)
widget_methods ["widget"]
widget_settings [{"data_count"=>10}]
taggable "Bulletin"
categorizable
authorizable