puffer_pages 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +10 -2
- data/VERSION +1 -1
- data/app/models/page.rb +1 -1
- data/lib/puffer_pages/liquid/tags/yield.rb +3 -3
- data/puffer_pages.gemspec +3 -1
- data/spec/models/page_spec.rb +2 -2
- data/spec/models/tags_spec.rb +9 -0
- metadata +5 -3
data/README.md
CHANGED
@@ -26,7 +26,7 @@ namespace :admin do
|
|
26
26
|
resources :layouts
|
27
27
|
resources :snippets
|
28
28
|
end
|
29
|
-
|
29
|
+
</pre>
|
30
30
|
|
31
31
|
## Introduction.
|
32
32
|
|
@@ -50,7 +50,15 @@ In puffer pages you can use puffer pages layouts or applcation layouts.
|
|
50
50
|
For puffer pages layouts page parts placeholder is liquid tag yield.
|
51
51
|
<pre>{% yield [page_part_name] %}</pre>
|
52
52
|
|
53
|
-
If no page_part_name specified, puffer layout will use page part with default name (
|
53
|
+
If no page_part_name specified, puffer layout will use page part with default name ('body'). You can change defaul page part name in puffer pages setup initializer.
|
54
|
+
|
55
|
+
Ex.
|
56
|
+
<pre>
|
57
|
+
{% yield %} # renders body
|
58
|
+
{% yield 'sidebar' %} # renders sidebar
|
59
|
+
{% assign sb = 'sidebar' %}
|
60
|
+
{% yield sb %} # renders sidebar too
|
61
|
+
</pre>
|
54
62
|
|
55
63
|
### Application layouts.
|
56
64
|
For application layout page part body will be inserted instead of SUDDENLY! <%= yield %>
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.6
|
data/app/models/page.rb
CHANGED
@@ -3,20 +3,20 @@ module PufferPages
|
|
3
3
|
module Tags
|
4
4
|
|
5
5
|
class Yield < ::Liquid::Tag
|
6
|
-
Syntax = /(
|
6
|
+
Syntax = /(#{::Liquid::QuotedFragment}+)/
|
7
7
|
|
8
8
|
def initialize(tag_name, markup, tokens)
|
9
9
|
if markup =~ Syntax
|
10
10
|
@name = $1
|
11
11
|
else
|
12
|
-
@name = PufferPages.primary_page_part_name
|
12
|
+
@name = "'#{PufferPages.primary_page_part_name}'"
|
13
13
|
end
|
14
14
|
|
15
15
|
super
|
16
16
|
end
|
17
17
|
|
18
18
|
def render(context)
|
19
|
-
|
19
|
+
context.registers[:page].part(context[@name]).render(context)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
data/puffer_pages.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{puffer_pages}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["pyromaniac"]
|
@@ -126,6 +126,7 @@ Gem::Specification.new do |s|
|
|
126
126
|
"spec/fabricators/pages_fabricator.rb",
|
127
127
|
"spec/integration/navigation_spec.rb",
|
128
128
|
"spec/models/page_spec.rb",
|
129
|
+
"spec/models/tags_spec.rb",
|
129
130
|
"spec/puffer_pages_spec.rb",
|
130
131
|
"spec/spec_helper.rb"
|
131
132
|
]
|
@@ -165,6 +166,7 @@ Gem::Specification.new do |s|
|
|
165
166
|
"spec/fabricators/pages_fabricator.rb",
|
166
167
|
"spec/integration/navigation_spec.rb",
|
167
168
|
"spec/models/page_spec.rb",
|
169
|
+
"spec/models/tags_spec.rb",
|
168
170
|
"spec/puffer_pages_spec.rb",
|
169
171
|
"spec/spec_helper.rb"
|
170
172
|
]
|
data/spec/models/page_spec.rb
CHANGED
@@ -122,9 +122,9 @@ describe Page do
|
|
122
122
|
end
|
123
123
|
|
124
124
|
it 'should render layout' do
|
125
|
-
@layout = Fabricate :layout, :name => 'foo_layout', :body => "{% yield %}
|
125
|
+
@layout = Fabricate :layout, :name => 'foo_layout', :body => "|{% yield %}|{% yield 'sidebar' %}|{% assign sb = 'sidebar' %}|{% yield sb %}|"
|
126
126
|
result = @root.render 'self' => PufferPages::Liquid::PageDrop.new(@root)
|
127
|
-
result.should == "
|
127
|
+
result.should == "|#{@root.title}|#{@root.name}||#{@root.name}|"
|
128
128
|
end
|
129
129
|
|
130
130
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puffer_pages
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 6
|
10
|
+
version: 0.0.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- pyromaniac
|
@@ -313,6 +313,7 @@ files:
|
|
313
313
|
- spec/fabricators/pages_fabricator.rb
|
314
314
|
- spec/integration/navigation_spec.rb
|
315
315
|
- spec/models/page_spec.rb
|
316
|
+
- spec/models/tags_spec.rb
|
316
317
|
- spec/puffer_pages_spec.rb
|
317
318
|
- spec/spec_helper.rb
|
318
319
|
has_rdoc: true
|
@@ -381,5 +382,6 @@ test_files:
|
|
381
382
|
- spec/fabricators/pages_fabricator.rb
|
382
383
|
- spec/integration/navigation_spec.rb
|
383
384
|
- spec/models/page_spec.rb
|
385
|
+
- spec/models/tags_spec.rb
|
384
386
|
- spec/puffer_pages_spec.rb
|
385
387
|
- spec/spec_helper.rb
|