sibu 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/sibu/pages_helper.rb +23 -0
- data/lib/sibu/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf4154f75e4073ae33fdd1f3597049e197d7d32b
|
4
|
+
data.tar.gz: f0875ddd59897f1f0fdecfd579235ae46a384993
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6e82ba298d3ad70a4403613d4e9e090567a972858b81a2b6a6b88c6852d12a90ff19a5fd3ec4e3f5635dd55214502150c1f354bd243e1f12f66f72415820eea
|
7
|
+
data.tar.gz: 7a8ffebf8b8d6da1722838a246ef862532eb9fca38cfdfb03b6734df9637c31485b7fbd6969aeef5e6c8a3fbf1e4311a133262bcfcb10f5654a55fa6eeee7bfe
|
@@ -90,6 +90,14 @@ module Sibu
|
|
90
90
|
content_tag(wrapper, capture(*elts(elt), &block), opts)
|
91
91
|
end
|
92
92
|
|
93
|
+
def empty_tag(elt, tag, type, opts = {})
|
94
|
+
repeat = opts.delete(:repeat)
|
95
|
+
defaults = {"id" => elt.is_a?(Hash) ? elt["id"] : elt}.merge!(default_content(type))
|
96
|
+
opts = defaults.merge(opts)
|
97
|
+
opts.merge!({data: {id: elt_id(elt), type: type, repeat: repeat}}) if action_name != 'show'
|
98
|
+
content_tag(tag, nil, opts)
|
99
|
+
end
|
100
|
+
|
93
101
|
def form_label(elt, html_opts = {}, &block)
|
94
102
|
defaults = {"id" => elt.is_a?(Hash) ? elt["id"] : elt, "text" => DEFAULT_TEXT}
|
95
103
|
content = defaults.merge(elt.is_a?(Hash) ? elt : (select_element(elt) || {}))
|
@@ -190,5 +198,20 @@ module Sibu
|
|
190
198
|
def elt_id(elt)
|
191
199
|
elt.is_a?(Hash) ? (elt["data-id"] || elt["id"]) : elt
|
192
200
|
end
|
201
|
+
|
202
|
+
def default_content(type)
|
203
|
+
case type
|
204
|
+
when "text"
|
205
|
+
{"text" => DEFAULT_TEXT}
|
206
|
+
when "link"
|
207
|
+
{"value" => "", "text" => DEFAULT_TEXT}
|
208
|
+
when "paragraph"
|
209
|
+
{"text" => DEFAULT_PARAGRAPH}
|
210
|
+
when "media"
|
211
|
+
{"src" => DEFAULT_IMG}
|
212
|
+
when "embed"
|
213
|
+
{"code" => '<p>Contenu HTML personnalisé (iframe, etc...)</p>'}
|
214
|
+
end
|
215
|
+
end
|
193
216
|
end
|
194
217
|
end
|
data/lib/sibu/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sibu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean-Baptiste Vilain
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-08-
|
11
|
+
date: 2019-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|