Module: Comfy::ArchiveHelper

Defined in:
app/helpers/comfy/archive_helper.rb

Instance Method Summary collapse

Instance Method Details



15
16
17
18
19
20
21
22
23
24
25
# File 'app/helpers/comfy/archive_helper.rb', line 15

def comfy_archive_link_to_category(category)
  if category.is_a? Comfy::Cms::Category
    label = category.label
  elsif category.is_a? String
    label = category
  end
  unless !@cms_index || category.blank?
    encoded_label = ComfyArchive.config.parameterize_category ? label.parameterize : CGI.escape(label)
    link_to label, comfy_archive_pages_of_category_path(@cms_index.url(relative: false), encoded_label)
  end
end


8
9
10
11
12
13
# File 'app/helpers/comfy/archive_helper.rb', line 8

def comfy_archive_link_to_month(year, month)
  unless !@cms_index || year.blank? || month.blank?
    date = [I18n.t("date.month_names")[month.to_i], year].join(' ')
    link_to date, comfy_archive_pages_of_month_path(@cms_index.url(relative: false), year: year, month: month)
  end
end