Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

[Cleanup] eslint prefer-template #745

Merged
merged 1 commit into from
Oct 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/adapters/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export default DS.RESTAdapter.extend(UserSession, {
startkey: '"org.couchdb.user"'
}
};
let allURL = this.endpoint + '_all_docs';
let allURL = `${this.endpoint}_all_docs`;
return this.ajax(allURL, 'GET', ajaxData);
},

Expand Down
4 changes: 2 additions & 2 deletions app/admin/roles/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ export default AbstractEditController.extend(UserRoles, UserSession, {
section.capabilities.forEach((key) => {
mappedCapabilities.push({
key: key,
name: this.get('i18n').t('admin.roles.capability.' + key)
name: this.get('i18n').t(`admin.roles.capability.${key}`)
});
});
return {
name: this.get('i18n').t('admin.roles.capability.' + section.name),
name: this.get('i18n').t(`admin.roles.capability.${section.name}`),
capabilities: mappedCapabilities
};
}),
Expand Down
2 changes: 1 addition & 1 deletion app/appointments/edit/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default AbstractEditController.extend(AppointmentStatuses, PatientSubmodu
let minute;
let minuteList = [];
for (minute = 0; minute < 60; minute++) {
minuteList.push(String('00' + minute).slice(-2));
minuteList.push(String(`00${minute}`).slice(-2));
}
return minuteList;
}.property(),
Expand Down
2 changes: 1 addition & 1 deletion app/appointments/search/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default AppointmentIndexRoute.extend(DateFormat, {
let startOfDay = startDate.startOf('day').toDate().getTime();
let searchOptions = {
startkey: [startOfDay, null, 'appointment_'],
endkey: [maxValue, maxValue, 'appointment_' + maxValue]
endkey: [maxValue, maxValue, `appointment_${maxValue}`]
};
return {
options: searchOptions,
Expand Down
2 changes: 1 addition & 1 deletion app/appointments/today/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default AppointmentIndexRoute.extend({
return {
options: {
startkey: [startOfDay, null, 'appointment_'],
endkey: [endOfDay, endOfDay, 'appointment_' + maxValue]
endkey: [endOfDay, endOfDay, `appointment_${maxValue}`]
},
mapReduce: 'appointments_by_date'
};
Expand Down
2 changes: 1 addition & 1 deletion app/components/charge-quantity.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default Ember.Component.extend({

didReceiveAttrs(/* attrs */) {
this._super(...arguments);
this.quantitySelected = Ember.computed.alias('model.' + this.get('pricingItem.id'));
this.quantitySelected = Ember.computed.alias(`model.${this.get('pricingItem.id')}`);
},

hasError: function() {
Expand Down
2 changes: 1 addition & 1 deletion app/components/charges-by-type-tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ export default Ember.Component.extend({

tabHref: function() {
let tabId = this.get('tabId');
return '#' + tabId;
return `#${tabId}`;
}.property('tabId')
});
6 changes: 3 additions & 3 deletions app/components/checkbox-or-typeahead.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ export default SelectOrTypeahead.extend({

_setup: function() {
let property = this.get('property');
Ember.defineProperty(this, 'errors', Ember.computed('model.errors.' + property, function() {
Ember.defineProperty(this, 'errors', Ember.computed(`model.errors.${property}`, function() {
let property = this.get('property');
let errors = this.get('model.errors.' + property);
let errors = this.get(`model.errors.${property}`);
if (!Ember.isEmpty(errors)) {
return errors[0];
}
Expand All @@ -47,7 +47,7 @@ export default SelectOrTypeahead.extend({
actions: {
checkboxChanged: function(value, checked) {
let property = this.get('property');
let propertyName = 'model.' + property;
let propertyName = `model.${property}`;
let selectedValues = this.get(propertyName);
if (!Ember.isArray(selectedValues)) {
selectedValues = [];
Expand Down
2 changes: 1 addition & 1 deletion app/components/custom-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default Ember.Component.extend(SelectValues, {
currentRow = [];
colCount = 0;
}
field.classNames += ' col-sm-' + (colWidth * colSpan);
field.classNames += ` col-sm-${colWidth * colSpan}`;
if (field.type === 'select') {
field.mappedValues = field.values.map(this.selectValuesMap);
}
Expand Down
10 changes: 5 additions & 5 deletions app/components/date-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,16 @@ export default HtmlInput.extend({
didReceiveAttrs(/* attrs */) {
this._super(...arguments);
let dateProperty = this.get('mainComponent.property');
let displayPropertyName = 'display_' + dateProperty;
let displayPropertyName = `display_${dateProperty}`;
this.set('mainComponent.property', displayPropertyName);
this.currentDate = Ember.computed.alias('mainComponent.model.' + dateProperty);
this.selectedValue = Ember.computed.alias('mainComponent.model.' + displayPropertyName);
this.currentDate = Ember.computed.alias(`mainComponent.model.${dateProperty}`);
this.selectedValue = Ember.computed.alias(`mainComponent.model.${displayPropertyName}`);
this.minDate = Ember.computed.alias('mainComponent.minDate');
this.maxDate = Ember.computed.alias('mainComponent.maxDate');
this.showTime = Ember.computed.alias('mainComponent.showTime');
this.yearRange = Ember.computed.alias('mainComponent.yearRange');
this.addObserver('mainComponent.model.' + dateProperty, this, this.currentDateChangedValue);
Ember.Binding.from('mainComponent.model.errors.' + dateProperty).to('mainComponent.model.errors.' + displayPropertyName).connect(this);
this.addObserver(`mainComponent.model.${dateProperty}`, this, this.currentDateChangedValue);
Ember.Binding.from(`mainComponent.model.errors.${dateProperty}`).to(`mainComponent.model.errors.${displayPropertyName}`).connect(this);
},

willDestroyElement: function() {
Expand Down
2 changes: 1 addition & 1 deletion app/components/icd10-typeahead.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default TypeAhead.extend({
cb(suggestions);
// Set the headers content.
let $header = this.$('.query-results');
$header.html('<strong><em>' + query + '</em></strong> returned <strong>' + suggestions.length + '</strong> results');
$header.html(`<strong><em>${query}</em></strong> returned <strong>${suggestions.length}</strong> results`);
}.bind(this));
},

Expand Down
4 changes: 2 additions & 2 deletions app/components/take-photo.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ export default Ember.Component.extend({
for (let i = 0; i !== sourceInfos.length; ++i) {
let sourceInfo = sourceInfos[i];
if (sourceInfo.kind === 'video') {
cameraLabel = 'Camera ' + (++cameraCount);
cameraLabel = `Camera '${++cameraCount}`;
if (sourceInfo.label) {
cameraLabel += ' (' + sourceInfo.label + ')';
cameraLabel += ` (${sourceInfo.label})`;
}
videoSources.addObject({
id: sourceInfo.id,
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/abstract-edit-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ export default Ember.Controller.extend(EditPanelProps, IsUpdateDisabled, ModalHe
this.saveModel(skipAfterUpdate);
}).catch((err) => {
if (!err.ignore) {
this.displayAlert('Error!!!!', 'An error occurred while attempting to save: ' + JSON.stringify(err));
this.displayAlert('Error!!!!', `An error occurred while attempting to save: ${JSON.stringify(err)}`);
}
});
} catch (ex) {
this.displayAlert('Error!!!!', 'An error occurred while attempting to save: ' + ex);
this.displayAlert('Error!!!!', `An error occurred while attempting to save: ${ex}`);
}
}
},
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/abstract-report-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ export default Ember.Controller.extend(DateFormat, ModalHelper, NumberFormat, Pa
}

});
csvRows.push('"' + rowToAdd.join('","') + '"');
csvRows.push(`"${rowToAdd.join('","')}"`);
});
let csvString = csvRows.join('\r\n');
let uriContent = 'data:application/csv;charset=utf-8,' + encodeURIComponent(csvString);
let uriContent = `data:application/csv;charset=utf-8,${encodeURIComponent(csvString)}`;
this.set('csvExport', uriContent);
},

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default Ember.Controller.extend(UserSession, {
let permissions = this.get('defaultCapabilities');
for (let capability in permissions) {
if (this.currentUserCan(capability)) {
this.set('userCan_' + capability, true);
this.set(`userCan_${capability}`, true);
}
}
}.on('init'),
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ export default Ember.Controller.extend(HospitalRunVersion, ModalHelper, Progress
let textToFind = this.get('searchText');
if (currentSearchText !== textToFind || currentRouteName.indexOf('.search') === -1) {
this.set('searchText', '');
this.set('progressMessage', 'Searching for ' + textToFind + '. Please wait...');
this.set('progressMessage', `Searching for ${textToFind}. Please wait...`);
this.showProgressModal();
this.transitionToRoute(this.searchRoute + '/' + textToFind);
this.transitionToRoute(`${this.searchRoute}/${textToFind}`);
}
}
},
Expand Down
6 changes: 3 additions & 3 deletions app/inventory/edit/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export default AbstractEditController.extend(InventoryLocations, InventoryTypeLi
sequence.incrementProperty('value', 1);
sequenceValue = sequence.get('value');
if (sequenceValue < 100000) {
friendlyId += String('00000' + sequenceValue).slice(-5);
friendlyId += String(`00000${sequenceValue}`).slice(-5);
} else {
friendlyId += sequenceValue;
}
Expand All @@ -222,7 +222,7 @@ export default AbstractEditController.extend(InventoryLocations, InventoryTypeLi
sequenceFinder.then(function(prefixChars) {
let store = this.get('store');
let newSequence = store.push(store.normalize('sequence', {
id: 'inventory_' + inventoryType,
id: `inventory_${inventoryType}`,
prefix: inventoryType.toLowerCase().substr(0, prefixChars),
value: 0
}));
Expand Down Expand Up @@ -287,7 +287,7 @@ export default AbstractEditController.extend(InventoryLocations, InventoryTypeLi
model.validate().then(function() {
if (model.get('isValid')) {
this.set('savingNewItem', true);
this.store.find('sequence', 'inventory_' + inventoryType).then(function(sequence) {
this.store.find('sequence', `inventory_${inventoryType}`).then(function(sequence) {
this._completeBeforeUpdate(sequence, resolve, reject);
}.bind(this), function() {
this._findSequence(inventoryType, resolve, reject);
Expand Down
20 changes: 10 additions & 10 deletions app/inventory/reports/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number
let i = this._numberFormat(beginningBalance + inventoryAdjustment);
let i18n = this.get('i18n');
if ((beginningBalance + inventoryAdjustment) < 0) {
this.get('reportRows').addObject([i18n.t('inventory.reports.rows.balanceEnd'), '', '(' + i + ')']);
this.get('reportRows').addObject([i18n.t('inventory.reports.rows.balanceEnd'), '', `(${i})`]);
} else {
this.get('reportRows').addObject([i18n.t('inventory.reports.rows.balanceEnd'), '', i]);
}
Expand Down Expand Up @@ -695,23 +695,23 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number
Object.keys(consumed).forEach(function(key) {
let i = this._getValidNumber(consumed[key]);
consumedTotal += i;
this.get('reportRows').addObject(['', key, '(' + this._numberFormat(i) + ')']);
this.get('reportRows').addObject(['', key, `(${this._numberFormat(i)})`]);
}.bind(this));
overallValue += consumedTotal;
this.get('reportRows').addObject([i18n.t('inventory.reports.rows.consumedPurchasesTotal'), '', '(' + this._numberFormat(consumedTotal) + ')']);
this.get('reportRows').addObject([i18n.t('inventory.reports.rows.consumedPurchasesTotal'), '', `(${this._numberFormat(consumedTotal)})`]);
}
if (Object.keys(gikConsumed).length > 0) {
this.get('reportRows').addObject([i18n.t('inventory.reports.rows.consumedGik'), '', '']);
let gikTotal = 0;
Object.keys(gikConsumed).forEach(function(key) {
let i = this._getValidNumber(gikConsumed[key]);
gikTotal += i;
this.get('reportRows').addObject(['', key, '(' + this._numberFormat(i) + ')']);
this.get('reportRows').addObject(['', key, `(${this._numberFormat(i)})`]);
}.bind(this));
overallValue += gikTotal;
this.get('reportRows').addObject([i18n.t('inventory.reports.rows.consumedGikTotal'), '', '(' + this._numberFormat(gikTotal) + ')']);
this.get('reportRows').addObject([i18n.t('inventory.reports.rows.consumedGikTotal'), '', `(${this._numberFormat(gikTotal)})`]);
}
this.get('reportRows').addObject([i18n.t('inventory.reports.rows.consumedTotal'), '', '(' + this._numberFormat(overallValue) + ')']);
this.get('reportRows').addObject([i18n.t('inventory.reports.rows.consumedTotal'), '', `(${this._numberFormat(overallValue)})`]);
adjustedValue -= overallValue;
}
// write the adjustment rows
Expand All @@ -727,13 +727,13 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number
this.get('reportRows').addObject(['', key, this._numberFormat(i)]);
} else {
adjustmentTotal -= i;
this.get('reportRows').addObject(['', key, '(' + this._numberFormat(i) + ')']);
this.get('reportRows').addObject(['', key, `(${this._numberFormat(i)})`]);
}
}.bind(this));
}
}.bind(this));
if (adjustmentTotal < 0) {
this.get('reportRows').addObject([i18n.t('inventory.reports.rows.adjustmentsTotal'), '', '(' + this._numberFormat(adjustmentTotal) + ')']);
this.get('reportRows').addObject([i18n.t('inventory.reports.rows.adjustmentsTotal'), '', `(${this._numberFormat(adjustmentTotal)})`]);
} else {
this.get('reportRows').addObject([i18n.t('inventory.reports.rows.adjustmentsTotal'), '', this._numberFormat(adjustmentTotal)]);
}
Expand Down Expand Up @@ -803,7 +803,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number
}
}.bind(this));
if (beginningBalance < 0) {
this.get('reportRows').addObject([i18n.t('inventory.reports.rows.balanceBegin'), '', '(' + this._numberFormat(beginningBalance) + ')']);
this.get('reportRows').addObject([i18n.t('inventory.reports.rows.balanceBegin'), '', `(${this._numberFormat(beginningBalance)})`]);
} else {
this.get('reportRows').addObject([i18n.t('inventory.reports.rows.balanceBegin'), '', this._numberFormat(beginningBalance)]);
}
Expand Down Expand Up @@ -944,7 +944,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number
if (consumedQuantity === 0) {
row.consumedPerDay = '0';
} else {
row.consumedPerDay = '?' + consumedQuantity;
row.consumedPerDay = `?${consumedQuantity}`;
}
row.daysLeft = '?';
}
Expand Down
2 changes: 1 addition & 1 deletion app/invoices/edit/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ export default AbstractEditController.extend(NumberFormat, PatientSubmodule, Pub
sequence.incrementProperty('value', 1);
sequenceValue = sequence.get('value');
if (sequenceValue < 100000) {
invoiceId += String('00000' + sequenceValue).slice(-5);
invoiceId += String(`00000${sequenceValue}`).slice(-5);
} else {
invoiceId += sequenceValue;
}
Expand Down
8 changes: 4 additions & 4 deletions app/mixins/charge-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default Ember.Mixin.create({
resolve();
}.bind(this), reject);
}.bind(this), reject);
}.bind(this), '_createNewChargeRecord with pricingId:' + pricingId);
}.bind(this), `_createNewChargeRecord with pricingId:${pricingId}`);
},

actions: {
Expand Down Expand Up @@ -207,7 +207,7 @@ export default Ember.Mixin.create({
this.set(priceObjectToSet, newPricing);
resolve();
}.bind(this), reject);
}.bind(this), 'saveNewPricing for: ' + pricingName);
}.bind(this), `saveNewPricing for: ${pricingName}`);
},

getSelectedPricing: function(selectedField) {
Expand Down Expand Up @@ -293,7 +293,7 @@ export default Ember.Mixin.create({
}
}
}.bind(this));
Ember.RSVP.all(chargePromises, 'Charges updated for current record:' + this.get('model.id')).then(resolve, reject);
}.bind(this), 'updateCharges for current record:' + this.get('model.id'));
Ember.RSVP.all(chargePromises, `Charges updated for current record: ${this.get('model.id')}`).then(resolve, reject);
}.bind(this), `updateCharges for current record: ${this.get('model.id')}`);
}
});
2 changes: 1 addition & 1 deletion app/mixins/fulfill-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export default Ember.Mixin.create({
}
});
if (!foundQuantity) {
return 'Could not find any purchases that had the required quantity:' + quantityRequested;
return `Could not find any purchases that had the required quantity: ${quantityRequested}`;
}
}
request.set('costPerUnit', (totalCost / quantityRequested).toFixed(2));
Expand Down
2 changes: 1 addition & 1 deletion app/mixins/inventory-id.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ export default Ember.Mixin.create({
let max = 999;
let part1 = new Date().getTime();
let part2 = Math.floor(Math.random() * (max - min + 1)) + min;
return Ember.RSVP.resolve(part1.toString(36) + '_' + part2.toString(36));
return Ember.RSVP.resolve(`${part1.toString(36)}_${part2.toString(36)}`);
}
});
2 changes: 1 addition & 1 deletion app/mixins/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ export default Ember.Mixin.create({
nav.localizedTitle = translationOrOriginal(navTranslated, nav.title);
// Map all of the sub navs, too
nav.subnav = nav.subnav.map((sub) => {
let subItemKey = localizationPrefix + 'subnav.' + camelize(sub.title);
let subItemKey = `${localizationPrefix}subnav.${camelize(sub.title)}`;
let subTranslated = this.get('i18n').t(subItemKey);

sub.localizedTitle = translationOrOriginal(subTranslated, sub.title);
Expand Down
2 changes: 1 addition & 1 deletion app/mixins/patient-submodule.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export default Ember.Mixin.create(PatientVisits, {
let childPromises = [];
let visit = this.get('model.visit');
childPromises.addObjects(this.resolveVisitChildren());
Ember.RSVP.all(childPromises, 'Resolved visit children before removing ' + childName).then(function() {
Ember.RSVP.all(childPromises, `Resolved visit children before removing ${childName}`).then(function() {
visit.get(childName).then(function(visitChildren) {
visitChildren.removeObject(objectToRemove);
visit.save().then(resolve, reject);
Expand Down
2 changes: 1 addition & 1 deletion app/mixins/pouch-adapter-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default Ember.Mixin.create({
}
}
let errmsg = [err.status,
(err.name || err.error) + ':',
`${(err.name || err.error)}:`,
(err.message || err.reason)
].join(' ');
Ember.run(null, reject, errmsg);
Expand Down
2 changes: 1 addition & 1 deletion app/mixins/progress-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default Ember.Mixin.create({
progressBarValue = 0;
}
progressDialog.set('progressBarValue', progressBarValue);
let progressBarStyle = Ember.String.htmlSafe('width: ' + progressBarValue + '%');
let progressBarStyle = Ember.String.htmlSafe(`width: ${progressBarValue}%`);
progressDialog.set('progressBarStyle', progressBarStyle);
},

Expand Down
2 changes: 1 addition & 1 deletion app/models/patient-note.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default AbstractModel.extend({
authoredBy: function() {
if (!Ember.isEmpty(this.get('attribution'))) {
let i18n = this.get('i18n');
return this.get('createdBy') + ' ' + i18n.t('patients.notes.onBehalfOfCopy') + ' ' + this.get('attribution');
return `${this.get('createdBy')} ${i18n.t('patients.notes.onBehalfOfCopy')} ${this.get('attribution')}`;
} else {
return this.get('createdBy');
}
Expand Down
2 changes: 1 addition & 1 deletion app/models/visit.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export default AbstractModel.extend({
let startDate = moment(this.get('startDate'));
let visitDate = startDate.format('l');
if (!Ember.isEmpty(endDate) && !startDate.isSame(endDate, 'day')) {
visitDate += ' - ' + moment(endDate).format('l');
visitDate += ` - ${moment(endDate).format('l')}`;
}
return visitDate;
}.property('startDate', 'endDate'),
Expand Down
Loading