Sha256: 243c24cb8e9040b2bab782086f37c516eb44059251071bcafd431a578304e8dd

Contents?: true

Size: 1004 Bytes

Versions: 10

Compression:

Stored size: 1004 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(content_locale) },
                    :pages,
                    if: proc { Page.news_pages.any? },
                    current: proc { @page && @page.parent.try(&:news_page?) }

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

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

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

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
pages_core-3.15.5 lib/pages_core/pages_plugin.rb
pages_core-3.15.4 lib/pages_core/pages_plugin.rb
pages_core-3.15.3 lib/pages_core/pages_plugin.rb
pages_core-3.15.2 lib/pages_core/pages_plugin.rb
pages_core-3.15.1 lib/pages_core/pages_plugin.rb
pages_core-3.14.0 lib/pages_core/pages_plugin.rb
pages_core-3.13.0 lib/pages_core/pages_plugin.rb
pages_core-3.12.7 lib/pages_core/pages_plugin.rb
pages_core-3.12.6 lib/pages_core/pages_plugin.rb
pages_core-3.12.5 lib/pages_core/pages_plugin.rb