disguise 0.3.12 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +4 -4
- data/VERSION +1 -1
- data/app/models/domain_theme.rb +1 -1
- data/app/models/theme.rb +1 -1
- data/disguise.gemspec +3 -2
- data/lib/action_controller/disguise_application.rb +4 -4
- data/lib/disguise.rb +6 -15
- data/lib/disguise/config.rb +13 -0
- data/test/rails_root/config/initializers/disguise.rb +2 -2
- data/test/rails_root/test/test_helper.rb +2 -2
- metadata +3 -2
data/README.rdoc
CHANGED
@@ -48,12 +48,12 @@ Disguise can run in two modes. The first is the default which let's an administ
|
|
48
48
|
via the built in admin interface. The second looks at the url of the incoming request and matches it to a theme.
|
49
49
|
To enable this second mode create an initializer in /config/initializers/disguise.rb and enter the following contents:
|
50
50
|
|
51
|
-
Disguise.use_domain_for_themes = false
|
51
|
+
Disguise::Config.use_domain_for_themes = false
|
52
52
|
|
53
53
|
# These options are also available to configure disguise. In most cases the defaults should work fine.
|
54
|
-
Disguise.themes_enabled = true
|
55
|
-
Disguise.theme_path = 'themes'
|
56
|
-
Disguise.theme_full_base_path = File.join(RAILS_ROOT, Disguise.theme_path)
|
54
|
+
Disguise::Config.themes_enabled = true
|
55
|
+
Disguise::Config.theme_path = 'themes'
|
56
|
+
Disguise::Config.theme_full_base_path = File.join(RAILS_ROOT, Disguise::Config.theme_path)
|
57
57
|
|
58
58
|
== Notes
|
59
59
|
After installing Disguise be sure to generate a theme and set that theme as the default theme. Not setting a theme
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
data/app/models/domain_theme.rb
CHANGED
data/app/models/theme.rb
CHANGED
@@ -12,7 +12,7 @@ class Theme < ActiveRecord::Base
|
|
12
12
|
# along with a preview image.
|
13
13
|
def self.available_themes(selected_theme)
|
14
14
|
themes = []
|
15
|
-
theme_path = File.join(RAILS_ROOT, Disguise.theme_path)
|
15
|
+
theme_path = File.join(RAILS_ROOT, Disguise::Config.theme_path)
|
16
16
|
current_theme = nil
|
17
17
|
|
18
18
|
Dir.glob("#{theme_path}/*").each do |theme_directory|
|
data/disguise.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{disguise}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.4.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Justin Ball"]
|
12
|
-
s.date = %q{2010-01-
|
12
|
+
s.date = %q{2010-01-23}
|
13
13
|
s.description = %q{Add themes to your Rails application to easily change the view layer and impress everyone you know}
|
14
14
|
s.email = %q{justinball@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -47,6 +47,7 @@ Gem::Specification.new do |s|
|
|
47
47
|
"generators/theme/theme_generator.rb",
|
48
48
|
"lib/action_controller/disguise_application.rb",
|
49
49
|
"lib/disguise.rb",
|
50
|
+
"lib/disguise/config.rb",
|
50
51
|
"lib/disguise/initialize_routes.rb",
|
51
52
|
"lib/disguise/tasks.rb",
|
52
53
|
"locales/ar.yml",
|
@@ -23,9 +23,9 @@ module ActionController
|
|
23
23
|
protected
|
24
24
|
|
25
25
|
def setup_theme
|
26
|
-
return if !Disguise.themes_enabled
|
26
|
+
return if !Disguise::Config.themes_enabled
|
27
27
|
return if current_theme.blank? || current_theme.name.blank?
|
28
|
-
theme_view_path = File.join(Disguise.theme_full_base_path, current_theme.name, 'views')
|
28
|
+
theme_view_path = File.join(Disguise::Config.theme_full_base_path, current_theme.name, 'views')
|
29
29
|
if self.view_paths.first == theme_view_path
|
30
30
|
return
|
31
31
|
else
|
@@ -44,11 +44,11 @@ module ActionController
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def clean_theme_view_path
|
47
|
-
self.view_paths.delete_if {|view_path| view_path.to_s.index(Disguise.theme_path) == 0}
|
47
|
+
self.view_paths.delete_if {|view_path| view_path.to_s.index(Disguise::Config.theme_path) == 0}
|
48
48
|
end
|
49
49
|
|
50
50
|
def clean_theme_locale
|
51
|
-
I18n.load_path.delete_if {|localization_path| localization_path.index(Disguise.theme_full_base_path) == 0}
|
51
|
+
I18n.load_path.delete_if {|localization_path| localization_path.index(Disguise::Config.theme_full_base_path) == 0}
|
52
52
|
end
|
53
53
|
|
54
54
|
def set_theme_locale
|
data/lib/disguise.rb
CHANGED
@@ -1,20 +1,11 @@
|
|
1
|
+
require 'disguise/config'
|
2
|
+
|
1
3
|
ActionController::Base.send :include, ActionController::DisguiseApplication
|
2
4
|
|
3
5
|
I18n.load_path += Dir[ File.join(File.dirname(__FILE__), '..', 'locales', '*.{rb,yml}') ]
|
4
6
|
|
5
|
-
class Disguise
|
6
|
-
|
7
|
-
class << self
|
8
|
-
attr_accessor :themes_enabled
|
9
|
-
attr_accessor :use_domain_for_themes
|
10
|
-
attr_accessor :theme_path
|
11
|
-
attr_accessor :theme_full_base_path
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
15
|
-
|
16
7
|
# Set defaults
|
17
|
-
Disguise.themes_enabled = true
|
18
|
-
Disguise.use_domain_for_themes = false
|
19
|
-
Disguise.theme_path = 'themes'
|
20
|
-
Disguise.theme_full_base_path = File.join(RAILS_ROOT, Disguise.theme_path)
|
8
|
+
Disguise::Config.themes_enabled = true
|
9
|
+
Disguise::Config.use_domain_for_themes = false
|
10
|
+
Disguise::Config.theme_path = 'themes'
|
11
|
+
Disguise::Config.theme_full_base_path = File.join(RAILS_ROOT, Disguise::Config.theme_path)
|
@@ -1,2 +1,2 @@
|
|
1
|
-
Disguise.themes_enabled = true
|
2
|
-
Disguise.use_domain_for_themes = false
|
1
|
+
Disguise::Config.themes_enabled = true
|
2
|
+
Disguise::Config.use_domain_for_themes = false
|
@@ -25,11 +25,11 @@ class ActiveSupport::TestCase
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def clean_theme_view_path(controller)
|
28
|
-
controller.view_paths.delete_if {|view_path| view_path.to_s.index(Disguise.theme_path) == 0}
|
28
|
+
controller.view_paths.delete_if {|view_path| view_path.to_s.index(Disguise::Config.theme_path) == 0}
|
29
29
|
end
|
30
30
|
|
31
31
|
def clean_theme_locale
|
32
|
-
I18n.load_path.delete_if {|localization_path| localization_path.index(Disguise.theme_full_base_path) == 0}
|
32
|
+
I18n.load_path.delete_if {|localization_path| localization_path.index(Disguise::Config.theme_full_base_path) == 0}
|
33
33
|
end
|
34
34
|
|
35
35
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: disguise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Ball
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-23 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -53,6 +53,7 @@ files:
|
|
53
53
|
- generators/theme/theme_generator.rb
|
54
54
|
- lib/action_controller/disguise_application.rb
|
55
55
|
- lib/disguise.rb
|
56
|
+
- lib/disguise/config.rb
|
56
57
|
- lib/disguise/initialize_routes.rb
|
57
58
|
- lib/disguise/tasks.rb
|
58
59
|
- locales/ar.yml
|