intersect_rails_layout 0.0.1
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/.gitignore +17 -0
- data/CHANGELOG.textile +55 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.textile +287 -0
- data/Rakefile +1 -0
- data/intersect_rails_layout.gemspec +22 -0
- data/lib/generators/layout/USAGE +20 -0
- data/lib/generators/layout/layout_generator.rb +86 -0
- data/lib/generators/layout/templates/application.css.scss +24 -0
- data/lib/generators/layout/templates/application.js +16 -0
- data/lib/generators/layout/templates/bootstrap-application.js +17 -0
- data/lib/generators/layout/templates/bootstrap2-application.html.erb +35 -0
- data/lib/generators/layout/templates/bootstrap2-application.html.haml +23 -0
- data/lib/generators/layout/templates/bootstrap2-messages.html.erb +9 -0
- data/lib/generators/layout/templates/bootstrap2-messages.html.haml +6 -0
- data/lib/generators/layout/templates/bootstrap2-navigation.html.erb +3 -0
- data/lib/generators/layout/templates/bootstrap2-navigation.html.haml +2 -0
- data/lib/generators/layout/templates/bootstrap2_and_overrides.css.scss +3 -0
- data/lib/generators/layout/templates/bootstrap3-application.html.erb +41 -0
- data/lib/generators/layout/templates/bootstrap3-application.html.haml +31 -0
- data/lib/generators/layout/templates/bootstrap3-messages.html.erb +9 -0
- data/lib/generators/layout/templates/bootstrap3-messages.html.haml +6 -0
- data/lib/generators/layout/templates/bootstrap3-navigation.html.erb +3 -0
- data/lib/generators/layout/templates/bootstrap3-navigation.html.haml +2 -0
- data/lib/generators/layout/templates/bootstrap3_and_overrides.css.scss +2 -0
- data/lib/generators/layout/templates/foundation4-application.html.erb +41 -0
- data/lib/generators/layout/templates/foundation4-application.html.haml +31 -0
- data/lib/generators/layout/templates/foundation4-application.js +20 -0
- data/lib/generators/layout/templates/foundation4-messages.html.erb +9 -0
- data/lib/generators/layout/templates/foundation4-messages.html.haml +6 -0
- data/lib/generators/layout/templates/foundation4-navigation.html.erb +3 -0
- data/lib/generators/layout/templates/foundation4-navigation.html.haml +2 -0
- data/lib/generators/layout/templates/foundation_and_overrides.css.scss +2 -0
- data/lib/generators/layout/templates/none-application.html.erb +14 -0
- data/lib/generators/layout/templates/none-application.html.haml +9 -0
- data/lib/generators/layout/templates/simple-application.html.erb +26 -0
- data/lib/generators/layout/templates/simple-application.html.haml +18 -0
- data/lib/generators/layout/templates/simple-messages.html.erb +5 -0
- data/lib/generators/layout/templates/simple-messages.html.haml +3 -0
- data/lib/generators/layout/templates/simple-navigation.html.erb +3 -0
- data/lib/generators/layout/templates/simple-navigation.html.haml +2 -0
- data/lib/generators/layout/templates/simple.css +45 -0
- data/lib/rails_layout/version.rb +3 -0
- data/lib/rails_layout.rb +5 -0
- metadata +125 -0
data/.gitignore
ADDED
data/CHANGELOG.textile
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
h1. CHANGELOG
|
2
|
+
|
3
|
+
h2. 0.2.2 November 2, 2013
|
4
|
+
|
5
|
+
* remove 'container' div from Bootstrap 3 application layout (issue #1)
|
6
|
+
|
7
|
+
h2. 0.2.1 November 2, 2013
|
8
|
+
|
9
|
+
* no turbolinks when used with Rails 3.2
|
10
|
+
|
11
|
+
h2. 0.2.0 October 31, 2013
|
12
|
+
|
13
|
+
* installs a framework by setting up files in the assets folder
|
14
|
+
|
15
|
+
h2. 0.1.9 October 20, 2013
|
16
|
+
|
17
|
+
* use class instead of id for simple CSS flash messages
|
18
|
+
|
19
|
+
h2. 0.1.8 October 19, 2013
|
20
|
+
|
21
|
+
* fix navigation
|
22
|
+
* fix Foundation messages partial
|
23
|
+
|
24
|
+
h2. 0.1.7 October 13, 2013
|
25
|
+
|
26
|
+
* support for Haml markup
|
27
|
+
|
28
|
+
h2. 0.1.6 October 13, 2013
|
29
|
+
|
30
|
+
* support for Zurb Foundation 4.0
|
31
|
+
|
32
|
+
h2. 0.1.5 October 12, 2013
|
33
|
+
|
34
|
+
* support for Twitter Bootstrap 3.0
|
35
|
+
|
36
|
+
h2. 0.1.4 September 20, 2013
|
37
|
+
|
38
|
+
* add simple stylesheet if there is no front-end framework
|
39
|
+
|
40
|
+
h2. 0.1.3 September 20, 2013
|
41
|
+
|
42
|
+
* add missing escape sequence to ERB delimiters
|
43
|
+
|
44
|
+
h2. 0.1.2 September 20, 2013
|
45
|
+
|
46
|
+
* add simple layout files
|
47
|
+
* add missing turbolinks attributes
|
48
|
+
|
49
|
+
h2. 0.1.1 September 19, 2013
|
50
|
+
|
51
|
+
* add navigation links for 'About' or 'Contact' if view files exist in expected locations
|
52
|
+
|
53
|
+
h2. 0.1.0 September 19, 2013
|
54
|
+
|
55
|
+
* support for Twitter Bootstrap 2.3
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Daniel Kehoe
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.textile
ADDED
@@ -0,0 +1,287 @@
|
|
1
|
+
h1. !http://railsapps.github.io/images/rails-36x36.jpg(RailsLayout Gem)! RailsLayout Gem
|
2
|
+
|
3
|
+
RailsLayout is a utility gem to use during development.
|
4
|
+
|
5
|
+
It is a Rails generator that you add to your Rails application Gemfile.
|
6
|
+
|
7
|
+
Use it to set up a front-end framework:
|
8
|
+
|
9
|
+
* Twitter Bootstrap 2.3
|
10
|
+
* Twitter Bootstrap 3.0
|
11
|
+
* Zurb Foundation 4.0
|
12
|
+
|
13
|
+
It will rename *application.css.css* to *application.css.scss*.
|
14
|
+
|
15
|
+
And modify the necessary asset files:
|
16
|
+
|
17
|
+
* application.js
|
18
|
+
|
19
|
+
and add either:
|
20
|
+
|
21
|
+
* bootstrap_and_overrides.css.scss
|
22
|
+
|
23
|
+
or:
|
24
|
+
|
25
|
+
* foundation_and_overrides.css.scss
|
26
|
+
|
27
|
+
It will set up a default application layout.
|
28
|
+
|
29
|
+
You also get partials for
|
30
|
+
|
31
|
+
* Rails flash messages
|
32
|
+
* navigation links
|
33
|
+
|
34
|
+
h4. Supported Frameworks
|
35
|
+
|
36
|
+
You can generate layout files suitable for use with the following front-end frameworks:
|
37
|
+
|
38
|
+
* @simple@ - simple layout
|
39
|
+
* @bootstrap2@ - Twitter Bootstrap 2.3
|
40
|
+
* @bootstrap3@ - Twitter Bootstrap 3.0
|
41
|
+
* @foundation4@ - Zurb Foundation 4.0
|
42
|
+
* @none@ - removes all changes
|
43
|
+
|
44
|
+
h4. Generated Files
|
45
|
+
|
46
|
+
The RailsLayout gem generates application layout files:
|
47
|
+
|
48
|
+
* app/views/layouts/application.html.erb
|
49
|
+
* app/views/layouts/_messages.html.erb
|
50
|
+
* app/views/layouts/_navigation.html.erb
|
51
|
+
|
52
|
+
Additionally, when the @simple@ option is selected:
|
53
|
+
|
54
|
+
* app/assets/stylesheets/simple.css
|
55
|
+
|
56
|
+
h4. Support for ERB or Haml
|
57
|
+
|
58
|
+
If you are using ERB for Rails views, the RailsLayout gem will generate ERB files.
|
59
|
+
|
60
|
+
If you are using Haml, the RailsLayout gem will generate Haml files instead.
|
61
|
+
|
62
|
+
h4. Rails Composer
|
63
|
+
|
64
|
+
The "Rails Composer":http://railsapps.github.io/rails-composer/ tool, an application template used to create starter applications, uses the RailsLayout gem to generate the layout files used in various starter applications. You can use Rails Composer to generate entire applications.
|
65
|
+
|
66
|
+
h2. Usage Example
|
67
|
+
|
68
|
+
To see how the generated files from the RailsLayout gem are used, see the "Learn Rails":https://github.com/RailsApps/learn-rails example application that is described in the book "Learn Ruby on Rails":http://learn-rails.com/learn-ruby-on-rails.html.
|
69
|
+
|
70
|
+
!http://railsapps.github.io/images/learn-rails-cover-130x161.jpg(Learn Ruby on Rails)!:http://learn-rails.com/learn-ruby-on-rails.html
|
71
|
+
|
72
|
+
h2. Installing a Front-End Framework
|
73
|
+
|
74
|
+
Instead of following the "instructions for Twitter Bootstrap":http://railsapps.github.io/twitter-bootstrap-rails.html or "Zurb Foundation":http://foundation.zurb.com/docs/rails.html to install a front-end framework, add the gems you need. Then use the RailsLayout gem. It will set up your assets files.
|
75
|
+
|
76
|
+
h3. Install Gems for a Front-End Framework
|
77
|
+
|
78
|
+
Add the gems you need to your Rails application Gemfile:
|
79
|
+
|
80
|
+
h4. Twitter Bootstrap 2.3
|
81
|
+
|
82
|
+
<pre>
|
83
|
+
gem 'bootstrap-sass', '~> 2.3.2.2'
|
84
|
+
</pre>
|
85
|
+
|
86
|
+
h4. Twitter Bootstrap 3.0
|
87
|
+
|
88
|
+
<pre>
|
89
|
+
gem 'bootstrap-sass'
|
90
|
+
</pre>
|
91
|
+
|
92
|
+
h4. Zurb Foundation 4.0
|
93
|
+
|
94
|
+
<pre>
|
95
|
+
gem 'compass-rails', '~> 2.0.alpha.0'
|
96
|
+
gem 'zurb-foundation'
|
97
|
+
</pre>
|
98
|
+
|
99
|
+
Use Bundler to install the gems:
|
100
|
+
|
101
|
+
<pre>
|
102
|
+
$ bundle install
|
103
|
+
</pre>
|
104
|
+
|
105
|
+
h2. Install the RailsLayout Gem
|
106
|
+
|
107
|
+
Add it to your Rails application Gemfile:
|
108
|
+
|
109
|
+
<pre>
|
110
|
+
group :development do
|
111
|
+
gem 'rails_layout'
|
112
|
+
end
|
113
|
+
</pre>
|
114
|
+
|
115
|
+
You don't need the gem deployed to production, so put it in the @development@ group.
|
116
|
+
|
117
|
+
If you want to use a newer unreleased version from GitHub:
|
118
|
+
|
119
|
+
<pre>
|
120
|
+
group :development do
|
121
|
+
gem 'rails_layout', github: 'RailsApps/rails_layout'
|
122
|
+
end
|
123
|
+
</pre>
|
124
|
+
|
125
|
+
Use Bundler to install the gem:
|
126
|
+
|
127
|
+
<pre>
|
128
|
+
$ bundle install
|
129
|
+
</pre>
|
130
|
+
|
131
|
+
h2. Generate a Simple Layout
|
132
|
+
|
133
|
+
To create a set of simple layout files:
|
134
|
+
|
135
|
+
<pre>
|
136
|
+
$ rails generate layout simple
|
137
|
+
</pre>
|
138
|
+
|
139
|
+
Use @--force@ if you want to overwrite existing files:
|
140
|
+
|
141
|
+
<pre>
|
142
|
+
$ rails generate layout simple --force
|
143
|
+
</pre>
|
144
|
+
|
145
|
+
See the files that are generated:
|
146
|
+
|
147
|
+
* "app/views/layouts/application.html.erb":https://github.com/RailsApps/rails_layout/blob/master/lib/generators/layout/templates/simple-application.html.erb
|
148
|
+
* "app/views/layouts/_messages.html.erb":https://github.com/RailsApps/rails_layout/blob/master/lib/generators/layout/templates/simple-messages.html.erb
|
149
|
+
* "app/views/layouts/_navigation.html.erb":https://github.com/RailsApps/rails_layout/blob/master/lib/generators/layout/templates/simple-navigation.html.erb
|
150
|
+
* "app/assets/stylesheets/simple.css":https://github.com/RailsApps/rails_layout/blob/master/lib/generators/layout/templates/simple.css
|
151
|
+
|
152
|
+
The RailsLayout gem will create the file:
|
153
|
+
|
154
|
+
* "app/assets/stylesheets/application.css.scss":https://github.com/RailsApps/rails_layout/blob/master/lib/generators/layout/templates/application.css.scss
|
155
|
+
|
156
|
+
h2. Twitter Bootstrap 2.3 Layout
|
157
|
+
|
158
|
+
To create layout files for use with Twitter Bootstrap 2.3:
|
159
|
+
|
160
|
+
<pre>
|
161
|
+
$ rails generate layout bootstrap2
|
162
|
+
</pre>
|
163
|
+
|
164
|
+
Use @--force@ if you want to overwrite existing files:
|
165
|
+
|
166
|
+
<pre>
|
167
|
+
$ rails generate layout bootstrap2 --force
|
168
|
+
</pre>
|
169
|
+
|
170
|
+
See the files that are generated:
|
171
|
+
|
172
|
+
* "app/views/layouts/application.html.erb":https://github.com/RailsApps/rails_layout/blob/master/lib/generators/layout/templates/bootstrap2-application.html.erb
|
173
|
+
* "app/views/layouts/_messages.html.erb":https://github.com/RailsApps/rails_layout/blob/master/lib/generators/layout/templates/bootstrap2-messages.html.erb
|
174
|
+
* "app/views/layouts/_navigation.html.erb":https://github.com/RailsApps/rails_layout/blob/master/lib/generators/layout/templates/bootstrap2-navigation.html.erb
|
175
|
+
|
176
|
+
The RailsLayout gem will create the file:
|
177
|
+
|
178
|
+
* "app/assets/stylesheets/bootstrap_and_overrides.css.scss":https://github.com/RailsApps/rails_layout/blob/master/lib/generators/layout/templates/bootstrap2_and_overrides.css.scss
|
179
|
+
|
180
|
+
and modify the file:
|
181
|
+
|
182
|
+
* "app/assets/javascripts/application.js":https://github.com/RailsApps/rails_layout/blob/master/lib/generators/layout/templates/bootstrap-application.js
|
183
|
+
|
184
|
+
h2. Twitter Bootstrap 3.0 Layout
|
185
|
+
|
186
|
+
To create layout files for use with Twitter Bootstrap 3.0:
|
187
|
+
|
188
|
+
<pre>
|
189
|
+
$ rails generate layout bootstrap3
|
190
|
+
</pre>
|
191
|
+
|
192
|
+
Use @--force@ if you want to overwrite existing files:
|
193
|
+
|
194
|
+
<pre>
|
195
|
+
$ rails generate layout bootstrap3 --force
|
196
|
+
</pre>
|
197
|
+
|
198
|
+
See the files that are generated:
|
199
|
+
|
200
|
+
* "app/views/layouts/application.html.erb":https://github.com/RailsApps/rails_layout/blob/master/lib/generators/layout/templates/bootstrap3-application.html.erb
|
201
|
+
* "app/views/layouts/_messages.html.erb":https://github.com/RailsApps/rails_layout/blob/master/lib/generators/layout/templates/bootstrap3-messages.html.erb
|
202
|
+
* "app/views/layouts/_navigation.html.erb":https://github.com/RailsApps/rails_layout/blob/master/lib/generators/layout/templates/bootstrap3-navigation.html.erb
|
203
|
+
|
204
|
+
The RailsLayout gem will create the file:
|
205
|
+
|
206
|
+
* "app/assets/stylesheets/bootstrap_and_overrides.css.scss":https://github.com/RailsApps/rails_layout/blob/master/lib/generators/layout/templates/bootstrap3_and_overrides.css.scss
|
207
|
+
|
208
|
+
and modify the file:
|
209
|
+
|
210
|
+
* "app/assets/javascripts/application.js":https://github.com/RailsApps/rails_layout/blob/master/lib/generators/layout/templates/bootstrap-application.js
|
211
|
+
|
212
|
+
h2. Zurb Foundation 4.0 Layout
|
213
|
+
|
214
|
+
To create layout files for use with Zurb Foundation 4.0:
|
215
|
+
|
216
|
+
<pre>
|
217
|
+
$ rails generate layout foundation4
|
218
|
+
</pre>
|
219
|
+
|
220
|
+
Use @--force@ if you want to overwrite existing files:
|
221
|
+
|
222
|
+
<pre>
|
223
|
+
$ rails generate layout foundation4 --force
|
224
|
+
</pre>
|
225
|
+
|
226
|
+
See the files that are generated:
|
227
|
+
|
228
|
+
* "app/views/layouts/application.html.erb":https://github.com/RailsApps/rails_layout/blob/master/lib/generators/layout/templates/foundation4-application.html.erb
|
229
|
+
* "app/views/layouts/_messages.html.erb":https://github.com/RailsApps/rails_layout/blob/master/lib/generators/layout/templates/foundation4-messages.html.erb
|
230
|
+
* "app/views/layouts/_navigation.html.erb":https://github.com/RailsApps/rails_layout/blob/master/lib/generators/layout/templates/foundation4-navigation.html.erb
|
231
|
+
|
232
|
+
The RailsLayout gem will create the file:
|
233
|
+
|
234
|
+
* "app/assets/stylesheets/foundation_and_overrides.css.scss":https://github.com/RailsApps/rails_layout/blob/master/lib/generators/layout/templates/foundation_and_overrides.css.scss
|
235
|
+
|
236
|
+
and modify the file:
|
237
|
+
|
238
|
+
* "app/assets/javascripts/application.js":https://github.com/RailsApps/rails_layout/blob/master/lib/generators/layout/templates/foundation4-application.js
|
239
|
+
|
240
|
+
h2. Reverting to None
|
241
|
+
|
242
|
+
To revert your application to a default application layout:
|
243
|
+
|
244
|
+
<pre>
|
245
|
+
$ rails generate layout none
|
246
|
+
</pre>
|
247
|
+
|
248
|
+
The RailsLayout gem will remove files it may have added:
|
249
|
+
|
250
|
+
* app/views/layouts/_messages.html.erb
|
251
|
+
* app/views/layouts/_navigation.html.erb
|
252
|
+
* app/assets/stylesheets/simple.css
|
253
|
+
* app/assets/stylesheets/bootstrap_and_overrides.css.scss
|
254
|
+
* app/assets/stylesheets/foundation_and_overrides.css.scss
|
255
|
+
|
256
|
+
Additionally, it will restore these files to the default versions:
|
257
|
+
|
258
|
+
* app/views/layouts/application.html.erb
|
259
|
+
* app/assets/javascripts/application.js
|
260
|
+
|
261
|
+
The file *app/assets/stylesheets/application.css.scss* will contain a CSS rule but you can ignore it or remove it.
|
262
|
+
|
263
|
+
h2. Help
|
264
|
+
|
265
|
+
To see help messages:
|
266
|
+
|
267
|
+
<pre>
|
268
|
+
$ rails generate layout --help
|
269
|
+
</pre>
|
270
|
+
|
271
|
+
h2. Issues
|
272
|
+
|
273
|
+
Any issues? Please create an "issue":http://github.com/RailsApps/rails_layout/issues on GitHub. Reporting issues (and patching!) helps everyone.
|
274
|
+
|
275
|
+
h2. Credits
|
276
|
+
|
277
|
+
Daniel Kehoe maintains this gem as part of the "RailsApps project":http://railsapps.github.io/.
|
278
|
+
|
279
|
+
Please see the "CHANGELOG":https://github.com/RailsApps/rails_layout/blob/master/CHANGELOG.textile for a list of contributors.
|
280
|
+
|
281
|
+
Is the gem useful to you? Follow the project on Twitter: "@rails_apps":http://twitter.com/rails_apps. I'd love to know you were helped out by the gem.
|
282
|
+
|
283
|
+
h2. MIT License
|
284
|
+
|
285
|
+
"MIT License":http://www.opensource.org/licenses/mit-license
|
286
|
+
|
287
|
+
Copyright © 2013 Daniel Kehoe
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "intersect_rails_layout"
|
7
|
+
spec.version = "0.0.1"
|
8
|
+
spec.authors = ["Marc Ziani de Ferranti"]
|
9
|
+
spec.email = ["marc@intersect.org.au"]
|
10
|
+
spec.description = %q{Generates Rails application layout files for use with various front-end frameworks.}
|
11
|
+
spec.summary = %q{Rails generator creates application layout files for Twitter Bootstrap and other frameworks.}
|
12
|
+
spec.homepage = "http://github.com/RailsApps/rails_layout/"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files`.split($/)
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
21
|
+
spec.add_development_dependency "rake"
|
22
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Description:
|
2
|
+
Creates Rails layout files suitable for various front-end frameworks.
|
3
|
+
|
4
|
+
Creates files:
|
5
|
+
* app/views/layouts/application.html.erb
|
6
|
+
* app/views/layouts/_messages.html.erb
|
7
|
+
* app/views/layouts/_navigation.html.erb
|
8
|
+
* app/assets/stylesheets/simple.css (only for simple option)
|
9
|
+
|
10
|
+
Create simple layout files when no front-end framework is used:
|
11
|
+
rails generate layout simple
|
12
|
+
|
13
|
+
Create layout files suitable for Twitter Bootstrap 2.3:
|
14
|
+
rails generate layout bootstrap2
|
15
|
+
|
16
|
+
Create layout files suitable for Twitter Bootstrap 3.0:
|
17
|
+
rails generate layout bootstrap3
|
18
|
+
|
19
|
+
Create layout files suitable for Zurb Foundation 4.0:
|
20
|
+
rails generate layout foundation4
|
@@ -0,0 +1,86 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module Layout
|
4
|
+
module Generators
|
5
|
+
class LayoutGenerator < ::Rails::Generators::Base
|
6
|
+
source_root File.expand_path("../templates", __FILE__)
|
7
|
+
argument :framework_name, :type => :string, :default => "simple"
|
8
|
+
|
9
|
+
attr_reader :app_name
|
10
|
+
|
11
|
+
# Install the desired framework
|
12
|
+
def install_framework
|
13
|
+
remove_file 'app/assets/stylesheets/application.css'
|
14
|
+
copy_file 'application.css.scss', 'app/assets/stylesheets/application.css.scss'
|
15
|
+
case framework_name
|
16
|
+
when 'none'
|
17
|
+
copy_file 'application.js', 'app/assets/javascripts/application.js'
|
18
|
+
remove_file 'app/assets/stylesheets/simple.css'
|
19
|
+
remove_file 'app/assets/stylesheets/bootstrap_and_overrides.css.scss'
|
20
|
+
remove_file 'app/assets/stylesheets/foundation_and_overrides.css.scss'
|
21
|
+
when 'simple'
|
22
|
+
copy_file 'simple.css', 'app/assets/stylesheets/simple.css'
|
23
|
+
copy_file 'application.js', 'app/assets/javascripts/application.js'
|
24
|
+
remove_file 'app/assets/stylesheets/bootstrap_and_overrides.css.scss'
|
25
|
+
remove_file 'app/assets/stylesheets/foundation_and_overrides.css.scss'
|
26
|
+
when 'bootstrap2'
|
27
|
+
copy_file 'bootstrap2_and_overrides.css.scss', 'app/assets/stylesheets/bootstrap_and_overrides.css.scss'
|
28
|
+
copy_file 'bootstrap-application.js', 'app/assets/javascripts/application.js'
|
29
|
+
remove_file 'app/assets/stylesheets/simple.css'
|
30
|
+
remove_file 'app/assets/stylesheets/foundation_and_overrides.css.scss'
|
31
|
+
when 'bootstrap3'
|
32
|
+
copy_file 'bootstrap3_and_overrides.css.scss', 'app/assets/stylesheets/bootstrap_and_overrides.css.scss'
|
33
|
+
copy_file 'bootstrap-application.js', 'app/assets/javascripts/application.js'
|
34
|
+
remove_file 'app/assets/stylesheets/simple.css'
|
35
|
+
remove_file 'app/assets/stylesheets/foundation_and_overrides.css.scss'
|
36
|
+
when 'foundation4'
|
37
|
+
copy_file 'foundation_and_overrides.css.scss', 'app/assets/stylesheets/foundation_and_overrides.css.scss'
|
38
|
+
copy_file 'foundation4-application.js', 'app/assets/javascripts/application.js'
|
39
|
+
remove_file 'app/assets/stylesheets/simple.css'
|
40
|
+
remove_file 'app/assets/stylesheets/bootstrap_and_overrides.css.scss'
|
41
|
+
end
|
42
|
+
if Rails::VERSION::MAJOR.to_s == "3"
|
43
|
+
gsub_file 'app/assets/javascripts/application.js', /\/\/= require turbolinks\n/, ''
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# Create an application layout file with partials for messages and navigation
|
48
|
+
def generate_layout
|
49
|
+
app = ::Rails.application
|
50
|
+
@app_name = app.class.to_s.split("::").first
|
51
|
+
ext = app.config.generators.options[:rails][:template_engine] || :erb
|
52
|
+
template "#{framework_name}-application.html.#{ext}", "app/views/layouts/application.html.#{ext}"
|
53
|
+
if Rails::VERSION::MAJOR.to_s == "3"
|
54
|
+
gsub_file "app/views/layouts/application.html.#{ext}", /, "data-turbolinks-track" => true/, ''
|
55
|
+
end
|
56
|
+
if framework_name == 'none'
|
57
|
+
remove_file "app/views/layouts/_messages.html.#{ext}"
|
58
|
+
remove_file "app/views/layouts/_navigation.html.#{ext}"
|
59
|
+
else
|
60
|
+
copy_file "#{framework_name}-messages.html.#{ext}", "app/views/layouts/_messages.html.#{ext}"
|
61
|
+
copy_file "#{framework_name}-navigation.html.#{ext}", "app/views/layouts/_navigation.html.#{ext}"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# If 'About' or 'Contact' views exist in known locations, add navigation links
|
66
|
+
def add_navigation_links
|
67
|
+
unless framework_name == 'none'
|
68
|
+
# not yet accommodating Slim (we'll need different substitutions)
|
69
|
+
if File.exists?('app/views/pages/about.html.erb')
|
70
|
+
insert_into_file 'app/views/layouts/_navigation.html.erb', "\n <li><%= link_to 'About', page_path('about') %></li>", :before => "\n</ul>"
|
71
|
+
end
|
72
|
+
if File.exists?('app/views/contacts/new.html.erb')
|
73
|
+
insert_into_file 'app/views/layouts/_navigation.html.erb', "\n <li><%= link_to 'Contact', new_contact_path %></li>", :before => "\n</ul>"
|
74
|
+
end
|
75
|
+
if File.exists?('app/views/contacts/new.html.haml')
|
76
|
+
insert_into_file 'app/views/layouts/_navigation.html.haml', "\n %li= link_to 'Contact', new_contact_path", :after => "root_path"
|
77
|
+
end
|
78
|
+
if File.exists?('app/views/pages/about.html.haml')
|
79
|
+
insert_into_file 'app/views/layouts/_navigation.html.haml', "\n %li= link_to 'About', page_path('about')", :after => "root_path"
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
+
*
|
11
|
+
*= require_self
|
12
|
+
*= require_tree .
|
13
|
+
*/
|
14
|
+
.content {
|
15
|
+
background-color: #eee;
|
16
|
+
padding: 20px;
|
17
|
+
margin: 0 -20px;
|
18
|
+
-webkit-border-radius: 0 0 6px 6px;
|
19
|
+
-moz-border-radius: 0 0 6px 6px;
|
20
|
+
border-radius: 0 0 6px 6px;
|
21
|
+
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.15);
|
22
|
+
-moz-box-shadow: 0 1px 2px rgba(0,0,0,.15);
|
23
|
+
box-shadow: 0 1px 2px rgba(0,0,0,.15);
|
24
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require jquery
|
14
|
+
//= require jquery_ujs
|
15
|
+
//= require turbolinks
|
16
|
+
//= require_tree .
|
@@ -0,0 +1,17 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require jquery
|
14
|
+
//= require jquery_ujs
|
15
|
+
//= require turbolinks
|
16
|
+
//= require bootstrap
|
17
|
+
//= require_tree .
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
5
|
+
<title><%%= content_for?(:title) ? yield(:title) : "<%= app_name.underscore.titleize %>" %></title>
|
6
|
+
<meta name="description" content="<%%= content_for?(:description) ? yield(:description) : "<%= app_name.underscore.titleize %>" %>">
|
7
|
+
<%%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
|
8
|
+
<%%= javascript_include_tag "application", "data-turbolinks-track" => true %>
|
9
|
+
<%%= csrf_meta_tags %>
|
10
|
+
</head>
|
11
|
+
<body>
|
12
|
+
<%%# application layout styled for Twitter Bootstrap 2.3 %>
|
13
|
+
<header class="navbar navbar-fixed-top">
|
14
|
+
<nav class="navbar-inner">
|
15
|
+
<div class="container">
|
16
|
+
<%%= render 'layouts/navigation' %>
|
17
|
+
</div>
|
18
|
+
</nav>
|
19
|
+
</header>
|
20
|
+
<main role="main">
|
21
|
+
<div class="container">
|
22
|
+
<div class="content">
|
23
|
+
<div class="row">
|
24
|
+
<div class="span12">
|
25
|
+
<%%= render 'layouts/messages' %>
|
26
|
+
<%%= yield %>
|
27
|
+
</div>
|
28
|
+
</div>
|
29
|
+
<footer>
|
30
|
+
</footer>
|
31
|
+
</div>
|
32
|
+
</div>
|
33
|
+
</main>
|
34
|
+
</body>
|
35
|
+
</html>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
!!!
|
2
|
+
%html
|
3
|
+
%head
|
4
|
+
%meta{:name => "viewport", :content => "width=device-width, initial-scale=1.0"}
|
5
|
+
%title= content_for?(:title) ? yield(:title) : '<%= app_name.underscore.titleize %>'
|
6
|
+
%meta{:name => "description", :content => "#{content_for?(:description) ? yield(:description) : '<%= app_name.underscore.titleize %>'}"}
|
7
|
+
= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true
|
8
|
+
= javascript_include_tag "application", "data-turbolinks-track" => true
|
9
|
+
= csrf_meta_tags
|
10
|
+
%body
|
11
|
+
-# application layout styled for Twitter Bootstrap 2.3
|
12
|
+
%header.navbar.navbar-fixed-top
|
13
|
+
%nav.navbar-inner
|
14
|
+
.container
|
15
|
+
= render 'layouts/navigation'
|
16
|
+
%main{:role => "main"}
|
17
|
+
.container
|
18
|
+
.content
|
19
|
+
.row
|
20
|
+
.span12
|
21
|
+
= render 'layouts/messages'
|
22
|
+
= yield
|
23
|
+
%footer
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<%# Rails flash messages styled for Twitter Bootstrap 2.3 %>
|
2
|
+
<% flash.each do |name, msg| %>
|
3
|
+
<% if msg.is_a?(String) %>
|
4
|
+
<div class="alert alert-<%= name == :notice ? "success" : "error" %>">
|
5
|
+
<a class="close" data-dismiss="alert">×</a>
|
6
|
+
<%= content_tag :div, msg, :id => "flash_#{name}" %>
|
7
|
+
</div>
|
8
|
+
<% end %>
|
9
|
+
<% end %>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
-# Rails flash messages styled for Twitter Bootstrap 2.3
|
2
|
+
- flash.each do |name, msg|
|
3
|
+
- if msg.is_a?(String)
|
4
|
+
%div{:class => "alert alert-#{name == :notice ? "success" : "error"}"}
|
5
|
+
%a.close{"data-dismiss" => "alert"} ×
|
6
|
+
= content_tag :div, msg, :id => "flash_#{name}"
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
5
|
+
<title><%%= content_for?(:title) ? yield(:title) : "<%= app_name.underscore.titleize %>" %></title>
|
6
|
+
<meta name="description" content="<%%= content_for?(:description) ? yield(:description) : "<%= app_name.underscore.titleize %>" %>">
|
7
|
+
<%%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
|
8
|
+
<%%= javascript_include_tag "application", "data-turbolinks-track" => true %>
|
9
|
+
<%%= csrf_meta_tags %>
|
10
|
+
</head>
|
11
|
+
<body>
|
12
|
+
<%%# application layout styled for Twitter Bootstrap 3.0 %>
|
13
|
+
<header>
|
14
|
+
<nav class="navbar navbar-default navbar-fixed-top">
|
15
|
+
<div class="container">
|
16
|
+
<div class="navbar-header">
|
17
|
+
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
18
|
+
<span class="sr-only">Toggle navigation</span>
|
19
|
+
<span class="icon-bar"></span>
|
20
|
+
<span class="icon-bar"></span>
|
21
|
+
<span class="icon-bar"></span>
|
22
|
+
</button>
|
23
|
+
</div>
|
24
|
+
<div class="collapse navbar-collapse">
|
25
|
+
<%%= render 'layouts/navigation' %>
|
26
|
+
</div>
|
27
|
+
</div>
|
28
|
+
</nav>
|
29
|
+
</header>
|
30
|
+
<main role="main">
|
31
|
+
<div class="container">
|
32
|
+
<div class="row">
|
33
|
+
<div class="col-md-12">
|
34
|
+
<%%= render 'layouts/messages' %>
|
35
|
+
<%%= yield %>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
</div>
|
39
|
+
</main>
|
40
|
+
</body>
|
41
|
+
</html>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
!!!
|
2
|
+
%html
|
3
|
+
%head
|
4
|
+
%meta{:name => "viewport", :content => "width=device-width, initial-scale=1.0"}
|
5
|
+
%title= content_for?(:title) ? yield(:title) : '<%= app_name.underscore.titleize %>'
|
6
|
+
%meta{:name => "description", :content => "#{content_for?(:description) ? yield(:description) : '<%= app_name.underscore.titleize %>'}"}
|
7
|
+
= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true
|
8
|
+
= javascript_include_tag "application", "data-turbolinks-track" => true
|
9
|
+
= csrf_meta_tags
|
10
|
+
%body
|
11
|
+
-# application layout styled for Twitter Bootstrap 3.0
|
12
|
+
%header
|
13
|
+
%nav.navbar.navbar-default.navbar-fixed-top
|
14
|
+
.container
|
15
|
+
.navbar-header
|
16
|
+
%button.navbar-toggle{"data-target" => ".navbar-collapse", "data-toggle" => "collapse", :type => "button"}
|
17
|
+
%span.sr-only Toggle navigation
|
18
|
+
%span.icon-bar
|
19
|
+
%span.icon-bar
|
20
|
+
%span.icon-bar
|
21
|
+
.collapse.navbar-collapse
|
22
|
+
= render 'layouts/navigation'
|
23
|
+
%main{:role => "main"}
|
24
|
+
.container
|
25
|
+
.container
|
26
|
+
.content
|
27
|
+
.row
|
28
|
+
.col-md-12
|
29
|
+
= render 'layouts/messages'
|
30
|
+
= yield
|
31
|
+
%footer
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<%# Rails flash messages styled for Twitter Bootstrap 3.0 %>
|
2
|
+
<% flash.each do |name, msg| %>
|
3
|
+
<% if msg.is_a?(String) %>
|
4
|
+
<div class="alert alert-<%= name == :notice ? "success" : "danger" %>">
|
5
|
+
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
6
|
+
<%= content_tag :div, msg, :id => "flash_#{name}" %>
|
7
|
+
</div>
|
8
|
+
<% end %>
|
9
|
+
<% end %>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
-# Rails flash messages styled for Twitter Bootstrap 3.0
|
2
|
+
- flash.each do |name, msg|
|
3
|
+
- if msg.is_a?(String)
|
4
|
+
%div{:class => "alert alert-#{name == :notice ? "success" : "danger"}"}
|
5
|
+
%button.close{"aria-hidden" => "true", "data-dismiss" => "alert", :type => "button"} ×
|
6
|
+
= content_tag :div, msg, :id => "flash_#{name}"
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
5
|
+
<title><%%= content_for?(:title) ? yield(:title) : "<%= app_name.underscore.titleize %>" %></title>
|
6
|
+
<meta name="description" content="<%%= content_for?(:description) ? yield(:description) : "<%= app_name.underscore.titleize %>" %>">
|
7
|
+
<%%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
|
8
|
+
<%%# Modernizr is required for Zurb Foundation 4 %>
|
9
|
+
<%%= javascript_include_tag "vendor/custom.modernizr" %>
|
10
|
+
<%%= javascript_include_tag "application", "data-turbolinks-track" => true %>
|
11
|
+
<%%= csrf_meta_tags %>
|
12
|
+
</head>
|
13
|
+
<body>
|
14
|
+
<%%# application layout styled for Zurb Foundation 4 %>
|
15
|
+
<header>
|
16
|
+
<nav class="top-bar">
|
17
|
+
<ul class="title-area">
|
18
|
+
<li class="name"><!-- add site name or logo here --></li>
|
19
|
+
<li class="toggle-topbar menu-icon"><a href="#"><span>Menu</span></a></li>
|
20
|
+
</ul>
|
21
|
+
<section class="top-bar-section">
|
22
|
+
<%%= render 'layouts/navigation' %>
|
23
|
+
</section>
|
24
|
+
</nav>
|
25
|
+
</header>
|
26
|
+
<main role="main">
|
27
|
+
<div class="container">
|
28
|
+
<div class="content">
|
29
|
+
<div class="row">
|
30
|
+
<div class="twelve columns">
|
31
|
+
<%%= render 'layouts/messages' %>
|
32
|
+
<%%= yield %>
|
33
|
+
</div>
|
34
|
+
</div>
|
35
|
+
<footer>
|
36
|
+
</footer>
|
37
|
+
</div>
|
38
|
+
</div>
|
39
|
+
</main>
|
40
|
+
</body>
|
41
|
+
</html>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
!!!
|
2
|
+
%html
|
3
|
+
%head
|
4
|
+
%meta{:name => "viewport", :content => "width=device-width, initial-scale=1.0"}
|
5
|
+
%title= content_for?(:title) ? yield(:title) : '<%= app_name.underscore.titleize %>'
|
6
|
+
%meta{:name => "description", :content => "#{content_for?(:description) ? yield(:description) : '<%= app_name.underscore.titleize %>'}"}
|
7
|
+
= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true
|
8
|
+
-# Modernizr is required for Zurb Foundation 4
|
9
|
+
= javascript_include_tag "vendor/custom.modernizr"
|
10
|
+
= javascript_include_tag "application", "data-turbolinks-track" => true
|
11
|
+
= csrf_meta_tags
|
12
|
+
%body
|
13
|
+
-# application layout styled for Zurb Foundation 4
|
14
|
+
%header
|
15
|
+
%nav.top-bar
|
16
|
+
%ul.title-area
|
17
|
+
%li.name
|
18
|
+
-# add site name or logo here
|
19
|
+
%li.toggle-topbar.menu-icon
|
20
|
+
%a{:href => "#"}
|
21
|
+
%span Menu
|
22
|
+
%section.top-bar-section
|
23
|
+
= render 'layouts/navigation'
|
24
|
+
%main{:role => "main"}
|
25
|
+
.container
|
26
|
+
.content
|
27
|
+
.row
|
28
|
+
.twelve.columns
|
29
|
+
= render 'layouts/messages'
|
30
|
+
= yield
|
31
|
+
%footer
|
@@ -0,0 +1,20 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require jquery
|
14
|
+
//= require jquery_ujs
|
15
|
+
//= require turbolinks
|
16
|
+
//= require foundation
|
17
|
+
//= require_tree .
|
18
|
+
$(function() {
|
19
|
+
$(document).foundation();
|
20
|
+
});
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<%# Rails flash messages styled for Zurb Foundation 4 %>
|
2
|
+
<% flash.each do |name, msg| %>
|
3
|
+
<% if msg.is_a?(String) %>
|
4
|
+
<div data-alert class="alert-box round <%= name == :notice ? "success" : "alert" %>">
|
5
|
+
<%= content_tag :div, msg %>
|
6
|
+
<a href="#" class="close">×</a>
|
7
|
+
</div>
|
8
|
+
<% end %>
|
9
|
+
<% end %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title><%= app_name.underscore.titleize %></title>
|
5
|
+
<%%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
|
6
|
+
<%%= javascript_include_tag "application", "data-turbolinks-track" => true %>
|
7
|
+
<%%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
5
|
+
<title><%%= content_for?(:title) ? yield(:title) : "<%= app_name.underscore.titleize %>" %></title>
|
6
|
+
<meta name="description" content="<%%= content_for?(:description) ? yield(:description) : "<%= app_name.underscore.titleize %>" %>">
|
7
|
+
<%%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
|
8
|
+
<%%= javascript_include_tag "application", "data-turbolinks-track" => true %>
|
9
|
+
<%%= csrf_meta_tags %>
|
10
|
+
</head>
|
11
|
+
<body>
|
12
|
+
<div class="container">
|
13
|
+
<header>
|
14
|
+
<%%= render 'layouts/navigation' %>
|
15
|
+
</header>
|
16
|
+
<main role="main">
|
17
|
+
<div class="content">
|
18
|
+
<%%= render 'layouts/messages' %>
|
19
|
+
<%%= yield %>
|
20
|
+
</div>
|
21
|
+
</main>
|
22
|
+
<footer>
|
23
|
+
</footer>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
!!!
|
2
|
+
%html
|
3
|
+
%head
|
4
|
+
%meta{:name => "viewport", :content => "width=device-width, initial-scale=1.0"}
|
5
|
+
%title= content_for?(:title) ? yield(:title) : '<%= app_name.underscore.titleize %>'
|
6
|
+
%meta{:name => "description", :content => "#{content_for?(:description) ? yield(:description) : '<%= app_name.underscore.titleize %>'}"}
|
7
|
+
= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true
|
8
|
+
= javascript_include_tag "application", "data-turbolinks-track" => true
|
9
|
+
= csrf_meta_tags
|
10
|
+
%body
|
11
|
+
.container
|
12
|
+
%header
|
13
|
+
= render 'layouts/navigation'
|
14
|
+
%main{:role => "main"}
|
15
|
+
.content
|
16
|
+
= render 'layouts/messages'
|
17
|
+
= yield
|
18
|
+
%footer
|
@@ -0,0 +1,45 @@
|
|
1
|
+
/*
|
2
|
+
* Simple CSS stylesheet for a navigation bar and flash messages.
|
3
|
+
*/
|
4
|
+
header {
|
5
|
+
border: 1px solid #d4d4d4;
|
6
|
+
background-image: linear-gradient(to bottom, white, #f2f2f2);
|
7
|
+
background-color: #f9f9f9;
|
8
|
+
-webkit-box-shadow: 0 1px 10px rgba(0, 0, 0, 0.1);
|
9
|
+
-moz-box-shadow: 0 1px 10px rgba(0, 0, 0, 0.1);
|
10
|
+
box-shadow: 0 1px 10px rgba(0, 0, 0, 0.1);
|
11
|
+
margin-bottom: 20px;
|
12
|
+
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
13
|
+
}
|
14
|
+
ul.nav li {
|
15
|
+
display: inline;
|
16
|
+
}
|
17
|
+
ul.nav li a {
|
18
|
+
padding: 10px 15px 10px;
|
19
|
+
color: #777777;
|
20
|
+
text-decoration: none;
|
21
|
+
text-shadow: 0 1px 0 white;
|
22
|
+
}
|
23
|
+
.flash_notice, .flash_alert {
|
24
|
+
padding: 8px 35px 8px 14px;
|
25
|
+
margin-bottom: 20px;
|
26
|
+
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
|
27
|
+
border: 1px solid #fbeed5;
|
28
|
+
-webkit-border-radius: 4px;
|
29
|
+
-moz-border-radius: 4px;
|
30
|
+
border-radius: 4px;
|
31
|
+
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
32
|
+
font-size: 14px;
|
33
|
+
line-height: 20px;
|
34
|
+
}
|
35
|
+
.flash_notice {
|
36
|
+
background-color: #dff0d8;
|
37
|
+
border-color: #d6e9c6;
|
38
|
+
color: #468847;
|
39
|
+
}
|
40
|
+
.flash_alert {
|
41
|
+
background-color: #f2dede;
|
42
|
+
border-color: #eed3d7;
|
43
|
+
color: #b94a48;
|
44
|
+
}
|
45
|
+
|
data/lib/rails_layout.rb
ADDED
metadata
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: intersect_rails_layout
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Marc Ziani de Ferranti
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-11-05 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.3'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.3'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rake
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
description: Generates Rails application layout files for use with various front-end
|
47
|
+
frameworks.
|
48
|
+
email:
|
49
|
+
- marc@intersect.org.au
|
50
|
+
executables: []
|
51
|
+
extensions: []
|
52
|
+
extra_rdoc_files: []
|
53
|
+
files:
|
54
|
+
- .gitignore
|
55
|
+
- CHANGELOG.textile
|
56
|
+
- Gemfile
|
57
|
+
- LICENSE.txt
|
58
|
+
- README.textile
|
59
|
+
- Rakefile
|
60
|
+
- intersect_rails_layout.gemspec
|
61
|
+
- lib/generators/layout/USAGE
|
62
|
+
- lib/generators/layout/layout_generator.rb
|
63
|
+
- lib/generators/layout/templates/application.css.scss
|
64
|
+
- lib/generators/layout/templates/application.js
|
65
|
+
- lib/generators/layout/templates/bootstrap-application.js
|
66
|
+
- lib/generators/layout/templates/bootstrap2-application.html.erb
|
67
|
+
- lib/generators/layout/templates/bootstrap2-application.html.haml
|
68
|
+
- lib/generators/layout/templates/bootstrap2-messages.html.erb
|
69
|
+
- lib/generators/layout/templates/bootstrap2-messages.html.haml
|
70
|
+
- lib/generators/layout/templates/bootstrap2-navigation.html.erb
|
71
|
+
- lib/generators/layout/templates/bootstrap2-navigation.html.haml
|
72
|
+
- lib/generators/layout/templates/bootstrap2_and_overrides.css.scss
|
73
|
+
- lib/generators/layout/templates/bootstrap3-application.html.erb
|
74
|
+
- lib/generators/layout/templates/bootstrap3-application.html.haml
|
75
|
+
- lib/generators/layout/templates/bootstrap3-messages.html.erb
|
76
|
+
- lib/generators/layout/templates/bootstrap3-messages.html.haml
|
77
|
+
- lib/generators/layout/templates/bootstrap3-navigation.html.erb
|
78
|
+
- lib/generators/layout/templates/bootstrap3-navigation.html.haml
|
79
|
+
- lib/generators/layout/templates/bootstrap3_and_overrides.css.scss
|
80
|
+
- lib/generators/layout/templates/foundation4-application.html.erb
|
81
|
+
- lib/generators/layout/templates/foundation4-application.html.haml
|
82
|
+
- lib/generators/layout/templates/foundation4-application.js
|
83
|
+
- lib/generators/layout/templates/foundation4-messages.html.erb
|
84
|
+
- lib/generators/layout/templates/foundation4-messages.html.haml
|
85
|
+
- lib/generators/layout/templates/foundation4-navigation.html.erb
|
86
|
+
- lib/generators/layout/templates/foundation4-navigation.html.haml
|
87
|
+
- lib/generators/layout/templates/foundation_and_overrides.css.scss
|
88
|
+
- lib/generators/layout/templates/none-application.html.erb
|
89
|
+
- lib/generators/layout/templates/none-application.html.haml
|
90
|
+
- lib/generators/layout/templates/simple-application.html.erb
|
91
|
+
- lib/generators/layout/templates/simple-application.html.haml
|
92
|
+
- lib/generators/layout/templates/simple-messages.html.erb
|
93
|
+
- lib/generators/layout/templates/simple-messages.html.haml
|
94
|
+
- lib/generators/layout/templates/simple-navigation.html.erb
|
95
|
+
- lib/generators/layout/templates/simple-navigation.html.haml
|
96
|
+
- lib/generators/layout/templates/simple.css
|
97
|
+
- lib/rails_layout.rb
|
98
|
+
- lib/rails_layout/version.rb
|
99
|
+
homepage: http://github.com/RailsApps/rails_layout/
|
100
|
+
licenses:
|
101
|
+
- MIT
|
102
|
+
post_install_message:
|
103
|
+
rdoc_options: []
|
104
|
+
require_paths:
|
105
|
+
- lib
|
106
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
107
|
+
none: false
|
108
|
+
requirements:
|
109
|
+
- - ! '>='
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
requirements: []
|
119
|
+
rubyforge_project:
|
120
|
+
rubygems_version: 1.8.23
|
121
|
+
signing_key:
|
122
|
+
specification_version: 3
|
123
|
+
summary: Rails generator creates application layout files for Twitter Bootstrap and
|
124
|
+
other frameworks.
|
125
|
+
test_files: []
|