rlayout 0.1.1 → 0.1.2
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/CHANGELOG +4 -0
- data/README +8 -8
- data/Rakefile +1 -1
- data/lib/rlayout/layout.rb +10 -7
- metadata +2 -2
data/CHANGELOG
CHANGED
data/README
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Rails Layout Extension, release 0.1.
|
1
|
+
Rails Layout Extension, release 0.1.2 (May. 2008)
|
2
2
|
|
3
3
|
Feature
|
4
4
|
=======
|
@@ -15,16 +15,10 @@ require 'rlayout'
|
|
15
15
|
|
16
16
|
Usage
|
17
17
|
=======
|
18
|
-
1. determining layout in erb file
|
19
|
-
<% content_for :config do %>
|
20
|
-
layout: happy
|
21
|
-
<% end %>
|
22
18
|
|
23
|
-
|
19
|
+
1. simplifying content_for
|
24
20
|
|
25
21
|
<% content_for :config do %>
|
26
|
-
#note��key layout won't be transferred to a content_for variable, it is only used to determine a view layout
|
27
|
-
layout: happy
|
28
22
|
title: This is my title
|
29
23
|
panel: This is my panel
|
30
24
|
<% end %>
|
@@ -38,4 +32,10 @@ This is my title
|
|
38
32
|
This is my panel
|
39
33
|
<%- end -%>
|
40
34
|
|
35
|
+
2. determining layout in erb file
|
36
|
+
<% content_for :config do %>
|
37
|
+
#note��key layout won't be transferred to a content_for variable, it is only used to determine a view layout
|
38
|
+
layout: happy
|
39
|
+
<% end %>
|
40
|
+
|
41
41
|
Copyright (c) 2008 Leon Li, released under the MIT license
|
data/Rakefile
CHANGED
data/lib/rlayout/layout.rb
CHANGED
@@ -17,13 +17,16 @@ module Rlayout
|
|
17
17
|
options_new = options.dup.merge :layout => false if template_with_options
|
18
18
|
content_for_layout = render_with_no_layout(options_new, &block)
|
19
19
|
new_layout = nil
|
20
|
-
page_config = @template.instance_variable_get("@content_for_config")
|
21
|
-
page_config.
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
20
|
+
page_config = @template.instance_variable_get("@content_for_config")
|
21
|
+
unless page_config.nil?
|
22
|
+
page_config = page_config.strip
|
23
|
+
page_config.split("\n").each do |pair|
|
24
|
+
key, value = pair.split(": ")
|
25
|
+
if key == 'layout'
|
26
|
+
new_layout = value
|
27
|
+
else
|
28
|
+
@template.instance_variable_set("@content_for_#{key}", value)
|
29
|
+
end
|
27
30
|
end
|
28
31
|
end
|
29
32
|
unless new_layout.nil? || new_layout.empty?
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rlayout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leon Li
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-05-
|
12
|
+
date: 2008-05-07 00:00:00 +08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|