Module: PdfNewslettersHelper

Defined in:
app/helpers/pdf_newsletters_helper.rb

Instance Method Summary collapse

Instance Method Details

#each_year(newsletters) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/helpers/pdf_newsletters_helper.rb', line 6

def each_year(newsletters)
  newsletters_list = newsletters
  newsletter = newsletters_list.shift
  while newsletter.present?
    year_list = []
    @year = newsletter.year
    while newsletter && newsletter.year == @year
      year_list << newsletter
      newsletter = newsletters_list.shift
    end
    yield year_list
  end
end

#newsletter_description(newsletter) ⇒ Object



2
3
4
# File 'app/helpers/pdf_newsletters_helper.rb', line 2

def newsletter_description(newsletter)
  "Volume #{newsletter.volume} Issue #{newsletter.issue} - #{newsletter.month} #{newsletter.year}"
end