haml-edge 3.1.57 → 3.1.58
Sign up to get free protection for your applications and to get access to all the features.
- data/EDGE_GEM_VERSION +1 -1
- data/VERSION +1 -1
- data/lib/haml/helpers/action_view_mods.rb +11 -7
- data/test/haml/helper_test.rb +14 -1
- metadata +2 -2
data/EDGE_GEM_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.1.
|
1
|
+
3.1.58
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.1.
|
1
|
+
3.1.58
|
@@ -140,7 +140,8 @@ module ActionView
|
|
140
140
|
module FormTagHelper
|
141
141
|
def form_tag_with_haml(url_for_options = {}, options = {}, *parameters_for_url, &proc)
|
142
142
|
if is_haml?
|
143
|
-
|
143
|
+
wrap_block = block_given? && block_is_haml?(proc)
|
144
|
+
if wrap_block
|
144
145
|
oldproc = proc
|
145
146
|
proc = haml_bind_proc do |*args|
|
146
147
|
concat "\n"
|
@@ -148,7 +149,7 @@ module ActionView
|
|
148
149
|
end
|
149
150
|
end
|
150
151
|
res = form_tag_without_haml(url_for_options, options, *parameters_for_url, &proc) + "\n"
|
151
|
-
res << "\n" if
|
152
|
+
res << "\n" if wrap_block
|
152
153
|
res
|
153
154
|
else
|
154
155
|
form_tag_without_haml(url_for_options, options, *parameters_for_url, &proc)
|
@@ -160,12 +161,13 @@ module ActionView
|
|
160
161
|
|
161
162
|
module FormHelper
|
162
163
|
def form_for_with_haml(object_name, *args, &proc)
|
163
|
-
|
164
|
+
wrap_block = block_given? && is_haml? && block_is_haml?(proc)
|
165
|
+
if wrap_block
|
164
166
|
oldproc = proc
|
165
167
|
proc = proc {|*args| with_tabs(1) {oldproc.call(*args)}}
|
166
168
|
end
|
167
169
|
res = form_for_without_haml(object_name, *args, &proc)
|
168
|
-
res << "\n" if
|
170
|
+
res << "\n" if wrap_block
|
169
171
|
res
|
170
172
|
end
|
171
173
|
alias_method :form_for_without_haml, :form_for
|
@@ -191,7 +193,8 @@ module ActionView
|
|
191
193
|
module FormTagHelper
|
192
194
|
def form_tag_with_haml(url_for_options = {}, options = {}, *parameters_for_url, &proc)
|
193
195
|
if is_haml?
|
194
|
-
|
196
|
+
wrap_block = block_given? && block_is_haml?(proc)
|
197
|
+
if wrap_block
|
195
198
|
oldproc = proc
|
196
199
|
proc = haml_bind_proc do |*args|
|
197
200
|
concat "\n"
|
@@ -218,7 +221,8 @@ module ActionView
|
|
218
221
|
|
219
222
|
module FormHelper
|
220
223
|
def form_for_with_haml(object_name, *args, &proc)
|
221
|
-
|
224
|
+
wrap_block = block_given? && is_haml? && block_is_haml?(proc)
|
225
|
+
if wrap_block
|
222
226
|
oldproc = proc
|
223
227
|
proc = haml_bind_proc do |*args|
|
224
228
|
tab_up
|
@@ -229,7 +233,7 @@ module ActionView
|
|
229
233
|
concat haml_indent
|
230
234
|
end
|
231
235
|
form_for_without_haml(object_name, *args, &proc)
|
232
|
-
concat "\n" if
|
236
|
+
concat "\n" if wrap_block
|
233
237
|
Haml::Helpers::ErrorReturn.new("form_for") if is_haml?
|
234
238
|
end
|
235
239
|
alias_method :form_for_without_haml, :form_for
|
data/test/haml/helper_test.rb
CHANGED
@@ -5,6 +5,10 @@ class ActionView::Base
|
|
5
5
|
def nested_tag
|
6
6
|
content_tag(:span) {content_tag(:div) {"something"}}
|
7
7
|
end
|
8
|
+
|
9
|
+
def wacky_form
|
10
|
+
form_tag("/foo") {"bar"}
|
11
|
+
end
|
8
12
|
end
|
9
13
|
|
10
14
|
module Haml::Helpers
|
@@ -176,6 +180,15 @@ HTML
|
|
176
180
|
HAML
|
177
181
|
end
|
178
182
|
|
183
|
+
def test_form_tag_in_helper_with_string_block
|
184
|
+
def @base.protect_against_forgery?; false; end
|
185
|
+
assert_equal(<<HTML, render(<<HAML, :action_view))
|
186
|
+
<form #{rails_form_attr}action="/foo" method="post">#{rails_form_opener}bar</form>
|
187
|
+
HTML
|
188
|
+
#{rails_block_helper_char} wacky_form
|
189
|
+
HAML
|
190
|
+
end
|
191
|
+
|
179
192
|
def test_haml_tag_name_attribute_with_id
|
180
193
|
assert_equal("<p id='some_id'></p>\n", render("- haml_tag 'p#some_id'"))
|
181
194
|
end
|
@@ -397,7 +410,7 @@ MESSAGE
|
|
397
410
|
render("- something_that_uses_haml_concat")
|
398
411
|
assert false, "Expected Haml::Error"
|
399
412
|
rescue Haml::Error => e
|
400
|
-
assert_equal
|
413
|
+
assert_equal 16, e.backtrace[0].scan(/:(\d+)/).first.first.to_i
|
401
414
|
end
|
402
415
|
|
403
416
|
class ActsLikeTag
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: haml-edge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.58
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Weizenbaum
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2010-08-
|
14
|
+
date: 2010-08-08 00:00:00 -04:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|