From 649479b70c9a299607a3194a106982e9f87072cf Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Wed, 1 Oct 2014 16:26:22 +0800 Subject: [PATCH] now only one date and also removed second widget method --- app/controllers/announcements_controller.rb | 73 +-------------------- lib/announcement/engine.rb | 2 +- 2 files changed, 3 insertions(+), 72 deletions(-) diff --git a/app/controllers/announcements_controller.rb b/app/controllers/announcements_controller.rb index 59d331c..13bbee0 100644 --- a/app/controllers/announcements_controller.rb +++ b/app/controllers/announcements_controller.rb @@ -15,19 +15,7 @@ class AnnouncementsController < ApplicationController "subtitle" => a.subtitle, "statuses" => statuses, "category" => a.category.title, - "postdate" => a.postdate.strftime("%b %d, %Y at %I:%M %p"), - "date" => a.postdate.strftime("%F"), - "year" => a.postdate.strftime("%Y"), - "month" => a.postdate.strftime("%b"), - "month-num" => a.postdate.strftime("%m"), - "week" => a.postdate.strftime("%A"), - "week-num" => a.postdate.strftime("%u"), - "day" => a.postdate.strftime("%d"), - "hour" => a.postdate.strftime("%H"), - "minute" => a.postdate.strftime("%M"), - "second" => a.postdate.strftime("%S"), - "meridian" => a.postdate.strftime("%p"), - + "postdate" => a.postdate, "link_to_show" => OrbitHelper.url_to_show(a.to_param), "img_src" => a.image.thumb.url || "http://placehold.it/100x100", "more" => t(:more_plus) @@ -63,19 +51,7 @@ class AnnouncementsController < ApplicationController "subtitle" => a.subtitle, "statuses" => statuses, "category" => a.category.title, - "postdate" => a.postdate.strftime("%d"), - "date" => a.postdate.strftime("%F"), - "year" => a.postdate.strftime("%Y"), - "month" => a.postdate.strftime("%b"), - "month-num" => a.postdate.strftime("%m"), - "week" => a.postdate.strftime("%A"), - "week-num" => a.postdate.strftime("%u"), - "day" => a.postdate.strftime("%d"), - "hour" => a.postdate.strftime("%H"), - "minute" => a.postdate.strftime("%M"), - "second" => a.postdate.strftime("%S"), - "meridian" => a.postdate.strftime("%p"), - + "postdate" => a.postdate, "link_to_show" => OrbitHelper.widget_item_url(a.to_param), "img_src" => a.image.thumb.url || "http://placehold.it/100x100", } @@ -93,51 +69,6 @@ class AnnouncementsController < ApplicationController } end - def widget1 - announcements = Bulletin.where(:is_preview.in=>[false,nil]).can_display.is_approved.order_by(:created_at=>'desc').filter_by_widget_categories.filter_by_tags(OrbitHelper.widget_tags) - - anns = announcements.collect do |a| - statuses = a.statuses_with_classname.collect do |status| - { - "status" => status["name"], - "status-class" => "status-#{status['classname']}" - } - end - { - "title" => a.title, - "subtitle" => a.subtitle, - "statuses" => statuses, - "category" => a.category.title, - "postdate" => a.postdate.strftime("%d"), - "date" => a.postdate.strftime("%F"), - "year" => a.postdate.strftime("%Y"), - "month" => a.postdate.strftime("%b"), - "month-num" => a.postdate.strftime("%m"), - "week" => a.postdate.strftime("%A"), - "week-num" => a.postdate.strftime("%u"), - "day" => a.postdate.strftime("%d"), - "hour" => a.postdate.strftime("%H"), - "minute" => a.postdate.strftime("%M"), - "second" => a.postdate.strftime("%S"), - "meridian" => a.postdate.strftime("%p"), - - "link_to_show" => OrbitHelper.widget_item_url(a.to_param), - "img_src" => a.image.thumb.url || "http://placehold.it/100x100", - } - end - { - "announcements" => anns, - "extras" => { - "more_url"=>OrbitHelper.widget_more_url, - "title-head" => t('announcement.table.title'), - "date-head" => t('announcement.table.date'), - "status-head" => t('announcement.table.status'), - "subtitle-head" => t('announcement.table.sub_title'), - "category-head" => t('announcement.table.category') - } - } - end - def show params = OrbitHelper.params announcement = Bulletin.can_display.find_by(:uid=>params[:uid]) diff --git a/lib/announcement/engine.rb b/lib/announcement/engine.rb index 6cd2fdb..174c9ad 100644 --- a/lib/announcement/engine.rb +++ b/lib/announcement/engine.rb @@ -4,7 +4,7 @@ module Announcement OrbitApp.registration "Announcement", :type => "ModuleApp" do module_label "announcement.announcement" base_url File.expand_path File.dirname(__FILE__) - widget_methods ["widget","widget1"] + widget_methods ["widget"] widget_settings [{"data_count"=>10}] taggable "Bulletin" categorizable