Sha256: f6ef92c957e8f51a4fb7564612e0152cf0eed8fad81504ac8e62621817f8aa78

Contents?: true

Size: 943 Bytes

Versions: 3

Compression:

Stored size: 943 Bytes

Contents

# Set up middleware to serve theme files
config.middleware.use "ThemeServer"

# Add or remove theme paths to/from Refinery application
::Refinery::ApplicationController.module_eval %(
  before_filter do |controller|
    controller.view_paths.reject! { |v| v.to_s =~ %r{^themes/} }
    if (theme = RefinerySetting[:theme]).present?
      # Set up view path again for the current theme.
      controller.view_paths.unshift Rails.root.join("themes", theme, "views").to_s
    end
  end
)

if (theme = RefinerySetting[:theme]).present?
  # Set up controller paths, which can only be brought in with a server restart, sorry. (But for good reason)
  controller_path = Rails.root.join("themes", theme, "controllers").to_s

  ::ActiveSupport::Dependencies.load_paths.unshift controller_path
  config.controller_paths.unshift controller_path
end

# Include theme functions into application helper.
Refinery::ApplicationHelper.send :include, ThemesHelper

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
jacobat-refinerycms-0.9.6.14 vendor/plugins/themes/rails/init.rb
refinerycms-0.9.6.14 vendor/plugins/themes/rails/init.rb
refinerycms-0.9.6.13 vendor/plugins/themes/rails/init.rb