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 +4 -4
- data/README.md +12 -3
- data/app/assets/javascripts/effective_select/initialize.js.coffee +9 -0
- data/lib/effective_bootstrap/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: 5438b717e13e5703e1bb97a43ec8db0c95cd2287
|
4
|
+
data.tar.gz: 7d0dfc9261e7eea03ed664e722a9ea806da3ab80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
367
|
+
to display rich html for the option value:
|
368
368
|
|
369
369
|
```ruby
|
370
|
-
f.
|
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
|
|
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.
|
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-
|
11
|
+
date: 2018-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|