require 'jquery-rails' require 'authlogic' require 'breadcrumbs_on_rails' require 'will_paginate' require 'tinymce-rails' module Spud module Core class Engine < ::Rails::Engine require "#{root}/lib/spud_core/belongs_to_app" require "#{root}/lib/spud_core/errors" require "#{root}/lib/spud_core/searchable" require "#{root}/lib/responds_to_parent" engine_name :tb_core config.autoload_paths << "#{root}/lib" initializer 'tb_core.controller_overrides' do |config| ActionController::Base.class_eval do include Spud::BelongsToApp end end initializer 'tb_core.model_overrides' do |config| ActiveRecord::Base.class_eval do include Spud::Searchable end end initializer 'tb_core.admin', :after => :admin do |config| # Translate Hash configured permissions into SpudPermission objects Spud::Core.permissions.collect! do |p| if p.class == Hash p = SpudPermission.new(p[:tag], p[:name], p[:apps]) end p end # Append Users admin module Spud::Core.config.admin_applications.unshift({ :name => "Users", :thumbnail => "admin/users_thumb.png", :url => '/admin/users', :order => 100 }) # Create default permissions for modules Spud::Core.admin_applications.each do |admin_application| admin_application[:key] ||= admin_application[:name].gsub(' ', '_').downcase.to_sym tag = "admin.#{admin_application[:key]}.full_access" name = "#{admin_application[:name]} admin" apps = [admin_application[:key]] Spud::Core.permissions.push(SpudPermission.new(tag, name, apps)) end end initializer 'tb_core.catch_all_route' do |config| # Handle 404 errors if Spud::Cms is not installed if !defined?(Spud::Cms) config.routes_reloader.paths << File.expand_path('../catch_all_route.rb', __FILE__) end end end end end