Sha256: 1d057d53d6364a50f36cb7c8760d8e3101bdfaec9fbbbc693434de12d9bed232

Contents?: true

Size: 1.26 KB

Versions: 1

Compression:

Stored size: 1.26 KB

Contents

module Homeland
  module Press
    class Engine < ::Rails::Engine
      isolate_namespace Homeland::Press

      initializer 'homeland.press.assets.precompile', group: :all do |app|
        app.config.assets.precompile += %w[homeland/press/application.css homeland/press/application.js]
      end

      initializer 'homeland.press.init' do |app|
        if Setting.has_module?(:press)
          app.config.after_initialize do
            # Because need use I18n.t
            # must after Rails application initialized will get correct locale
            Homeland.register_plugin do |plugin|
              plugin.name              = 'press'
              plugin.display_name      = I18n.t('plugin.press')
              plugin.description       = 'A Press/News plugin for Homeland.'
              plugin.navbar_link       = true
              plugin.admin_navbar_link = true
              plugin.root_path         = "/posts"
              plugin.admin_path        = "/admin/posts"
            end
          end


          User.send :include, Homeland::Press::UserMixin

          app.routes.prepend do
            mount Homeland::Press::Engine => '/'
          end

          app.config.paths["db/migrate"].concat(config.paths["db/migrate"].expanded)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
homeland-press-0.4.2 lib/homeland/press/engine.rb