From 81abc73163fed8b92a61830ebc0541da6e660ac7 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Fri, 23 May 2014 13:56:28 +0800 Subject: [PATCH] changed engine settings and added widget --- app/controllers/announcements_controller.rb | 8 +++++--- lib/announcement/engine.rb | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/controllers/announcements_controller.rb b/app/controllers/announcements_controller.rb index b2202b5..3ea825a 100644 --- a/app/controllers/announcements_controller.rb +++ b/app/controllers/announcements_controller.rb @@ -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 diff --git a/lib/announcement/engine.rb b/lib/announcement/engine.rb index cc29c44..9c70a70 100644 --- a/lib/announcement/engine.rb +++ b/lib/announcement/engine.rb @@ -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