Sha256: ac5b7784318dc2a32fa5234a341282c86fb36c2b097e2c8140b5fd321e87d7a3

Contents?: true

Size: 1.6 KB

Versions: 2

Compression:

Stored size: 1.6 KB

Contents

require 'tb_core'
require 'tb_redirects'

module Spud
  module Cms
    class Engine < Rails::Engine
      engine_name :tb_cms

      config.generators do |g|
        g.test_framework :rspec, view_specs: false
      end

      initializer :admin do
        Spud::Core.configure do |config|
          config.admin_applications += [{ name: 'Pages', thumbnail: 'admin/pages_thumb.png', url: '/admin/pages', order: 0 }]
          if Spud::Cms.menus_enabled
            config.admin_applications += [{ name: 'Menus', thumbnail: 'admin/menus_thumb.png', url: '/admin/menus', order: 2 }]
          end

          if Spud::Cms.snippets_enabled
            config.admin_applications += [{ name: 'Snippets', thumbnail: 'admin/snippets_thumb.png', url: '/admin/snippets', order: 3 }]
          end
        end
      end

      initializer :model_overrides_cms do |_config|
        ActiveRecord::Base.class_eval do
          include Spud::Searchable
        end
      end

      initializer :spud_cms_routes do |config|
        config.routes_reloader.paths << File.expand_path('../page_route.rb', __FILE__)
      end

      initializer 'tb_cms.assets' do |_config|
        Spud::Core.append_admin_javascripts('admin/cms/application')
        Spud::Core.append_admin_stylesheets('admin/cms/application')
        Rails.application.config.assets.precompile += ['admin/pages_thumb.png', 'admin/snippets_thumb.png', 'admin/menus_thumb.png']
      end

      initializer :template_parser do |_config|
        @template_parser = Spud::Cms::TemplateParser.new
      end

      def template_parser
        return @template_parser
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tb_cms-1.3.2 lib/spud_cms/engine.rb
tb_cms-1.3.1 lib/spud_cms/engine.rb