effective_bootstrap 0.11.16 → 0.11.18

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: e2175b1d7e4f1ac7a6a097555260b36d6ddae38e76bdd48fc95b8aad3d2b74ab
4
- data.tar.gz: ca1d58ee920c2d55afb4e5df81b01774e978aeb5ba1b3826f747d803e13f252f
3
+ metadata.gz: d8b2aa82be991ed7702172237571e299677c91af45bce9e213a11962b6086f97
4
+ data.tar.gz: e45e9fbab8c28c712159c669ac3733f464e9c481078458f5fca975f28d2dab06
5
5
  SHA512:
6
- metadata.gz: 75c6c84817311517738d7726bfe72bf4748aae7cd22a772a2de7c4a2450184c6e6e1ea951ca65dbdb00502d1d33f8a751a8abf32d81bc62188d27f8d04e05bbc
7
- data.tar.gz: 4ae8ad5fd75245078c5c61565d49887f46e2c3505cedbb91f629cf868d7271c9e3d03243ec45d8046b2499f5b42f5599c1ee148df5f7eb8ea2e3343fcfc4c346
6
+ metadata.gz: 6d03aee0bb092f9a2f9c18dd5fd9be2e66668dc481a3728abb6aa814d7242b6c81568bad67156b1b7421746fd17c890238ece19f74c363bdc04c891b2ed682ec
7
+ data.tar.gz: 1ecd48015673e4684c8f9e1886b433fe658ee42541fb09199a5b65c6ff0cc4adb830417d9907b1ba45735410ca56bd05219e7685249c6dfdbf2087e773403d03
@@ -0,0 +1,32 @@
1
+ // Implements the jQuery load div pattern
2
+ // See effective_reports admin screen
3
+ $(document).on('change', "[data-load-ajax-url][data-load-ajax-div]", function(event) {
4
+ let $input = $(event.currentTarget);
5
+
6
+ let url = $input.data('load-ajax-url');
7
+ let div = $input.data('load-ajax-div');
8
+
9
+ let $container = $input.closest('form').find(div);
10
+ if(div.length == 0) { console.error("Unable to find load ajax div " + div); return; }
11
+
12
+ let name = ($input.attr('name').split(/\[|\]/)[1] || '');
13
+ if(name.length == 0) { console.error("Unable to parse load ajax input name " + $input.attr('name')); return; }
14
+
15
+ let value = ($input.val() || '');
16
+ if(value.length == 0) { $container.html(''); return; }
17
+
18
+ url = (url + '?' + name + '=' + value);
19
+
20
+ $container.html("<div class='load-ajax-loading'><p>Loading...</p></div>");
21
+
22
+ let $content = $('<div></div>');
23
+
24
+ $content.load(url + ' ' + div, function(response, status, xhr) {
25
+ if(status == 'error') {
26
+ $container.append("<div class='load-ajax-error'><p>Error: please refresh the page and try again.</p></div>");
27
+ } else {
28
+ $container.replaceWith($content.children(div));
29
+ EffectiveBootstrap.initialize();
30
+ }
31
+ });
32
+ });
@@ -7,7 +7,7 @@ $(document).ready(function() {
7
7
 
8
8
  } else if (document.location.search.length > 0) {
9
9
  var tab = new URLSearchParams(document.location.search).get('tab');
10
- if(tab.length == 0) { return false; }
10
+ if((tab || '').length == 0) { return false; }
11
11
 
12
12
  $('.nav.nav-tabs').find("a[href^='#" + tab + "']").tab('show');
13
13
  }
@@ -1,6 +1,7 @@
1
1
  //= require ./effective_bootstrap/base
2
2
  //= require ./effective_bootstrap/confirm
3
3
  //= require ./effective_bootstrap/form
4
+ //= require ./effective_bootstrap/load_ajax
4
5
  //= require ./effective_bootstrap/logic
5
6
  //= require ./effective_bootstrap/other
6
7
  //= require ./effective_bootstrap/reveal_mail_to
@@ -16,8 +16,9 @@ effectiveMatch = (params, data) ->
16
16
  term = params.term.toLowerCase()
17
17
 
18
18
  # The text value
19
- text = $(data.element.getAttribute('data-html')).text()
20
- text = $(data.text).text() if text.length == 0
19
+ text = ''
20
+ try text = $(data.element.getAttribute('data-html')).text()
21
+ try text = $(data.text).text() if text.length == 0
21
22
  text = data.text if text.length == 0
22
23
 
23
24
  if(text.length > 0)
@@ -30,8 +31,9 @@ effectiveMatch = (params, data) ->
30
31
 
31
32
  $.each(data.children, (idx, child) ->
32
33
  # Text value
33
- text = $(child.element.getAttribute('data-html')).text()
34
- text = $(data.text).text() if text.length == 0
34
+ text = ''
35
+ try text = $(child.element.getAttribute('data-html')).text()
36
+ try text = $(data.text).text() if text.length == 0
35
37
  text = data.text if text.length == 0
36
38
 
37
39
  filteredChildren.push(child) if text.toLowerCase().indexOf(term) > -1
@@ -1,3 +1,3 @@
1
1
  module EffectiveBootstrap
2
- VERSION = '0.11.16'.freeze
2
+ VERSION = '0.11.18'.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.11.16
4
+ version: 0.11.18
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-11-07 00:00:00.000000000 Z
11
+ date: 2022-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -426,6 +426,7 @@ files:
426
426
  - app/assets/javascripts/effective_bootstrap/base.js.coffee
427
427
  - app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
428
428
  - app/assets/javascripts/effective_bootstrap/form.js.coffee
429
+ - app/assets/javascripts/effective_bootstrap/load_ajax.js
429
430
  - app/assets/javascripts/effective_bootstrap/logic.js.coffee
430
431
  - app/assets/javascripts/effective_bootstrap/other.js.coffee
431
432
  - app/assets/javascripts/effective_bootstrap/reveal_mail_to.js