themes 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -6,10 +6,10 @@ Add simple themes to your rails applications
6
6
 
7
7
  - allow app to load diferent configuration depending on theme
8
8
  - Load theme using APP_THEME environment variable
9
+ - Load views based on theme directory
9
10
 
10
11
  ## Wished features:
11
12
 
12
- - Load views based on theme directory
13
13
  - Use differnt theme depending on domain name
14
14
 
15
15
 
@@ -9,4 +9,5 @@ module Themes
9
9
  end
10
10
 
11
11
  require 'themes/engine'
12
- require 'themes/helpers'
12
+ require 'themes/helpers'
13
+ require 'themes/paths'
@@ -8,11 +8,19 @@ module Themes
8
8
  end
9
9
 
10
10
  initializer "themes.configure_mailers", after: 'action_mailer.set_configs' do |app|
11
- ActionMailer::Base.default from: app.config.theme.email
11
+ ActionMailer::Base.default from: app.config.theme.email, template_path: "app/views/themes/#{ENV['APP_THEME']}"
12
12
  end
13
13
 
14
14
  initializer "themes.insert_helpers", after: 'themes.configure_mailers' do |app|
15
15
  ActionController::Base.send(:include,Themes::Helpers)
16
+ ActionController::Base.send(:extend,Themes::Helpers)
17
+ ActionMailer::Base.send(:extend,Themes::Helpers)
18
+ end
19
+
20
+ initializer "themes.add_views_path", after: "themes.insert_helpers" do |app|
21
+ ActionController::Base.send(:extend, Themes::Paths)
22
+ ActionController::Base.send(:include, Themes::Paths)
23
+ ActionMailer::Base.send(:include, Themes::Paths)
16
24
  end
17
25
  end
18
26
  end
@@ -0,0 +1,11 @@
1
+ require 'active_support/concern'
2
+
3
+ module Themes
4
+ module Paths
5
+ extend ActiveSupport::Concern
6
+
7
+ included do
8
+ prepend_view_path(Rails.root.join('app', 'views', 'themes', current_theme))
9
+ end
10
+ end
11
+ end
@@ -1,3 +1,3 @@
1
1
  module Themes
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: themes
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.1
5
+ version: 0.0.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Ricard Forniol Agustí
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-19 00:00:00.000000000 Z
12
+ date: 2013-09-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  prerelease: false
@@ -101,6 +101,7 @@ files:
101
101
  - lib/tasks/themes_tasks.rake
102
102
  - lib/themes/engine.rb
103
103
  - lib/themes/helpers.rb
104
+ - lib/themes/paths.rb
104
105
  - lib/themes/version.rb
105
106
  - lib/themes.rb
106
107
  - MIT-LICENSE
@@ -118,7 +119,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
118
119
  - !ruby/object:Gem::Version
119
120
  segments:
120
121
  - 0
121
- hash: -3823414900650914796
122
+ hash: 1487130218803673752
122
123
  version: '0'
123
124
  none: false
124
125
  required_rubygems_version: !ruby/object:Gem::Requirement
@@ -127,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
128
  - !ruby/object:Gem::Version
128
129
  segments:
129
130
  - 0
130
- hash: -3823414900650914796
131
+ hash: 1487130218803673752
131
132
  version: '0'
132
133
  none: false
133
134
  requirements: []