Module: SiteAnnouncementsHelper

Defined in:
app/helpers/site_announcements_helper.rb

Instance Method Summary collapse

Instance Method Details

#site_annoucements_headlineObject



5
6
7
8
9
# File 'app/helpers/site_announcements_helper.rb', line 5

def site_annoucements_headline
  headline = SiteAnnouncement.headline_announcement
  return "" unless headline #return empty string if there is no announcement
  return render :partial=>"site_announcements/headline_announcement",:object=>headline
end

#site_announcement_attributes(announcement) ⇒ Object



17
18
19
20
21
22
23
# File 'app/helpers/site_announcements_helper.rb', line 17

def site_announcement_attributes announcement
  attr=[]
  attr << "show in feed" if announcement.show_in_feed?
  attr << "headline" if announcement.is_headline?
  attr << "mail" if announcement.email_notification?
  attr
end

#site_announcements_feed(options) ⇒ Object



11
12
13
14
15
# File 'app/helpers/site_announcements_helper.rb', line 11

def site_announcements_feed options
  options[:limit]||=5    
  announcements = SiteAnnouncement.feed_announcements :limit=>options[:limit]
  return render :partial=>"site_announcements/feed_announcements",:object=>announcements,:locals=>{:truncate_length=>options[:truncate_length],:limit=>options[:limit]}
end