nestive 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/Gemfile.lock +45 -46
  2. data/README.md +139 -107
  3. data/lib/nestive/version.rb +1 -1
  4. data/nestive.gemspec +3 -3
  5. metadata +28 -27
@@ -1,42 +1,42 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nestive (0.1.0)
5
- rails (~> 3.0)
4
+ nestive (0.2.0)
5
+ rails (>= 3.0.0)
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
9
9
  specs:
10
- actionmailer (3.2.8)
11
- actionpack (= 3.2.8)
10
+ actionmailer (3.2.11)
11
+ actionpack (= 3.2.11)
12
12
  mail (~> 2.4.4)
13
- actionpack (3.2.8)
14
- activemodel (= 3.2.8)
15
- activesupport (= 3.2.8)
13
+ actionpack (3.2.11)
14
+ activemodel (= 3.2.11)
15
+ activesupport (= 3.2.11)
16
16
  builder (~> 3.0.0)
17
17
  erubis (~> 2.7.0)
18
18
  journey (~> 1.0.4)
19
19
  rack (~> 1.4.0)
20
20
  rack-cache (~> 1.2)
21
21
  rack-test (~> 0.6.1)
22
- sprockets (~> 2.1.3)
23
- activemodel (3.2.8)
24
- activesupport (= 3.2.8)
22
+ sprockets (~> 2.2.1)
23
+ activemodel (3.2.11)
24
+ activesupport (= 3.2.11)
25
25
  builder (~> 3.0.0)
26
- activerecord (3.2.8)
27
- activemodel (= 3.2.8)
28
- activesupport (= 3.2.8)
26
+ activerecord (3.2.11)
27
+ activemodel (= 3.2.11)
28
+ activesupport (= 3.2.11)
29
29
  arel (~> 3.0.2)
30
30
  tzinfo (~> 0.3.29)
31
- activeresource (3.2.8)
32
- activemodel (= 3.2.8)
33
- activesupport (= 3.2.8)
34
- activesupport (3.2.8)
31
+ activeresource (3.2.11)
32
+ activemodel (= 3.2.11)
33
+ activesupport (= 3.2.11)
34
+ activesupport (3.2.11)
35
35
  i18n (~> 0.6)
36
36
  multi_json (~> 1.0)
37
37
  arel (3.0.2)
38
38
  builder (3.0.4)
39
- combustion (0.3.2)
39
+ combustion (0.3.3)
40
40
  rails (>= 3.0.0)
41
41
  thor (>= 0.14.6)
42
42
  diff-lcs (1.1.3)
@@ -44,57 +44,56 @@ GEM
44
44
  hike (1.2.1)
45
45
  i18n (0.6.1)
46
46
  journey (1.0.4)
47
- json (1.7.5)
47
+ json (1.7.6)
48
48
  mail (2.4.4)
49
49
  i18n (>= 0.4.0)
50
50
  mime-types (~> 1.16)
51
51
  treetop (~> 1.4.8)
52
52
  mime-types (1.19)
53
- multi_json (1.3.7)
53
+ multi_json (1.5.0)
54
54
  polyglot (0.3.3)
55
- rack (1.4.1)
55
+ rack (1.4.4)
56
56
  rack-cache (1.2)
57
57
  rack (>= 0.4)
58
- rack-ssl (1.3.2)
58
+ rack-ssl (1.3.3)
59
59
  rack
60
60
  rack-test (0.6.2)
61
61
  rack (>= 1.0)
62
- rails (3.2.8)
63
- actionmailer (= 3.2.8)
64
- actionpack (= 3.2.8)
65
- activerecord (= 3.2.8)
66
- activeresource (= 3.2.8)
67
- activesupport (= 3.2.8)
62
+ rails (3.2.11)
63
+ actionmailer (= 3.2.11)
64
+ actionpack (= 3.2.11)
65
+ activerecord (= 3.2.11)
66
+ activeresource (= 3.2.11)
67
+ activesupport (= 3.2.11)
68
68
  bundler (~> 1.0)
69
- railties (= 3.2.8)
70
- railties (3.2.8)
71
- actionpack (= 3.2.8)
72
- activesupport (= 3.2.8)
69
+ railties (= 3.2.11)
70
+ railties (3.2.11)
71
+ actionpack (= 3.2.11)
72
+ activesupport (= 3.2.11)
73
73
  rack-ssl (~> 1.3.2)
