themes_for_rails 0.5.1 → 1.0.0rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/.rvmrc +1 -0
- data/Gemfile.lock +82 -60
- data/README.textile +235 -11
- data/Rakefile +31 -11
- data/init.rb +1 -0
- data/lib/generators/themes_for_rails/install_generator.rb +21 -6
- data/lib/generators/themes_for_rails/templates/README +11 -0
- data/lib/generators/themes_for_rails/templates/theme/{images → assets/images}/.gitkeep +0 -0
- data/lib/generators/themes_for_rails/templates/theme/{javascripts → assets/javascripts}/.gitkeep +0 -0
- data/lib/generators/themes_for_rails/templates/theme/assets/javascripts/application.js +9 -0
- data/lib/generators/themes_for_rails/templates/theme/{stylesheets → assets/stylesheets}/.gitkeep +0 -0
- data/lib/generators/themes_for_rails/templates/theme/assets/stylesheets/application.css +7 -0
- data/lib/generators/themes_for_rails/theme_generator.rb +2 -3
- data/lib/themes_for_rails.rb +15 -40
- data/lib/themes_for_rails/assets_finder.rb +44 -0
- data/lib/themes_for_rails/common_methods.rb +26 -34
- data/lib/themes_for_rails/config.rb +8 -59
- data/lib/themes_for_rails/{action_controller.rb → controller_methods.rb} +7 -13
- data/lib/themes_for_rails/logging.rb +14 -0
- data/lib/themes_for_rails/mailer_methods.rb +22 -0
- data/lib/themes_for_rails/railtie.rb +10 -21
- data/lib/themes_for_rails/routes.rb +3 -15
- data/lib/themes_for_rails/version.rb +1 -2
- data/lib/themes_for_rails/view_helpers.rb +52 -0
- data/spec/controllers/my_controller_spec.rb +99 -0
- data/{test/dummy_app → spec/dummy}/.gitignore +2 -1
- data/spec/dummy/Gemfile +35 -0
- data/spec/dummy/Gemfile.lock +127 -0
- data/spec/dummy/README +261 -0
- data/{test/dummy_app → spec/dummy}/Rakefile +1 -1
- data/{test/dummy_app/public → spec/dummy/app/assets}/images/rails.png +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +9 -0
- data/spec/dummy/app/assets/stylesheets/application.css +7 -0
- data/{test/dummy_app → spec/dummy}/app/controllers/application_controller.rb +0 -0
- data/{test/dummy_app → spec/dummy}/app/helpers/application_helper.rb +0 -0
- data/{test/dummy_app/empty_themes → spec/dummy/app/mailers}/.gitkeep +0 -0
- data/{test/dummy_app/lib/tasks → spec/dummy/app/models}/.gitkeep +0 -0
- data/spec/dummy/app/themes/default/assets/images/rails.png +0 -0
- data/spec/dummy/app/themes/default/assets/javascripts/application.js +9 -0
- data/spec/dummy/app/themes/default/assets/stylesheets/application.css +7 -0
- data/spec/dummy/app/themes/default/views/layouts/application.html.erb +14 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/{test/dummy_app → spec/dummy}/config.ru +0 -0
- data/{test/dummy_app → spec/dummy}/config/application.rb +12 -6
- data/spec/dummy/config/boot.rb +6 -0
- data/{test/dummy_app → spec/dummy}/config/database.yml +10 -3
- data/{test/dummy_app → spec/dummy}/config/environment.rb +0 -0
- data/{test/dummy_app → spec/dummy}/config/environments/development.rb +8 -4
- data/{test/dummy_app → spec/dummy}/config/environments/production.rb +24 -13
- data/{test/dummy_app → spec/dummy}/config/environments/test.rb +9 -2
- data/{test/dummy_app → spec/dummy}/config/initializers/backtrace_silencers.rb +0 -0
- data/{test/dummy_app → spec/dummy}/config/initializers/inflections.rb +0 -0
- data/{test/dummy_app → spec/dummy}/config/initializers/mime_types.rb +0 -0
- data/{test/dummy_app → spec/dummy}/config/initializers/secret_token.rb +1 -1
- data/{test/dummy_app → spec/dummy}/config/initializers/session_store.rb +2 -2
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/{test/dummy_app → spec/dummy}/config/locales/en.yml +1 -1
- data/spec/dummy/config/routes.rb +3 -0
- data/{test/dummy_app → spec/dummy}/db/seeds.rb +2 -2
- data/spec/dummy/doc/README_FOR_APP +2 -0
- data/{test/dummy_app/public/stylesheets → spec/dummy/lib/assets}/.gitkeep +0 -0
- data/{doc/REVIEW_NOTES → spec/dummy/lib/tasks/.gitkeep} +0 -0
- data/{test/dummy_app/another_themes/another_default/images/logo.png → spec/dummy/log/.gitkeep} +0 -0
- data/{test/dummy_app → spec/dummy}/public/404.html +0 -0
- data/{test/dummy_app → spec/dummy}/public/422.html +0 -0
- data/{test/dummy_app → spec/dummy}/public/500.html +0 -0
- data/{test/dummy_app → spec/dummy}/public/favicon.ico +0 -0
- data/{test/dummy_app → spec/dummy}/public/index.html +10 -8
- data/{test/dummy_app → spec/dummy}/public/robots.txt +0 -0
- data/{test/dummy_app → spec/dummy}/script/rails +0 -0
- data/{test/dummy_app/another_themes/another_default/images/nested/logo.png → spec/dummy/test/fixtures/.gitkeep} +0 -0
- data/{test/dummy_app/another_themes/another_default/stylesheets/style.css → spec/dummy/test/functional/.gitkeep} +0 -0
- data/{test/dummy_app/another_themes/another_default/views/products/index.html.erb → spec/dummy/test/integration/.gitkeep} +0 -0
- data/spec/dummy/test/performance/browsing_test.rb +12 -0
- data/spec/dummy/test/test_helper.rb +13 -0
- data/{test/dummy_app/themes/default/images/logo.png → spec/dummy/test/unit/.gitkeep} +0 -0
- data/{test/dummy_app/themes/default/images/nested/logo.png → spec/dummy/vendor/assets/stylesheets/.gitkeep} +0 -0
- data/{test/dummy_app/themes/default/javascripts/app.min.js → spec/dummy/vendor/plugins/.gitkeep} +0 -0
- data/spec/lib/assets_finder_spec.rb +10 -0
- data/spec/lib/common_methods_spec.rb +30 -0
- data/spec/lib/config_spec.rb +19 -0
- data/spec/lib/controller_methods_spec.rb +19 -0
- data/spec/lib/view_helpers_spec.rb +38 -0
- data/spec/mailers/mailer_methods_spec.rb +39 -0
- data/spec/spec_helper.rb +15 -0
- data/test/dummy_app/Gemfile.lock +91 -0
- data/test/dummy_app/{themes/default/stylesheets/images/logo.png → log/development.log} +0 -0
- data/test/dummy_app/log/test.log +6 -0
- data/themes_for_rails.gemspec +140 -20
- metadata +112 -183
- data/.gitignore +0 -7
- data/.travis.yml +0 -2
- data/LICENSE +0 -21
- data/doc/README.textile +0 -363
- data/doc/RMU_REVIEW +0 -26
- data/doc/TODO.textile +0 -3
- data/lib/themes_for_rails/action_mailer.rb +0 -22
- data/lib/themes_for_rails/action_view.rb +0 -62
- data/lib/themes_for_rails/assets_controller.rb +0 -66
- data/lib/themes_for_rails/interpolation.rb +0 -11
- data/lib/themes_for_rails/url_helpers.rb +0 -27
- data/test/dummy_app/Gemfile +0 -30
- data/test/dummy_app/another_themes/another_default/javascripts/app.js +0 -1
- data/test/dummy_app/another_themes/another_default/stylesheets/style2.css +0 -3
- data/test/dummy_app/another_themes/another_default/views/layouts/default.html.erb +0 -10
- data/test/dummy_app/app/views/layouts/application.html.erb +0 -14
- data/test/dummy_app/config/boot.rb +0 -13
- data/test/dummy_app/config/routes.rb +0 -4
- data/test/dummy_app/public/javascripts/application.js +0 -2
- data/test/dummy_app/public/javascripts/controls.js +0 -965
- data/test/dummy_app/public/javascripts/dragdrop.js +0 -974
- data/test/dummy_app/public/javascripts/effects.js +0 -1123
- data/test/dummy_app/public/javascripts/prototype.js +0 -6001
- data/test/dummy_app/public/javascripts/rails.js +0 -175
- data/test/dummy_app/themes/default/javascripts/app.js +0 -1
- data/test/dummy_app/themes/default/stylesheets/style.css +0 -0
- data/test/dummy_app/themes/default/stylesheets/style2.css +0 -3
- data/test/dummy_app/themes/default/views/layouts/default.html.erb +0 -10
- data/test/dummy_app/themes/default/views/products/index.html.erb +0 -0
- data/test/lib/action_controller_test.rb +0 -170
- data/test/lib/action_mailer_test.rb +0 -35
- data/test/lib/action_view_test.rb +0 -54
- data/test/lib/assets_controller_test.rb +0 -73
- data/test/lib/common_methods_test.rb +0 -28
- data/test/lib/config_test.rb +0 -26
- data/test/lib/integration_test.rb +0 -12
- data/test/lib/routes_test.rb +0 -40
- data/test/lib/themes_for_rails_test.rb +0 -18
- data/test/support/extensions.rb +0 -19
- data/test/test_helper.rb +0 -12
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use 1.9.2@themes_for_rails --create
|
data/Gemfile.lock
CHANGED
@@ -1,79 +1,102 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
themes_for_rails (0.
|
5
|
-
rails (
|
4
|
+
themes_for_rails (1.0.0rc1)
|
5
|
+
rails (~> 3.1.0)
|
6
|
+
themes_for_rails
|
6
7
|
|
7
8
|
GEM
|
8
9
|
remote: http://rubygems.org/
|
9
10
|
specs:
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
rack (~> 1.
|
21
|
-
rack-mount (~> 0.
|
22
|
-
rack-test (~> 0.
|
23
|
-
|
24
|
-
activemodel (3.
|
25
|
-
activesupport (= 3.
|
26
|
-
builder (~>
|
27
|
-
i18n (~> 0.
|
28
|
-
activerecord (3.
|
29
|
-
activemodel (= 3.
|
30
|
-
activesupport (= 3.
|
31
|
-
arel (~> 2.
|
32
|
-
tzinfo (~> 0.3.
|
33
|
-
activeresource (3.
|
34
|
-
activemodel (= 3.
|
35
|
-
activesupport (= 3.
|
36
|
-
activesupport (3.
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
11
|
+
actionmailer (3.1.1)
|
12
|
+
actionpack (= 3.1.1)
|
13
|
+
mail (~> 2.3.0)
|
14
|
+
actionpack (3.1.1)
|
15
|
+
activemodel (= 3.1.1)
|
16
|
+
activesupport (= 3.1.1)
|
17
|
+
builder (~> 3.0.0)
|
18
|
+
erubis (~> 2.7.0)
|
19
|
+
i18n (~> 0.6)
|
20
|
+
rack (~> 1.3.2)
|
21
|
+
rack-cache (~> 1.1)
|
22
|
+
rack-mount (~> 0.8.2)
|
23
|
+
rack-test (~> 0.6.1)
|
24
|
+
sprockets (~> 2.0.2)
|
25
|
+
activemodel (3.1.1)
|
26
|
+
activesupport (= 3.1.1)
|
27
|
+
builder (~> 3.0.0)
|
28
|
+
i18n (~> 0.6)
|
29
|
+
activerecord (3.1.1)
|
30
|
+
activemodel (= 3.1.1)
|
31
|
+
activesupport (= 3.1.1)
|
32
|
+
arel (~> 2.2.1)
|
33
|
+
tzinfo (~> 0.3.29)
|
34
|
+
activeresource (3.1.1)
|
35
|
+
activemodel (= 3.1.1)
|
36
|
+
activesupport (= 3.1.1)
|
37
|
+
activesupport (3.1.1)
|
38
|
+
multi_json (~> 1.0)
|
39
|
+
arel (2.2.1)
|
40
|
+
builder (3.0.0)
|
41
|
+
diff-lcs (1.1.3)
|
42
|
+
erubis (2.7.0)
|
43
|
+
hike (1.2.1)
|
44
|
+
i18n (0.6.0)
|
45
|
+
json (1.6.1)
|
46
|
+
mail (2.3.0)
|
46
47
|
i18n (>= 0.4.0)
|
47
48
|
mime-types (~> 1.16)
|
48
49
|
treetop (~> 1.4.8)
|
49
50
|
mime-types (1.17.2)
|
50
|
-
|
51
|
+
multi_json (1.0.3)
|
51
52
|
polyglot (0.3.3)
|
52
|
-
rack (1.
|
53
|
-
rack-
|
53
|
+
rack (1.3.5)
|
54
|
+
rack-cache (1.1)
|
55
|
+
rack (>= 0.4)
|
56
|
+
rack-mount (0.8.3)
|
54
57
|
rack (>= 1.0.0)
|
55
|
-
rack-
|
58
|
+
rack-ssl (1.3.2)
|
59
|
+
rack
|
60
|
+
rack-test (0.6.1)
|
56
61
|
rack (>= 1.0)
|
57
|
-
rails (3.
|
58
|
-
actionmailer (= 3.
|
59
|
-
actionpack (= 3.
|
60
|
-
activerecord (= 3.
|
61
|
-
activeresource (= 3.
|
62
|
-
activesupport (= 3.
|
62
|
+
rails (3.1.1)
|
63
|
+
actionmailer (= 3.1.1)
|
64
|
+
actionpack (= 3.1.1)
|
65
|
+
activerecord (= 3.1.1)
|
66
|
+
activeresource (= 3.1.1)
|
67
|
+
activesupport (= 3.1.1)
|
63
68
|
bundler (~> 1.0)
|
64
|
-
railties (= 3.
|
65
|
-
railties (3.
|
66
|
-
actionpack (= 3.
|
67
|
-
activesupport (= 3.
|
69
|
+
railties (= 3.1.1)
|
70
|
+
railties (3.1.1)
|
71
|
+
actionpack (= 3.1.1)
|
72
|
+
activesupport (= 3.1.1)
|
73
|
+
rack-ssl (~> 1.3.2)
|
68
74
|
rake (>= 0.8.7)
|
69
75
|
rdoc (~> 3.4)
|
70
|
-
thor (~> 0.14.
|
76
|
+
thor (~> 0.14.6)
|
71
77
|
rake (0.9.2.2)
|
72
|
-
rdoc (3.
|
78
|
+
rdoc (3.11)
|
73
79
|
json (~> 1.4)
|
74
|
-
|
75
|
-
|
80
|
+
rspec (2.7.0)
|
81
|
+
rspec-core (~> 2.7.0)
|
82
|
+
rspec-expectations (~> 2.7.0)
|
83
|
+
rspec-mocks (~> 2.7.0)
|
84
|
+
rspec-core (2.7.1)
|
85
|
+
rspec-expectations (2.7.0)
|
86
|
+
diff-lcs (~> 1.1.2)
|
87
|
+
rspec-mocks (2.7.0)
|
88
|
+
rspec-rails (2.7.0)
|
89
|
+
actionpack (~> 3.0)
|
90
|
+
activesupport (~> 3.0)
|
91
|
+
railties (~> 3.0)
|
92
|
+
rspec (~> 2.7.0)
|
93
|
+
sprockets (2.0.3)
|
94
|
+
hike (~> 1.2)
|
95
|
+
rack (~> 1.0)
|
96
|
+
tilt (~> 1.1, != 1.3.0)
|
97
|
+
sqlite3 (1.3.4)
|
76
98
|
thor (0.14.6)
|
99
|
+
tilt (1.3.3)
|
77
100
|
treetop (1.4.10)
|
78
101
|
polyglot
|
79
102
|
polyglot (>= 0.3.1)
|
@@ -83,9 +106,8 @@ PLATFORMS
|
|
83
106
|
ruby
|
84
107
|
|
85
108
|
DEPENDENCIES
|
86
|
-
|
87
|
-
|
88
|
-
rails
|
109
|
+
rails (~> 3.1)
|
110
|
+
rspec
|
111
|
+
rspec-rails
|
89
112
|
sqlite3
|
90
|
-
test-unit
|
91
113
|
themes_for_rails!
|
data/README.textile
CHANGED
@@ -1,33 +1,258 @@
|
|
1
1
|
h1. Theme For Rails (3 and hopefully later)
|
2
2
|
|
3
|
-
h2. Features list
|
3
|
+
h2. Features list / Wish list
|
4
4
|
|
5
5
|
* Support for adding themes which includes stylesheets, javascripts, views and layouts.
|
6
|
-
* add a theme-image-url sass helper method for asset pipeline based themes
|
7
|
-
* update the generators and rake tasks to support asset pipeline based themes
|
8
|
-
* (NEW) works with the Rails Assets Pipeline without interfering, and leveraging it.
|
9
6
|
|
10
|
-
|
7
|
+
<pre>
|
8
|
+
$app_root
|
9
|
+
themes/
|
10
|
+
[theme_name]
|
11
|
+
images/
|
12
|
+
stylesheets/
|
13
|
+
javascripts/
|
14
|
+
views/ <- you can override application views
|
15
|
+
layouts/ <- layout .rhtml or .liquid templates
|
16
|
+
</pre>
|
17
|
+
|
18
|
+
h2. Instructions
|
19
|
+
|
20
|
+
Add themes_for_rails to your Gemfile.
|
21
|
+
|
22
|
+
<pre>
|
23
|
+
gem 'themes_for_rails'
|
24
|
+
</pre>
|
25
|
+
|
26
|
+
Add themes_for_rails to your config/routes.rb
|
27
|
+
|
28
|
+
<pre>
|
29
|
+
MySuperDuperApp::Application.routes.draw do
|
30
|
+
# ...
|
31
|
+
themes_for_rails
|
32
|
+
# ...
|
33
|
+
end
|
34
|
+
</pre>
|
35
|
+
|
36
|
+
h3. And then?
|
37
|
+
|
38
|
+
Now you'll be able to use themes like this:
|
39
|
+
|
40
|
+
Inside method, for some explicit action:
|
41
|
+
|
42
|
+
<pre>
|
43
|
+
class MyController < ApplicationController
|
44
|
+
def show
|
45
|
+
theme "purple"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
</pre>
|
49
|
+
|
50
|
+
Or at class level definition, in order to set a theme for more than one action. I think this is is prettier, and less invasive.
|
51
|
+
|
52
|
+
<pre>
|
53
|
+
class MyController < ApplicationController
|
54
|
+
theme "purple" # all actions will use this theme
|
55
|
+
def show
|
56
|
+
...
|
57
|
+
end
|
58
|
+
end
|
59
|
+
</pre>
|
60
|
+
|
61
|
+
You could also enable a theme for some actions only
|
62
|
+
|
63
|
+
<pre>
|
64
|
+
class MyController < ApplicationController
|
65
|
+
theme "purple", :only => :show
|
66
|
+
def show
|
67
|
+
# with theme
|
68
|
+
end
|
69
|
+
def edit
|
70
|
+
# no theme
|
71
|
+
end
|
72
|
+
end
|
73
|
+
</pre>
|
74
|
+
|
75
|
+
As a plus, you could do this to defer theme name resolution to a method:
|
76
|
+
|
77
|
+
<pre>
|
78
|
+
class MyController < ApplicationController
|
79
|
+
theme :theme_resolver
|
80
|
+
# ...
|
81
|
+
private
|
82
|
+
def theme_resolver
|
83
|
+
current_user.theme # or anything else that return a string.
|
84
|
+
end
|
85
|
+
end
|
86
|
+
</pre>
|
87
|
+
|
88
|
+
As a general rule, when passing a String, that becomes the theme name, but when a Symbol is sent, it gets treated as method message.
|
89
|
+
|
90
|
+
|
91
|
+
h3. Action Mailer integration:
|
92
|
+
|
93
|
+
As a plus, you can use it from Action Mailer too (thanks to rafaelss) like this:
|
94
|
+
|
95
|
+
<pre>
|
96
|
+
class MyMailer < ActionMailer::Base
|
97
|
+
|
98
|
+
def notify_someone
|
99
|
+
mail :theme => "blue" , :to => "some@one.com"
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|
103
|
+
</pre>
|
104
|
+
|
105
|
+
Or set the theme by default like this (thanks to maxjgon):
|
106
|
+
|
107
|
+
<pre>
|
108
|
+
class MyMailer < ActionMailer::Base
|
109
|
+
|
110
|
+
default :theme => "blue"
|
111
|
+
|
112
|
+
def notify_someone
|
113
|
+
mail :to => "some@one.com"
|
114
|
+
end
|
115
|
+
|
116
|
+
end
|
117
|
+
</pre>
|
118
|
+
|
119
|
+
h3. Url Helpers
|
120
|
+
|
121
|
+
In your views you should be able to access your assets like this (given the theme 'default' is set):
|
122
|
+
|
123
|
+
<pre>
|
124
|
+
current_theme_image_path('logo.png') # => /themes/default/images/logo.png
|
125
|
+
current_theme_stylesheet_path('style') # => /themes/default/stylesheets/logo.css
|
126
|
+
current_theme_javascript_path('app') # => /themes/default/stylesheets/app.js
|
127
|
+
</pre>
|
128
|
+
|
129
|
+
Or a given theme:
|
130
|
+
|
131
|
+
<pre>
|
132
|
+
current_theme_image_path('logo.png', 'purple') # => /themes/purple/images/logo.png
|
133
|
+
</pre>
|
134
|
+
|
135
|
+
In your application views, there are theme specific helper tags
|
136
|
+
available to you. For ERb templates they are:
|
137
|
+
|
138
|
+
<pre>
|
139
|
+
theme_image_tag
|
140
|
+
theme_image_path
|
141
|
+
theme_javascript_include_tag
|
142
|
+
theme_javascript_path
|
143
|
+
theme_stylesheet_link_tag
|
144
|
+
theme_stylesheet_path
|
145
|
+
</pre>
|
146
|
+
|
147
|
+
h2. Generators
|
148
|
+
|
149
|
+
For now, it only creates the theme folder and add the "themes_for_rails" route in the routes.rb.
|
150
|
+
|
151
|
+
<pre>
|
152
|
+
rails generate themes_for_rails:install
|
153
|
+
</pre>
|
154
|
+
|
155
|
+
Inside the themes folder, it create a structure for my_theme.
|
156
|
+
|
157
|
+
<pre>
|
158
|
+
rails generate themes_for_rails:theme my_theme
|
159
|
+
</pre>
|
160
|
+
|
161
|
+
h2. Changing things
|
162
|
+
|
163
|
+
At least for now, you can change the ThemesForRails base dir in your app, in the corresponding environment file, or in your application.rb file. Do it like this:
|
164
|
+
|
165
|
+
<pre>
|
166
|
+
KillerApp::Application.configure do
|
167
|
+
#
|
168
|
+
|
169
|
+
config.themes_for_rails.base_dir = File.join(Rails.root, "tmp")
|
170
|
+
|
171
|
+
#...
|
172
|
+
end
|
173
|
+
</pre>
|
174
|
+
|
175
|
+
Thanks to matheusca, now you can change the name of the theme's dir.
|
176
|
+
|
177
|
+
<pre>
|
178
|
+
KillerApp::Application.configure do
|
179
|
+
#
|
180
|
+
|
181
|
+
config.themes_for_rails.themes_dir = "another_themes"
|
182
|
+
|
183
|
+
#...
|
184
|
+
end
|
185
|
+
</pre>
|
186
|
+
|
187
|
+
h2. Sass support
|
188
|
+
|
189
|
+
ThemesForRails will automatically add the themes paths to Sass, if sass is available.
|
190
|
+
|
191
|
+
For instance, everything you put inside themes/my_theme/stylesheets/sass will get compiled into themes/my_theme/stylesheets (duh, right?)
|
192
|
+
|
193
|
+
To bypass sass configuration, do this:
|
194
|
+
<pre>
|
195
|
+
KillerApp::Application.configure do
|
196
|
+
#
|
197
|
+
|
198
|
+
config.themes_for_rails.use_sass = false
|
199
|
+
|
200
|
+
#...
|
201
|
+
end
|
202
|
+
</pre>
|
203
|
+
|
204
|
+
h2. Another way to change things
|
205
|
+
|
206
|
+
If you don't like this approach and prefer something more like an initializer file, you could create one an put something like this.
|
207
|
+
|
208
|
+
<pre>
|
209
|
+
# Rails.root/config/initializers/themes_for_rails.rb (for instance)
|
210
|
+
ThemesForRails.config do |config|
|
211
|
+
#
|
212
|
+
config.themes_dir = 'another_themes'
|
213
|
+
# ...
|
214
|
+
end
|
215
|
+
</pre>
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
h2. Notes and Warnings.
|
220
|
+
|
221
|
+
If you are running an app in production mode, and you get the static files with no content, is because you don't have X-senfile enabled at your web server.
|
222
|
+
|
223
|
+
You can do two things:
|
224
|
+
|
225
|
+
comment out this line in your production.rb file:
|
226
|
+
|
227
|
+
config.action_dispatch.x_sendfile_header = "X-Sendfile"
|
228
|
+
|
229
|
+
or
|
230
|
+
|
231
|
+
configure your web server to use it. :)
|
11
232
|
|
12
|
-
This gem works with Rails from version 3.0 to at least 3.2.1 (current at the moment of writing this readme file).
|
13
233
|
|
14
234
|
h2. Documentation
|
15
235
|
|
16
|
-
|
17
|
-
* "Wiki":https://github.com/lucasefe/themes_for_rails/wiki
|
18
|
-
* "Old Readme File":https://github.com/lucasefe/themes_for_rails/blob/master/doc/README.textile
|
236
|
+
"Read it here":http://rubydoc.info/github/lucasefe/themes_for_rails/master/frames
|
19
237
|
|
20
|
-
h2. Ideas
|
238
|
+
h2. Ideas
|
21
239
|
|
22
240
|
* Add ThemesForRails::Railtie for configuration, so we selectively set the plugin on or off. Also to be able to change several settings.
|
23
241
|
* -Add routes to allow access to the theme's static resources (js and cs), unless cached on public folder by capistrano / rake.-
|
24
242
|
* -Extend Action View path in order to make the views accessible. Same for the layouts.-
|
25
243
|
* More tests ford edge cases. Now I am only testing the happy paths.
|
26
244
|
|
245
|
+
h2. Things to remember.
|
246
|
+
|
247
|
+
* -Final version should be a gem. Initialization hooks doesn't work when using this as a plugin (vendor/plugins).-
|
248
|
+
* -Research about testing this kind of gem. I really don't have a clue.- Testing in place!
|
249
|
+
* I should probably load the theme list at start time, to be able to consult it as needed. I am gonna need that when dealing with runtime theme selection. Many themes are going to be used simultaneously, so I have to be able to switch view paths as fast as I can.
|
250
|
+
|
27
251
|
h2. Rails 2 Support
|
28
252
|
|
29
253
|
This gem only works with Rails 3 (duh). If you want the same exactly behavior, but for Rails 2.x, go "here":http://github.com/jystewart/theme_support .
|
30
254
|
|
255
|
+
|
31
256
|
h2. Running tests
|
32
257
|
|
33
258
|
<pre>
|
@@ -39,7 +264,6 @@ rake
|
|
39
264
|
h2. Authors and contributors
|
40
265
|
|
41
266
|
* lucasefe
|
42
|
-
* jedifreeman
|
43
267
|
* jbarreneche
|
44
268
|
* kule
|
45
269
|
* matheusmoreira
|
data/Rakefile
CHANGED
@@ -1,11 +1,31 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
require '
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
1
|
+
# require File.join(File.dirname(__FILE__), 'lib', 'themes_for_rails')
|
2
|
+
require File.dirname(__FILE__) + "/lib/themes_for_rails/version.rb"
|
3
|
+
|
4
|
+
require 'rake'
|
5
|
+
require 'rspec/core'
|
6
|
+
require 'rspec/core/rake_task'
|
7
|
+
|
8
|
+
desc 'Default: run rspec for all'
|
9
|
+
task :default => :spec
|
10
|
+
|
11
|
+
desc "Run the code examples"
|
12
|
+
RSpec::Core::RakeTask.new(:spec ) do |t|
|
13
|
+
t.pattern = "./spec/**/*_spec.rb"
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
begin
|
18
|
+
require 'jeweler'
|
19
|
+
Jeweler::Tasks.new do |gemspec|
|
20
|
+
gemspec.name = "themes_for_rails"
|
21
|
+
gemspec.summary = "Themes support for rails (3)"
|
22
|
+
gemspec.description = "It allows an application to have many different ways of rendering static assets and dynamic views."
|
23
|
+
gemspec.email = "lucasefe@gmail.com"
|
24
|
+
gemspec.homepage = "http://github.com/lucasefe/themes_for_rails"
|
25
|
+
gemspec.authors = ["Lucas Florio"]
|
26
|
+
gemspec.version = ThemesForRails::VERSION
|
27
|
+
gemspec.add_dependency "rails", "~> 3.1.0"
|
28
|
+
end
|
29
|
+
rescue LoadError
|
30
|
+
puts "Jeweler not available. Install it with: gem install jeweler"
|
31
|
+
end
|