Sha256: 644cf320f458dd12817efb0b48e33ccfce250d22f327c3c441eb263deb82bbfc

Contents?: true

Size: 688 Bytes

Versions: 56

Compression:

Stored size: 688 Bytes

Contents

module Cmor
  module Cms
    # Usage:
    #
    #     # app/controllers/application_controller.rb
    #     class ApplicationController < ActionController::Base
    #       view_helper Cmor::Cms::PageViewHelper, as: :cms_page_helper
    #     end
    #
    class PageViewHelper < Rao::ViewHelper::Base
      def is_page?
        c.params[:action] == 'respond' && page_param.present?
      end

      def current?(page)
        is_page? && page_param.to_s == page.to_s
      end

      def current
        is_page? ? page_param.to_s : nil
      end

      def home?
        current?(:home)
      end

      private

      def page_param
        c.params[:page]
      end
    end
  end
end

Version data entries

56 entries across 56 versions & 1 rubygems

Version Path
cmor_cms-0.0.60.pre app/view_helpers/cmor/cms/page_view_helper.rb
cmor_cms-0.0.59.pre app/view_helpers/cmor/cms/page_view_helper.rb
cmor_cms-0.0.58.pre app/view_helpers/cmor/cms/page_view_helper.rb
cmor_cms-0.0.57.pre app/view_helpers/cmor/cms/page_view_helper.rb
cmor_cms-0.0.56.pre app/view_helpers/cmor/cms/page_view_helper.rb
cmor_cms-0.0.55.pre app/view_helpers/cmor/cms/page_view_helper.rb
cmor_cms-0.0.54.pre app/view_helpers/cmor/cms/page_view_helper.rb
cmor_cms-0.0.53.pre app/view_helpers/cmor/cms/page_view_helper.rb
cmor_cms-0.0.52.pre app/view_helpers/cmor/cms/page_view_helper.rb
cmor_cms-0.0.51.pre app/view_helpers/cmor/cms/page_view_helper.rb
cmor_cms-0.0.50.pre app/view_helpers/cmor/cms/page_view_helper.rb
cmor_cms-0.0.49.pre app/view_helpers/cmor/cms/page_view_helper.rb
cmor_cms-0.0.48.pre app/view_helpers/cmor/cms/page_view_helper.rb
cmor_cms-0.0.45.pre app/view_helpers/cmor/cms/page_view_helper.rb
cmor_cms-0.0.44.pre app/view_helpers/cmor/cms/page_view_helper.rb
cmor_cms-0.0.43.pre app/view_helpers/cmor/cms/page_view_helper.rb
cmor_cms-0.0.42.pre app/view_helpers/cmor/cms/page_view_helper.rb
cmor_cms-0.0.41.pre app/view_helpers/cmor/cms/page_view_helper.rb
cmor_cms-0.0.40.pre app/view_helpers/cmor/cms/page_view_helper.rb
cmor_cms-0.0.39.pre app/view_helpers/cmor/cms/page_view_helper.rb