74
74
  rake (>= 0.8.7)
75
75
  rdoc (~> 3.4)
76
76
  thor (>= 0.14.6, < 2.0)
77
- rake (0.9.2.2)
77
+ rake (10.0.3)
78
78
  rdoc (3.12)
79
79
  json (~> 1.4)
80
- rspec (2.11.0)
81
- rspec-core (~> 2.11.0)
82
- rspec-expectations (~> 2.11.0)
83
- rspec-mocks (~> 2.11.0)
84
- rspec-core (2.11.1)
85
- rspec-expectations (2.11.3)
80
+ rspec-core (2.12.2)
81
+ rspec-expectations (2.12.1)
86
82
  diff-lcs (~> 1.1.3)
87
- rspec-mocks (2.11.3)
88
- rspec-rails (2.11.4)
83
+ rspec-mocks (2.12.2)
84
+ rspec-rails (2.12.2)
89
85
  actionpack (>= 3.0)
90
86
  activesupport (>= 3.0)
91
87
  railties (>= 3.0)
92
- rspec (~> 2.11.0)
93
- sprockets (2.1.3)
88
+ rspec-core (~> 2.12.0)
89
+ rspec-expectations (~> 2.12.0)
90
+ rspec-mocks (~> 2.12.0)
91
+ sprockets (2.2.2)
94
92
  hike (~> 1.2)
93
+ multi_json (~> 1.0)
95
94
  rack (~> 1.0)
96
95
  tilt (~> 1.1, != 1.3.0)
97
- thor (0.16.0)
96
+ thor (0.17.0)
98
97
  tilt (1.3.3)
99
98
  treetop (1.4.12)
100
99
  polyglot
@@ -105,6 +104,6 @@ PLATFORMS
105
104
  ruby
106
105
 
107
106
  DEPENDENCIES
108
- combustion (~> 0.3.2)
107
+ combustion (~> 0.3.3)
109
108
  nestive!
110
- rspec-rails (~> 2.11)
109
+ rspec-rails (~> 2.12)
data/README.md CHANGED
@@ -16,15 +16,19 @@ Nestive is *better* because it addresses these problems.
16
16
 
17
17
  The `area` helper is a lot like Rails' own `<%= yield :foo %>`, and is used in layouts to define and render a chunk of content in your layout:
18
18
 
19
- <%= area :sidebar %>
19
+ ``` erb
20
+ <%= area :sidebar %>
21
+ ```
20
22
 
21
23
  Unlike `yield`, `area` will allow your parent layouts to add content to the area at the same time using either a String or a block:
22
24
 
23
- <%= area :sidebar, "Some Content Here" %>
25
+ ``` erb
26
+ <%= area :sidebar, "Some Content Here" %>
24
27
 
25
- <%= area :sidebar do %>
26
- Some Content Here
27
- <% end %>
28
+ <%= area :sidebar do %>
29
+ Some Content Here
30
+ <% end %>
31
+ ```
28
32
 
29
33
  It's important to note that this isn't *default* content, it *is* the content (unless a child changes it).
30
34
 
