We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | define( |
||
2 | ['jquery', 'marionette', 'backbone', 'lodash', 'routing', 'template'], |
||
3 | function($, Mn, Backbone, _, Routing, Template) { |
||
4 | "use strict"; |
||
5 | |||
6 | return function(module, model) { |
||
7 | var LoaderView = Mn.ItemView.extend({ |
||
8 | template: Template.payment.loader |
||
9 | }); |
||
10 | |||
11 | return { |
||
12 | showMethod: function(routeFragment) { |
||
13 | var fragment = Backbone.history.getFragment(); |
||
14 | |||
15 | if (_.isEmpty(fragment)) { |
||
16 | fragment = routeFragment; |
||
17 | } |
||
18 | |||
19 | $('li', '#payment-method-tabs').removeClass('active'); |
||
20 | $('a[data-method="' + fragment + '"]').closest('li').addClass('active'); |
||
21 | |||
22 | var route = Routing.generate('_xhr_payments_settings', {'method': fragment}); |
||
23 | module.app.getRegion('paymentMethodData').show(new LoaderView); |
||
0 ignored issues
–
show
|
|||
24 | |||
25 | $.get(route, function(response) { |
||
26 | var ItemView = Mn.ItemView.extend({ |
||
27 | template: response, |
||
28 | ui: { |
||
29 | 'save': '#payment_methods_save' |
||
30 | }, |
||
31 | events: { |
||
32 | 'click @ui.save': 'saveMethod' |
||
33 | }, |
||
34 | saveMethod: function(event) { |
||
35 | event.preventDefault(); |
||
36 | |||
37 | module.app.getRegion('paymentMethodData').show(new LoaderView); |
||
0 ignored issues
–
show
|
|||
38 | |||
39 | var form = this.$('form'); |
||
40 | var data = form.serialize(), |
||
41 | url = form.prop('action'); |
||
42 | |||
43 | $.ajax({ |
||
44 | url: url, |
||
45 | data: data, |
||
46 | method: 'POST', |
||
47 | success: function(response) { |
||
48 | module.app.getRegion('paymentMethodData').show(new ItemView({template: response})); |
||
49 | model.fetch(); |
||
50 | } |
||
51 | }); |
||
52 | }, |
||
53 | onRender: function() { |
||
54 | setTimeout(function() { |
||
55 | $.material.init(); |
||
56 | }, 0); |
||
57 | } |
||
58 | }); |
||
59 | |||
60 | module.app.getRegion('paymentMethodData').show(new ItemView); |
||
0 ignored issues
–
show
|
|||
61 | }); |
||
62 | } |
||
63 | }; |
||
64 | }; |
||
65 | }); |
This requirement purely is a coding style requirement and is not required to run on JavaScript engines: