Sha256: 1a9f3cdfd1d96001955db7e836954a6885b6d568e6733bc56cf384ba982c4683
Contents?: true
Size: 881 Bytes
Versions: 14
Compression:
Stored size: 881 Bytes
Contents
# frozen_string_literal: true module Admin module CalendarsHelper def calendar_pages(locale) Page.where( id: Page.with_dates.visible.pluck(:parent_page_id).uniq.compact ).in_locale(locale) end def calendar_page_options(locale) options_for_select( calendar_pages(locale).map do |p| [page_name(p, include_parents: true).gsub("»", "ยป"), p.id] end ) end def calendar_years_with_count calendar_counts.each_with_object({}) do |entry, obj| obj[entry[:year]] ||= 0 obj[entry[:year]] += entry[:count] end end def calendar_months_count(year) calendar_counts.filter { |e| e[:year] == year } .map { |e| [e[:month], e[:count]] } end private def calendar_counts @calendar_counts ||= Page.count_by_month end end end
Version data entries
14 entries across 14 versions & 1 rubygems