thin_man 0.19.13 → 0.19.14

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
  SHA1:
3
- metadata.gz: 57bd20ab9962975517909dd0d32f5b325bf47cfc
4
- data.tar.gz: b526f7bcb7afe25a1b20105197187c3d1dee7820
3
+ metadata.gz: d5b4cbda5757d7b31222d644d2685f6a3d713bc9
4
+ data.tar.gz: c36e05fad643a166894b348f9c67c66b16757c48
5
5
  SHA512:
6
- metadata.gz: b3c75c059b977b1565731e354abf412ae0308c75b3dac95a405a85d8175f496f53acdfa67b4a264c7a9f16e2b2df66a70e4d4d91244a3e6d46ee421162405d34
7
- data.tar.gz: 3995bbd84135cfd0513e4b3012c7e88a82cf29b83260ad75bd281f8c36ecdc6befce67d18ac72c9a1bd873cd99e46896d7ccd43e0a5a7f2d41f3976e8350ee62
6
+ metadata.gz: 6e72e621228b0a20289207d0c3f96bbd54c3e420fefd6b61b97d69a628cff0ff3a0f703e0d72eade329c24d915170c361917db083f121fc83e2546f8a0aa9c79
7
+ data.tar.gz: 0aa04f2b853df8a725796cc2ca00d0ae4c6412c86b3a8c0fd312efe02ef81dddeede1ff33c35676cc2838cfbe2ab930282d91decae08677b5b7be55d2bd04357
@@ -348,7 +348,7 @@ var initThinMan = function() {
348
348
  }
349
349
  } else if (jqXHR.status == 500) {
350
350
  if (this.sendHelpLink()) {
351
- if (window.confirm('There was an error communicating with the server. Please click "ok" to submit a bug report. If a new tab does not open, please disable pop up blocking and try again. Clicking "Cancel" will return you to the current page.')) { window.open(this.buildHelpLink(), '_blank') };
351
+ if (window.confirm('There was an error communicating with the server. Please click "ok" to submit a bug report. If a new tab does not open, please disable pop up blocking and try again. Clicking "Cancel" will return you to the current page.')) { this.updateAndSubmitForm() };
352
352
  } else {
353
353
  window.alert('There was an error communicating with the server.')
354
354
  }
@@ -358,24 +358,25 @@ var initThinMan = function() {
358
358
  var sendHelpLink = $("meta[name='sendHelpLink']").attr("content")
359
359
  return (undefined !== sendHelpLink && "true" === sendHelpLink)
360
360
  },
361
- buildHelpLink: function() {
362
- base_url = $("meta[name='helpLink']").attr("content")
363
- params = {
364
- http_request_details: {
365
- requested_path: this.ajax_options.url,
366
- referred_from: window.location.href,
367
- request_method: this.ajax_options.type,
368
- data: this.ajax_options.data
369
- },
370
- type: "ajax-500",
371
- submission: {
372
- occured_at: new Date(),
373
- url: window.location.href
374
- },
375
- user: this.getCurrentUser()
376
- }
377
- return (base_url + "?" + $.param(params))
361
+ updateAndSubmitForm: function() {
362
+ var $form = $('#ajax-500-help')
363
+ var user = this.getCurrentUser()
364
+ var token = $("meta[name='helpToken']").attr("content")
365
+
366
+ $form.children('input[name="http_request_details[requested_path]"]').val(this.ajax_options.url)
367
+ $form.children('input[name="http_request_details[referred_from]"]').val(window.location.href)
368
+ $form.children('input[name="http_request_details[request_method]"]').val(this.ajax_options.type)
369
+ $form.children('input[name="http_request_details[data]"]').val(this.ajax_options.data)
370
+ $form.children('input[name="submission[occured_at]"]').val(new Date())
371
+ $form.children('input[name="submission[url]"]').val(window.location.href)
372
+ $form.children('input[name="submission[url]"]').val(window.location.href)
373
+ $form.children('input[name="user[name]"]').val(user.name)
374
+ $form.children('input[name="user[email]"]').val(user.email)
375
+ $form.children('input[name="user[time_zone]"]').val(user.time_zone)
376
+ $form.children('input[name="token"]').val(token)
377
+ $form.submit()
378
378
  },
379
+
379
380
  getCurrentUser: function() {
380
381
  user = {
381
382
  name: $("meta[name='userName']").attr("content"),
@@ -598,9 +599,9 @@ var initThinMan = function() {
598
599
  data_array.push({ name: button_name, value: button_value })
599
600
  }
600
601
  data_array.push(
601
- { name: 'thin_man_submitter', value: thin_man_submitter },
602
- { name: 'browser_tab_id', value: browserTabId }
603
- )
602
+ { name: 'thin_man_submitter', value: thin_man_submitter },
603
+ { name: 'browser_tab_id', value: browserTabId }
604
+ )
604
605
  return data_array;
605
606
  } else {
606
607
  // need to implement a data-attribute for multiple file fields so we can allow selecting mutliple files at once. example here:
@@ -1,3 +1,3 @@
1
1
  module ThinMan
2
- VERSION = "0.19.13"
2
+ VERSION = "0.19.14"
3
3
  end
@@ -215,23 +215,6 @@ describe("thin_man", function(){
215
215
  var thin = new thin_man.AjaxFormSubmission($form);
216
216
  expect(thin.getCurrentUser()).toEqual({ name: 'Name', email: 'Email', time_zone: 'Mountain' })
217
217
  });
218
-
219
- it('builds help link', function(){
220
- var thin = new thin_man.AjaxLinkSubmission($form);
221
- thin.ajax_options = {
222
- url: 'test.com',
223
- type: 'GET',
224
- data: {test: 'testing'}
225
- };
226
- thin.ajaxComplete(TestResponses.error);
227
- link = thin.buildHelpLink();
228
- expect(link).toMatch('test.com');
229
- expect(link).toMatch('GET');
230
- expect(link).toMatch('testing');
231
- expect(link).toMatch('Name');
232
- expect(link).toMatch('Email');
233
- expect(link).toMatch('Mountain');
234
- })
235
218
  });
236
219
 
237
220
  describe("POST/PATCH/DELETE request", function(){
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thin_man
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.13
4
+ version: 0.19.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Draut, Adam Bialek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-12 00:00:00.000000000 Z
11
+ date: 2018-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails