effective_bootstrap 0.10.12 → 0.10.13

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
  SHA256:
3
- metadata.gz: 4457e76be27c68a8b073ec08835d3e1b23afa2b3286f82fabf576216b8adbcbb
4
- data.tar.gz: a1137338109b7e8abc7198fe3e203628bb2e889bb8a5b058b85549297f1db571
3
+ metadata.gz: 18283bae1bd667e7f76c44f788a90a57baf73ef19f4d9c35fb988ca6c0fd8074
4
+ data.tar.gz: 93b4e935bcd41f4c0212bdd1b68be0662e2a472a1c0a6fed4ca31d0383229230
5
5
  SHA512:
6
- metadata.gz: be559b52ec51afe5efdf66f0d990fe36fd59eb0f0be1774f0a0b8d332619027ff24b03564dd4a4a9dbc1938dc423268f15f559756d64fc8587719c480f31df96
7
- data.tar.gz: 2caa306b24fb77284da25f3e026e2e1ff9085b1611327088abc7e01376b5e0f047a857fa91edca983bad08497cc5c6448d3e035ca4b48c7707f0797c2cd0b43b
6
+ metadata.gz: 35b322340f25ec52147e09de9e80cd720d3dcb775e95b20fb0867fa76c563cdda3913a4054ec2843790171a15a166719b27abdb8cfe25be32bcc385c8f9bba8b
7
+ data.tar.gz: 1b44d718ce5732eb85cfd0567c6d004dedab8c2e29668cc9e9cb177234f1ab88f121d318075ffa5f7b621dd2fe516b9c6cd85e76ecb8bc3995b6b36cf13d7365
@@ -1,24 +1,24 @@
1
1
  # https://select2.github.io/examples.html
2
2
 
3
- formatWithGlyphicon = (data, container) ->
4
- if data.element && data.element.className
5
- $("<span><i class='glyphicon #{data.element.className}'></i> #{data.text}</span>")
6
- else
7
- data.text
8
-
9
- formatWithHtml = (data, container) ->
3
+ effectiveFormat = (data, container) ->
10
4
  if data.element && data.element.getAttribute('data-html')
11
5
  $(data.element.getAttribute('data-html'))
6
+ else if data.text.startsWith("<") && data.text.endsWith(">")
7
+ $(data.text)
12
8
  else
13
9
  data.text
14
10
 
15
- matchWithHtml = (params, data) ->
11
+ effectiveMatch = (params, data) ->
16
12
  return data if $.trim(params.term) == ''
17
13
  return null unless data.element?
18
14
 
19
15
  # Single item mode
20
16
  term = params.term.toLowerCase()
17
+
18
+ # The text value
21
19
  text = $(data.element.getAttribute('data-html')).text()
20
+ text = $(data.text).text() if text.length == 0
21
+ text = data.text if text.length == 0
22
22
 
23
23
  if(text.length > 0)
24
24
  if text.toLowerCase().indexOf(term) > -1 then return(data) else return(null)
@@ -29,7 +29,11 @@ matchWithHtml = (params, data) ->
29
29
  filteredChildren = []
30
30
 
31
31
  $.each(data.children, (idx, child) ->
32
+ # Text value
32
33
  text = $(child.element.getAttribute('data-html')).text()
34
+ text = $(data.text).text() if text.length == 0
35
+ text = data.text if text.length == 0
36
+
33
37
  filteredChildren.push(child) if text.toLowerCase().indexOf(term) > -1
34
38
  )
35
39
 
@@ -41,14 +45,9 @@ matchWithHtml = (params, data) ->
41
45
  return modifiedData
42
46
 
43
47
  (this.EffectiveBootstrap || {}).effective_select = ($element, options) ->
44
- switch options['template']
45
- when 'glyphicon'
46
- options['templateResult'] = formatWithGlyphicon
47
- options['templateSelection'] = formatWithGlyphicon
48
- when 'html'
49
- options['templateResult'] = formatWithHtml
50
- options['templateSelection'] = formatWithHtml
51
- options['matcher'] = matchWithHtml
48
+ options['templateResult'] = effectiveFormat
49
+ options['templateSelection'] = effectiveFormat
50
+ options['matcher'] = effectiveMatch
52
51
 
53
52
  if options['noResults']
54
53
  noResults = options['noResults']
@@ -1,3 +1,3 @@
1
1
  module EffectiveBootstrap
2
- VERSION = '0.10.12'.freeze
2
+ VERSION = '0.10.13'.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.10.12
4
+ version: 0.10.13
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: 2022-06-16 00:00:00.000000000 Z
11
+ date: 2022-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails