ext_yarn 0.2.0 → 0.3.0

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: 5524117d0cb9f6c77bace1651cfc079967650fe45d95a76ee89e90755b2e3f42
4
- data.tar.gz: 406d6b26bd971d4059d9f06acb4c920e8a7e7359c9327dcb22443bee6f36eb9a
3
+ metadata.gz: 1edcfc68e21531d2d8cfb737b5882686ad65954dd6c9f4c9051e3cfd3d44f706
4
+ data.tar.gz: 4267f63e820f5acaa79d2dfdb03b5088aacf5941966d0a35922aeadacda507b8
5
5
  SHA512:
6
- metadata.gz: 5c6b4d7f41741ba19ce2c0c77a90ab72ecc3ac7285ebda4401d7652ce482ad3737593ab5291906ac4c33cb9df5ff32c704a767142c0999eb294bde087ee77f23
7
- data.tar.gz: 711726ea16d8f7bf4bbecad87dbec76cd63f5a677593c6539d11bcd828e03f5718292bc81307ff84d4264767c14daa88f3b4ab1f4ebc58f677a2e8f6d25b1f3d
6
+ metadata.gz: 1027018c23d91e4c7b45e1b95129d5555170f36b2f06ea6dd5c504f8e33b22857bbc9e8870e14bd747d34158665f8e6615cbfec82953a1ec54ce288e77d3a9ce
7
+ data.tar.gz: a16636931411f4425e134cf95caf2fa51cd66595977ec35779007ec0b7eb4a4273cbf6dbb12d47f026672ee71e7d328e3bbbde9d4964e8810e32ca2760bbb5a2
data/.gitignore CHANGED
@@ -142,6 +142,9 @@ vendor/popper.js/dist/esm/*
142
142
  vendor/popper.js/dist/*.js
143
143
  vendor/popper.js/*.md
144
144
 
145
+ vendor/rails-ujs/*.md
146
+ vendor/rails-ujs/README.rdoc
147
+
145
148
  vendor/roboto-fontface/*
146
149
  !vendor/roboto-fontface/css*
147
150
  vendor/roboto-fontface/css/**/*.css
@@ -1,3 +1,3 @@
1
1
  module ExtYarn
2
- VERSION = '0.2.0'
2
+ VERSION = '0.3.0'
3
3
  end
data/package.json CHANGED
@@ -22,6 +22,7 @@
22
22
  "moment-timezone": "^0.5.14",
23
23
  "nprogress": "rstacruz/nprogress",
24
24
  "popper.js": "^1.14.4",
25
+ "rails-ujs": "^5.2.1",
25
26
  "roboto-fontface": "^0.8.0",
26
27
  "signature_pad": "^2.3.2",
27
28
  "tempusdominus-bootstrap-4": "^5.1.2"
@@ -26,6 +26,7 @@
26
26
  "moment@^2.19.1",
27
27
  "nprogress@rstacruz/nprogress",
28
28
  "popper.js@^1.14.4",
29
+ "rails-ujs@^5.2.1",
29
30
  "roboto-fontface@^0.8.0",
30
31
  "signature_pad@^2.3.2",
31
32
  "tempusdominus-bootstrap-4@^5.1.2"
@@ -68,6 +69,7 @@
68
69
  "nprogress@rstacruz/nprogress": "https://codeload.github.com/rstacruz/nprogress/tar.gz/a0ab16ccdaca501d8d9881a4da1d691f4e6c4dda",
69
70
  "popper.js@^1.14.3": "https://registry.yarnpkg.com/popper.js/-/popper.js-1.14.4.tgz#8eec1d8ff02a5a3a152dd43414a15c7b79fd69b6",
70
71
  "popper.js@^1.14.4": "https://registry.yarnpkg.com/popper.js/-/popper.js-1.14.4.tgz#8eec1d8ff02a5a3a152dd43414a15c7b79fd69b6",
72
+ "rails-ujs@^5.2.1": "https://registry.yarnpkg.com/rails-ujs/-/rails-ujs-5.2.1.tgz#2869c6d54fdfefac3aaa257f4efe211d8f5a7169",
71
73
  "roboto-fontface@^0.8.0": "https://registry.yarnpkg.com/roboto-fontface/-/roboto-fontface-0.8.0.tgz#031a83c8f79932801a57d83bf743f37250163499",
72
74
  "signature_pad@^2.3.2": "https://registry.yarnpkg.com/signature_pad/-/signature_pad-2.3.2.tgz#ca7230021c89cedeead27b33d8d16ff254e5f04a",
