- site_path = @cms_index.url(relative: false) %h2 = link_to @cms_index.page.label, site_path - @archive_pages.each do |page| %h3 = link_to page.label, page.url .date = page.published_at(@cms_index.datetime_fragment).to_s(:db) = comfy_paginate @archive_pages %h4 Archives - case ActiveRecord::Base.connection.adapter_name.downcase.to_sym - when :mysql, :mysql2 - dates = @cms_index.children(true).chronologically(@cms_index.datetime_fragment).group(:year, :month).unscope(:order).order(year: :desc, month: :desc).pluck(Arel.sql("YEAR(comfy_cms_fragments.datetime) as year, MONTH(comfy_cms_fragments.datetime) as month")) - when :sqlite - dates = @cms_index.children(true).chronologically(@cms_index.datetime_fragment).group(:year, :month).unscope(:order).order(year: :desc, month: :desc).pluck(Arel.sql("strftime('%Y', comfy_cms_fragments.datetime) as year, strftime('%m', comfy_cms_fragments.datetime) as month")) - else - raise NotImplementedError, "Unknown adapter type '#{ActiveRecord::Base.connection.adapter_name}'" - dates.each do |(year, month)| %li = comfy_archive_link_to_month year, month %h4 Categories - @cms_index.categories(true).each do |category| = comfy_archive_link_to_category category