effective_bootstrap 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7d7f86a0d2683a7ba00bec65b642d7d68a5381a4
4
- data.tar.gz: f0ce7680a8e5ff6df8a9e31bda7d3bb10fc789e0
3
+ metadata.gz: 5438b717e13e5703e1bb97a43ec8db0c95cd2287
4
+ data.tar.gz: 7d0dfc9261e7eea03ed664e722a9ea806da3ab80
5
5
  SHA512:
6
- metadata.gz: 4b9cafa5062102c1b1eb947c569a94f7c53826892e778c359fefe56b730a84dbd9565f165a924912157b2408e8d58e4a8bd25604d680c087b6b738deea34c747
7
- data.tar.gz: e934a6fac03621ee5789aa05ea607c225a1ebf5040fa68ae16b4d6deb24a462a1202f7a514cd71bfe7651638f615e14e8a5f27faf29d561abd632c9ca58e780f
6
+ metadata.gz: 0b2cae0e0461a12d394f3c465e8a47db3697dd14aaa572bd47511635d786b05c65f3b32f036d11400afa72eeedc94ba3d004a500b81721b88e8c3ae8572e44b9
7
+ data.tar.gz: 61f1b929c27c8080b62a7fc2dee5afa722c84b7ff95c689675f278f3fee55f8bcb97c233a04925923866724782fff0d07879cae8cd84b26ab70e9d28b9695937
data/README.md CHANGED
@@ -364,13 +364,22 @@ containerClass: 'custom-container-class'
364
364
  dropdownClass: 'custom-dropdown-class'
365
365
  ```
366
366
 
367
- to display a glyphicon infront of each option value:
367
+ to display rich html for the option value:
368
368
 
369
369
  ```ruby
370
- f.input :user, User.all.map { |user| [user.to_s, user.to_param, { class: 'glyphicon-flag' }] }, template: :glyphicon
370
+ f.select :user, user_tag_collection(User.all), template: :html
371
+
372
+ def user_tag_collection(users)
373
+ users.map do |user|
374
+ [
375
+ user.to_s,
376
+ user.to_param,
377
+ { 'data-html': content_tag(:span, user.to_s, class: 'user-choice') }
378
+ ]
379
+ end
380
+ end
371
381
  ```
372
382
 
373
-
374
383
  ### Additional
375
384
 
376
385
  Call with `single_selected: true` to ensure only the first selected option tag will be `<option selected="selected">`.
@@ -6,11 +6,20 @@ formatWithGlyphicon = (data, container) ->
6
6
  else
7
7
  data.text
8
8
 
9
+ formatWithHtml = (data, container) ->
10
+ if data.element && data.element.getAttribute('data-html')
11
+ $(data.element.getAttribute('data-html'))
12
+ else
13
+ data.text
14
+
9
15
  (this.EffectiveBootstrap || {}).effective_select = ($element, options) ->
10
16
  switch options['template']
11
17
  when 'glyphicon'
12
18
  options['templateResult'] = formatWithGlyphicon
13
19
  options['templateSelection'] = formatWithGlyphicon
20
+ when 'html'
21
+ options['templateResult'] = formatWithHtml
22
+ options['templateSelection'] = formatWithHtml
14
23
 
15
24
  $select = $element.select2(options)
16
25
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveBootstrap
2
- VERSION = '0.1.5'.freeze
2
+ VERSION = '0.1.6'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_bootstrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-07 00:00:00.000000000 Z
11
+ date: 2018-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails