Sha256: 0df31e920f5e69be7d18a770b00e12b940727bd84a0d87aaf4c430823a3cf775

Contents?: true

Size: 944 Bytes

Versions: 5

Compression:

Stored size: 944 Bytes

Contents

# frozen_string_literal: true

module PagesCore
  class PagesPlugin < Plugin
    class << self
      def configure_localizations!
        unless @localizations_added
          I18n.load_path += Dir[
            new.root.join("config", "locales", "**", "*.{rb,yml}")
          ]
        end
        @localizations_added = true
      end
    end

    paths["db/migrate"] = "db/migrate"

    admin_menu_item "News",  proc { admin_news_index_path(@locale) }, :pages,
                    if: proc { Page.news_pages.any? },
                    current: proc { @page && @page.parent.try(&:news_page?) }

    admin_menu_item "Calendar", proc { admin_calendar_path(@locale) }, :pages,
                    if: proc { Page.with_dates.any? },
                    current: proc { @page && @page.starts_at? }

    admin_menu_item "Pages", proc { admin_pages_path(@locale) }, :pages

    admin_menu_item "Users", proc { admin_users_path }, :account
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pages_core-3.12.4 lib/pages_core/pages_plugin.rb
pages_core-3.12.3 lib/pages_core/pages_plugin.rb
pages_core-3.12.2 lib/pages_core/pages_plugin.rb
pages_core-3.12.1 lib/pages_core/pages_plugin.rb
pages_core-3.12.0 lib/pages_core/pages_plugin.rb