Skip to content

Commit 9d1e43e

Browse files
Use template strings
1 parent 29fb24a commit 9d1e43e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+218
-236
lines changed

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"comma-style": [2, "last"],
1717
"one-var": [2, "never"],
1818
"strict": [2, "global"],
19+
"prefer-template": 2,
1920
"no-console": 0,
2021
"no-use-before-define": [2, "nofunc"],
2122
"no-underscore-dangle": 0,

client/account/controllers/account.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function AccountController($scope, $window) {
1313
// are _all over the place_ and no base href is set anywhere. That's why $location refuses to work properly.
1414
var locationHash = $window.location.hash;
1515
if (locationHash) {
16-
$('a[href="' + locationHash + '"]').tab('show');
16+
$(`a[href="${locationHash}"]`).tab('show');
1717
}
1818

1919
$scope.deleteAccount = function (account) {
@@ -54,7 +54,7 @@ function AccountController($scope, $window) {
5454
var acct = {
5555
id: id,
5656
provider: provider,
57-
title: provider + ' ' + id,
57+
title: `${provider} ${id}`,
5858
last_updated: new Date(),
5959
config: {},
6060
cache: [],
@@ -65,7 +65,7 @@ function AccountController($scope, $window) {
6565
};
6666

6767
$scope.saveAccount = function (provider, account, next) {
68-
$.ajax('/api/account/' + provider + '/' + account.id, {
68+
$.ajax(`/api/account/${provider}/${account.id}`, {
6969
type: 'PUT',
7070
data: JSON.stringify(account),
7171
contentType: 'application/json',
@@ -102,7 +102,7 @@ function AccountController($scope, $window) {
102102
dataType: 'json',
103103
error: function (xhr) {
104104
var resp = $.parseJSON(xhr.responseText);
105-
$scope.error('Failed to change email: ' + resp.errors[0].message, true);
105+
$scope.error(`Failed to change email: ${resp.errors[0].message}`, true);
106106
},
107107
success: function () {
108108
$scope.success('Email successfully changed', true);

client/account/controllers/job.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
function JobController($scope, $element, $attrs) {
44
var name = $attrs.id.split('-')[1];
5-
$scope.$watch('user.jobplugins["' + name + '"]', function (value) {
5+
$scope.$watch(`user.jobplugins["${name}"]`, function (value) {
66
$scope.config = value;
77
});
88
}

client/alerts/controllers/alerts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ module.exports = function ($scope, $sce) {
4141
}
4242

4343
$scope.message = {
44-
text: $sce.trustAsHtml('<strong>Done.</strong> ' + text),
44+
text: $sce.trustAsHtml(`<strong>Done.</strong> ${text}`),
4545
type: 'success',
4646
showing: true
4747
};

client/ansi/filters/ansi.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module.exports = function () {
1212
.replace(/\u001b\[K[^\n\r]*/g, '')
1313
.replace(/[^\n]*\r([^\n])/g, '$1')
1414
.replace(/^[^\n]*\u001b\[0G/gm, '');
15-
if (startswithcr) input = '\r' + input;
15+
if (startswithcr) input = `\r${input}`;
1616
if (plaintext) return ansi_up.ansi_to_text(input);
1717
return ansi_up.ansi_to_html(ansi_up.escape_for_html(input));
1818
};

client/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ var $navbar = $('.navbar');
1010
require('angular-route');
1111

1212
$navbar.find('li').removeClass('active');
13-
$navbar.find('a[href="' + global.location.pathname + '"]')
13+
$navbar.find(`a[href="${global.location.pathname}"]`)
1414
.parent().addClass('active');
1515
$('#layout-header').hide();
1616
$('#invite-box').height($('#signup-box').height());

client/config/controllers/branches.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,25 @@ function BranchesController($scope) {
1010
$scope.allBranches = allBranches;
1111

1212
$scope.remove = function (item) {
13-
var actuallyDelete = confirm('Are you sure you want to remove ' + item.name + '?');
13+
var actuallyDelete = confirm(`Are you sure you want to remove ${item.name}?`);
1414
if (actuallyDelete) {
1515
item.loading = true;
1616
$scope.clearMessage();
1717
$.ajax({
18-
url: '/' + $scope.project.name + '/branches/',
18+
url: `/${$scope.project.name}/branches/`,
1919
type: 'DELETE',
2020
data: {name: item.name},
2121
success: function () {
2222
remove($scope.branches, item);
23-
$scope.success(item.name + ' is no longer a configured branch.', true);
23+
$scope.success(`${item.name} is no longer a configured branch.`, true);
2424
},
2525
error: function (xhr, ts, e) {
2626
item.loading = false;
2727
if (xhr && xhr.responseText) {
2828
var data = $.parseJSON(xhr.responseText);
29-
$scope.error('Error deleting branch: ' + data.errors[0], true);
29+
$scope.error(`Error deleting branch: ${data.errors[0]}`, true);
3030
} else {
31-
$scope.error('Error deleting branch: ' + e, true);
31+
$scope.error(`Error deleting branch: ${e}`, true);
3232
}
3333
}
3434
});
@@ -39,7 +39,7 @@ function BranchesController($scope) {
3939
var data = {name: $scope.branchName};
4040

4141
$.ajax({
42-
url: '/' + $scope.project.name + '/branches/',
42+
url: `/${$scope.project.name}/branches/`,
4343
type: 'POST',
4444
data: data,
4545
dataType: 'json',
@@ -53,9 +53,9 @@ function BranchesController($scope) {
5353
error: function (xhr, ts, e) {
5454
if (xhr && xhr.responseText) {
5555
var data = $.parseJSON(xhr.responseText);
56-
$scope.error('Error adding branch: ' + data.errors[0], true);
56+
$scope.error(`Error adding branch: ${data.errors[0]}`, true);
5757
} else {
58-
$scope.error('Error adding branch: ' + e, true);
58+
$scope.error(`Error adding branch: ${e}`, true);
5959
}
6060
}
6161
});
@@ -64,7 +64,7 @@ function BranchesController($scope) {
6464
$scope.changeBranchOrder = function (list) {
6565
$scope.branches = list;
6666
$.ajax({
67-
url: '/' + $scope.project.name + '/branches/',
67+
url: `/${$scope.project.name}/branches/`,
6868
type: 'PUT',
6969
data: JSON.stringify({branches: list}),
7070
contentType: 'application/json',
@@ -75,9 +75,9 @@ function BranchesController($scope) {
7575
error: function (xhr, ts, e) {
7676
if (xhr && xhr.responseText) {
7777
var data = $.parseJSON(xhr.responseText);
78-
$scope.error('Error changing order of branch: ' + data.errors[0], true);
78+
$scope.error(`Error changing order of branch: ${data.errors[0]}`, true);
7979
} else {
80-
$scope.error('Error changing order of branch: ' + e, true);
80+
$scope.error(`Error changing order of branch: ${e}`, true);
8181
}
8282
}
8383
});
@@ -93,7 +93,7 @@ function BranchesController($scope) {
9393
var data = {name: item.name, cloneName: cloneName};
9494

9595
$.ajax({
96-
url: '/' + $scope.project.name + '/branches/',
96+
url: `/${$scope.project.name}/branches/`,
9797
type: 'POST',
9898
data: data,
9999
dataType: 'json',
@@ -107,9 +107,9 @@ function BranchesController($scope) {
107107
error: function (xhr, ts, e) {
108108
if (xhr && xhr.responseText) {
109109
var data = $.parseJSON(xhr.responseText);
110-
$scope.error('Error cloning branch: ' + data.errors[0], true);
110+
$scope.error(`Error cloning branch: ${data.errors[0]}`, true);
111111
} else {
112-
$scope.error('Error cloning branch: ' + e, true);
112+
$scope.error(`Error cloning branch: ${e}`, true);
113113
}
114114
}
115115
});

client/config/controllers/collaborators.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,25 @@ function CollaboratorsController($scope) {
77
$scope.new_access = 0;
88
$scope.collaborators = global.collaborators || [];
99
$scope.remove = function (item) {
10-
var actuallyDelete = confirm('Are you sure you want to remove ' + item.email + '?');
10+
var actuallyDelete = confirm(`Are you sure you want to remove ${item.email}?`);
1111
if (actuallyDelete) {
1212
item.loading = true;
1313
$scope.clearMessage();
1414
$.ajax({
15-
url: '/' + $scope.project.name + '/collaborators/',
15+
url: `/${$scope.project.name}/collaborators/`,
1616
type: 'DELETE',
1717
data: {email: item.email},
1818
success: function () {
1919
remove($scope.collaborators, item);
20-
$scope.success(item.email + ' is no longer a collaborator on this project.', true);
20+
$scope.success(`${item.email} is no longer a collaborator on this project.`, true);
2121
},
2222
error: function (xhr, ts, e) {
2323
item.loading = false;
2424
if (xhr && xhr.responseText) {
2525
var data = $.parseJSON(xhr.responseText);
26-
$scope.error('Error deleting collaborator: ' + data.errors[0], true);
26+
$scope.error(`Error deleting collaborator: ${data.errors[0]}`, true);
2727
} else {
28-
$scope.error('Error deleting collaborator: ' + e, true);
28+
$scope.error(`Error deleting collaborator: ${e}`, true);
2929
}
3030
}
3131
});
@@ -40,7 +40,7 @@ function CollaboratorsController($scope) {
4040
};
4141

4242
$.ajax({
43-
url: '/' + $scope.project.name + '/collaborators/',
43+
url: `/${$scope.project.name}/collaborators/`,
4444
type: 'POST',
4545
data: data,
4646
dataType: 'json',
@@ -55,9 +55,9 @@ function CollaboratorsController($scope) {
5555
error: function (xhr, ts, e) {
5656
if (xhr && xhr.responseText) {
5757
var data = $.parseJSON(xhr.responseText);
58-
$scope.error('Error adding collaborator: ' + data.errors[0], true);
58+
$scope.error(`Error adding collaborator: ${data.errors[0]}`, true);
5959
} else {
60-
$scope.error('Error adding collaborator: ' + e, true);
60+
$scope.error(`Error adding collaborator: ${e}`, true);
6161
}
6262
}
6363
});

0 commit comments

Comments
 (0)