building-blocks 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +9 -8
- data/VERSION +1 -1
- data/lib/building_blocks/base.rb +6 -3
- metadata +18 -4
data/README.rdoc
CHANGED
@@ -116,11 +116,12 @@ In your application.html layout file, you might use this as follows:
|
|
116
116
|
<head>
|
117
117
|
<%= blocks.use :includes do %>
|
118
118
|
<%= blocks.use :stylesheets do %>
|
119
|
-
<%= stylesheet_link_tag "
|
119
|
+
<%= stylesheet_link_tag "application", :media => "all" %>
|
120
120
|
<% end %>
|
121
121
|
<%= blocks.use :javscripts do %>
|
122
|
-
<%= javascript_include_tag "
|
122
|
+
<%= javascript_include_tag "application" %>
|
123
123
|
<% end %>
|
124
|
+
<%= csrf_meta_tags %>
|
124
125
|
<% end %>
|
125
126
|
</head>
|
126
127
|
<body>
|
@@ -131,27 +132,27 @@ In your application.html layout file, you might use this as follows:
|
|
131
132
|
Then, in a specific view that is rendered using this layout, you can add stylesheets before or after the list of stylesheets includes, before or after the list of javascript includes, or before or after the entire list of stylesheet and javascript includes. For example, index.html.erb might add in more stylesheets and javascripts:
|
132
133
|
|
133
134
|
<% blocks.before :includes do %>
|
134
|
-
<%= stylesheet_link_tag "
|
135
|
+
<%= stylesheet_link_tag "before_includes" %>
|
135
136
|
<% end %>
|
136
137
|
|
137
138
|
<% blocks.after :includes do %>
|
138
|
-
<%= stylesheet_link_tag "
|
139
|
+
<%= stylesheet_link_tag "after_includes" %>
|
139
140
|
<% end %>
|
140
141
|
|
141
142
|
<% blocks.before :stylesheets do %>
|
142
|
-
<%= stylesheet_link_tag "
|
143
|
+
<%= stylesheet_link_tag "before_stylesheets" %>
|
143
144
|
<% end %>
|
144
145
|
|
145
146
|
<% blocks.after :stylesheets do %>
|
146
|
-
<%= stylesheet_link_tag "
|
147
|
+
<%= stylesheet_link_tag "after_stylesheets" %>
|
147
148
|
<% end %>
|
148
149
|
|
149
150
|
<% blocks.before :javascripts do %>
|
150
|
-
<%= javascript_include_tag "
|
151
|
+
<%= javascript_include_tag "after_javascripts" %>
|
151
152
|
<% end %>
|
152
153
|
|
153
154
|
<% blocks.after :javascripts do %>
|
154
|
-
<%= javascript_include_tag "
|
155
|
+
<%= javascript_include_tag "before_javascripts" %>
|
155
156
|
<% end %>
|
156
157
|
|
157
158
|
<!--
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.9
|
data/lib/building_blocks/base.rb
CHANGED
@@ -73,6 +73,7 @@ module BuildingBlocks
|
|
73
73
|
# anonymous blocks don't override its definition
|
74
74
|
name = args.first ? args.shift : self.anonymous_block_name
|
75
75
|
|
76
|
+
self.define_block_container(name, options, &block) if block_given?
|
76
77
|
self.render_block name, args, options
|
77
78
|
end
|
78
79
|
|
@@ -91,8 +92,11 @@ module BuildingBlocks
|
|
91
92
|
def render
|
92
93
|
raise "Must specify :template parameter in order to render" unless global_options[:template]
|
93
94
|
|
94
|
-
|
95
|
-
|
95
|
+
render_options = global_options.clone
|
96
|
+
render_options[render_options[:variable] ? render_options[:variable].to_sym : :blocks] = self
|
97
|
+
render_options[:captured_block] = view.capture(self, &self.block) if self.block
|
98
|
+
|
99
|
+
view.render global_options[:template], render_options
|
96
100
|
end
|
97
101
|
|
98
102
|
def before(name, options={}, &block)
|
@@ -156,7 +160,6 @@ module BuildingBlocks
|
|
156
160
|
protected
|
157
161
|
|
158
162
|
def initialize(view, options={}, &block)
|
159
|
-
options[options[:variable] ? options[:variable].to_sym : :blocks] = self
|
160
163
|
options[:templates_folder] = "blocks" if options[:templates_folder].nil?
|
161
164
|
|
162
165
|
self.view = view
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: building-blocks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 13
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 9
|
10
|
+
version: 0.0.9
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andrew Hunter
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-01-
|
18
|
+
date: 2012-01-25 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -62,6 +62,20 @@ dependencies:
|
|
62
62
|
prerelease: false
|
63
63
|
type: :development
|
64
64
|
requirement: *id003
|
65
|
+
- !ruby/object:Gem::Dependency
|
66
|
+
name: jeweler
|
67
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
hash: 3
|
73
|
+
segments:
|
74
|
+
- 0
|
75
|
+
version: "0"
|
76
|
+
prerelease: false
|
77
|
+
type: :development
|
78
|
+
requirement: *id004
|
65
79
|
description: ""
|
66
80
|
email: hunterae@gmail.com
|
67
81
|
executables: []
|