73
75
  "tempusdominus-bootstrap-4@^5.1.2": "https://registry.yarnpkg.com/tempusdominus-bootstrap-4/-/tempusdominus-bootstrap-4-5.1.2.tgz#3c9906ca6e5d563faa0b81b2fdc6aa79cad9c0be"
@@ -0,0 +1,707 @@
1
+ /*
2
+ Unobtrusive JavaScript
3
+ https://github.com/rails/rails/blob/master/actionview/app/assets/javascripts
4
+ Released under the MIT license
5
+ */
6
+
7
+ (function() {
8
+ var context = this;
9
+
10
+ (function() {
11
+ (function() {
12
+ this.Rails = {
13
+ linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]',
14
+ buttonClickSelector: {
15
+ selector: 'button[data-remote]:not([form]), button[data-confirm]:not([form])',
16
+ exclude: 'form button'
17
+ },
18
+ inputChangeSelector: 'select[data-remote], input[data-remote], textarea[data-remote]',
19
+ formSubmitSelector: 'form',
20
+ formInputClickSelector: 'form input[type=submit], form input[type=image], form button[type=submit], form button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])',
21
+ formDisableSelector: 'input[data-disable-with]:enabled, button[data-disable-with]:enabled, textarea[data-disable-with]:enabled, input[data-disable]:enabled, button[data-disable]:enabled, textarea[data-disable]:enabled',
22
+ formEnableSelector: 'input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled, input[data-disable]:disabled, button[data-disable]:disabled, textarea[data-disable]:disabled',
23
+ fileInputSelector: 'input[name][type=file]:not([disabled])',
24
+ linkDisableSelector: 'a[data-disable-with], a[data-disable]',
25
+ buttonDisableSelector: 'button[data-remote][data-disable-with], button[data-remote][data-disable]'
26
+ };
27
+
28
+ }).call(this);
29
+ }).call(context);
30
+
31
+ var Rails = context.Rails;
32
+
33
+ (function() {
34
+ (function() {
35
+ var cspNonce;
36
+
37
+ cspNonce = Rails.cspNonce = function() {
38
+ var meta;
39
+ meta = document.querySelector('meta[name=csp-nonce]');
40
+ return meta && meta.content;
41
+ };
42
+
43
+ }).call(this);
44
+ (function() {
45
+ var expando, m;
46
+
47
+ m = Element.prototype.matches || Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector;
48
+
49
+ Rails.matches = function(element, selector) {
50
+ if (selector.exclude != null) {
51
+ return m.call(element, selector.selector) && !m.call(element, selector.exclude);
52
+ } else {
53
+ return m.call(element, selector);
54
+ }
55
+ };
56
+
57
+ expando = '_ujsData';
58
+
59
+ Rails.getData = function(element, key) {
60
+ var ref;
61
+ return (ref = element[expando]) != null ? ref[key] : void 0;
62
+ };
63
+
64
+ Rails.setData = function(element, key, value) {
65
+ if (element[expando] == null) {
66
+ element[expando] = {};
67
+ }
68
+ return element[expando][key] = value;
69
+ };
70
+
71
+ Rails.$ = function(selector) {
72
+ return Array.prototype.slice.call(document.querySelectorAll(selector));
73
+ };
74
+
75
+ }).call(this);
76
+ (function() {
77
+ var $, csrfParam, csrfToken;
78
+
79
+ $ = Rails.$;
80
+
81
+ csrfToken = Rails.csrfToken = function() {
82
+ var meta;
83
+ meta = document.querySelector('meta[name=csrf-token]');
84
+ return meta && meta.content;
85
+ };
86
+
87
+ csrfParam = Rails.csrfParam = function() {
88
+ var meta;
89
+ meta = document.querySelector('meta[name=csrf-param]');
90
+ return meta && meta.content;
91
+ };
92
+
93
+ Rails.CSRFProtection = function(xhr) {
94
+ var token;
95
+ token = csrfToken();
96
+ if (token != null) {
97
+ return xhr.setRequestHeader('X-CSRF-Token', token);
98
+ }
99
+ };
100
+
101
+ Rails.refreshCSRFTokens = function() {
102
+ var param, token;
103
+ token = csrfToken();
104
+ param = csrfParam();
105
+ if ((token != null) && (param != null)) {
106
+ return $('form input[name="' + param + '"]').forEach(function(input) {
107
+ return input.value = token;
108
+ });
109
+ }
110
+ };
111
+
112
+ }).call(this);
113
+ (function() {
114
+ var CustomEvent, fire, matches, preventDefault;
115
+
116
+ matches = Rails.matches;
117
+
118
+ CustomEvent = window.CustomEvent;
119
+
120
+ if (typeof CustomEvent !== 'function') {
121
+ CustomEvent = function(event, params) {
122
+ var evt;
123
+ evt = document.createEvent('CustomEvent');
124
+ evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
125
+ return evt;
126
+ };
127
+ CustomEvent.prototype = window.Event.prototype;
128
+ preventDefault = CustomEvent.prototype.preventDefault;
129
+ CustomEvent.prototype.preventDefault = function() {
130
+ var result;
131
+ result = preventDefault.call(this);
132
+ if (this.cancelable && !this.defaultPrevented) {
133
+ Object.defineProperty(this, 'defaultPrevented', {
134
+ get: function() {
135
+ return true;
136
+ }
137
+ });
138
+ }
139
+ return result;
140
+ };
141
+ }
142
+
143
+ fire = Rails.fire = function(obj, name, data) {
144
+ var event;
145
+ event = new CustomEvent(name, {
146
+ bubbles: true,
147
+ cancelable: true,
148
+ detail: data
149
+ });
150
+ obj.dispatchEvent(event);
151
+ return !event.defaultPrevented;
152
+ };
153
+
154
+ Rails.stopEverything = function(e) {
155
+ fire(e.target, 'ujs:everythingStopped');
156
+ e.preventDefault();
157
+ e.stopPropagation();
158
+ return e.stopImmediatePropagation();
159
+ };
160
+
161
+ Rails.delegate = function(element, selector, eventType, handler) {
162
+ return element.addEventListener(eventType, function(e) {
163
+ var target;
164
+ target = e.target;
165
+ while (!(!(target instanceof Element) || matches(target, selector))) {
166
+ target = target.parentNode;
167
+ }
168
+ if (target instanceof Element && handler.call(target, e) === false) {
169
+ e.preventDefault();
170
+ return e.stopPropagation();
171
+ }
172
+ });
173
+ };
174
+
175
+ }).call(this);
176
+ (function() {
177
+ var AcceptHeaders, CSRFProtection, createXHR, cspNonce, fire, prepareOptions, processResponse;
178
+
179
+ cspNonce = Rails.cspNonce, CSRFProtection = Rails.CSRFProtection, fire = Rails.fire;
180
+
181
+ AcceptHeaders = {
182
+ '*': '*/*',
183
+ text: 'text/plain',
184
+ html: 'text/html',
185
+ xml: 'application/xml, text/xml',
186
+ json: 'application/json, text/javascript',
187
+ script: 'text/javascript, application/javascript, application/ecmascript, application/x-ecmascript'
188
+ };
189
+
190
+ Rails.ajax = function(options) {
191
+ var xhr;
192
+ options = prepareOptions(options);
193
+ xhr = createXHR(options, function() {
194
+ var ref, response;
195
+ response = processResponse((ref = xhr.response) != null ? ref : xhr.responseText, xhr.getResponseHeader('Content-Type'));
196
+ if (Math.floor(xhr.status / 100) === 2) {
197
+ if (typeof options.success === "function") {
198
+ options.success(response, xhr.statusText, xhr);
199
+ }
200
+ } else {
201
+ if (typeof options.error === "function") {
202
+ options.error(response, xhr.statusText, xhr);
203
+ }
204
+ }
205
+ return typeof options.complete === "function" ? options.complete(xhr, xhr.statusText) : void 0;
206
+ });
207
+ if ((options.beforeSend != null) && !options.beforeSend(xhr, options)) {
208
+ return false;
209
+ }
210
+ if (xhr.readyState === XMLHttpRequest.OPENED) {
211
+ return xhr.send(options.data);
212
+ }
213
+ };
214
+
215
+ prepareOptions = function(options) {
216
+ options.url = options.url || location.href;
217
+ options.type = options.type.toUpperCase();
218
+ if (options.type === 'GET' && options.data) {
219
+ if (options.url.indexOf('?') < 0) {
220
+ options.url += '?' + options.data;
221
+ } else {
222
+ options.url += '&' + options.data;
223
+ }
224
+ }
225
+ if (AcceptHeaders[options.dataType] == null) {
226
+ options.dataType = '*';
227
+ }
228
+ options.accept = AcceptHeaders[options.dataType];
229
+ if (options.dataType !== '*') {
230
+ options.accept += ', */*; q=0.01';
231
+ }
232
+ return options;
233
+ };
234
+
235
+ createXHR = function(options, done) {
236
+ var xhr;
237
+ xhr = new XMLHttpRequest();
238
+ xhr.open(options.type, options.url, true);
239
+ xhr.setRequestHeader('Accept', options.accept);
240
+ if (typeof options.data === 'string') {
241
+ xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
242
+ }
243
+ if (!options.crossDomain) {
244
+ xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
245
+ }
246
+ CSRFProtection(xhr);
247
+ xhr.withCredentials = !!options.withCredentials;
248
+ xhr.onreadystatechange = function() {
249
+ if (xhr.readyState === XMLHttpRequest.DONE) {
250
+ return done(xhr);
251
+ }
252
+ };
253
+ return xhr;
254
+ };
255
+
256
+ processResponse = function(response, type) {
257
+ var parser, script;
258
+ if (typeof response === 'string' && typeof type === 'string') {
259
+ if (type.match(/\bjson\b/)) {
260
+ try {
261
+ response = JSON.parse(response);
262
+ } catch (error) {}
263
+ } else if (type.match(/\b(?:java|ecma)script\b/)) {
264
+ script = document.createElement('script');
265
+ script.setAttribute('nonce', cspNonce());
266
+ script.text = response;
267
+ document.head.appendChild(script).parentNode.removeChild(script);
268
+ } else if (type.match(/\b(xml|html|svg)\b/)) {
269
+ parser = new DOMParser();
270
+ type = type.replace(/;.+/, '');
271
+ try {
272
+ response = parser.parseFromString(response, type);
273
+ } catch (error) {}
274
+ }
275
+ }
276
+ return response;
277
+ };
278
+
279
+ Rails.href = function(element) {
280
+ return element.href;
281
+ };
282
+
283
+ Rails.isCrossDomain = function(url) {
284
+ var e, originAnchor, urlAnchor;
285
+ originAnchor = document.createElement('a');
286
+ originAnchor.href = location.href;
287
+ urlAnchor = document.createElement('a');
288
+ try {
289
+ urlAnchor.href = url;
290
+ return !(((!urlAnchor.protocol || urlAnchor.protocol === ':') && !urlAnchor.host) || (originAnchor.protocol + '//' + originAnchor.host === urlAnchor.protocol + '//' + urlAnchor.host));
291
+ } catch (error) {
292
+ e = error;
293
+ return true;
294
+ }
295
+ };
296
+
297
+ }).call(this);
298
+ (function() {
299
+ var matches, toArray;
300
+
301
+ matches = Rails.matches;
302
+
303
+ toArray = function(e) {
304
+ return Array.prototype.slice.call(e);
305
+ };
306
+
307
+ Rails.serializeElement = function(element, additionalParam) {
308
+ var inputs, params;
309
+ inputs = [element];
310
+ if (matches(element, 'form')) {
311
+ inputs = toArray(element.elements);
312
+ }
313
+ params = [];
314
+ inputs.forEach(function(input) {
315
+ if (!input.name || input.disabled) {
316
+ return;
317
+ }
318
+ if (matches(input, 'select')) {
319
+ return toArray(input.options).forEach(function(option) {
320
+ if (option.selected) {
321
+ return params.push({
322
+ name: input.name,
323
+ value: option.value
324
+ });
325
+ }
326
+ });
327
+ } else if (input.checked || ['radio', 'checkbox', 'submit'].indexOf(input.type) === -1) {
328
+ return params.push({
329
+ name: input.name,
330
+ value: input.value
331
+ });
332
+ }
333
+ });
334
+ if (additionalParam) {
335
+ params.push(additionalParam);
336
+ }
337
+ return params.map(function(param) {
338
+ if (param.name != null) {
339
+ return (encodeURIComponent(param.name)) + "=" + (encodeURIComponent(param.value));
340
+ } else {
341
+ return param;
342
+ }
343
+ }).join('&');
344
+ };
345
+
346
+ Rails.formElements = function(form, selector) {
347
+ if (matches(form, 'form')) {
348
+ return toArray(form.elements).filter(function(el) {
349
+ return matches(el, selector);
350
+ });
351
+ } else {
352
+ return toArray(form.querySelectorAll(selector));
353
+ }
354
+ };
355
+
356
+ }).call(this);
357
+ (function() {
358
+ var allowAction, fire, stopEverything;
359
+
360
+ fire = Rails.fire, stopEverything = Rails.stopEverything;
361
+
362
+ Rails.handleConfirm = function(e) {
363
+ if (!allowAction(this)) {
364
+ return stopEverything(e);
365
+ }
366
+ };
367
+
368
+ allowAction = function(element) {
369
+ var answer, callback, message;
370
+ message = element.getAttribute('data-confirm');
371
+ if (!message) {
372
+ return true;
373
+ }
374
+ answer = false;
375
+ if (fire(element, 'confirm')) {
376
+ try {
377
+ answer = confirm(message);
378
+ } catch (error) {}
379
+ callback = fire(element, 'confirm:complete', [answer]);
380
+ }
381
+ return answer && callback;
382
+ };
383
+
384
+ }).call(this);
385
+ (function() {
386
+ var disableFormElement, disableFormElements, disableLinkElement, enableFormElement, enableFormElements, enableLinkElement, formElements, getData, matches, setData, stopEverything;
387
+
388
+ matches = Rails.matches, getData = Rails.getData, setData = Rails.setData, stopEverything = Rails.stopEverything, formElements = Rails.formElements;
389
+
390
+ Rails.handleDisabledElement = function(e) {
391
+ var element;
392
+ element = this;
393
+ if (element.disabled) {
394
+ return stopEverything(e);
395
+ }
396
+ };
397
+
398
+ Rails.enableElement = function(e) {
399
+ var element;
400
+ element = e instanceof Event ? e.target : e;
401
+ if (matches(element, Rails.linkDisableSelector)) {
402
+ return enableLinkElement(element);
403
+ } else if (matches(element, Rails.buttonDisableSelector) || matches(element, Rails.formEnableSelector)) {
404
+ return enableFormElement(element);
405
+ } else if (matches(element, Rails.formSubmitSelector)) {
406
+ return enableFormElements(element);
407
+ }
408
+ };
409
+
410
+ Rails.disableElement = function(e) {
411
+ var element;
412
+ element = e instanceof Event ? e.target : e;
413
+ if (matches(element, Rails.linkDisableSelector)) {
414
+ return disableLinkElement(element);
415
+ } else if (matches(element, Rails.buttonDisableSelector) || matches(element, Rails.formDisableSelector)) {
416
+ return disableFormElement(element);
417
+ } else if (matches(element, Rails.formSubmitSelector)) {
418
+ return disableFormElements(element);
419
+ }
420
+ };
421
+
422
+ disableLinkElement = function(element) {
423
+ var replacement;
424
+ replacement = element.getAttribute('data-disable-with');
425
+ if (replacement != null) {
426
+ setData(element, 'ujs:enable-with', element.innerHTML);
427
+ element.innerHTML = replacement;
428
+ }
429
+ element.addEventListener('click', stopEverything);
430
+ return setData(element, 'ujs:disabled', true);
431
+ };
432
+
433
+ enableLinkElement = function(element) {
434
+ var originalText;
435
+ originalText = getData(element, 'ujs:enable-with');
436
+ if (originalText != null) {
437
+ element.innerHTML = originalText;
438
+ setData(element, 'ujs:enable-with', null);
439
+ }
440
+ element.removeEventListener('click', stopEverything);
441
+ return setData(element, 'ujs:disabled', null);
442
+ };
443
+
444
+ disableFormElements = function(form) {
445
+ return formElements(form, Rails.formDisableSelector).forEach(disableFormElement);
446
+ };
447
+
448
+ disableFormElement = function(element) {
449
+ var replacement;
450
+ replacement = element.getAttribute('data-disable-with');
451
+ if (replacement != null) {
452
+ if (matches(element, 'button')) {
453
+ setData(element, 'ujs:enable-with', element.innerHTML);
454
+ element.innerHTML = replacement;
455
+ } else {
456
+ setData(element, 'ujs:enable-with', element.value);
457
+ element.value = replacement;
458
+ }
459
+ }
460
+ element.disabled = true;
461
+ return setData(element, 'ujs:disabled', true);
462
+ };
463
+
464
+ enableFormElements = function(form) {
465
+ return formElements(form, Rails.formEnableSelector).forEach(enableFormElement);
466
+ };
467
+
468
+ enableFormElement = function(element) {
469
+ var originalText;
470
+ originalText = getData(element, 'ujs:enable-with');
471
+ if (originalText != null) {
472
+ if (matches(element, 'button')) {
473
+ element.innerHTML = originalText;
474
+ } else {
475
+ element.value = originalText;
476
+ }
477
+ setData(element, 'ujs:enable-with', null);
478
+ }
479
+ element.disabled = false;
480
+ return setData(element, 'ujs:disabled', null);
481
+ };
482
+
483
+ }).call(this);
484
+ (function() {
485
+ var stopEverything;
486
+
487
+ stopEverything = Rails.stopEverything;
488
+
489
+ Rails.handleMethod = function(e) {
490
+ var csrfParam, csrfToken, form, formContent, href, link, method;
491
+ link = this;
492
+ method = link.getAttribute('data-method');
493
+ if (!method) {
494
+ return;
495
+ }
496
+ href = Rails.href(link);
497
+ csrfToken = Rails.csrfToken();
498
+ csrfParam = Rails.csrfParam();
499
+ form = document.createElement('form');
500
+ formContent = "<input name='_method' value='" + method + "' type='hidden' />";
501
+ if ((csrfParam != null) && (csrfToken != null) && !Rails.isCrossDomain(href)) {
502
+ formContent += "<input name='" + csrfParam + "' value='" + csrfToken + "' type='hidden' />";
503
+ }
504
+ formContent += '<input type="submit" />';
505
+ form.method = 'post';
506
+ form.action = href;
507
+ form.target = link.target;
508
+ form.innerHTML = formContent;
509
+ form.style.display = 'none';
510
+ document.body.appendChild(form);
511
+ form.querySelector('[type="submit"]').click();
512
+ return stopEverything(e);
513
+ };
514
+
515
+ }).call(this);
516
+ (function() {
517
+ var ajax, fire, getData, isCrossDomain, isRemote, matches, serializeElement, setData, stopEverything,
518
+ slice = [].slice;
519
+
520
+ matches = Rails.matches, getData = Rails.getData, setData = Rails.setData, fire = Rails.fire, stopEverything = Rails.stopEverything, ajax = Rails.ajax, isCrossDomain = Rails.isCrossDomain, serializeElement = Rails.serializeElement;
521
+
522
+ isRemote = function(element) {
523
+ var value;
524
+ value = element.getAttribute('data-remote');
525
+ return (value != null) && value !== 'false';
526
+ };
527
+
528
+ Rails.handleRemote = function(e) {
529
+ var button, data, dataType, element, method, url, withCredentials;
530
+ element = this;
531
+ if (!isRemote(element)) {
532
+ return true;
533
+ }
534
+ if (!fire(element, 'ajax:before')) {
535
+ fire(element, 'ajax:stopped');
536
+ return false;
537
+ }
538
+ withCredentials = element.getAttribute('data-with-credentials');
539
+ dataType = element.getAttribute('data-type') || 'script';
540
+ if (matches(element, Rails.formSubmitSelector)) {
541
+ button = getData(element, 'ujs:submit-button');
542
+ method = getData(element, 'ujs:submit-button-formmethod') || element.method;
543
+ url = getData(element, 'ujs:submit-button-formaction') || element.getAttribute('action') || location.href;
544
+ if (method.toUpperCase() === 'GET') {
545
+ url = url.replace(/\?.*$/, '');
546
+ }
547
+ if (element.enctype === 'multipart/form-data') {
548
+ data = new FormData(element);
549
+ if (button != null) {
550
+ data.append(button.name, button.value);
551
+ }
552
+ } else {
553
+ data = serializeElement(element, button);
554
+ }
555
+ setData(element, 'ujs:submit-button', null);
556
+ setData(element, 'ujs:submit-button-formmethod', null);
557
+ setData(element, 'ujs:submit-button-formaction', null);
558
+ } else if (matches(element, Rails.buttonClickSelector) || matches(element, Rails.inputChangeSelector)) {
559
+ method = element.getAttribute('data-method');
560
+ url = element.getAttribute('data-url');
561
+ data = serializeElement(element, element.getAttribute('data-params'));
562
+ } else {
563
+ method = element.getAttribute('data-method');
564
+ url = Rails.href(element);
565
+ data = element.getAttribute('data-params');
566
+ }
567
+ ajax({
568
+ type: method || 'GET',
569
+ url: url,
570
+ data: data,
571
+ dataType: dataType,
572
+ beforeSend: function(xhr, options) {
573
+ if (fire(element, 'ajax:beforeSend', [xhr, options])) {
574
+ return fire(element, 'ajax:send', [xhr]);
575
+ } else {
576
+ fire(element, 'ajax:stopped');
577
+ return false;
578
+ }
579
+ },
580
+ success: function() {
581
+ var args;
582
+ args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
583
+ return fire(element, 'ajax:success', args);
584
+ },
585
+ error: function() {
586
+ var args;
587
+ args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
588
+ return fire(element, 'ajax:error', args);
589
+ },
590
+ complete: function() {
591
+ var args;
592
+ args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
593
+ return fire(element, 'ajax:complete', args);
594
+ },
595
+ crossDomain: isCrossDomain(url),
596
+ withCredentials: (withCredentials != null) && withCredentials !== 'false'
597
+ });
598
+ return stopEverything(e);
599
+ };
600
+
601
+ Rails.formSubmitButtonClick = function(e) {
602
+ var button, form;
603
+ button = this;
604
+ form = button.form;
605
+ if (!form) {
606
+ return;
607
+ }
608
+ if (button.name) {
609
+ setData(form, 'ujs:submit-button', {
610
+ name: button.name,
611
+ value: button.value
612
+ });
613
+ }
614
+ setData(form, 'ujs:formnovalidate-button', button.formNoValidate);
615
+ setData(form, 'ujs:submit-button-formaction', button.getAttribute('formaction'));
616
+ return setData(form, 'ujs:submit-button-formmethod', button.getAttribute('formmethod'));
617
+ };
618
+
619
+ Rails.handleMetaClick = function(e) {
620
+ var data, link, metaClick, method;
621
+ link = this;
622
+ method = (link.getAttribute('data-method') || 'GET').toUpperCase();
623
+ data = link.getAttribute('data-params');
624
+ metaClick = e.metaKey || e.ctrlKey;
625
+ if (metaClick && method === 'GET' && !data) {
626
+ return e.stopImmediatePropagation();
627
+ }
628
+ };
629
+
630
+ }).call(this);
631
+ (function() {
632
+ var $, CSRFProtection, delegate, disableElement, enableElement, fire, formSubmitButtonClick, getData, handleConfirm, handleDisabledElement, handleMetaClick, handleMethod, handleRemote, refreshCSRFTokens;
633
+
634
+ fire = Rails.fire, delegate = Rails.delegate, getData = Rails.getData, $ = Rails.$, refreshCSRFTokens = Rails.refreshCSRFTokens, CSRFProtection = Rails.CSRFProtection, enableElement = Rails.enableElement, disableElement = Rails.disableElement, handleDisabledElement = Rails.handleDisabledElement, handleConfirm = Rails.handleConfirm, handleRemote = Rails.handleRemote, formSubmitButtonClick = Rails.formSubmitButtonClick, handleMetaClick = Rails.handleMetaClick, handleMethod = Rails.handleMethod;
635
+
636
+ if ((typeof jQuery !== "undefined" && jQuery !== null) && (jQuery.ajax != null) && !jQuery.rails) {
637
+ jQuery.rails = Rails;
638
+ jQuery.ajaxPrefilter(function(options, originalOptions, xhr) {
639
+ if (!options.crossDomain) {
640
+ return CSRFProtection(xhr);
641
+ }
642
+ });
643
+ }
644
+
645
+ Rails.start = function() {
646
+ if (window._rails_loaded) {
647
+ throw new Error('rails-ujs has already been loaded!');
648
+ }
649
+ window.addEventListener('pageshow', function() {
650
+ $(Rails.formEnableSelector).forEach(function(el) {
651
+ if (getData(el, 'ujs:disabled')) {
652
+ return enableElement(el);
653
+ }
654
+ });
655
+ return $(Rails.linkDisableSelector).forEach(function(el) {
656
+ if (getData(el, 'ujs:disabled')) {
657
+ return enableElement(el);
658
+ }
659
+ });
660
+ });
661
+ delegate(document, Rails.linkDisableSelector, 'ajax:complete', enableElement);
662
+ delegate(document, Rails.linkDisableSelector, 'ajax:stopped', enableElement);
663
+ delegate(document, Rails.buttonDisableSelector, 'ajax:complete', enableElement);
664
+ delegate(document, Rails.buttonDisableSelector, 'ajax:stopped', enableElement);
665
+ delegate(document, Rails.linkClickSelector, 'click', handleDisabledElement);
666
+ delegate(document, Rails.linkClickSelector, 'click', handleConfirm);
667
+ delegate(document, Rails.linkClickSelector, 'click', handleMetaClick);
668
+ delegate(document, Rails.linkClickSelector, 'click', disableElement);
669
+ delegate(document, Rails.linkClickSelector, 'click', handleRemote);
670
+ delegate(document, Rails.linkClickSelector, 'click', handleMethod);
671
+ delegate(document, Rails.buttonClickSelector, 'click', handleDisabledElement);
672
+ delegate(document, Rails.buttonClickSelector, 'click', handleConfirm);
673
+ delegate(document, Rails.buttonClickSelector, 'click', disableElement);
674
+ delegate(document, Rails.buttonClickSelector, 'click', handleRemote);
675
+ delegate(document, Rails.inputChangeSelector, 'change', handleDisabledElement);
676
+ delegate(document, Rails.inputChangeSelector, 'change', handleConfirm);
677
+ delegate(document, Rails.inputChangeSelector, 'change', handleRemote);
678
+ delegate(document, Rails.formSubmitSelector, 'submit', handleDisabledElement);
679
+ delegate(document, Rails.formSubmitSelector, 'submit', handleConfirm);
680
+ delegate(document, Rails.formSubmitSelector, 'submit', handleRemote);
681
+ delegate(document, Rails.formSubmitSelector, 'submit', function(e) {
682
+ return setTimeout((function() {
683
+ return disableElement(e);
684
+ }), 13);
685
+ });
686
+ delegate(document, Rails.formSubmitSelector, 'ajax:send', disableElement);
687
+ delegate(document, Rails.formSubmitSelector, 'ajax:complete', enableElement);
688
+ delegate(document, Rails.formInputClickSelector, 'click', handleDisabledElement);
689
+ delegate(document, Rails.formInputClickSelector, 'click', handleConfirm);
690
+ delegate(document, Rails.formInputClickSelector, 'click', formSubmitButtonClick);
691
+ document.addEventListener('DOMContentLoaded', refreshCSRFTokens);
692
+ return window._rails_loaded = true;
693
+ };
694
+
695
+ if (window.Rails === Rails && fire(document, 'rails:attachBindings')) {
696
+ Rails.start();
697
+ }
698
+
699
+ }).call(this);
700
+ }).call(this);
701
+
702
+ if (typeof module === "object" && module.exports) {
703
+ module.exports = Rails;
704
+ } else if (typeof define === "function" && define.amd) {
705
+ define(Rails);
706
+ }
707
+ }).call(this);
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "rails-ujs",
3
+ "version": "5.2.1",
4
+ "description": "Ruby on Rails unobtrusive scripting adapter",
5
+ "main": "lib/assets/compiled/rails-ujs.js",
6
+ "files": [
7
+ "lib/assets/compiled/*.js"
8
+ ],
9
+ "directories": {
10
+ "test": "test"
11
+ },
12
+ "scripts": {
13
+ "build": "bundle exec blade build",
14
+ "test": "echo \"See the README: https://github.com/rails/rails/blob/master/actionview/app/assets/javascripts#how-to-run-tests\" && exit 1",
15
+ "lint": "coffeelint app/assets/javascripts && eslint test/ujs/public/test"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "rails/rails"
20
+ },
21
+ "contributors": [
22
+ "Stephen St. Martin",
23
+ "Steve Schwartz",
24
+ "Dangyi Liu",
25
+ "All contributors"
26
+ ],
27
+ "license": "MIT",
28
+ "bugs": {
29
+ "url": "https://github.com/rails/rails/issues"
30
+ },
31
+ "homepage": "http://rubyonrails.org/",
32
+ "devDependencies": {
33
+ "coffeelint": "^1.15.7",
34
+ "eslint": "^2.13.1"
35
+ }
36
+ }
data/yarn.lock CHANGED
@@ -167,6 +167,11 @@ popper.js@^1.14.3, popper.js@^1.14.4:
167
167
  resolved "https://registry.yarnpkg.com/popper.js/-/popper.js-1.14.4.tgz#8eec1d8ff02a5a3a152dd43414a15c7b79fd69b6"
