hanami-helpers 1.0.0.beta1 → 1.0.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/LICENSE.md +1 -1
- data/README.md +1 -1
- data/lib/hanami/helpers.rb +1 -0
- data/lib/hanami/helpers/form_helper.rb +71 -60
- data/lib/hanami/helpers/form_helper/form_builder.rb +605 -156
- data/lib/hanami/helpers/html_helper.rb +1 -0
- data/lib/hanami/helpers/html_helper/empty_html_node.rb +3 -0
- data/lib/hanami/helpers/html_helper/html_builder.rb +28 -16
- data/lib/hanami/helpers/html_helper/html_fragment.rb +1 -0
- data/lib/hanami/helpers/routing_helper.rb +2 -0
- data/lib/hanami/helpers/version.rb +1 -1
- metadata +2 -2
@@ -114,15 +114,18 @@ module Hanami
|
|
114
114
|
result
|
115
115
|
end
|
116
116
|
|
117
|
+
# @api private
|
117
118
|
def boolean_attribute?(attribute_name)
|
118
119
|
BOOLEAN_ATTRIBUTES.include?(attribute_name.to_s)
|
119
120
|
end
|
120
121
|
|
121
122
|
# Do not render boolean attributes when their value is _false_.
|
123
|
+
# @api private
|
122
124
|
def boolean_attribute(attribute_name, _value)
|
123
125
|
%(#{ATTRIBUTES_SEPARATOR}#{attribute_name}="#{attribute_name}")
|
124
126
|
end
|
125
127
|
|
128
|
+
# @api private
|
126
129
|
def attribute(attribute_name, value)
|
127
130
|
%(#{ATTRIBUTES_SEPARATOR}#{attribute_name}="#{value}")
|
128
131
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'hanami/utils'
|
1
|
+
require 'hanami/utils'
|
2
2
|
require 'hanami/utils/class_attribute'
|
3
3
|
require 'hanami/utils/escape'
|
4
4
|
require 'hanami/helpers/html_helper/empty_html_node'
|
@@ -42,6 +42,7 @@ module Hanami
|
|
42
42
|
datalist
|
43
43
|
del
|
44
44
|
details
|
45
|
+
dialog
|
45
46
|
dfn
|
46
47
|
div
|
47
48
|
dl
|
@@ -61,6 +62,7 @@ module Hanami
|
|
61
62
|
h6
|
62
63
|
head
|
63
64
|
header
|
65
|
+
hgroup
|
64
66
|
i
|
65
67
|
iframe
|
66
68
|
ins
|
@@ -68,7 +70,6 @@ module Hanami
|
|
68
70
|
label
|
69
71
|
legend
|
70
72
|
li
|
71
|
-
link
|
72
73
|
main
|
73
74
|
map
|
74
75
|
mark
|
@@ -88,12 +89,14 @@ module Hanami
|
|
88
89
|
q
|
89
90
|
rp
|
90
91
|
rt
|
92
|
+
rtc
|
91
93
|
ruby
|
92
94
|
s
|
93
95
|
samp
|
94
96
|
script
|
95
97
|
section
|
96
98
|
select
|
99
|
+
slot
|
97
100
|
small
|
98
101
|
span
|
99
102
|
strong
|
@@ -115,6 +118,7 @@ module Hanami
|
|
115
118
|
tr
|
116
119
|
u
|
117
120
|
ul
|
121
|
+
var
|
118
122
|
video
|
119
123
|
).freeze
|
120
124
|
|
@@ -183,6 +187,7 @@ module Hanami
|
|
183
187
|
@nodes = []
|
184
188
|
end
|
185
189
|
|
190
|
+
# @api private
|
186
191
|
def options
|
187
192
|
end
|
188
193
|
|
@@ -294,15 +299,18 @@ module Hanami
|
|
294
299
|
#
|
295
300
|
# @example
|
296
301
|
#
|
297
|
-
#
|
298
|
-
#
|
299
|
-
#
|
300
|
-
#
|
301
|
-
#
|
302
|
-
#
|
303
|
-
#
|
304
|
-
#
|
305
|
-
#
|
302
|
+
# <%=
|
303
|
+
# html.label do
|
304
|
+
# text "Option 1"
|
305
|
+
# radio_button :option, 1
|
306
|
+
# end
|
307
|
+
# %>
|
308
|
+
#
|
309
|
+
# <!-- output -->
|
310
|
+
# <label>
|
311
|
+
# Option 1
|
312
|
+
# <input type="radio" name="option" value="1" />
|
313
|
+
# </label>
|
306
314
|
def text(content)
|
307
315
|
@nodes << TextNode.new(content)
|
308
316
|
self
|
@@ -346,16 +354,20 @@ module Hanami
|
|
346
354
|
@nodes.any?
|
347
355
|
end
|
348
356
|
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
357
|
+
if !Utils.jruby?
|
358
|
+
# Resolve the context for nested contents
|
359
|
+
#
|
360
|
+
# @since 0.1.0
|
361
|
+
# @api private
|
354
362
|
def resolve(&blk)
|
355
363
|
@context = blk.binding.receiver
|
356
364
|
instance_exec(&blk)
|
357
365
|
end
|
358
366
|
else
|
367
|
+
# Resolve the context for nested contents
|
368
|
+
#
|
369
|
+
# @since 0.1.0
|
370
|
+
# @api private
|
359
371
|
def resolve(&blk)
|
360
372
|
@context = eval 'self', blk.binding
|
361
373
|
instance_exec(&blk)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hanami-helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luca Guidi
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-
|
13
|
+
date: 2017-03-17 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: hanami-utils
|