rails_layout 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.textile +4 -0
- data/README.textile +62 -18
- data/lib/generators/layout/.DS_Store +0 -0
- data/lib/generators/layout/USAGE +3 -0
- data/lib/generators/layout/layout_generator.rb +5 -0
- data/lib/generators/layout/templates/foundation4-application.html.erb +1 -1
- data/lib/generators/layout/templates/foundation4-application.html.haml +1 -1
- data/lib/generators/layout/templates/foundation4-messages.html.erb +1 -1
- data/lib/generators/layout/templates/foundation4-messages.html.haml +1 -1
- data/lib/generators/layout/templates/foundation5-application.html.erb +22 -0
- data/lib/generators/layout/templates/foundation5-application.html.haml +17 -0
- data/lib/generators/layout/templates/foundation5-application.js +20 -0
- data/lib/generators/layout/templates/foundation5-messages.html.erb +9 -0
- data/lib/generators/layout/templates/foundation5-messages.html.haml +6 -0
- data/lib/generators/layout/templates/foundation5-navigation.html.erb +12 -0
- data/lib/generators/layout/templates/foundation5-navigation.html.haml +11 -0
- data/lib/generators/layout/templates/foundation5_and_overrides.css.scss +48 -0
- data/lib/rails_layout/version.rb +1 -1
- metadata +11 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b969f789ec6da69a52b1751b38dd60bf183debe7
|
4
|
+
data.tar.gz: 87ca4674709e15dbf1c0584cc14369f12e143594
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3ba2b5a7ffe88116926d04388dcf7b9b45f6aacc8a61f3c5d9286ab6bdd9d468a597e0b72b6f9963f13f757b1a4b0853213f9d2bdb04bf1d9208b879678fa96
|
7
|
+
data.tar.gz: a5e4e08eb9792dd36a4006250f4740bcdb9c43bdff17c9c3fa42481b7b26d654616911dcf442d935db6ec69b445d6d0973d5ce8865e9589ee287516d56bb2d31
|
data/CHANGELOG.textile
CHANGED
data/README.textile
CHANGED
@@ -2,13 +2,14 @@ h1. !http://railsapps.github.io/images/rails-36x36.jpg(RailsLayout Gem)! RailsLa
|
|
2
2
|
|
3
3
|
RailsLayout is a utility gem to use during development.
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
Use it to set up a front-end framework:
|
5
|
+
Use it to set up your choice of front-end framework:
|
8
6
|
|
9
7
|
* Twitter Bootstrap 2.3
|
10
8
|
* Twitter Bootstrap 3.0
|
11
9
|
* Zurb Foundation 4.0
|
10
|
+
* Zurb Foundation 4.0
|
11
|
+
|
12
|
+
Add it to your Rails application Gemfile, then use the generator.
|
12
13
|
|
13
14
|
It will rename *application.css* to *application.css.scss*.
|
14
15
|
|
@@ -22,12 +23,12 @@ And modify the JavaScript asset file:
|
|
22
23
|
|
23
24
|
It will set up a default application layout.
|
24
25
|
|
25
|
-
|
26
|
+
It creates partials for:
|
26
27
|
|
27
28
|
* Rails flash messages
|
28
29
|
* navigation links
|
29
30
|
|
30
|
-
|
31
|
+
You can also generate a navigation links file suitable for use with Devise (the authentication gem).
|
31
32
|
|
32
33
|
h4. Supported Frameworks
|
33
34
|
|
@@ -37,6 +38,7 @@ You can generate layout files suitable for use with the following front-end fram
|
|
37
38
|
* @bootstrap2@ - Twitter Bootstrap 2.3
|
38
39
|
* @bootstrap3@ - Twitter Bootstrap 3.0
|
39
40
|
* @foundation4@ - Zurb Foundation 4.0
|
41
|
+
* @foundation5@ - Zurb Foundation 5.0
|
40
42
|
* @none@ - removes all changes
|
41
43
|
|
42
44
|
h4. Generated Files
|
@@ -56,12 +58,12 @@ h4. Note About the Navigation Partials
|
|
56
58
|
|
57
59
|
Two navigation partials are created:
|
58
60
|
|
59
|
-
* app/views/layouts/_navigation.html.erb
|
60
61
|
* app/views/layouts/_navigation_links.html.erb
|
62
|
+
* app/views/layouts/_navigation.html.erb
|
61
63
|
|
62
|
-
The first file
|
64
|
+
The first file contains no framework-specific styling. It is only a list of links. You can add additional links to this file as needed.
|
63
65
|
|
64
|
-
The second file contains
|
66
|
+
The second file contains framework-specific styling.
|
65
67
|
|
66
68
|
h4. Support for ERB or Haml
|
67
69
|
|
@@ -73,9 +75,9 @@ h4. Rails Composer
|
|
73
75
|
|
74
76
|
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.
|
75
77
|
|
76
|
-
|
78
|
+
h4. Usage Example
|
77
79
|
|
78
|
-
|
80
|
+
Look at the "Learn Rails":https://github.com/RailsApps/learn-rails example application to see how the generated files from the RailsLayout gem are used. You'll find details about the example application in the book "Learn Ruby on Rails":http://learn-rails.com/learn-ruby-on-rails.html.
|
79
81
|
|
80
82
|
!http://railsapps.github.io/images/learn-rails-cover-130x161.jpg(Learn Ruby on Rails)!:http://learn-rails.com/learn-ruby-on-rails.html
|
81
83
|
|
@@ -106,7 +108,15 @@ gem 'compass-rails', '~> 2.0.alpha.0'
|
|
106
108
|
gem 'zurb-foundation'
|
107
109
|
</pre>
|
108
110
|
|
109
|
-
|
111
|
+
h4. Zurb Foundation 5.0
|
112
|
+
|
113
|
+
<pre>
|
114
|
+
gem 'foundation-rails'
|
115
|
+
</pre>
|
116
|
+
|
117
|
+
h4. Use Bundler
|
118
|
+
|
119
|
+
Use Bundler to install the gem:
|
110
120
|
|
111
121
|
<pre>
|
112
122
|
$ bundle install
|
@@ -138,7 +148,11 @@ Use Bundler to install the gem:
|
|
138
148
|
$ bundle install
|
139
149
|
</pre>
|
140
150
|
|
141
|
-
h2. Generate
|
151
|
+
h2. Generate an Application Layout
|
152
|
+
|
153
|
+
Generate application layout files for the framework you will use.
|
154
|
+
|
155
|
+
h3. Generate a Simple Layout
|
142
156
|
|
143
157
|
To create a set of simple layout files:
|
144
158
|
|
@@ -163,7 +177,7 @@ The RailsLayout gem will create the file:
|
|
163
177
|
|
164
178
|
* "app/assets/stylesheets/application.css.scss":https://github.com/RailsApps/rails_layout/blob/master/lib/generators/layout/templates/application.css.scss
|
165
179
|
|
166
|
-
|
180
|
+
h3. Twitter Bootstrap 2.3 Layout
|
167
181
|
|
168
182
|
To create layout files for use with Twitter Bootstrap 2.3:
|
169
183
|
|
@@ -191,7 +205,7 @@ and modify the file:
|
|
191
205
|
|
192
206
|
* "app/assets/javascripts/application.js":https://github.com/RailsApps/rails_layout/blob/master/lib/generators/layout/templates/bootstrap-application.js
|
193
207
|
|
194
|
-
|
208
|
+
h3. Twitter Bootstrap 3.0 Layout
|
195
209
|
|
196
210
|
To create layout files for use with Twitter Bootstrap 3.0:
|
197
211
|
|
@@ -219,7 +233,7 @@ and modify the file:
|
|
219
233
|
|
220
234
|
* "app/assets/javascripts/application.js":https://github.com/RailsApps/rails_layout/blob/master/lib/generators/layout/templates/bootstrap-application.js
|
221
235
|
|
222
|
-
|
236
|
+
h3. Zurb Foundation 4.0 Layout
|
223
237
|
|
224
238
|
To create layout files for use with Zurb Foundation 4.0:
|
225
239
|
|
@@ -247,7 +261,35 @@ and modify the file:
|
|
247
261
|
|
248
262
|
* "app/assets/javascripts/application.js":https://github.com/RailsApps/rails_layout/blob/master/lib/generators/layout/templates/foundation4-application.js
|
249
263
|
|
250
|
-
|
264
|
+
h3. Zurb Foundation 5.0 Layout
|
265
|
+
|
266
|
+
To create layout files for use with Zurb Foundation 5.0:
|
267
|
+
|
268
|
+
<pre>
|
269
|
+
$ rails generate layout foundation5
|
270
|
+
</pre>
|
271
|
+
|
272
|
+
Use @--force@ if you want to overwrite existing files:
|
273
|
+
|
274
|
+
<pre>
|
275
|
+
$ rails generate layout foundation5 --force
|
276
|
+
</pre>
|
277
|
+
|
278
|
+
See the files that are generated:
|
279
|
+
|
280
|
+
* "app/views/layouts/application.html.erb":https://github.com/RailsApps/rails_layout/blob/master/lib/generators/layout/templates/foundation5-application.html.erb
|
281
|
+
* "app/views/layouts/_messages.html.erb":https://github.com/RailsApps/rails_layout/blob/master/lib/generators/layout/templates/foundation4-messages.html.erb
|
282
|
+
* "app/views/layouts/_navigation.html.erb":https://github.com/RailsApps/rails_layout/blob/master/lib/generators/layout/templates/foundation5-navigation.html.erb
|
283
|
+
|
284
|
+
The RailsLayout gem will create the file:
|
285
|
+
|
286
|
+
* "app/assets/stylesheets/framework_and_overrides.css.scss":https://github.com/RailsApps/rails_layout/blob/master/lib/generators/layout/templates/foundation5_and_overrides.css.scss
|
287
|
+
|
288
|
+
and modify the file:
|
289
|
+
|
290
|
+
* "app/assets/javascripts/application.js":https://github.com/RailsApps/rails_layout/blob/master/lib/generators/layout/templates/foundation5-application.js
|
291
|
+
|
292
|
+
h3. Reverting to None
|
251
293
|
|
252
294
|
To revert your application to a default application layout:
|
253
295
|
|
@@ -255,7 +297,7 @@ To revert your application to a default application layout:
|
|
255
297
|
$ rails generate layout none
|
256
298
|
</pre>
|
257
299
|
|
258
|
-
The RailsLayout gem will remove files it may have added:
|
300
|
+
The RailsLayout gem will remove any files it may have added:
|
259
301
|
|
260
302
|
* app/views/layouts/_messages.html.erb
|
261
303
|
* app/views/layouts/_navigation.html.erb
|
@@ -309,7 +351,9 @@ The full set of links will be created if the following files are found in your a
|
|
309
351
|
* app/views/devise/registrations/new.html.erb
|
310
352
|
* app/views/users/index.html.erb
|
311
353
|
|
312
|
-
|
354
|
+
These files will be present in your application if you have created custom views for Devise.
|
355
|
+
|
356
|
+
The @rails generate navigation@ command is used to populate the navigation bar in starter applications created by the "Rails Composer":http://railsapps.github.io/rails-composer/ tool.
|
313
357
|
|
314
358
|
h2. Help
|
315
359
|
|
Binary file
|
data/lib/generators/layout/USAGE
CHANGED
@@ -13,6 +13,9 @@ Description:
|
|
13
13
|
Create layout files suitable for Zurb Foundation 4.0:
|
14
14
|
rails generate layout foundation4
|
15
15
|
|
16
|
+
Create layout files suitable for Zurb Foundation 5.0:
|
17
|
+
rails generate layout foundation5
|
18
|
+
|
16
19
|
Remove layout files:
|
17
20
|
rails generate layout none
|
18
21
|
|
@@ -40,6 +40,11 @@ module Layout
|
|
40
40
|
copy_file 'foundation4-application.js', 'app/assets/javascripts/application.js'
|
41
41
|
remove_file 'app/assets/stylesheets/simple.css'
|
42
42
|
remove_file 'app/assets/stylesheets/bootstrap_and_overrides.css.scss'
|
43
|
+
when 'foundation5'
|
44
|
+
copy_file 'foundation5_and_overrides.css.scss', 'app/assets/stylesheets/framework_and_overrides.css.scss'
|
45
|
+
copy_file 'foundation5-application.js', 'app/assets/javascripts/application.js'
|
46
|
+
remove_file 'app/assets/stylesheets/simple.css'
|
47
|
+
remove_file 'app/assets/stylesheets/bootstrap_and_overrides.css.scss'
|
43
48
|
end
|
44
49
|
if Rails::VERSION::MAJOR.to_s == "3"
|
45
50
|
gsub_file 'app/assets/javascripts/application.js', /\/\/= require turbolinks\n/, ''
|
@@ -5,7 +5,7 @@
|
|
5
5
|
<title><%%= content_for?(:title) ? yield(:title) : "<%= app_name.underscore.titleize %>" %></title>
|
6
6
|
<meta name="description" content="<%%= content_for?(:description) ? yield(:description) : "<%= app_name.underscore.titleize %>" %>">
|
7
7
|
<%%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
|
8
|
-
<%%# Modernizr is required for Zurb Foundation
|
8
|
+
<%%# Modernizr is required for Zurb Foundation %>
|
9
9
|
<%%= javascript_include_tag "vendor/custom.modernizr" %>
|
10
10
|
<%%= javascript_include_tag "application", "data-turbolinks-track" => true %>
|
11
11
|
<%%= csrf_meta_tags %>
|
@@ -5,7 +5,7 @@
|
|
5
5
|
%title= content_for?(:title) ? yield(:title) : '<%= app_name.underscore.titleize %>'
|
6
6
|
%meta{:name => "description", :content => "#{content_for?(:description) ? yield(:description) : '<%= app_name.underscore.titleize %>'}"}
|
7
7
|
= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true
|
8
|
-
-# Modernizr is required for Zurb Foundation
|
8
|
+
-# Modernizr is required for Zurb Foundation
|
9
9
|
= javascript_include_tag "vendor/custom.modernizr"
|
10
10
|
= javascript_include_tag "application", "data-turbolinks-track" => true
|
11
11
|
= csrf_meta_tags
|
@@ -0,0 +1,22 @@
|
|
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 %>
|
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
|
+
<header>
|
15
|
+
<%%= render 'layouts/navigation' %>
|
16
|
+
</header>
|
17
|
+
<main role="main">
|
18
|
+
<%%= render 'layouts/messages' %>
|
19
|
+
<%%= yield %>
|
20
|
+
</main>
|
21
|
+
</body>
|
22
|
+
</html>
|
@@ -0,0 +1,17 @@
|
|
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
|
9
|
+
= javascript_include_tag "vendor/custom.modernizr"
|
10
|
+
= javascript_include_tag "application", "data-turbolinks-track" => true
|
11
|
+
= csrf_meta_tags
|
12
|
+
%body
|
13
|
+
%header
|
14
|
+
= render 'layouts/navigation'
|
15
|
+
%main{:role => "main"}
|
16
|
+
= render 'layouts/messages'
|
17
|
+
= yield
|
@@ -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 %>
|
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,12 @@
|
|
1
|
+
<%# navigation styled for Zurb Foundation 5 %>
|
2
|
+
<nav class="top-bar" "data-topbar">
|
3
|
+
<ul class="title-area">
|
4
|
+
<li class="name"><%= link_to 'Home', root_path %></li>
|
5
|
+
<li class="toggle-topbar menu-icon"><a href="#"><span>Menu</span></a></li>
|
6
|
+
</ul>
|
7
|
+
<div class="top-bar-section">
|
8
|
+
<ul>
|
9
|
+
<%= render 'layouts/navigation_links' %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
</nav>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
-# navigation styled for Zurb Foundation 5
|
2
|
+
%nav.top-bar{:data-topbar => true}
|
3
|
+
%ul.title-area
|
4
|
+
%li.name
|
5
|
+
= link_to 'Home', root_path
|
6
|
+
%li.toggle-topbar.menu-icon
|
7
|
+
%a{:href => "#"}
|
8
|
+
%span Menu
|
9
|
+
.top-bar-section
|
10
|
+
%ul
|
11
|
+
= render 'layouts/navigation_links'
|
@@ -0,0 +1,48 @@
|
|
1
|
+
// import the CSS framework
|
2
|
+
@import "foundation";
|
3
|
+
|
4
|
+
// override for the 'Home' navigation link
|
5
|
+
.top-bar .name {
|
6
|
+
font-size: 0.8125em;
|
7
|
+
line-height: 45px; }
|
8
|
+
.top-bar .name a {
|
9
|
+
font-weight: bold;
|
10
|
+
color: white;
|
11
|
+
padding: 0 15px; }
|
12
|
+
|
13
|
+
// THESE ARE EXAMPLES YOU CAN MODIFY
|
14
|
+
// create mixins using Foundation classes
|
15
|
+
@mixin twelve-columns {
|
16
|
+
@extend .small-12;
|
17
|
+
@extend .columns;
|
18
|
+
}
|
19
|
+
@mixin six-columns-centered {
|
20
|
+
@extend .small-6;
|
21
|
+
@extend .columns;
|
22
|
+
@extend .text-center;
|
23
|
+
}
|
24
|
+
// create your own classes
|
25
|
+
// to make views framework-neutral
|
26
|
+
.column {
|
27
|
+
@include six-columns-centered;
|
28
|
+
}
|
29
|
+
.form {
|
30
|
+
@include grid-column(6);
|
31
|
+
}
|
32
|
+
.form-centered {
|
33
|
+
@include six-columns-centered;
|
34
|
+
}
|
35
|
+
.submit {
|
36
|
+
@extend .button;
|
37
|
+
@extend .radius;
|
38
|
+
}
|
39
|
+
// apply styles to HTML elements
|
40
|
+
// to make views framework-neutral
|
41
|
+
main {
|
42
|
+
@include twelve-columns;
|
43
|
+
background-color: #eee;
|
44
|
+
}
|
45
|
+
section {
|
46
|
+
@extend .row;
|
47
|
+
margin-top: 20px;
|
48
|
+
}
|
data/lib/rails_layout/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_layout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Kehoe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,7 @@ files:
|
|
52
52
|
- LICENSE.txt
|
53
53
|
- README.textile
|
54
54
|
- Rakefile
|
55
|
+
- lib/generators/layout/.DS_Store
|
55
56
|
- lib/generators/layout/USAGE
|
56
57
|
- lib/generators/layout/layout_generator.rb
|
57
58
|
- lib/generators/layout/templates/application.css.scss
|
@@ -79,6 +80,14 @@ files:
|
|
79
80
|
- lib/generators/layout/templates/foundation4-navigation.html.erb
|
80
81
|
- lib/generators/layout/templates/foundation4-navigation.html.haml
|
81
82
|
- lib/generators/layout/templates/foundation4_and_overrides.css.scss
|
83
|
+
- lib/generators/layout/templates/foundation5-application.html.erb
|
84
|
+
- lib/generators/layout/templates/foundation5-application.html.haml
|
85
|
+
- lib/generators/layout/templates/foundation5-application.js
|
86
|
+
- lib/generators/layout/templates/foundation5-messages.html.erb
|
87
|
+
- lib/generators/layout/templates/foundation5-messages.html.haml
|
88
|
+
- lib/generators/layout/templates/foundation5-navigation.html.erb
|
89
|
+
- lib/generators/layout/templates/foundation5-navigation.html.haml
|
90
|
+
- lib/generators/layout/templates/foundation5_and_overrides.css.scss
|
82
91
|
- lib/generators/layout/templates/navigation_links.html.erb
|
83
92
|
- lib/generators/layout/templates/none-application.html.erb
|
84
93
|
- lib/generators/layout/templates/none-application.html.haml
|