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 end
def widget 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| anns = announcements.collect do |a|
{ {
"title" => a.title, "title" => a.title,
"subtitle" => a.subtitle, "subtitle" => a.subtitle,
"postdate" => a.postdate.strftime("%b %d, %Y at %I:%M %p"),
"link_to_show" => OrbitHelper.url_to_show(a.to_param), "link_to_show" => OrbitHelper.url_to_show(a.to_param),
"more" => "More", "img_src" => a.image.thumb.url || "http://placehold.it/100x100",
} }
end end
{ {
"data" => anns "announcements" => anns,
"extras" => {"widget-title"=>"Announcements"}
} }
end end

View File

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