now only one date and also removed second widget method

This commit is contained in:
Harry Bomrah 2014-10-01 16:26:22 +08:00
parent 7552fdd6d0
commit 649479b70c
2 changed files with 3 additions and 72 deletions

View File

@ -15,19 +15,7 @@ class AnnouncementsController < ApplicationController
"subtitle" => a.subtitle, "subtitle" => a.subtitle,
"statuses" => statuses, "statuses" => statuses,
"category" => a.category.title, "category" => a.category.title,
"postdate" => a.postdate.strftime("%b %d, %Y at %I:%M %p"), "postdate" => a.postdate,
"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.url_to_show(a.to_param), "link_to_show" => OrbitHelper.url_to_show(a.to_param),
"img_src" => a.image.thumb.url || "http://placehold.it/100x100", "img_src" => a.image.thumb.url || "http://placehold.it/100x100",
"more" => t(:more_plus) "more" => t(:more_plus)
@ -63,64 +51,7 @@ class AnnouncementsController < ApplicationController
"subtitle" => a.subtitle, "subtitle" => a.subtitle,
"statuses" => statuses, "statuses" => statuses,
"category" => a.category.title, "category" => a.category.title,
"postdate" => a.postdate.strftime("%d"), "postdate" => a.postdate,
"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 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), "link_to_show" => OrbitHelper.widget_item_url(a.to_param),
"img_src" => a.image.thumb.url || "http://placehold.it/100x100", "img_src" => a.image.thumb.url || "http://placehold.it/100x100",
} }

View File

@ -4,7 +4,7 @@ module Announcement
OrbitApp.registration "Announcement", :type => "ModuleApp" do OrbitApp.registration "Announcement", :type => "ModuleApp" do
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","widget1"] widget_methods ["widget"]
widget_settings [{"data_count"=>10}] widget_settings [{"data_count"=>10}]
taggable "Bulletin" taggable "Bulletin"
categorizable categorizable