yaks-html 0.7.6 → 0.7.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/yaks/format/html.rb +10 -10
- data/lib/yaks/format/template.html +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1777856e4e47dd9771ad5f0f3a6ee2bb0162053c
|
4
|
+
data.tar.gz: 18547188e16d518b7a604cca7e832efb71a9e84d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3cf0c777333ff5cc8c42c1dea270e11406e224725ca5fffdc3d0142b141d64fde9973c2a4f681fd1dad00da09b912c052b0690eade3ff80d4dda3034a615870a
|
7
|
+
data.tar.gz: 141708ec6e2bcee9cfee23495d0300ac63c74a7b995f5c0f55413fb192f09c96252ddecc02297f1f3cdb0c7ad63cad9a49f104c221f01679a5cddb835243d61c
|
data/lib/yaks/format/html.rb
CHANGED
@@ -27,7 +27,7 @@ module Yaks
|
|
27
27
|
.replace('.type') { |header| header.content(resource.type.to_s + (resource.collection? ? ' collection' : '')) }
|
28
28
|
.replace('.attribute', &render_attributes(resource.attributes))
|
29
29
|
.replace('.links') {|links| resource.links.empty? ? [] : links.replace('.link', &render_links(resource.links)) }
|
30
|
-
.replace('.
|
30
|
+
.replace('.forms') {|div| render_forms(resource.forms).call(div) }
|
31
31
|
.replace('.subresource') {|sub_templ| render_subresources(resource, templ, sub_templ) }
|
32
32
|
end
|
33
33
|
|
@@ -70,22 +70,22 @@ module Yaks
|
|
70
70
|
end
|
71
71
|
|
72
72
|
|
73
|
-
def
|
73
|
+
def render_forms(forms)
|
74
74
|
->(div) do
|
75
75
|
div.content(
|
76
|
-
|
76
|
+
forms.map(&method(:render_form))
|
77
77
|
)
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
-
def
|
81
|
+
def render_form(form_control)
|
82
82
|
form = H[:form]
|
83
|
-
form = form.attr('name',
|
84
|
-
form = form.attr('method',
|
85
|
-
form = form.attr('action',
|
86
|
-
form = form.attr('enctype',
|
83
|
+
form = form.attr('name', form_control.name) if form_control.name
|
84
|
+
form = form.attr('method', form_control.method) if form_control.method
|
85
|
+
form = form.attr('action', form_control.action) if form_control.action
|
86
|
+
form = form.attr('enctype', form_control.media_type) if form_control.media_type
|
87
87
|
|
88
|
-
rows =
|
88
|
+
rows = form_control.fields.map do |field|
|
89
89
|
H[:tr,
|
90
90
|
H[:td, H[:label, {for: field.name}, field.label || '']],
|
91
91
|
H[:td, case field.type
|
@@ -96,7 +96,7 @@ module Yaks
|
|
96
96
|
end]
|
97
97
|
]
|
98
98
|
end
|
99
|
-
form.content(H[:table,
|
99
|
+
form.content(H[:table, form_control.title || '', *rows, H[:tr, H[:td, H[:input, {type: 'submit'}]]]])
|
100
100
|
end
|
101
101
|
end
|
102
102
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yaks-html
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arne Brasseur
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yaks
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.7.
|
19
|
+
version: 0.7.7
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.7.
|
26
|
+
version: 0.7.7
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: hexp
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|