@@ -32,147 +36,175 @@ It's important to note that this isn't *default* content, it *is* the content (u
32
36
 
33
37
  The implementation details are quite different, but the `append` helper works much like Rails' built-in `content_for`. It will work with either a String or block, adding the new content onto the end of any content previously provided by parent layouts:
34
38
 
35
- <%= extends :application do %>
36
- <% append :sidebar, "More content." %>
37
- <% append :sidebar do %>
38
- More content.
39
- <% end %>
40
- <% end %>
39
+ ``` erb
40
+ <%= extends :application do %>
41
+ <% append :sidebar, "More content." %>
42
+ <% append :sidebar do %>
43
+ More content.
44
+ <% end %>
45
+ <% end %>
46
+ ```
41
47
 
42
48
  ### Prepending content to an area:
43
49
 
44
50
  Exactly what you think it is. The reverse of `append` (duh), adding the new content at the start of any content previously provided by parent layouts:
45
51
 
46
- <%= extends :application do %>
47
- <%= prepend :sidebar, "Content." %>
48
- <%= prepend :sidebar do %>
49
- Content.
50
- <% end %>
51
- <% end %>
52
+ ``` erb
53
+ <%= extends :application do %>
54
+ <%= prepend :sidebar, "Content." %>
55
+ <%= prepend :sidebar do %>
56
+ Content.
57
+ <% end %>
58
+ <% end %>
59
+ ```
52
60
 
53
61
  ### Replacing content
54
62
 
55
63
  You can also replace any content provided by parent layouts:
56
64
 
57
- <%= extends :application do %>
58
- <%= replace :sidebar, "New content." %>
59
- <%= replace :sidebar do %>
60
- New content.
61
- <% end %>
62
- <% end %>
65
+ ``` erb
66
+ <%= extends :application do %>
67
+ <%= replace :sidebar, "New content." %>
68
+ <%= replace :sidebar do %>
69
+ New content.
70
+ <% end %>
71
+ <% end %>
72
+ ```
63
73
 
64
74
  ### Extending a layout in a child layout (or view):
65
75
 
66
76
  Any layout (or view) can declare that it wants to inherit from and extend a parent layout, in this case we're extending `app/views/layouts/application.html.erb`:
67
77
 
68
- <%= extends :application do %>
69
- ...
70
- <% end %>
78
+ ``` erb
79
+ <%= extends :application do %>
80
+ ...
81
+ <% end %>
82
+ ```
71
83
 
72
84
  You can nest many levels deep:
73
85
 
74
- # app/views/layouts/application.html.erb
75
- <!DOCTYPE html>
76
- <html>
77
- <head>
78
- <%= area :head do %>
79
- <title><%= area :title, 'Nestive' %></title>
80
- <% end %>
81
- </head>
82
- <body>
83
- <%= yield %>
84
- </body>
85
- </html>
86
-
87
- # app/views/layouts/with_sidebar.html.erb
88
- <%= extends :application do %>
89
- <div class="sidebar"><%= area(:sidebar) do %>
90
- here goes sidebar
91
- <% end %></div>
92
- <%= yield -%>
93
- <% end %>
94
-
95
- # app/views/layouts/blog_posts.html.erb
96
- <%= extends :with_sidebar do %>
97
- <% append :sidebar do %>
98
- Blog archive:
99
- <%= render_blog_archive %>
100
- <% end %>
86
+ `app/views/layouts/application.html.erb`:
101
87
 
102
- <% append :head do %>
103
- <%= javascript_include_tag 'fancy_blog_archive_tag_cloud' %>
88
+ ``` erb
89
+ <!DOCTYPE html>
90
+ <html>
91
+ <head>
92
+ <%= area :head do %>
93
+ <title><%= area :title, 'Nestive' %></title>
104
94
  <% end %>
105
-
106
- <%= yield %>
107
- <% end %>
108
-
109
-
95
+ </head>
96
+ <body>
97
+ <%= yield %>
98
+ </body>
99
+ </html>
100
+ ```
101
+
102
+ `app/views/layouts/with_sidebar.html.erb`:
103
+
104
+ ``` erb
105
+ <%= extends :application do %>
106
+ <div class="sidebar"><%= area(:sidebar) do %>
107
+ here goes sidebar
108
+ <% end %></div>
109
+ <%= yield -%>
110
+ <% end %>
111
+ ```
112
+
113
+ `app/views/layouts/blog_posts.html.erb`:
114
+
115
+ ``` erb
116
+ <%= extends :with_sidebar do %>
117
+ <% append :sidebar do %>
118
+ Blog archive:
119
+ <%= render_blog_archive %>
120
+ <% end %>
121
+
122
+ <% append :head do %>
123
+ <%= javascript_include_tag 'fancy_blog_archive_tag_cloud' %>
124
+ <% end %>
125
+
126
+ <%= yield %>
127
+ <% end %>
128
+ ```
110
129
 
111
130
  ## The token blog example
112
131
 
113
132
  Set-up a global layout defining some content areas.
114
133
 
115
- # app/views/layouts/application.html.erb
116
- <!DOCTYPE html>
117
- <html>
118
- <head>
119
- <meta charset="utf-8">
120
- <title><%= area :title, "JustinFrench.com" %></title>
121
- <meta name="description" content="<%= area :description, "This is my website." %>">
122
- <meta name="keywords" content="<%= area :keywords, "justin, french, ruby, design" %>">
123
- </head>
124
- <body>
125
- <div id="wrapper">
126
- <div id="content">
127
- <%= area :content do %>
128
- <p>Default content goes here.</p>
129
- <% end %>
130
- </div>
131
- <div id="sidebar">
132
- <%= area :sidebar do %>
133
- <h2>About Me</h2>
134
- <p>...</p>
135
- <% end %>
136
- </div>
137
- </div>
138
- <%= yield %>
139
- </body>
140
- </html>
134
+ `app/views/layouts/application.html.erb`:
135
+
136
+ ``` erb
137
+ <!DOCTYPE html>
138
+ <html>
139
+ <head>
140
+ <meta charset="utf-8">
141
+ <title><%= area :title, "JustinFrench.com" %></title>
142
+ <meta name="description" content="<%= area :description, "This is my website." %>">
143
+ <meta name="keywords" content="<%= area :keywords, "justin, french, ruby, design" %>">
144
+ </head>
145
+ <body>
146
+ <div id="wrapper">
147
+ <div id="content">
148
+ <%= area :content do %>
149
+ <p>Default content goes here.</p>
150
+ <% end %>
151
+ </div>
152
+ <div id="sidebar">
153
+ <%= area :sidebar do %>
154
+ <h2>About Me</h2>
155
+ <p>...</p>
156
+ <% end %>
157
+ </div>
158
+ </div>
159
+ <%= yield %>
160
+ </body>
161
+ </html>
162
+ ```
141
163
 
142
164
  Next, we set-up a `blog` layout that extends `application`, replacing, appending & prepending content to the areas we defined earlier.
143
165
 
144
- # app/views/layouts/blog.html.erb
145
- <%= extends :application do %>
146
- <% replace :title, "My Blog – " %>
147
- <% replace :description, "Justin French blogs here on Ruby, Rails, Design, Formtastic, etc" %>
148
- <% prepend :keywords, "blog, weblog, design links, ruby links, formtastic release notes, " %>
149
- <%= yield %>
150
- <% end %>
166
+ `app/views/layouts/blog.html.erb`:
167
+
168
+ ``` erb
169
+ <%= extends :application do %>
170
+ <% replace :title, "My Blog " %>
171
+ <% replace :description, "Justin French blogs here on Ruby, Rails, Design, Formtastic, etc" %>
172
+ <% prepend :keywords, "blog, weblog, design links, ruby links, formtastic release notes, " %>
173
+ <%= yield %>
174
+ <% end %>
175
+ ```
151
176
 
152
177
  Now in our blog index view we can use `blog` layout and fill in the areas with content specific to the index action.
153
178
 
154
- # app/views/posts/index.html.erb
155
- <% replace :content do %>
156
- <h1>My Blog</h1>
157
- <%= render @articles %>
158
- <% end %>
159
179
 
160
- <% append :sidebar do %>
161
- <h2>Blog Roll</h2>
162
- <%= render @links %>
163
- <% end %>
180
+ `app/views/posts/index.html.erb`:
181
+
182
+ ``` erb
183
+ <% replace :content do %>
184
+ <h1>My Blog</h1>
185
+ <%= render @articles %>
186
+ <% end %>
187
+
188
+ <% append :sidebar do %>
189
+ <h2>Blog Roll</h2>
190
+ <%= render @links %>
191
+ <% end %>
192
+ ```
164
193
 
165
194
  We also need to instruct the `PostsController` to use this `blog` layout:
166
195
 
167
- # app/controllers/posts_controller.rb
168
- class PostsController < ApplicationController
169
- layout 'blog'
170
- end
196
+ `app/controllers/posts_controller.rb`:
197
+
198
+ ``` ruby
199
+ class PostsController < ApplicationController
200
+ layout 'blog'
201
+ end
202
+ ```
171
203
 
172
204
 
173
205
  ## Installation
174
206
 
175
- * add `gem 'nestive', '~> 0.2'` to your gemfile
207
+ * add `gem 'nestive', '~> 0.2'` to your Gemfile
176
208
  * run `bundle`
177
209
 
178
210
  ## Compatibility
@@ -1,3 +1,3 @@
1
1
  module Nestive
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
@@ -19,8 +19,8 @@ Gem::Specification.new do |s|
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
20
  s.require_paths = ['lib']
21
21
 
22
- s.add_dependency 'rails', '~> 3.0'
23
- s.add_development_dependency 'combustion', '~> 0.3.2'
24
- s.add_development_dependency 'rspec-rails', '~> 2.11'
22
+ s.add_dependency 'rails', '>= 3.0.0'
23
+ s.add_development_dependency 'combustion', '~> 0.3.3'
24
+ s.add_development_dependency 'rspec-rails', '~> 2.12'
25
25
 
26
26
  end
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nestive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
5
4
  prerelease:
5
+ version: 0.2.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Justin French
@@ -10,56 +10,56 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-11-10 00:00:00.000000000 Z
13
+ date: 2013-02-02 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
+ prerelease: false
17
+ version_requirements: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 3.0.0
22
+ none: false
23
+ type: :runtime
16
24
  name: rails
17
25
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
26
  requirements:
20
- - - ~>
27
+ - - ! '>='
21
28
  - !ruby/object:Gem::Version
22
- version: '3.0'
23
- type: :runtime
29
+ version: 3.0.0
30
+ none: false
31
+ - !ruby/object:Gem::Dependency
24
32
  prerelease: false
25
33
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
34
  requirements:
28
35
  - - ~>
29
36
  - !ruby/object:Gem::Version
30
- version: '3.0'
31
- - !ruby/object:Gem::Dependency
37
+ version: 0.3.3
38
+ none: false
39
+ type: :development
32
40
  name: combustion
33
41
  requirement: !ruby/object:Gem::Requirement
34
- none: false
35
42
  requirements:
36
43
  - - ~>
37
44
  - !ruby/object:Gem::Version
38
- version: 0.3.2
39
- type: :development
45
+ version: 0.3.3
46
+ none: false
47
+ - !ruby/object:Gem::Dependency
40
48
  prerelease: false
41
49
  version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
50
  requirements:
44
51
  - - ~>
45
52
  - !ruby/object:Gem::Version
46
- version: 0.3.2
47
- - !ruby/object:Gem::Dependency
53
+ version: '2.12'
54
+ none: false
55
+ type: :development
48
56
  name: rspec-rails
49
57
  requirement: !ruby/object:Gem::Requirement
50
- none: false
51
58
  requirements:
52
59
  - - ~>
53
60
  - !ruby/object:Gem::Version
54
- version: '2.11'
55
- type: :development
56
- prerelease: false
57
- version_requirements: !ruby/object:Gem::Requirement
61
+ version: '2.12'
58
62
  none: false
59
- requirements:
60
- - - ~>
61
- - !ruby/object:Gem::Version
62
- version: '2.11'
63
63
  description: A Rails plugin/gem for awesome nested templates and layouts
64
64
  email:
65
65
  - justin@indent.com.au
@@ -110,20 +110,20 @@ rdoc_options: []
110
110
  require_paths:
111
111
  - lib
112
112
  required_ruby_version: !ruby/object:Gem::Requirement
113
- none: false
114
113
  requirements:
115
114
  - - ! '>='
116
115
  - !ruby/object:Gem::Version
117
116
  version: '0'
118
- required_rubygems_version: !ruby/object:Gem::Requirement
119
117
  none: false
118
+ required_rubygems_version: !ruby/object:Gem::Requirement
120
119
  requirements:
121
120
  - - ! '>='
122
121
  - !ruby/object:Gem::Version
123
122
  version: '0'
123
+ none: false
124
124
  requirements: []
125
125
  rubyforge_project: nestive
126
- rubygems_version: 1.8.24
126
+ rubygems_version: 1.8.25
127
127
  signing_key:
128
128
  specification_version: 3
129
129
  summary: A Rails plugin/gem for awesome nested templates and layouts
@@ -145,3 +145,4 @@ test_files:
145
145
  - spec/internal/log/.gitignore
146
146
  - spec/internal/public/favicon.ico
147
147
  - spec/spec_helper.rb
148
+ has_rdoc: