module Drapes

Public Class Methods

remove_theme(theme, controller) click to toggle source
# File lib/drapes.rb, line 8
def self.remove_theme(theme, controller)
  if theme
    Rails.application.config.assets.paths.delete Rails.root.join("app", "assets", "themes", theme)
    view_path = Rails.root.join("app", "assets", "themes", theme, "views")
    controller.lookup_context.view_paths.delete_path(view_path.to_s)
  end
end
set_theme(theme, controller) click to toggle source
# File lib/drapes.rb, line 16
def self.set_theme(theme, controller)
  self.remove_theme(@theme, controller)
  @theme = theme
  if @theme
    Rails.application.config.assets.paths.unshift Rails.root.join("app", "assets", "themes", theme)
    controller.prepend_view_path Rails.root.join("app", "assets", "themes", theme, "views")
  end
end
theme() click to toggle source
# File lib/drapes.rb, line 4
def self.theme
  @theme
end