nfg_ui 0.10.4.1 → 0.10.5

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: 0c9fc90e202ea7d9a08078e1a4f89ec3c361432e10c47024660668d71babbbec
4
- data.tar.gz: d26cb49c78b9987f162fde28b0adbfd33d47b121f752bd9468f0ca12a834c1f4
3
+ metadata.gz: 7e6fb7eaae723d2726e41b01347417d802c085b5e47ed58446b7051f3d0cf55b
4
+ data.tar.gz: d65dcb67b6a57ac37503717c69a8cd5963dec852a95beb46ee17933f2b14c5d8
5
5
  SHA512:
6
- metadata.gz: '09f789b11dca1cfd55007de31986c9484af3be4c0d72e399d3cd641e5fed14ab8df402aaf8afe31fbd02d47cadb375cb553a8b19fd784d837e52632564f68ed5'
7
- data.tar.gz: a3db4ef2ef37c8d79e9b08260d5eb476ebeb424de38a7f11e5cfdfd85ed5bb9026c81eeca3a902b10d572c2ec3ac8dd15c43fdcd50700ed7d18b882b52194add
6
+ metadata.gz: bb9925852e4f5daf3ef6d42bac3ba4e4b1fc2580a139ff12458b822439832a8ed19a8fb69509d06fd6667513fb3569b2248bbb599479754d0f8cf0f5cbe8af2d
7
+ data.tar.gz: ef6aecf55597415d8dd1c4e3e9137dbd782ddef98c1511867e5fd7777d6e3bf8fc2c741d3877d4f6a61ea3e97837da853de6bf994d96bdddcf6c539f8bf7fda6
@@ -1,3 +1,4 @@
1
+
1
2
  #= require jquery3
2
3
  #= require popper
3
4
  #= require select2
@@ -6,14 +7,10 @@
6
7
  #= require nfg_ui/vendor/bootstrap-datetimepicker.min
7
8
 
8
9
  #= require_self
10
+ #= require nfg_ui/document_ready
9
11
  #= require nfg_ui/collapsible_toggle
10
12
  #= require nfg_ui/select2
11
13
  #= require nfg_ui/tooltips
12
14
  #= require nfg_ui/datetimepicker_configuration
13
15
 
14
- window.NfgUi = {}
15
-
16
- if $("head [data-turbolinks-track='reload']").length
17
- window.NfgUi.readyOrTurbolinksLoad = "turbolinks:load"
18
- else
19
- window.NfgUi.readyOrTurbolinksLoad = "ready"
16
+ window.NfgUi = {}
@@ -15,7 +15,7 @@ class NfgUi.CollapsibleToggle
15
15
  @el
16
16
  .find ".#{@collapseIconClass}"
17
17
  .removeClass @collapseIconClass
18
- .addClass @collapsedIconClass
18
+ .addClass @collapsedIconClass
19
19
  else
20
20
  @el
21
21
  .find ".#{@collapsedIconClass}"
@@ -39,9 +39,14 @@ class NfgUi.CollapsibleToggle
39
39
  .removeClass @collapsedIconClass
40
40
  .addClass @collapseIconClass
41
41
 
42
- $ ->
42
+ initNfgUiCollapsibleToggle = () ->
43
43
  el = $("[data-toggle='collapse'][data-collapse-icon][data-collapsed-icon]")
44
-
44
+
45
45
  return unless el.length
46
46
  el.each ->
47
47
  inst = new NfgUi.CollapsibleToggle $(@)
48
+
49
+ if NfgUi.turbolinks
50
+ $(document).on('turbolinks:load', initNfgUiCollapsibleToggle)
51
+ else
52
+ $(document).ready(initNfgUiCollapsibleToggle)
@@ -64,7 +64,7 @@ function () {
64
64
  return DateTimePicker;
65
65
  }();
66
66
 
