nfg_ui 0.9.15 → 0.9.16

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
  SHA256:
3
- metadata.gz: bcde1c0cb0c6710204e47174a49a1d9714b9eb7c4e8efc056a324931e1800461
4
- data.tar.gz: 568118cf6b42f055b63ee32a14f6176bf2c8c0ebc61c29d4054a8c645068c3ef
3
+ metadata.gz: a5eff2dbd27f1207470e754379027bd19cb9836c237a56658ab84b30f17cb7f4
4
+ data.tar.gz: 01aef97bf4e2783e9f3dd6bd29c84e34cb31e0ab6d5c26643033aa5802ca166a
5
5
  SHA512:
6
- metadata.gz: 857ab4ccaf62efa694c51439e508745aaab198efa34629cefe390324a78e8de6345ded9e078dc32a0ff8e3321d8803ead3f86f3c000a6ee490cbaef161ae381c
7
- data.tar.gz: c7c24d5c2eb5a605c28f7488d26219eaf371f0683c6e40814de5901ced519314686b3663df758d2818ea89c3549bdb66c2b33838e9f71df4db9a8a2920c6eeb5
6
+ metadata.gz: 59fa2d8d00081d85487382b477ced0d9f3ea869697cf7a90a395e3564e3806fe5c052c0005fd83500754ac99740a874eedbbd4a71a095683f453ce3ed8341c99
7
+ data.tar.gz: b0231f761e74ffffe0284805cea470fcaf04e7b89af05813a4fe5aaa394f11e9fb8f66c4521675252622f2e30cad16220dcd4ff4bfc864c0aab73f28393a544a
data/README.md CHANGED
@@ -1,7 +1,9 @@
1
1
  # Network for Good's Design System for Ruby on Rails
2
2
  The authoritative resource for the Network for Good front-end UI, empowered by the NFG Design System.
3
3
 
