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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 581dc6f007ee79baca625913bb3d2435cd4d6670
4
- data.tar.gz: de20141f770bb6ff3143b4bc7e0610f108d8c6d1
3
+ metadata.gz: cf4154f75e4073ae33fdd1f3597049e197d7d32b
4
+ data.tar.gz: f0875ddd59897f1f0fdecfd579235ae46a384993
5
5
  SHA512:
6
- metadata.gz: 98dd538ee917b5e7a8aebc3c41c61b0698952b8a79d4f824032c2faab88f87497991bb37738e6be959cc1a6de0644974de52c1fc9662061ace4f971365ef8967
7
- data.tar.gz: 7c025d653c4d53144abda8dafb419075941b216318dc19f0ab63aa7cb8c40916dc566c0b2e7c6f1948188d574aafdf61d0d453913e72895987dbb4599de6fd6e
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
@@ -1,3 +1,3 @@
1
1
  module Sibu
2
- VERSION = '0.9.0'
2
+ VERSION = '0.9.1'
3
3
  end
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.0
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-28 00:00:00.000000000 Z
11
+ date: 2019-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails