announcement-test/app/helpers/admin/announcements_helper.rb

8 lines
320 B
Ruby

module Admin::AnnouncementsHelper
def page_for_bulletin(bulletin)
page = Page.where(:categories.in=>[bulletin.category.id.to_s]).first
page = Page.where(:module=>'announcement').first if page.nil?
request.protocol+(request.host_with_port+page.url+'/'+bulletin.to_param).gsub('//','/') rescue "/"
end
end