67
- $(function() {
67
+ function initNfgUiDateTimePicker() {
68
68
  var inputs = $("input[data-datetimepicker='datetime'], input[data-datetimepicker='date'], input[data-datetimepicker='time']");
69
69
 
70
70
  if (!(inputs.length > 0)) {
@@ -74,4 +74,9 @@ $(function() {
74
74
  return inputs.each(function (index, input) {
75
75
  return new NfgUi.DateTimePicker($(input));
76
76
  });
77
- });
77
+ }
78
+
79
+ if (NfgUi.turbolinks)
80
+ $(document).on('turbolinks:load', initNfgUiDateTimePicker);
81
+ else
82
+ $(document).ready(initNfgUiDateTimePicker);
@@ -0,0 +1,6 @@
1
+ # Facilitate 'on ready' event for turbolinks and non-turbolinks environments
2
+
3
+ if typeof NfgUi == 'undefined'
4
+ window.NfgUi = {}
5
+
6
+ NfgUi.turbolinks = ($("head [data-turbolinks-track='reload']").length > 0)
@@ -1,11 +1,3 @@
1
- # It is necessary to include window.NfgUi = {}
2
- # Because several legacy evo JS files
3
- # Are `require`ing this file. This makes it easier
4
- # To just drop in a //= require nfg_ui/prevent_clickable_disabled_element
5
- # Once we've transitioned over to nfg_ui managing Evo's javascript
6
- # This window.NfgUi = {} should be removed
7
- window.NfgUi = {}
8
-
9
1
  class NfgUi.PreventClickableDisabledElement
10
2
  constructor: (@el) ->
11
3
  @el.click (e) =>
@@ -23,10 +15,10 @@ init_plugin = (el) ->
23
15
  el.each ->
24
16
  inst = new NfgUi.PreventClickableDisabledElement $(@)
25
17
 
26
- $ ->
18
+ initNfgUiPreventClickableDisabledElement = () ->
27
19
  elSelectorClass = '.disabled'
28
20
  elAttribute = '[disabled]'
29
-
21
+
30
22
  $(document).on 'ajax:success', (e, xhr, settings) ->
31
23
  if $(elSelectorClass).length
32
24
  init_plugin $(elSelectorClass)
@@ -37,11 +29,14 @@ $ ->
37
29
  # Otherwise, initialize using $('[disabled]')
38
30
  init_plugin $(elAttribute)
39
31
 
40
- if $(elSelectorClass).length
32
+ if $(elSelectorClass).length
41
33
  init_plugin $(elSelectorClass)
42
-
34
+
43
35
  if $(elAttribute).length
44
36
  unless $(elAttribute).hasClass 'disabled'
45
37
  init_plugin $(elAttribute)
46
38
 
47
-
39
+ if NfgUi.turbolinks
40
+ $(document).on('turbolinks:load', initNfgUiPreventClickableDisabledElement)
41
+ else
42
+ $(document).ready(initNfgUiPreventClickableDisabledElement)
@@ -11,7 +11,7 @@ init_plugin = (parent) ->
11
11
  # with the select2 menu.
12
12
  dropdownParent: parent.find('select.select2').parent()
13
13
 
14
- $ ->
14
+ initNfgUiSelect2 = () ->
15
15
  doc = $(document)
16
16
  body = $('body')
17
17
  modal = $('.modal')
@@ -28,3 +28,8 @@ $ ->
28
28
  # after the a tooltipped element is removed from the page
29
29
  doc.on 'hidden.bs.modal ajax:success', (e) ->
30
30
  init_plugin body
31
+
32
+ if NfgUi.turbolinks
33
+ $(document).on('turbolinks:load', initNfgUiSelect2)
34
+ else
35
+ $(document).ready(initNfgUiSelect2)
@@ -4,7 +4,7 @@ init_plugin = (parent) ->
4
4
  parent.find("[data-toggle='tooltip']").tooltip()
5
5
  $('body').tooltip selector: "[data-toggle~='tooltip']"
6
6
 
7
- $ ->
7
+ initNfgUiTooltips = () ->
8
8
  doc = $(document)
9
9
  body = $('body')
10
10
  modal = $('.modal')
@@ -16,3 +16,8 @@ $ ->
16
16
 
17
17
  doc.on 'hidden.bs.modal ajax:success', (e, xhr, settings) ->
18
18
  init_plugin body
19
+
20
+ if NfgUi.turbolinks
21
+ $(document).on('turbolinks:load', initNfgUiTooltips)
22
+ else
23
+ $(document).ready(initNfgUiTooltips)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NfgUi
4
- VERSION = '0.10.4.1'
4
+ VERSION = '0.10.5'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nfg_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.4.1
4
+ version: 0.10.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Roehm
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-01-13 00:00:00.000000000 Z
12
+ date: 2020-01-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bootstrap
@@ -378,6 +378,7 @@ files:
378
378
  - app/assets/javascripts/nfg_ui/application.coffee
379
379
  - app/assets/javascripts/nfg_ui/collapsible_toggle.coffee
380
380
  - app/assets/javascripts/nfg_ui/datetimepicker_configuration.js
381
+ - app/assets/javascripts/nfg_ui/document_ready.coffee
381
382
  - app/assets/javascripts/nfg_ui/prevent_clickable_disabled_element.coffee
382
383
  - app/assets/javascripts/nfg_ui/select2.coffee
383
384
  - app/assets/javascripts/nfg_ui/tooltips.coffee