Skip to content

Commit

Permalink
enabled turning off/on locales
Browse files Browse the repository at this point in the history
  • Loading branch information
jbasdf committed Sep 6, 2011
1 parent 751b9b0 commit b00f2a1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ The default settings are fine for most uses but if you'd like to customize disgu

Disguise.configure do |config|
config.use_domain_for_themes = false # Changing theme per domain can be expense so it's off by default
config.locales_enabled = false # Reloads locales based on the theme. Only enable this if you are using locales specific to each theme. Enabling this method requires reloading the locales which incurs a heavy performance penalty.
config.themes_enabled = true # Turns disguise off/on.
config.theme_full_base_path = File.join(::Rails.root.to_s, 'themes') # Full path to the themes folder. The examples puts themes in a directory called 'themes' in the Rails app root.
end
Expand Down
4 changes: 3 additions & 1 deletion lib/disguise/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ class Configuration
attr_accessor :themes_enabled
attr_accessor :use_domain_for_themes
attr_accessor :theme_full_base_path
attr_accessor :locales_enabled

def initialize
@themes_enabled = true
@use_domain_for_themes = false
@locales_enabled = false
@use_domain_for_themes = false
@theme_full_base_path = File.join(::Rails.root.to_s, 'themes')
end
end
Expand Down
8 changes: 5 additions & 3 deletions lib/disguise/controllers/disguise_application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ def setup_theme
return if !theme_exists(theme_view_path)
clean_theme_view_path
self.prepend_view_path(ActionView::FileSystemResolver.new(theme_view_path))
clean_theme_locale
set_theme_locale
I18n.reload!
if Disguise.configuration.locales_enabled
clean_theme_locale
set_theme_locale
I18n.reload!
end
end
end

Expand Down

0 comments on commit b00f2a1

Please sign in to comment.