Sha256: 53d46fc9578bcd4fd98af0d794197d2093aa20e00ec5b8f519dc1d70fa46731c

Contents?: true

Size: 1.81 KB

Versions: 8

Compression:

Stored size: 1.81 KB

Contents

require 'spud_core'
require 'awesome_nested_set'
require 'spud_permalinks'
require 'truncate_html'

module Spud
  module Blog
    class Engine < Rails::Engine

      def self.require_model(model_name)
        require "#{root}/app/models/#{model_name}"
      end

      def self.require_controller(controller_name)
        require "#{root}/app/controllers/#{controller_name}"
      end

      engine_name :spud_blog
      initializer :admin do
        if Spud::Blog.enable_sitemap == true
          Spud::Core.config.sitemap_urls += [:spud_blog_sitemap_url]
        end
        if Spud::Blog.config.blog_enabled
          Spud::Core.config.admin_applications += [{
            :name => 'Blog Posts',
            :thumbnail => 'spud/admin/posts_thumb.png',
            :url => '/spud/admin/posts',
            :order => 1
          }]
        end
        if Spud::Blog.config.news_enabled
          Spud::Core.config.admin_applications += [{
            :name => 'News Posts',
            :thumbnail => 'spud/admin/news_thumb.png',
            :url => '/spud/admin/news_posts',
            :order => 2
          }]
        end
      end
      initializer :assets do
        Rails.application.config.assets.precompile += ['spud/admin/posts.*','spud/blog/validity.css']
        Spud::Core.append_admin_javascripts('spud/admin/posts')
        Spud::Core.append_admin_stylesheets('spud/admin/posts')
      end
      initializer :associations do
        SpudUser.class_eval do
          has_many :posts, :class_name => 'SpudPost'
        end
      end
      initializer :news_layout do
        if Spud::Core.config.news_layout.nil?
          Spud::Core.config.news_layout = Spud::Core.config.base_layout
        end
      end

      initializer :rakismet do
        if Spud::Blog.enable_rakismet
          require 'rakismet'
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
spud_blog-1.0.0.rc1.1 lib/spud_blog/engine.rb
spud_blog-1.0.0.rc1 lib/spud_blog/engine.rb
spud_blog-0.9.11 lib/spud_blog/engine.rb
spud_blog-0.9.10 lib/spud_blog/engine.rb
spud_blog-0.9.9 lib/spud_blog/engine.rb
spud_blog-0.9.8 lib/spud_blog/engine.rb
spud_blog-0.9.7 lib/spud_blog/engine.rb
spud_blog-0.9.5 lib/spud_blog/engine.rb