4
- Note: the readme documentation is a little out of date and will be updated with accurate info soon (note added on Jan. 19, 2019)
4
+ Note: the readme documentation is a little out of date and will be updated with accurate info soon (noted on Aug. 22, 2019)
5
+
6
+ See [changelog](https://github.com/network-for-good/nfg_ui/blob/master/CHANGELOG.md) for notes on updates.
5
7
 
6
8
  [Jump to development / setting up the gem locally](https://github.com/network-for-good/nfg_ui/blob/master/README.md#local-development--accessing-documentation)
7
9
 
@@ -2,11 +2,14 @@
2
2
  #= require popper
3
3
  #= require select2
4
4
  #= require bootstrap
5
+ #= require moment
6
+ #= require bootstrap-datetimepicker.min
5
7
 
6
8
  #= require_self
7
9
  #= require nfg_ui/collapsible_toggle
8
10
  #= require nfg_ui/vendor/select2
9
11
  #= require nfg_ui/vendor/tooltips
12
+ #= require nfg_ui/vendor/datetimepicker_configuration
10
13
 
11
14
  window.NfgUi = {}
12
15
 
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+
3
+ function _instanceof(left, right) { if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { return !!right[Symbol.hasInstance](left); } else { return left instanceof right; } }
4
+
5
+ function _classCallCheck(instance, Constructor) { if (!_instanceof(instance, Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
+
7
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
8
+
9
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
10
+
11
+ NfgUi.DateTimePicker =
12
+ /*#__PURE__*/
13
+ function () {
14
+ function DateTimePicker(input) {
15
+ _classCallCheck(this, DateTimePicker);
16
+
17
+ this.input = input;
18
+ this.input[0].readOnly = true;
19
+ this.input.datetimepicker(this.options());
20
+ this.input.on('dp.show', function (event) {
21
+ $('.bootstrap-datetimepicker-widget').addClass('fs-ignore-rage-clicks'); // makes fullstory ignore "rage clicks" on the datetimepicker
22
+ });
23
+ }
24
+
25
+ _createClass(DateTimePicker, [{
26
+ key: "options",
27
+ value: function options() {
28
+ var options = this.input.data('options') || {};
29
+
30
+ if (!options.format) {
31
+ options.format = this.defaultFormat();
32
+ }
33
+
34
+ options.useCurrent = false;
35
+ options.ignoreReadonly = true;
36
+ options.icons = {
37
+ time:"fa fa-clock-o",
38
+ date:"fa fa-calendar",
39
+ up:"fa fa-caret-up",
40
+ down:"fa fa-caret-down",
41
+ previous:"fa fa-caret-left",
42
+ next:"fa fa-caret-right",
43
+ today:"fa fa-crosshairs",
44
+ clear:"fa fa-trash-o",
45
+ close:"fa fa-times"
46
+ }
47
+ // options.debug = true
48
+ return options;
49
+ }
50
+ }, {
51
+ key: "defaultFormat",
52
+ value: function defaultFormat() {
53
+
54
+ if (this.input.data('datetimepicker') == 'datetime') {
55
+ return 'Y-MM-DD hh:mm A';
56
+ } else if (this.input.data('datetimepicker') == 'time') {
57
+ return 'hh:mm A';
58
+ } else {
59
+ return 'Y-MM-DD';
60
+ }
61
+ }
62
+ }]);
63
+
64
+ return DateTimePicker;
65
+ }();
66
+
67
+ $(function() {
68
+ var inputs = $("input[data-datetimepicker='datetime'], input[data-datetimepicker='date'], input[data-datetimepicker='time']");
69
+
70
+ if (!(inputs.length > 0)) {
71
+ return;
72
+ }
73
+
74
+ return inputs.each(function (index, input) {
75
+ return new NfgUi.DateTimePicker($(input));
76
+ });
77
+ });
@@ -16,6 +16,7 @@
16
16
 
17
17
  // Plugins
18
18
  @import 'nfg_ui/network_for_good/public/plugins/datepicker';
19
+ @import 'nfg_ui/network_for_good/public/plugins/datetimepicker';
19
20
  @import 'nfg_ui/network_for_good/public/plugins/sticky_div';
20
21
  @import 'nfg_ui/network_for_good/public/plugins/select2';
21
22
 
@@ -18,6 +18,7 @@
18
18
  @import 'plugins/datepicker';
19
19
  @import 'plugins/sticky_div';
20
20
  @import 'plugins/select2';
21
+ @import 'plugins/datetimepicker';
21
22
 
22
23
  // Legacy browser support
23
24
  @import 'legacy_browser_support/application';
@@ -16,4 +16,5 @@
16
16
  @import 'nfg_theme/custom';
17
17
 
18
18
  // Plugins
19
+ @import 'plugins/datetimepicker';
19
20
  @import 'plugins/select2';
@@ -0,0 +1,44 @@
1
+ // Specific styles for entity branding
2
+ .datepicker, .timepicker {
3
+
4
+ //** Default states for actions
5
+ [data-action^='select'],
6
+ [data-action^='picker'],
7
+ .prev,
8
+ .next,
9
+ .timepicker-picker a.btn {
10
+ &:hover, &:active, &.active {
11
+ color: color-yiq($primary) !important;
12
+ background-color: $primary !important;
13
+ }
14
+ }
15
+
16
+ //** Today's state
17
+ .today {
18
+ &.active {
19
+ &:hover, &:active {
20
+ color: color-yiq($primary) !important;
21
+ background-color: $primary !important;
22
+ }
23
+ }
24
+ }
25
+ }
26
+
27
+ //** Datepicker specific
28
+ .datepicker {
29
+ .prev, .next { color: color-yiq($primary, $yiq-text-dark, $primary); }
30
+ }
31
+
32
+ //** Timepicker picker section
33
+ .timepicker-picker td a { color: color-yiq($primary, $yiq-text-dark, $primary); }
34
+
35
+ //** Time/Date Toggle
36
+ .picker-switch.accordion-toggle {
37
+ a {
38
+ color: color-yiq($primary, $yiq-text-dark, $primary);
39
+ &:hover, &:active {
40
+ color: color-yiq($primary) !important;
41
+ background-color: $primary !important;
42
+ }
43
+ }
44
+ }
@@ -0,0 +1,265 @@
1
+ // @import 'jquery.datetimepicker.min.css';
2
+
3
+ //*****************************//
4
+ // DATEPICKER -- based on http://eonasdan.github.io/bootstrap-daetetimepicker/
5
+ //*****************************//
6
+
7
+ //** Base styles
8
+ .bootstrap-datetimepicker-widget {
9
+ display: block;
10
+ top: 0 !important;
11
+ padding: 0;
12
+ min-width: ($spacer * 14);
13
+ max-width: ($spacer * 14);
14
+ background-color: $white;
15
+ border: $border-width solid $border-color;
16
+ border-radius: 0;
17
+ z-index: 110;
18
+
19
+ &.dropdown-menu {
20
+ position: absolute !important;
21
+ top: 100% !important;
22
+ right: auto !important;
23
+ bottom: auto !important;
24
+ left: auto !important;
25
+ opacity: 1;
26
+ pointer-events: auto;
27
+ visibility: visible !important;
28
+ transform: none;
29
+ }
30
+
31
+ //** Base date and time styles
32
+ ul { margin: 0; }
33
+ .datepicker, .timepicker {
34
+ display: block;
35
+ margin-left: auto;
36
+ margin-right: auto;
37
+ }
38
+ a[data-action] { display: block; }
39
+
40
+ //** Table defaults
41
+ table {
42
+ width: 100%;
43
+ td, th {
44
+ text-align: center;
45
+ vertical-align: middle;
46
+ }
47
+ }
48
+
49
+ //** Time/Date Toggle
50
+ .collapse.show {
51
+ .timepicker-picker {
52
+ tr:first-child a, tr:last-child a { border-radius: 0; }
53
+ }
54
+ + .picker-switch { border-top: $border-width solid $border-color; }
55
+ }
56
+ .picker-switch + .collapse.show { border-top: $border-width solid $border-color; }
57
+
58
+ //** Accessbility
59
+ .prev, .next {
60
+ &:after {
61
+ position: absolute;
62
+ margin: -1px;
63
+ padding: 0;
64
+ width: 1px;
65
+ height: 1px;
66
+ border: 0;
67
+ overflow: hidden;
68
+ clip: rect(0, 0, 0, 0);
69
+ }
70
+ }
71
+ .prev:after { content: 'Previous Month'; }
72
+ .next:after { content: 'Next Month'; }
73
+ }
74
+
75
+ //** Shared datepicker and timepicker styles
76
+ .datepicker, .timepicker {
77
+
78
+ //** Default states for actions
79
+ [data-action^='select'],
80
+ [data-action^='picker'],
81
+ .prev,
82
+ .next,
83
+ .timepicker-picker a.btn {
84
+ cursor: pointer;
85
+ background-color: $white;
86
+ @include transition(color 250ms ease, background-color 250ms ease);
87
+ &:hover, &:active, &.active {
88
+ color: $white;
89
+ background-color: $link-color;
90
+ }
91
+ }
92
+ [data-action^='select'],
93
+ [data-action^='picker'] {
94
+ font-weight: $font-weight-bold;
95
+ font-size: $font-size-base;
96
+ color: $body-color;
97
+ border-left: $border-width solid $border-color;
98
+ border-top: $border-width solid $border-color;
99
+ }
100
+
101
+ //** Disabled or unavailable states
102
+ .unavailable, .old, .new, .disabled, .disabled:hover {
103
+ font-size: $font-size-sm;
104
+ color: $input-placeholder-color;
105
+ background-color: $input-disabled-bg;
106
+ }
107
+ .unavailable, .disabled { cursor: not-allowed; }
108
+
109
+ //** Today's state
110
+ .today {
111
+ color: $white;
112
+ background-color: $dark;
113
+ &.active {
114
+ &:hover, &:active { background-color: $link-color; }
115
+ }
116
+ }
117
+
118
+ //** Default sizing for select cells
119
+ [data-action^='select'] {
120
+ display: inline-block;
121
+ height: ($spacer * 3);
122
+ line-height: ($spacer * 3);
123
+ }
124
+ }
125
+
126
+ //** Datepicker specific
127
+ .datepicker {
128
+
129
+ //** Top picker switcher for month, year, decade
130
+ [data-action^='picker'] {
131
+ padding-top: ($spacer / 2);
132
+ padding-bottom: ($spacer / 2);
133
+ width: ($spacer * 10);
134
+ border-right: $border-width solid $border-color;
135
+ border-left: $border-width solid $border-color;
136
+ border-top: none;
137
+ }
138
+
139
+ //** Day of the week
140
+ .dow {
141
+ padding: ($spacer / 4);
142
+ font-weight: $font-weight-bold;
143
+ font-size: $font-size-base;
144
+ border-top: $border-width solid $border-color;
145
+ }
146
+
147
+ //** Previous/Next buttons
148
+ .prev, .next {
149
+ color: $link-color;
150
+ width: ($spacer * 2);
151
+ height: 100%;
152
+ }
153
+
154
+ //** Body
155
+ .datepicker-days {
156
+ [data-action^='select'] {
157
+ display: table-cell;
158
+ width: ($spacer * 2);
159
+ height: ($spacer * 2);
160
+ line-height: 1;
161
+ &:first-child { border-left: none; }
162
+ }
163
+ }
164
+ .datepicker-months,
165
+ .datepicker-years,
166
+ .datepicker-decades {
167
+ [data-action^='select'] {
168
+ width: 33.3333333%;
169
+ &:nth-child(3n + 1) { border-left: none; }
170
+ }
171
+ }
172
+ }
173
+
174
+ //** Timepicker specific
175
+ .timepicker {
176
+ [data-action^='select'] {
177
+ width: 25%;
178
+ &:nth-child(4n + 1) { border-left: none; }
179
+ }
180
+ [class^='timepicker-'] {
181
+ tr:first-child td { border-top: none; }
182
+ }
183
+ }
184
+
185
+ //** Timepicker picker section
186
+ .timepicker-picker {
187
+ padding-right: ($spacer / 2);
188
+ td {
189
+ width: 35%;
190
+ &:nth-child(2) { width: ($spacer / 2); }
191
+ &:nth-child(4) {
192
+ padding-left: ($spacer / 2);
193
+ width: ($spacer * 2);
194
+ }
195
+ a { color: $link-color; }
196
+ }
197
+ [class^='timepicker-'] {
198
+ display: block;
199
+ width: 100%;
200
+ height: ($spacer * 2);
201
+ line-height: ($spacer * 2);
202
+ font-weight: $font-weight-bold;
203
+ font-size: $font-size-lg;
204
+ cursor: pointer;
205
+ transition: background-color 250ms ease; // @include transition(background-color 250ms ease);
206
+ &:hover, &:active { background-color: $border-color; }
207
+ }
208
+ .btn {
209
+ position: relative;
210
+ display: block;
211
+ padding: ($spacer / 2) 0;
212
+ width: 100%;
213
+ height: ($spacer * 2);
214
+ }
215
+ }
216
+
217
+ //** Time/Date Toggle
218
+ .picker-switch.accordion-toggle {
219
+ a {
220
+ display: block;
221
+ padding-top: ($spacer / 2);
222
+ padding-bottom: ($spacer / 2);
223
+ color: $link-color;
224
+ background-color: $white;
225
+ cursor: pointer;
226
+ transition: color 250ms ease, background-color 250ms ease; // @include transition(color 250ms ease, background-color 250ms ease);
227
+ &:hover, &:active {
228
+ color: $white;
229
+ background-color: $link-color;
230
+ }
231
+ }
232
+ }
233
+
234
+ //** Accessbility
235
+ [data-action='togglePicker'],
236
+ [data-action='incrementHours'],
237
+ [data-action='incrementMinutes'],
238
+ [data-action='decrementHours'],
239
+ [data-action='decrementMinutes'],
240
+ [data-action='showHours'],
241
+ [data-action='showMinutes'],
242
+ [data-action='togglePeriod'],
243
+ [data-action='clear'],
244
+ [data-action='today'] {
245
+ &:after {
246
+ position: absolute;
247
+ margin: -1px;
248
+ padding: 0;
249
+ width: 1px;
250
+ height: 1px;
251
+ border: 0;
252
+ overflow: hidden;
253
+ clip: rect(0, 0, 0, 0);
254
+ }
255
+ }
256
+ [data-action='togglePicker']:after { content: 'Toggle Date and Time Screens'; }
257
+ [data-action='incrementHours']:after { content: 'Increment Hours'; }
258
+ [data-action='incrementMinutes']:after { content: 'Increment Minutes'; }
259
+ [data-action='decrementHours']:after { content: 'Decrement Hours'; }
260
+ [data-action='decrementMinutes']:after { content: 'Decrement Minutes'; }
261
+ [data-action='showHours']:after { content: 'Show Hours'; }
262
+ [data-action='showMinutes']:after { content: 'Show Minutes'; }
263
+ [data-action='togglePeriod']:after { content: 'Toggle AM/PM'; }
264
+ [data-action='clear']:after { content: 'Clear the picker'; }
265
+ [data-action='today']:after { content: 'Set the date to today'; }
data/lib/nfg_ui.rb CHANGED
@@ -9,6 +9,7 @@ require 'jquery-rails'
9
9
  require 'sass-rails'
10
10
  require 'select2-rails'
11
11
  require 'inky'
12
+ require 'momentjs-rails'
12
13
 
13
14
  module NfgUi
14
15
  DEFAULT_BOOTSTRAP_THEME = :primary
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NfgUi
4
- VERSION = '0.9.15'
4
+ VERSION = '0.9.16'
5
5
  end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NfgUi
4
+ <<<<<<< HEAD
5
+ VERSION = '0.9.15.1'
6
+ =======
7
+ VERSION = '0.9.16'
8
+ >>>>>>> master
9
+ 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.9.15
4
+ version: 0.9.16
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: 2019-08-01 00:00:00.000000000 Z
12
+ date: 2019-08-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bootstrap
@@ -123,6 +123,26 @@ dependencies:
123
123
  - - "~>"
124
124
  - !ruby/object:Gem::Version
125
125
  version: '4.0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: momentjs-rails
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - "~>"
131
+ - !ruby/object:Gem::Version
132
+ version: '2.11'
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ version: 2.11.1
136
+ type: :runtime
137
+ prerelease: false
138
+ version_requirements: !ruby/object:Gem::Requirement
139
+ requirements:
140
+ - - "~>"
141
+ - !ruby/object:Gem::Version
142
+ version: '2.11'
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: 2.11.1
126
146
  - !ruby/object:Gem::Dependency
127
147
  name: browser
128
148
  requirement: !ruby/object:Gem::Requirement
@@ -343,8 +363,8 @@ files:
343
363
  - app/assets/images/nfg_ui/email/nfg-logo.png
344
364
  - app/assets/javascripts/nfg_ui/application.coffee
345
365
  - app/assets/javascripts/nfg_ui/collapsible_toggle.coffee
346
- - app/assets/javascripts/nfg_ui/disable_with_for_links.coffee
347
366
  - app/assets/javascripts/nfg_ui/prevent_clickable_disabled_element.coffee
367
+ - app/assets/javascripts/nfg_ui/vendor/datetimepicker_configuration.js
348
368
  - app/assets/javascripts/nfg_ui/vendor/select2.coffee
349
369
  - app/assets/javascripts/nfg_ui/vendor/tooltips.coffee
350
370
  - app/assets/stylesheets/nfg_ui/bootstrap/application.scss
@@ -411,6 +431,7 @@ files:
411
431
  - app/assets/stylesheets/nfg_ui/network_for_good/public/entity_branding/nfg_theme/_utilities.scss
412
432
  - app/assets/stylesheets/nfg_ui/network_for_good/public/entity_branding/nfg_theme/custom/_everyday_default.scss
413
433
  - app/assets/stylesheets/nfg_ui/network_for_good/public/entity_branding/nfg_theme/custom/_nav_step.scss
434
+ - app/assets/stylesheets/nfg_ui/network_for_good/public/entity_branding/plugins/_datetimepicker.scss
414
435
  - app/assets/stylesheets/nfg_ui/network_for_good/public/entity_branding/plugins/_select2.scss
415
436
  - app/assets/stylesheets/nfg_ui/network_for_good/public/legacy_browser_support/_variables.scss
416
437
  - app/assets/stylesheets/nfg_ui/network_for_good/public/legacy_browser_support/application.scss
@@ -468,6 +489,7 @@ files:
468
489
  - app/assets/stylesheets/nfg_ui/network_for_good/public/nfg_theme/custom/_tile.scss
469
490
  - app/assets/stylesheets/nfg_ui/network_for_good/public/nfg_theme/custom/_user_navbar.scss
470
491
  - app/assets/stylesheets/nfg_ui/network_for_good/public/plugins/_datepicker.scss
492
+ - app/assets/stylesheets/nfg_ui/network_for_good/public/plugins/_datetimepicker.scss
471
493
  - app/assets/stylesheets/nfg_ui/network_for_good/public/plugins/_select2.scss
472
494
  - app/assets/stylesheets/nfg_ui/network_for_good/public/plugins/_sticky_div.scss
473
495
  - app/controllers/nfg_ui/application_controller.rb
@@ -711,6 +733,7 @@ files:
711
733
  - lib/nfg_ui/ui/utilities.rb
712
734
  - lib/nfg_ui/ui/utilities/initializer.rb
713
735
  - lib/nfg_ui/version.rb
736
+ - lib/nfg_ui/version.rb.orig
714
737
  - lib/tasks/nfg_ui_tasks.rake
715
738
  homepage: https://github.com/network-for-good/nfg_ui
716
739
  licenses:
@@ -1,32 +0,0 @@
1
- class NfgUi.DisableWithForLinks
2
- constructor: (@el) ->
3
- @buttonInnerHTML = @el.html()
4
- @initialize()
5
-
6
- $('body').on 'hide.bs.modal', '.modal', (e) =>
7
- @restoreHTML()
8
-
9
- initialize: ->
10
- return if @el.hasClass 'disabled'
11
- @el.addClass 'disabled'
12
- .attr { 'data-link-disabled' : true, 'disabled' : '', 'tabindex' : '-1' }
13
-
14
-
15
- restoreHTML: ->
16
- return unless @el.data('link-disabled')
17
- @el.html @buttonInnerHTML
18
-
19
- @el.removeClass 'disabled'
20
- .removeAttr 'data-link-disabled', 'disabled'
21
-
22
- $ ->
23
- elSelector = "a[data-disable-with]"
24
-
25
- $(elSelector).click (e) =>
26
- e.preventDefault();
27
- inst = new NfgUi.DisableWithForLinks $(e.target)
28
-
29
- $(document).on 'ajax:success', (e, xhr, settings) ->
30
- return unless $(elSelector).length
31
- $(elSelector).click (e) =>
32
- inst = new NfgUi.DisableWithForLinks $(e.target)