168
168
  integrity sha1-juwdj/AqWjoVLdQ0FKFce3n9abY=
169
169
 
170
+ rails-ujs@^5.2.1:
171
+ version "5.2.1"
172
+ resolved "https://registry.yarnpkg.com/rails-ujs/-/rails-ujs-5.2.1.tgz#2869c6d54fdfefac3aaa257f4efe211d8f5a7169"
173
+ integrity sha512-kOsSdmBATcilfMzBCYgbefQ+5eUG6BAr9rDy+GC09Cvqx0017XBVp1Xu/Ksvwr6r7fHzgNkEUpKnQoOflpNz+A==
174
+
170
175
  roboto-fontface@^0.8.0:
171
176
  version "0.8.0"
172
177
  resolved "https://registry.yarnpkg.com/roboto-fontface/-/roboto-fontface-0.8.0.tgz#031a83c8f79932801a57d83bf743f37250163499"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ext_yarn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrice Lebel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-12 00:00:00.000000000 Z
11
+ date: 2018-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sprockets-rails
@@ -703,6 +703,8 @@ files:
703
703
  - vendor/popper.js/dist/umd/popper-utils.js
704
704
  - vendor/popper.js/dist/umd/popper.js
705
705
  - vendor/popper.js/package.json
706
+ - vendor/rails-ujs/lib/assets/compiled/rails-ujs.js
707
+ - vendor/rails-ujs/package.json
706
708
  - vendor/roboto-fontface/LICENSE
707
709
  - vendor/roboto-fontface/css/mixins.scss
708
710
  - vendor/roboto-fontface/css/roboto-condensed/sass/roboto-condensed-fontface-bold-italic.scss