Sha256: 6d0a725ca6e82eeb3b156016407d760331edd19c53edd0ac85f3b37db9610ca2

Contents?: true

Size: 912 Bytes

Versions: 2

Compression:

Stored size: 912 Bytes

Contents

module Ecm
  module Blog
    module ApplicationHelper
      # Prerequisites:
      # 
      # You have to add the simple-navigation gem to your Gemfile:
      # 
      #     # Gemfile
      #     gem 'simple-navigation'
      #
      # Usage:
      #
      #     # app/controllers/application_controller.rb
      #     class ApplicationController < ActionController::Base
      #       helper Ecm::Blog::ApplicationHelper
      #     end
      #
      #     # app/views/layouts/application.html.haml
      #     = blog_render_monthly_navigation if controller.class.name.deconstantize == 'Ecm::Blog'
      #
      def blog_render_monthly_navigation
        posts = Ecm::Blog::Post.published.all.pluck(:created_at)
        posts_by_month = posts.group_by {|t| t.beginning_of_month }
        render partial: 'ecm/blog/posts/monthly_navigation', locals: { posts_by_month: posts_by_month}
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ecm_blog-1.3.1 app/helpers/ecm/blog/application_helper.rb
ecm_blog-1.3.0 app/helpers/ecm/blog/application_helper.rb