diff --git a/app/controllers/announcements_controller.rb b/app/controllers/announcements_controller.rb index b8980c5..4ab1ac5 100644 --- a/app/controllers/announcements_controller.rb +++ b/app/controllers/announcements_controller.rb @@ -1,7 +1,8 @@ class AnnouncementsController < ApplicationController def index - announcements = Bulletin.where(:is_preview.in=>[false,nil]).can_display.order_by(:created_at=>'desc').filter_by_categories + announcements = Bulletin.where(:is_preview.in=>[false,nil]).can_display.order_by(:created_at=>'desc').filter_by_categories.filter_by_tags(OrbitHelper.params['tags']) + anns = announcements.collect do |a| statuses = a.statuses_with_classname.collect do |status| { @@ -16,19 +17,22 @@ class AnnouncementsController < ApplicationController "postdate" => a.postdate.strftime("%b %d, %Y at %I:%M %p"), "link_to_show" => OrbitHelper.url_to_show(a.to_param), "img_src" => a.image.thumb.url || "http://placehold.it/100x100", - "more" => "More" + "more" => t(:more_plus) } end { "announcements" => anns, - "extras" => {"widget-title"=>"Announcements"}, + "extras" => { + "widget-title"=>t('announcement.announcement') + }, "total_pages" => announcements.total_pages } end def widget - announcements = Bulletin.where(:is_preview.in=>[false,nil]).can_display.order_by(:created_at=>'desc').filter_by_widget_categories + announcements = Bulletin.where(:is_preview.in=>[false,nil]).can_display.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| { @@ -47,7 +51,9 @@ class AnnouncementsController < ApplicationController end { "announcements" => anns, - "extras" => {"widget-title"=>"Announcements","more_url"=>OrbitHelper.widget_more_url} + "extras" => { + "more_url"=>OrbitHelper.widget_more_url + } } end @@ -57,7 +63,10 @@ class AnnouncementsController < ApplicationController announcement = Bulletin.can_display.find_by(:uid=>params[:uid]) - tags = announcement.tags.map{|tag| { "tag" => tag.name } } rescue [] + tags = announcement.tags.map{|tag| { + "tag" => tag.name , + "url" => OrbitHelper.page_for_tag(tag) + } } rescue [] files = announcement.bulletin_files.map{|file| { "file_url" => file.file.url, "file_title" => (file.title.blank? ? File.basename(file.file.path) : file.title) } } rescue [] links = announcement.bulletin_links.map{|link| { "link_url" => link.url, "link_title" => (link.title.blank? ? link.url : link.title) } } rescue [] update_user = announcement.update_user.member_profile.name rescue "" diff --git a/app/views/admin/announcements/index.html.erb b/app/views/admin/announcements/index.html.erb index 31d9a3b..fb5add3 100644 --- a/app/views/admin/announcements/index.html.erb +++ b/app/views/admin/announcements/index.html.erb @@ -13,7 +13,7 @@