rails-themes 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/rails-themes.rb +19 -8
  2. metadata +2 -2
data/lib/rails-themes.rb CHANGED
@@ -26,19 +26,30 @@ ActionController::Base.class_eval do
26
26
 
27
27
  def add_theme_path
28
28
  current_theme
29
- new_path = "#{Rails.public_path}/themes/#{@active_theme}/views"
30
- self.prepend_view_path(new_path)
31
- return true
29
+ self.prepend_view_path(theme_views_path)
32
30
  end
33
31
 
34
32
  def current_theme
35
33
  theme = self.class.read_inheritable_attribute("theme")
36
34
 
37
- @active_theme = case theme
38
- when Proc then theme.call(self)
39
- when String then theme
40
- when Symbol then send(theme)
41
- end
35
+ @current_theme = case theme
36
+ when Proc then theme.call(self)
37
+ when String then theme
38
+ when Symbol then send(theme)
39
+ end
42
40
  end
43
41
 
42
+ def theme_path
43
+ "#{Rails.public_path}/themes/#{current_theme}"
44
+ end
45
+
46
+ def theme_views_path
47
+ theme_path + "/views"
48
+ end
49
+
50
+ def theme_assets_path
51
+ "/themes/#{current_theme}/assets"
52
+ end
53
+ helper_method :theme_assets_path
54
+
44
55
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: rails-themes
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.0
5
+ version: 1.1.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Francesc Esplugas
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-06-09 00:00:00 Z
13
+ date: 2011-06-22 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails