diff --git a/.eslintrc.js b/.eslintrc.js index 47fd3bc9517..7c404473041 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,19 +1,22 @@ module.exports = { root: true, - parser: 'babel-eslint', parserOptions: { - sourceType: "module", - allowImportExportEverywhere: false + ecmaVersion: 2017, + sourceType: 'module' }, + plugins: [ + 'ember' + ], extends: [ 'eslint:recommended', 'plugin:ember-suave/recommended' ], env: { - 'browser': true + browser: true }, rules: { 'arrow-spacing': 'error', + 'no-var': 'error', 'no-useless-escape': 'off', 'space-before-blocks': 'error', 'comma-dangle': ['error', 'never'], @@ -45,7 +48,6 @@ module.exports = { 'brace-style': ['error', '1tbs', { 'allowSingleLine': true }], 'max-statements-per-line': ['error', { 'max': 2 }], 'quotes': ['error', 'single'], - 'no-var': 'off', 'indent': [ 'error', 2, { "FunctionExpression": {"parameters": "first"}, @@ -64,7 +66,9 @@ module.exports = { 'eqeqeq': ['error', 'smart'], 'one-var': 'off', 'ember-suave/no-const-outside-module-scope': 'off', - 'ember-suave/require-access-in-comments': 'off' + 'ember-suave/require-access-in-comments': 'off', + 'ember/no-get': 'error', + 'ember/no-get-properties': 'error', }, globals: { module : true, @@ -74,5 +78,37 @@ module.exports = { Uint8Array : true, require : true, Promise : true - } + }, + overrides: [ + // node files + { + files: [ + '.eslintrc.js', + '.template-lintrc.js', + 'ember-cli-build.js', + 'testem.js', + 'blueprints/*/index.js', + 'config/**/*.js', + 'lib/*/index.js', + 'server/**/*.js' + ], + parserOptions: { + sourceType: 'script', + ecmaVersion: 2015 + }, + env: { + browser: false, + node: true + }, + plugins: ['node'], + rules: Object.assign({}, require('eslint-plugin-node').configs.recommended.rules, { + // add your custom rules and overrides for node files here + + // this can be removed once the following is fixed + // https://github.com/mysticatea/eslint-plugin-node/issues/77 + 'node/no-unpublished-require': 'off', + 'node/no-extraneous-require': 'off' + }) + } + ] }; diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index 2b6f469f0ce..00000000000 --- a/.jshintrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "esversion": 6 -} diff --git a/app/adapters/application.js b/app/adapters/application.js index ade3e626ae0..585fef648f6 100644 --- a/app/adapters/application.js +++ b/app/adapters/application.js @@ -39,7 +39,7 @@ export default JSONAPIAdapter.extend(HasManyQueryAdapterMixin, AdapterFetch, Cac isInvalid(statusCode) { if (statusCode !== 404 && statusCode !== 422 && statusCode !== 403 && statusCode !== 409) { - this.get('notify').error('An unexpected error occurred.', { + this.notify.error('An unexpected error occurred.', { closeAfter: 5000 }); } @@ -83,7 +83,7 @@ export default JSONAPIAdapter.extend(HasManyQueryAdapterMixin, AdapterFetch, Cac */ ensureResponseAuthorized(status) { if (status === 401 && this.get('session.isAuthenticated')) { - this.get('session').invalidate(); + this.session.invalidate(); } } }); diff --git a/app/components/event-card.js b/app/components/event-card.js index b65a8b1fc74..f13b8c76d24 100644 --- a/app/components/event-card.js +++ b/app/components/event-card.js @@ -1,6 +1,6 @@ import Component from '@ember/component'; import { computed } from '@ember/object'; -import { forOwn } from 'lodash'; +import { forOwn } from 'lodash-es'; import { pascalCase } from 'open-event-frontend/utils/string'; export default Component.extend({ diff --git a/app/components/events/event-import-section.js b/app/components/events/event-import-section.js index 2a28f8c8038..4adeca526c4 100644 --- a/app/components/events/event-import-section.js +++ b/app/components/events/event-import-section.js @@ -14,12 +14,12 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please upload a file') + prompt : this.l10n.t('Please upload a file') }, { type : 'regExp', value : '/^(.*.((zip|xml|ical|ics|xcal)$))?[^.]*$/i', - prompt : this.get('l10n').t('Please upload a file in suggested format') + prompt : this.l10n.t('Please upload a file in suggested format') } ] } diff --git a/app/components/events/view/export/api-response.js b/app/components/events/view/export/api-response.js index 8067c67d457..1c19abb8b53 100644 --- a/app/components/events/view/export/api-response.js +++ b/app/components/events/view/export/api-response.js @@ -14,11 +14,11 @@ export default Component.extend({ isLoading: false, baseUrl: computed('eventId', function() { - return `${`${ENV.APP.apiHost}/${ENV.APP.apiNamespace}/events/`}${this.get('eventId')}`; + return `${`${ENV.APP.apiHost}/${ENV.APP.apiNamespace}/events/`}${this.eventId}`; }), displayUrl: computed('eventId', function() { - return `${`${ENV.APP.apiHost}/${ENV.APP.apiNamespace}/events/`}${this.get('eventId')}`; + return `${`${ENV.APP.apiHost}/${ENV.APP.apiNamespace}/events/`}${this.eventId}`; }), toggleSwitches: { @@ -32,14 +32,14 @@ export default Component.extend({ makeRequest() { this.set('isLoading', true); - this.get('loader') - .load(this.get('displayUrl'), { isExternal: true }) + this.loader + .load(this.displayUrl, { isExternal: true }) .then(json => { json = JSON.stringify(json, null, 2); this.set('json', htmlSafe(syntaxHighlight(json))); }) .catch(() => { - this.get('notify').error(this.get('l10n').t('Could not fetch from the server')); + this.notify.error(this.l10n.t('Could not fetch from the server')); this.set('json', 'Could not fetch from the server'); }) .finally(() => { @@ -48,12 +48,12 @@ export default Component.extend({ }, buildDisplayUrl() { - let newUrl = this.get('baseUrl'); + let newUrl = this.baseUrl; const include = []; - for (const key in this.get('toggleSwitches')) { - if (this.get('toggleSwitches').hasOwnProperty(key)) { - this.get('toggleSwitches')[key] && include.push(key); + for (const key in this.toggleSwitches) { + if (this.toggleSwitches.hasOwnProperty(key)) { + this.toggleSwitches[key] && include.push(key); } } diff --git a/app/components/events/view/export/download-common.js b/app/components/events/view/export/download-common.js index 69be49c4b46..bbc0413e9ae 100644 --- a/app/components/events/view/export/download-common.js +++ b/app/components/events/view/export/download-common.js @@ -7,7 +7,7 @@ export default Component.extend({ eventDownloadUrl : '', isLoading : false, fileFormat : computed(function() { - switch (this.get('downloadType')) { + switch (this.downloadType) { case 'iCalendar': return 'ical'; case 'Pentabarf XML': @@ -19,29 +19,29 @@ export default Component.extend({ } }), displayUrl: computed(function() { - return this.get(`model.${ this.get('fileFormat') }Url`) !== null ? this.get(`model.${ this.get('fileFormat') }Url`) : 'Please publish to generate the link'; + return this.get(`model.${ this.fileFormat }Url`) !== null ? this.get(`model.${ this.fileFormat }Url`) : 'Please publish to generate the link'; }), requestLoop(exportJobInfo) { run.later(() => { - this.get('loader') + this.loader .load(exportJobInfo.task_url, { withoutPrefix: true }) .then(exportJobStatus => { if (exportJobStatus.state === 'SUCCESS') { this.set('isDownloadDisabled', false); this.set('eventDownloadUrl', exportJobStatus.result.download_url); - this.get('notify').success(this.get('l10n').t('Download Ready')); + this.notify.success(this.l10n.t('Download Ready')); } else if (exportJobStatus.state === 'WAITING') { this.requestLoop(exportJobInfo); this.set('eventExportStatus', exportJobStatus.state); - this.get('notify').alert(this.get('l10n').t('Task is going on.')); + this.notify.alert(this.l10n.t('Task is going on.')); } else { this.set('eventExportStatus', exportJobStatus.state); - this.get('notify').error(this.get('l10n').t('Task failed.')); + this.notify.error(this.l10n.t('Task failed.')); } }) .catch(() => { this.set('eventExportStatus', 'FAILURE'); - this.get('notify').error(this.get('l10n').t('Task failed.')); + this.notify.error(this.l10n.t('Task failed.')); }) .finally(() => { this.set('isLoading', false); @@ -51,14 +51,14 @@ export default Component.extend({ actions: { startExportTask() { this.set('isLoading', true); - this.get('loader') - .load(`/events/${this.get('model.id')}/export/${this.get('fileFormat')}`) + this.loader + .load(`/events/${this.get('model.id')}/export/${this.fileFormat}`) .then(exportJobInfo => { this.requestLoop(exportJobInfo); }) .catch(() => { this.set('isLoading', false); - this.get('notify').error(this.get('l10n').t('Unexpected error occurred.')); + this.notify.error(this.l10n.t('Unexpected error occurred.')); }); } } diff --git a/app/components/events/view/overview/manage-roles.js b/app/components/events/view/overview/manage-roles.js index 3822d1f7e95..bdbb0b9d0ff 100644 --- a/app/components/events/view/overview/manage-roles.js +++ b/app/components/events/view/overview/manage-roles.js @@ -5,7 +5,7 @@ export default Component.extend({ classNames : ['ui', 'fluid', 'card'], roleType : 'accepted', roleInvites : computed('data.roleInvites.@each', 'roleType', function() { - return this.get('data.roleInvites').filterBy('status', this.get('roleType')); + return this.get('data.roleInvites').filterBy('status', this.roleType); }), actions: { openAddUserRoleModal(invite) { @@ -13,7 +13,7 @@ export default Component.extend({ this.set('currentInvite', invite); this.set('isNewInvite', false); } else { - const currentInvite = this.get('data').roleInvites.createRecord({}); + const currentInvite = this.data.roleInvites.createRecord({}); this.set('currentInvite', currentInvite); this.set('isNewInvite', true); } @@ -21,18 +21,17 @@ export default Component.extend({ }, updateUserRoles() { this.set('isLoading', true); - const currentInvite = this.get('currentInvite'); - currentInvite.set('roleName', currentInvite.get('role.name')); - this.get('currentInvite').save() + this.currentInvite.set('roleName', this.currentInvite.get('role.name')); + this.currentInvite.save() .then(() => { - if (this.get('isNewInvite')) { - this.get('data.roleInvites').addObject(currentInvite); + if (this.isNewInvite) { + this.get('data.roleInvites').addObject(this.currentInvite); } this.set('isAddUserRoleModalOpen', false); - this.get('notify').success(this.get('isNewInvite') ? this.get('l10n').t('Role Invite sent successfully') : this.get('l10n').t('Role Invite updated successfully')); + this.notify.success(this.isNewInvite ? this.l10n.t('Role Invite sent successfully') : this.l10n.t('Role Invite updated successfully')); }) .catch(() => { - this.get('notify').error(this.get('l10n').t('Oops something went wrong. Please try again')); + this.notify.error(this.l10n.t('Oops something went wrong. Please try again')); }) .finally(() => { this.set('isLoading', false); @@ -42,11 +41,11 @@ export default Component.extend({ this.set('isLoading', true); invite.destroyRecord() .then(() => { - this.get('notify').success(this.get('l10n').t('Role Invite deleted successfully')); + this.notify.success(this.l10n.t('Role Invite deleted successfully')); this.get('data.roleInvites').removeObject(invite); }) .catch(() => { - this.get('notify').error(this.get('l10n').t('Oops something went wrong. Please try again')); + this.notify.error(this.l10n.t('Oops something went wrong. Please try again')); }) .finally(() => { this.set('isLoading', false); diff --git a/app/components/explore/side-bar.js b/app/components/explore/side-bar.js index 4c6010f62d3..9f39614984a 100644 --- a/app/components/explore/side-bar.js +++ b/app/components/explore/side-bar.js @@ -12,7 +12,7 @@ export default Component.extend({ customEndDate: null, hideClearFilters: computed('category', 'sub_category', 'event_type', 'startDate', 'endDate', 'location', function() { - return !(this.get('category') || this.get('sub_category') || this.get('event_type') || this.get('startDate') || this.get('endDate') || this.get('location') !== null); + return !(this.category || this.sub_category || this.event_type || this.startDate || this.endDate || this.location !== null); }), dateRanges: computed(function() { @@ -21,16 +21,16 @@ export default Component.extend({ actions: { selectCategory(category, subCategory) { - this.set('category', (category === this.get('category') && !subCategory) ? null : category); - this.set('sub_category', (!subCategory || subCategory === this.get('sub_category')) ? null : subCategory); + this.set('category', (category === this.category && !subCategory) ? null : category); + this.set('sub_category', (!subCategory || subCategory === this.sub_category) ? null : subCategory); }, selectEventType(eventType) { - this.set('event_type', eventType === this.get('event_type') ? null : eventType); + this.set('event_type', eventType === this.event_type ? null : eventType); }, dateValidate(date) { - if (moment(date).isAfter(this.get('customEndDate'))) { + if (moment(date).isAfter(this.customEndDate)) { this.set('customEndDate', date); } @@ -41,14 +41,14 @@ export default Component.extend({ let newStartDate = null; let newEndDate = null; - if (dateType === this.get('dateType') && dateType !== 'custom_dates') { + if (dateType === this.dateType && dateType !== 'custom_dates') { this.set('dateType', null); } else { this.set('dateType', dateType); switch (dateType) { case 'custom_dates': - newStartDate = this.get('customStartDate'); - newEndDate = this.get('customEndDate'); + newStartDate = this.customStartDate; + newEndDate = this.customEndDate; break; case 'all_dates': diff --git a/app/components/footer-main.js b/app/components/footer-main.js index d6b70555f14..2f9abb7b78e 100644 --- a/app/components/footer-main.js +++ b/app/components/footer-main.js @@ -5,18 +5,18 @@ export default Component.extend({ tagName : 'footer', classNames : ['ui', 'inverted', 'vertical', 'footer', 'segment'], currentLocale : computed(function() { - return this.get('l10n').getLocale(); + return this.l10n.getLocale(); }), actions: { switchLanguage(locale) { - this.get('l10n').switchLanguage(locale); + this.l10n.switchLanguage(locale); } }, didInsertElement() { - this.set('eventLocations', this.get('eventLocations').sortBy('name')); + this.set('eventLocations', this.eventLocations.sortBy('name')); - let eventTypes = this.get('eventTypes').sortBy('name').toArray(); + let eventTypes = this.eventTypes.sortBy('name').toArray(); eventTypes.forEach(eventType => { if (eventType.name === 'Other') { let other = eventType; diff --git a/app/components/forms/admin/content/pages-form.js b/app/components/forms/admin/content/pages-form.js index 9d594b1418b..1242a2bf827 100644 --- a/app/components/forms/admin/content/pages-form.js +++ b/app/components/forms/admin/content/pages-form.js @@ -14,7 +14,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter a name') + prompt : this.l10n.t('Please enter a name') } ] }, @@ -23,7 +23,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter a title') + prompt : this.l10n.t('Please enter a title') } ] }, @@ -32,16 +32,16 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter the path') + prompt : this.l10n.t('Please enter the path') }, { type : 'regExp', value : '/[^/](.*)/', - prompt : this.get('l10n').t('Path should not contain leading slash.') + prompt : this.l10n.t('Path should not contain leading slash.') }, { type : 'doesntContain[ ]', - prompt : this.get('l10n').t('Path should not contain whitespaces.') + prompt : this.l10n.t('Path should not contain whitespaces.') } ] }, @@ -50,7 +50,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please select a place') + prompt : this.l10n.t('Please select a place') } ] }, @@ -59,7 +59,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter a position') + prompt : this.l10n.t('Please enter a position') } ] }, @@ -68,7 +68,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter a language') + prompt : this.l10n.t('Please enter a language') } ] } @@ -83,13 +83,13 @@ export default Component.extend(FormMixin, { }); }, deletePage(data) { - if (!this.get('isCreate')) { + if (!this.isCreate) { data.destroyRecord(); this.set('isFormOpen', false); } }, close() { - if (this.get('isCreate')) { + if (this.isCreate) { this.set('isFormOpen', false); } } diff --git a/app/components/forms/admin/content/social-links-form.js b/app/components/forms/admin/content/social-links-form.js index 8af1e225843..d7bdf7a8833 100644 --- a/app/components/forms/admin/content/social-links-form.js +++ b/app/components/forms/admin/content/social-links-form.js @@ -17,7 +17,7 @@ export default Component.extend(FormMixin, { { type : 'regExp', value : protocolLessValidUrlPattern, - prompt : this.get('l10n').t('Please enter a valid url') + prompt : this.l10n.t('Please enter a valid url') } ] }, @@ -27,12 +27,12 @@ export default Component.extend(FormMixin, { rules : [ { type : 'containsExactly[twitter.com]', - prompt : this.get('l10n').t('Please enter a valid twitter url') + prompt : this.l10n.t('Please enter a valid twitter url') }, { type : 'regExp', value : protocolLessValidUrlPattern, - prompt : this.get('l10n').t('Please enter a valid url') + prompt : this.l10n.t('Please enter a valid url') } ] }, @@ -42,12 +42,12 @@ export default Component.extend(FormMixin, { rules : [ { type : 'containsExactly[facebook.com]', - prompt : this.get('l10n').t('Please enter a valid facebook url') + prompt : this.l10n.t('Please enter a valid facebook url') }, { type : 'regExp', value : protocolLessValidUrlPattern, - prompt : this.get('l10n').t('Please enter a valid url') + prompt : this.l10n.t('Please enter a valid url') } ] }, @@ -57,12 +57,12 @@ export default Component.extend(FormMixin, { rules : [ { type : 'containsExactly[plus.google.com]', - prompt : this.get('l10n').t('Please enter a valid google plus url') + prompt : this.l10n.t('Please enter a valid google plus url') }, { type : 'regExp', value : protocolLessValidUrlPattern, - prompt : this.get('l10n').t('Please enter a valid url') + prompt : this.l10n.t('Please enter a valid url') } ] }, @@ -72,12 +72,12 @@ export default Component.extend(FormMixin, { rules : [ { type : 'containsExactly[youtube.com]', - prompt : this.get('l10n').t('Please enter a valid YouTube url') + prompt : this.l10n.t('Please enter a valid YouTube url') }, { type : 'regExp', value : protocolLessValidUrlPattern, - prompt : this.get('l10n').t('Please enter a valid url') + prompt : this.l10n.t('Please enter a valid url') } ] }, @@ -87,12 +87,12 @@ export default Component.extend(FormMixin, { rules : [ { type : 'containsExactly[github.com]', - prompt : this.get('l10n').t('Please enter a valid GitHub url') + prompt : this.l10n.t('Please enter a valid GitHub url') }, { type : 'regExp', value : protocolLessValidUrlPattern, - prompt : this.get('l10n').t('Please enter a valid url') + prompt : this.l10n.t('Please enter a valid url') } ] } diff --git a/app/components/forms/admin/content/translation-form.js b/app/components/forms/admin/content/translation-form.js index 14e8dd0d1e6..41061660b74 100644 --- a/app/components/forms/admin/content/translation-form.js +++ b/app/components/forms/admin/content/translation-form.js @@ -14,12 +14,12 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please upload a file') + prompt : this.l10n.t('Please upload a file') }, { type : 'regExp', value : '/^(.*.((po)$))?[^.]*$/i', - prompt : this.get('l10n').t('Please upload a file in suggested format') + prompt : this.l10n.t('Please upload a file in suggested format') } ] }, @@ -28,7 +28,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please select a language') + prompt : this.l10n.t('Please select a language') } ] } diff --git a/app/components/forms/admin/settings/images-form.js b/app/components/forms/admin/settings/images-form.js index 0894d176acb..8cc8dc150c4 100644 --- a/app/components/forms/admin/settings/images-form.js +++ b/app/components/forms/admin/settings/images-form.js @@ -14,7 +14,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter width') + prompt : this.l10n.t('Please enter width') } ] }, @@ -23,7 +23,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter height') + prompt : this.l10n.t('Please enter height') } ] }, @@ -32,7 +32,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter quality') + prompt : this.l10n.t('Please enter quality') } ] }, @@ -41,7 +41,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter width') + prompt : this.l10n.t('Please enter width') } ] }, @@ -50,7 +50,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter height') + prompt : this.l10n.t('Please enter height') } ] }, @@ -59,7 +59,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter quality') + prompt : this.l10n.t('Please enter quality') } ] }, @@ -68,7 +68,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter width') + prompt : this.l10n.t('Please enter width') } ] }, @@ -77,7 +77,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter height') + prompt : this.l10n.t('Please enter height') } ] }, @@ -86,7 +86,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter quality') + prompt : this.l10n.t('Please enter quality') } ] }, @@ -95,7 +95,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter width') + prompt : this.l10n.t('Please enter width') } ] }, @@ -104,7 +104,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter height') + prompt : this.l10n.t('Please enter height') } ] }, @@ -113,7 +113,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter size') + prompt : this.l10n.t('Please enter size') } ] }, @@ -122,7 +122,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter quality') + prompt : this.l10n.t('Please enter quality') } ] }, @@ -131,7 +131,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter size') + prompt : this.l10n.t('Please enter size') } ] }, @@ -140,7 +140,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter quality') + prompt : this.l10n.t('Please enter quality') } ] }, @@ -149,7 +149,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter size') + prompt : this.l10n.t('Please enter size') } ] }, @@ -158,7 +158,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter quality') + prompt : this.l10n.t('Please enter quality') } ] } diff --git a/app/components/forms/admin/settings/microservices-form.js b/app/components/forms/admin/settings/microservices-form.js index 7186e3595b6..379a4b660d4 100644 --- a/app/components/forms/admin/settings/microservices-form.js +++ b/app/components/forms/admin/settings/microservices-form.js @@ -16,7 +16,7 @@ export default Component.extend(FormMixin, { { type : 'regExp', value : protocolLessValidUrlPattern, - prompt : this.get('l10n').t('Please enter a valid URL for Android app') + prompt : this.l10n.t('Please enter a valid URL for Android app') } ] }, @@ -28,7 +28,7 @@ export default Component.extend(FormMixin, { { type : 'regExp', value : protocolLessValidUrlPattern, - prompt : this.get('l10n').t('Please enter a valid URL for web app') + prompt : this.l10n.t('Please enter a valid URL for web app') } ] } diff --git a/app/components/forms/admin/settings/payment-gateway-form.js b/app/components/forms/admin/settings/payment-gateway-form.js index e1abd9ff52b..0d981a2d27f 100644 --- a/app/components/forms/admin/settings/payment-gateway-form.js +++ b/app/components/forms/admin/settings/payment-gateway-form.js @@ -14,7 +14,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter the client ID') + prompt : this.l10n.t('Please enter the client ID') } ] }, @@ -24,7 +24,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter the secret key') + prompt : this.l10n.t('Please enter the secret key') } ] }, @@ -34,7 +34,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter the publishable key') + prompt : this.l10n.t('Please enter the publishable key') } ] }, @@ -44,7 +44,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter the sandbox client id') + prompt : this.l10n.t('Please enter the sandbox client id') } ] }, @@ -54,7 +54,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter the sandbox secret token') + prompt : this.l10n.t('Please enter the sandbox secret token') } ] }, @@ -64,7 +64,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter the live client token') + prompt : this.l10n.t('Please enter the live client token') } ] }, @@ -74,7 +74,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter the live secret token') + prompt : this.l10n.t('Please enter the live secret token') } ] }, @@ -84,7 +84,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter the public test key') + prompt : this.l10n.t('Please enter the public test key') } ] }, @@ -94,7 +94,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter the secret test key') + prompt : this.l10n.t('Please enter the secret test key') } ] }, @@ -104,7 +104,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter the public live key') + prompt : this.l10n.t('Please enter the public live key') } ] }, @@ -114,7 +114,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter the secret live key') + prompt : this.l10n.t('Please enter the secret live key') } ] } @@ -137,23 +137,23 @@ export default Component.extend(FormMixin, { actions: { submit() { this.onValid(() => { - if (this.get('isCheckedStripe') === false) { - this.get('settings').setProperties({ + if (this.isCheckedStripe === false) { + this.settings.setProperties({ 'stripeClientId' : null, 'stripeSecretKey' : null, 'stripePublishableKey' : null }); } - if (this.get('isCheckedPaypal') === false) { - this.get('settings').setProperties({ + if (this.isCheckedPaypal === false) { + this.settings.setProperties({ 'paypalSandboxClient' : null, 'paypalSandboxSecret' : null, 'paypalSecret' : null, 'paypalClient' : null }); } - if (this.get('isCheckedOmise') === false) { - this.get('settings').setProperties({ + if (this.isCheckedOmise === false) { + this.settings.setProperties({ 'omiseTestPublic' : null, 'omiseTestSecret' : null, 'omiseLivePublic' : null, diff --git a/app/components/forms/admin/settings/system-form.js b/app/components/forms/admin/settings/system-form.js index b70f81bac88..e61ed3297d8 100644 --- a/app/components/forms/admin/settings/system-form.js +++ b/app/components/forms/admin/settings/system-form.js @@ -14,7 +14,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter the App name') + prompt : this.l10n.t('Please enter the App name') } ] }, @@ -24,7 +24,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter a tag line') + prompt : this.l10n.t('Please enter a tag line') } ] }, @@ -34,7 +34,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter the Bucket name') + prompt : this.l10n.t('Please enter the Bucket name') } ] }, @@ -44,7 +44,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter the access key') + prompt : this.l10n.t('Please enter the access key') } ] }, @@ -54,7 +54,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter the access secret') + prompt : this.l10n.t('Please enter the access secret') } ] }, @@ -64,7 +64,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please select a region') + prompt : this.l10n.t('Please select a region') } ] }, @@ -74,7 +74,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter the Bucket name') + prompt : this.l10n.t('Please enter the Bucket name') } ] }, @@ -84,7 +84,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter the key') + prompt : this.l10n.t('Please enter the key') } ] }, @@ -94,7 +94,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter the secret') + prompt : this.l10n.t('Please enter the secret') } ] }, @@ -104,11 +104,11 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter the from email') + prompt : this.l10n.t('Please enter the from email') }, { type : 'email', - prompt : this.get('l10n').t('Please enter a valid email address') + prompt : this.l10n.t('Please enter a valid email address') } ] }, @@ -118,7 +118,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter name for from email') + prompt : this.l10n.t('Please enter name for from email') } ] }, @@ -128,12 +128,12 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter the Frontend Url') + prompt : this.l10n.t('Please enter the Frontend Url') }, { type : 'regExp', value : protocolLessValidUrlPattern, - prompt : this.get('l10n').t('Please enter a valid URL for Frontend') + prompt : this.l10n.t('Please enter a valid URL for Frontend') } ] }, @@ -143,7 +143,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter the SMTP host') + prompt : this.l10n.t('Please enter the SMTP host') } ] }, @@ -153,11 +153,11 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter the SMTP port number') + prompt : this.l10n.t('Please enter the SMTP port number') }, { type : 'integer', - prompt : this.get('l10n').t('Please enter a valid port number') + prompt : this.l10n.t('Please enter a valid port number') } ] }, @@ -167,7 +167,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter the token for Sendgrid') + prompt : this.l10n.t('Please enter the token for Sendgrid') } ] }, @@ -177,11 +177,11 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter the application secret key') + prompt : this.l10n.t('Please enter the application secret key') }, { type : 'minLength[16]', - prompt : this.get('l10n').t('Your application secret key must have at least {ruleValue} characters') + prompt : this.l10n.t('Your application secret key must have at least {ruleValue} characters') } ] } diff --git a/app/components/forms/admin/settings/system/storage-option.js b/app/components/forms/admin/settings/system/storage-option.js index 90276f8c0cc..f1f2bd71710 100644 --- a/app/components/forms/admin/settings/system/storage-option.js +++ b/app/components/forms/admin/settings/system/storage-option.js @@ -1,7 +1,7 @@ import Component from '@ember/component'; import { computed } from '@ember/object'; import { amazonS3Regions } from 'open-event-frontend/utils/dictionary/amazon-s3-regions'; -import { orderBy } from 'lodash'; +import { orderBy } from 'lodash-es'; export default Component.extend({ regions: computed(function() { diff --git a/app/components/forms/admin/settings/ticket-fees-form.js b/app/components/forms/admin/settings/ticket-fees-form.js index 01401cf593c..60168ab701f 100644 --- a/app/components/forms/admin/settings/ticket-fees-form.js +++ b/app/components/forms/admin/settings/ticket-fees-form.js @@ -2,7 +2,7 @@ import Component from '@ember/component'; import { computed } from '@ember/object'; import { countries } from 'open-event-frontend/utils/dictionary/demography'; import { paymentCountries, paymentCurrencies } from 'open-event-frontend/utils/dictionary/payment'; -import { orderBy, filter } from 'lodash'; +import { orderBy, filter } from 'lodash-es'; export default Component.extend({ @@ -16,15 +16,15 @@ export default Component.extend({ actions: { addNewTicket() { - let settings = this.get('model'); + let settings = this.model; let incorrect_settings = settings.filter(function(setting) { return (!setting.get('currency') || !setting.get('country')); }); if (incorrect_settings.length > 0) { - this.notify.error(this.get('l10n').t('Existing items need to be completed before new items can be added.')); + this.notify.error(this.l10n.t('Existing items need to be completed before new items can be added.')); this.set('isLoading', false); } else { - this.get('model').toArray().addObject(this.store.createRecord('ticket-fee', { + this.model.toArray().addObject(this.store.createRecord('ticket-fee', { maximumFee : 0.0, serviceFee : 0.0 })); @@ -34,10 +34,10 @@ export default Component.extend({ this.set('isLoading', true); rec.destroyRecord() .then(() => { - this.get('notify').success(this.get('l10n').t('Fee setting deleted successfully')); + this.notify.success(this.l10n.t('Fee setting deleted successfully')); }) .catch(() => { - this.get('notify').error(this.get('l10n').t('Oops something went wrong. Please try again')); + this.notify.error(this.l10n.t('Oops something went wrong. Please try again')); }) .finally(() => { this.set('isLoading', false); diff --git a/app/components/forms/events/view/create-access-code.js b/app/components/forms/events/view/create-access-code.js index 2fda283bf08..2ddd37f4435 100644 --- a/app/components/forms/events/view/create-access-code.js +++ b/app/components/forms/events/view/create-access-code.js @@ -23,7 +23,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter access code') + prompt : this.l10n.t('Please enter access code') }, { type : 'regExp', @@ -36,11 +36,11 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter number of tickets') + prompt : this.l10n.t('Please enter number of tickets') }, { type : 'number', - prompt : this.get('l10n').t('Please enter proper number of tickets') + prompt : this.l10n.t('Please enter proper number of tickets') } ] }, @@ -50,11 +50,11 @@ export default Component.extend(FormMixin, { rules : [ { type : 'number', - prompt : this.get('l10n').t('Please enter the proper number') + prompt : this.l10n.t('Please enter the proper number') }, { type : 'checkMaxMin', - prompt : this.get('l10n').t('Minimum value should not be greater than maximum') + prompt : this.l10n.t('Minimum value should not be greater than maximum') } ] }, @@ -64,15 +64,15 @@ export default Component.extend(FormMixin, { rules : [ { type : 'number', - prompt : this.get('l10n').t('Please enter the proper number') + prompt : this.l10n.t('Please enter the proper number') }, { type : 'checkMaxMin', - prompt : this.get('l10n').t('Maximum value should not be less than minimum') + prompt : this.l10n.t('Maximum value should not be less than minimum') }, { type : 'checkMaxTotal', - prompt : this.get('l10n').t('Maximum value should not be greater than number of tickets') + prompt : this.l10n.t('Maximum value should not be greater than number of tickets') } ] }, @@ -82,7 +82,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'date', - prompt : this.get('l10n').t('Please enter the proper date') + prompt : this.l10n.t('Please enter the proper date') } ] }, @@ -92,7 +92,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'date', - prompt : this.get('l10n').t('Please enter the proper date') + prompt : this.l10n.t('Please enter the proper date') } ] } @@ -103,7 +103,7 @@ export default Component.extend(FormMixin, { accessLink : computed('data.code', function() { const params = this.get('router._router.currentState.routerJsState.params'); const origin = this.get('fastboot.isFastBoot') ? `${this.get('fastboot.request.protocol')}//${this.get('fastboot.request.host')}` : location.origin; - let link = origin + this.get('router').urlFor('public', params['events.view'].event_id, { queryParams: { access_code: this.get('data.code') } }); + let link = origin + this.router.urlFor('public', params['events.view'].event_id, { queryParams: { access_code: this.get('data.code') } }); this.set('data.accessUrl', link); return link; }), diff --git a/app/components/forms/events/view/create-discount-code.js b/app/components/forms/events/view/create-discount-code.js index f0e385eca28..b3d8c1495bc 100644 --- a/app/components/forms/events/view/create-discount-code.js +++ b/app/components/forms/events/view/create-discount-code.js @@ -33,7 +33,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter a discount code') + prompt : this.l10n.t('Please enter a discount code') }, { type : 'regExp', @@ -46,7 +46,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter the number of tickets') + prompt : this.l10n.t('Please enter the number of tickets') } ] }, @@ -55,7 +55,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter the discount amount') + prompt : this.l10n.t('Please enter the discount amount') } ] }, @@ -64,7 +64,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter the discount percentage') + prompt : this.l10n.t('Please enter the discount percentage') } ] }, @@ -74,11 +74,11 @@ export default Component.extend(FormMixin, { rules : [ { type : 'integer', - prompt : this.get('l10n').t('Please enter a valid integer') + prompt : this.l10n.t('Please enter a valid integer') }, { type : 'checkMaxMin', - prompt : this.get('l10n').t('Minimum value should not be greater than maximum') + prompt : this.l10n.t('Minimum value should not be greater than maximum') } ] }, @@ -88,15 +88,15 @@ export default Component.extend(FormMixin, { rules : [ { type : 'integer', - prompt : this.get('l10n').t('Please enter a valid integer') + prompt : this.l10n.t('Please enter a valid integer') }, { type : 'checkMaxMin', - prompt : this.get('l10n').t('Maximum value should not be less than minimum') + prompt : this.l10n.t('Maximum value should not be less than minimum') }, { type : 'checkMaxTotal', - prompt : this.get('l10n').t('Maximum value should not be greater than number of tickets') + prompt : this.l10n.t('Maximum value should not be greater than number of tickets') } ] }, @@ -105,7 +105,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'checkTicketSelected', - prompt : this.get('l10n').t('Please select atleast 1 ticket.') + prompt : this.l10n.t('Please select atleast 1 ticket.') } ] } @@ -115,7 +115,7 @@ export default Component.extend(FormMixin, { discountLink: computed('data.code', function() { const params = this.get('router._router.currentState.routerJsState.params'); const origin = this.get('fastboot.isFastBoot') ? `${this.get('fastboot.request.protocol')}//${this.get('fastboot.request.host')}` : location.origin; - let link = origin + this.get('router').urlFor('public', params['events.view'].event_id, { queryParams: { code: this.get('data.code') } }); + let link = origin + this.router.urlFor('public', params['events.view'].event_id, { queryParams: { code: this.get('data.code') } }); this.set('data.discountUrl', link); return link; }), diff --git a/app/components/forms/events/view/order-form.js b/app/components/forms/events/view/order-form.js index c7ddb0421c5..021640ba701 100644 --- a/app/components/forms/events/view/order-form.js +++ b/app/components/forms/events/view/order-form.js @@ -13,7 +13,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'integer[1..60]', - prompt : this.get('l10n').t('Please enter a valid registration time limit between 1 to 60 minutes.') + prompt : this.l10n.t('Please enter a valid registration time limit between 1 to 60 minutes.') } ] } diff --git a/app/components/forms/login-form.js b/app/components/forms/login-form.js index f2af806d9b1..0c645b2c51f 100644 --- a/app/components/forms/login-form.js +++ b/app/components/forms/login-form.js @@ -19,11 +19,11 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter your email ID') + prompt : this.l10n.t('Please enter your email ID') }, { type : 'email', - prompt : this.get('l10n').t('Please enter a valid email ID') + prompt : this.l10n.t('Please enter a valid email ID') } ] }, @@ -32,7 +32,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter your password') + prompt : this.l10n.t('Please enter your password') } ] } @@ -49,22 +49,22 @@ export default Component.extend(FormMixin, { this.set('errorMessage', null); this.set('isLoading', true); - this.get('session') + this.session .authenticate(authenticator, credentials) .then(async() => { - const tokenPayload = this.get('authManager').getTokenPayload(); + const tokenPayload = this.authManager.getTokenPayload(); if (tokenPayload) { - this.get('authManager').persistCurrentUser( - await this.get('store').findRecord('user', tokenPayload.identity) + this.authManager.persistCurrentUser( + await this.store.findRecord('user', tokenPayload.identity) ); } }) .catch(reason => { - if (!(this.get('isDestroyed') || this.get('isDestroying'))) { + if (!(this.isDestroyed || this.isDestroying)) { if (reason && reason.hasOwnProperty('status_code') && reason.status_code === 401) { - this.set('errorMessage', this.get('l10n').t('Your credentials were incorrect.')); + this.set('errorMessage', this.l10n.t('Your credentials were incorrect.')); } else { - this.set('errorMessage', this.get('l10n').t('An unexpected error occurred.')); + this.set('errorMessage', this.l10n.t('An unexpected error occurred.')); } this.set('isLoading', false); } else { @@ -72,7 +72,7 @@ export default Component.extend(FormMixin, { } }) .finally(() => { - if (!(this.get('isDestroyed') || this.get('isDestroying'))) { + if (!(this.isDestroyed || this.isDestroying)) { this.set('password', ''); } }); @@ -82,13 +82,13 @@ export default Component.extend(FormMixin, { async auth(provider) { try { if (provider === 'facebook') { - this.get('loader').load('/auth/oauth/facebook') + this.loader.load('/auth/oauth/facebook') .then(async response => { window.location.replace(response.url); }); } } catch (error) { - this.get('notify').error(this.get('l10n').t(error.message)); + this.notify.error(this.l10n.t(error.message)); } }, diff --git a/app/components/forms/orders/attendee-list.js b/app/components/forms/orders/attendee-list.js index efe86ab32c6..91cbb973aab 100644 --- a/app/components/forms/orders/attendee-list.js +++ b/app/components/forms/orders/attendee-list.js @@ -1,6 +1,6 @@ import Component from '@ember/component'; import { computed } from '@ember/object'; -import { groupBy } from 'lodash'; +import { groupBy } from 'lodash-es'; export default Component.extend({ buyer: computed('data.user', function() { @@ -16,6 +16,6 @@ export default Component.extend({ return true; }), allFields: computed('fields', function() { - return groupBy(this.get('fields').toArray(), field => field.get('form')); + return groupBy(this.fields.toArray(), field => field.get('form')); }) }); diff --git a/app/components/forms/orders/guest-order-form.js b/app/components/forms/orders/guest-order-form.js index 21879b20c03..0d7caf0057f 100644 --- a/app/components/forms/orders/guest-order-form.js +++ b/app/components/forms/orders/guest-order-form.js @@ -15,11 +15,11 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter your email ID') + prompt : this.l10n.t('Please enter your email ID') }, { type : 'email', - prompt : this.get('l10n').t('Please enter a valid email ID') + prompt : this.l10n.t('Please enter a valid email ID') } ] }, @@ -28,7 +28,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter your password') + prompt : this.l10n.t('Please enter your password') } ] } @@ -38,7 +38,7 @@ export default Component.extend(FormMixin, { actions: { submit() { this.onValid(() => { - if (this.get('userExists')) { + if (this.userExists) { this.loginExistingUser(this.email, this.password); } else { this.createNewUserViaEmail(this.email); diff --git a/app/components/forms/orders/order-form.js b/app/components/forms/orders/order-form.js index 951d6b4bb4d..62525284ebf 100644 --- a/app/components/forms/orders/order-form.js +++ b/app/components/forms/orders/order-form.js @@ -5,7 +5,7 @@ import { inject as service } from '@ember/service'; import FormMixin from 'open-event-frontend/mixins/form'; import moment from 'moment'; import { countries } from 'open-event-frontend/utils/dictionary/demography'; -import { groupBy, orderBy } from 'lodash'; +import { groupBy, orderBy } from 'lodash-es'; import { compulsoryProtocolValidUrlPattern, validTwitterProfileUrlPattern, validFacebookProfileUrlPattern, validGithubProfileUrlPattern @@ -35,7 +35,7 @@ export default Component.extend(FormMixin, { }), isPaidOrder: computed('data', function() { if (!this.get('data.amount')) { - this.get('data').set('paymentMode', 'free'); + this.data.set('paymentMode', 'free'); return false; } return true; @@ -56,8 +56,8 @@ export default Component.extend(FormMixin, { if (diff > 0) { this.timer(willExpireAt, orderIdentifier); } else { - this.get('data').reload(); - this.get('router').transitionTo('orders.expired', orderIdentifier); + this.data.reload(); + this.router.transitionTo('orders.expired', orderIdentifier); } }, 1000); }, @@ -67,7 +67,7 @@ export default Component.extend(FormMixin, { rules: [ { type : 'empty', - prompt : this.get('l10n').t('Please enter your first name') + prompt : this.l10n.t('Please enter your first name') } ] }; @@ -75,7 +75,7 @@ export default Component.extend(FormMixin, { rules: [ { type : 'empty', - prompt : this.get('l10n').t('Please enter your last name') + prompt : this.l10n.t('Please enter your last name') } ] }; @@ -83,11 +83,11 @@ export default Component.extend(FormMixin, { rules: [ { type : 'empty', - prompt : this.get('l10n').t('Please enter your email') + prompt : this.l10n.t('Please enter your email') }, { type : 'email', - prompt : this.get('l10n').t('Please enter a valid email') + prompt : this.l10n.t('Please enter a valid email') } ] }; @@ -96,7 +96,7 @@ export default Component.extend(FormMixin, { rules: [ { type : 'empty', - prompt : this.get('l10n').t('Please select a gender') + prompt : this.l10n.t('Please select a gender') } ] }; @@ -105,7 +105,7 @@ export default Component.extend(FormMixin, { rules: [ { type : 'empty', - prompt : this.get('l10n').t('Please enter your address') + prompt : this.l10n.t('Please enter your address') } ] }; @@ -114,7 +114,7 @@ export default Component.extend(FormMixin, { rules: [ { type : 'empty', - prompt : this.get('l10n').t('Please enter your city') + prompt : this.l10n.t('Please enter your city') } ] }; @@ -123,7 +123,7 @@ export default Component.extend(FormMixin, { rules: [ { type : 'empty', - prompt : this.get('l10n').t('Please enter your state') + prompt : this.l10n.t('Please enter your state') } ] }; @@ -132,7 +132,7 @@ export default Component.extend(FormMixin, { rules: [ { type : 'empty', - prompt : this.get('l10n').t('Please enter your country') + prompt : this.l10n.t('Please enter your country') } ] }; @@ -141,7 +141,7 @@ export default Component.extend(FormMixin, { rules: [ { type : 'empty', - prompt : this.get('l10n').t('Please enter your job title') + prompt : this.l10n.t('Please enter your job title') } ] }; @@ -150,7 +150,7 @@ export default Component.extend(FormMixin, { rules: [ { type : 'empty', - prompt : this.get('l10n').t('Please enter a mobile number') + prompt : this.l10n.t('Please enter a mobile number') } ] }; @@ -159,7 +159,7 @@ export default Component.extend(FormMixin, { rules: [ { type : 'empty', - prompt : this.get('l10n').t('Please enter your tax business info') + prompt : this.l10n.t('Please enter your tax business info') } ] }; @@ -168,7 +168,7 @@ export default Component.extend(FormMixin, { rules: [ { type : 'empty', - prompt : this.get('l10n').t('Please enter your billing address') + prompt : this.l10n.t('Please enter your billing address') } ] }; @@ -177,7 +177,7 @@ export default Component.extend(FormMixin, { rules: [ { type : 'empty', - prompt : this.get('l10n').t('Please enter your home address') + prompt : this.l10n.t('Please enter your home address') } ] }; @@ -186,7 +186,7 @@ export default Component.extend(FormMixin, { rules: [ { type : 'empty', - prompt : this.get('l10n').t('Please enter your shipping address') + prompt : this.l10n.t('Please enter your shipping address') } ] }; @@ -195,7 +195,7 @@ export default Component.extend(FormMixin, { rules: [ { type : 'empty', - prompt : this.get('l10n').t('Please enter your company') + prompt : this.l10n.t('Please enter your company') } ] }; @@ -204,7 +204,7 @@ export default Component.extend(FormMixin, { rules: [ { type : 'empty', - prompt : this.get('l10n').t('Please enter your work address') + prompt : this.l10n.t('Please enter your work address') } ] }; @@ -213,7 +213,7 @@ export default Component.extend(FormMixin, { rules: [ { type : 'empty', - prompt : this.get('l10n').t('Please enter your work phone') + prompt : this.l10n.t('Please enter your work phone') } ] }; @@ -224,7 +224,7 @@ export default Component.extend(FormMixin, { { type : 'regExp', value : compulsoryProtocolValidUrlPattern, - prompt : this.get('l10n').t('Please enter a valid url') + prompt : this.l10n.t('Please enter a valid url') } ] }; @@ -233,12 +233,12 @@ export default Component.extend(FormMixin, { rules: [ { type : 'empty', - prompt : this.get('l10n').t('Please enter url of website') + prompt : this.l10n.t('Please enter url of website') }, { type : 'regExp', value : compulsoryProtocolValidUrlPattern, - prompt : this.get('l10n').t('Please enter a valid url') + prompt : this.l10n.t('Please enter a valid url') } ] }; @@ -249,7 +249,7 @@ export default Component.extend(FormMixin, { { type : 'regExp', value : compulsoryProtocolValidUrlPattern, - prompt : this.get('l10n').t('Please enter a valid url') + prompt : this.l10n.t('Please enter a valid url') } ] }; @@ -258,12 +258,12 @@ export default Component.extend(FormMixin, { rules: [ { type : 'empty', - prompt : this.get('l10n').t('Please enter url of website') + prompt : this.l10n.t('Please enter url of website') }, { type : 'regExp', value : compulsoryProtocolValidUrlPattern, - prompt : this.get('l10n').t('Please enter a valid url') + prompt : this.l10n.t('Please enter a valid url') } ] }; @@ -274,7 +274,7 @@ export default Component.extend(FormMixin, { { type : 'regExp', value : validTwitterProfileUrlPattern, - prompt : this.get('l10n').t('Please enter a valid twitter profile url') + prompt : this.l10n.t('Please enter a valid twitter profile url') } ] }; @@ -283,12 +283,12 @@ export default Component.extend(FormMixin, { rules: [ { type : 'empty', - prompt : this.get('l10n').t('Please enter twitter link') + prompt : this.l10n.t('Please enter twitter link') }, { type : 'regExp', value : validTwitterProfileUrlPattern, - prompt : this.get('l10n').t('Please enter a valid twitter profile url') + prompt : this.l10n.t('Please enter a valid twitter profile url') } ] }; @@ -299,7 +299,7 @@ export default Component.extend(FormMixin, { { type : 'regExp', value : validFacebookProfileUrlPattern, - prompt : this.get('l10n').t('Please enter a valid facebook account url') + prompt : this.l10n.t('Please enter a valid facebook account url') } ] }; @@ -308,12 +308,12 @@ export default Component.extend(FormMixin, { rules: [ { type : 'empty', - prompt : this.get('l10n').t('Please enter facebook link') + prompt : this.l10n.t('Please enter facebook link') }, { type : 'regExp', value : validFacebookProfileUrlPattern, - prompt : this.get('l10n').t('Please enter a valid facebook account url') + prompt : this.l10n.t('Please enter a valid facebook account url') } ] }; @@ -324,7 +324,7 @@ export default Component.extend(FormMixin, { { type : 'regExp', value : validGithubProfileUrlPattern, - prompt : this.get('l10n').t('Please enter a valid GitHub profile url') + prompt : this.l10n.t('Please enter a valid GitHub profile url') } ] }; @@ -333,12 +333,12 @@ export default Component.extend(FormMixin, { rules: [ { type : 'empty', - prompt : this.get('l10n').t('Please enter GitHub link') + prompt : this.l10n.t('Please enter GitHub link') }, { type : 'regExp', value : validGithubProfileUrlPattern, - prompt : this.get('l10n').t('Please enter a valid GitHub profile url') + prompt : this.l10n.t('Please enter a valid GitHub profile url') } ] }; @@ -353,7 +353,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter your first name') + prompt : this.l10n.t('Please enter your first name') } ] }, @@ -362,7 +362,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter your last name') + prompt : this.l10n.t('Please enter your last name') } ] }, @@ -371,7 +371,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'email', - prompt : this.get('l10n').t('Please enter a valid email address') + prompt : this.l10n.t('Please enter a valid email address') } ] }, @@ -380,7 +380,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter your country') + prompt : this.l10n.t('Please enter your country') } ] }, @@ -389,7 +389,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter your company') + prompt : this.l10n.t('Please enter your company') } ] }, @@ -398,7 +398,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter your address') + prompt : this.l10n.t('Please enter your address') } ] }, @@ -407,7 +407,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter your city ') + prompt : this.l10n.t('Please enter your city ') } ] }, @@ -416,7 +416,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter your zip code') + prompt : this.l10n.t('Please enter your zip code') } ] }, @@ -425,7 +425,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'checked', - prompt : this.get('l10n').t('Please specify your choice of payment method ') + prompt : this.l10n.t('Please specify your choice of payment method ') } ] } @@ -464,7 +464,7 @@ export default Component.extend(FormMixin, { }, allFields: computed('fields', function() { - return groupBy(this.get('fields').toArray(), field => field.get('form')); + return groupBy(this.fields.toArray(), field => field.get('form')); }), countries: computed(function() { @@ -478,11 +478,10 @@ export default Component.extend(FormMixin, { }); }, modifyHolder(holder) { - let buyer = this.get('buyer'); - if (this.get('sameAsBuyer')) { - holder.set('firstname', buyer.content.firstName); - holder.set('lastname', buyer.content.lastName); - holder.set('email', buyer.content.email); + if (this.sameAsBuyer) { + holder.set('firstname', this.buyer.content.firstName); + holder.set('lastname', this.buyer.content.lastName); + holder.set('email', this.buyer.content.email); } else { holder.set('firstname', ''); holder.set('lastname', ''); diff --git a/app/components/forms/register-form.js b/app/components/forms/register-form.js index 3234d72280d..7bb8a8493c1 100644 --- a/app/components/forms/register-form.js +++ b/app/components/forms/register-form.js @@ -18,7 +18,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'email', - prompt : this.get('l10n').t('Please enter a valid email address') + prompt : this.l10n.t('Please enter a valid email address') } ] }, @@ -27,11 +27,11 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter a password') + prompt : this.l10n.t('Please enter a password') }, { type : 'minLength[8]', - prompt : this.get('l10n').t('Your password must have at least {ruleValue} characters') + prompt : this.l10n.t('Your password must have at least {ruleValue} characters') } ] }, @@ -40,7 +40,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'match[password]', - prompt : this.get('l10n').t('Passwords do not match') + prompt : this.l10n.t('Passwords do not match') } ] } @@ -48,8 +48,8 @@ export default Component.extend(FormMixin, { }; }, didInsertElement() { - if (this.get('inviteEmail')) { - this.get('data').set('email', this.get('inviteEmail')); + if (this.inviteEmail) { + this.data.set('email', this.inviteEmail); } }, diff --git a/app/components/forms/reset-password-form.js b/app/components/forms/reset-password-form.js index f7304476373..fdb89edf7bc 100644 --- a/app/components/forms/reset-password-form.js +++ b/app/components/forms/reset-password-form.js @@ -19,11 +19,11 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter your email ID') + prompt : this.l10n.t('Please enter your email ID') }, { type : 'email', - prompt : this.get('l10n').t('Please enter a valid email ID') + prompt : this.l10n.t('Please enter a valid email ID') } ] }, @@ -33,7 +33,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter your new password') + prompt : this.l10n.t('Please enter your new password') } ] } @@ -45,21 +45,21 @@ export default Component.extend(FormMixin, { submit() { this.onValid(() => { let payload = {}; - if (this.get('token')) { + if (this.token) { payload = { 'data': { - 'token' : this.get('token'), - 'password' : this.get('password') + 'token' : this.token, + 'password' : this.password } }; - this.get('loader') + this.loader .patch('auth/reset-password', payload) .then(() => { - this.notify.success(this.get('l10n').t('Your password has been reset successfully. Please log in to continue')); - this.get('router').transitionTo('login'); + this.notify.success(this.l10n.t('Your password has been reset successfully. Please log in to continue')); + this.router.transitionTo('login'); }) .catch(() => { - this.set('errorMessage', this.get('l10n').t('An unexpected error occurred.')); + this.set('errorMessage', this.l10n.t('An unexpected error occurred.')); }) .finally(() => { this.set('isLoading', false); @@ -69,20 +69,20 @@ export default Component.extend(FormMixin, { } else { payload = { 'data': { - 'email': this.get('identification') + 'email': this.identification } }; - this.get('loader') + this.loader .post('auth/reset-password', payload) .then(() => { - this.notify.success(this.get('l10n').t('Please go to the link sent to your email to reset your password')); - this.get('router').transitionTo('login'); + this.notify.success(this.l10n.t('Please go to the link sent to your email to reset your password')); + this.router.transitionTo('login'); }) .catch(reason => { if (reason && reason.hasOwnProperty('errors') && reason.errors[0].status === 404) { - this.set('errorMessage', this.get('l10n').t('No account is registered with this email address.')); + this.set('errorMessage', this.l10n.t('No account is registered with this email address.')); } else { - this.set('errorMessage', this.get('l10n').t('An unexpected error occurred.')); + this.set('errorMessage', this.l10n.t('An unexpected error occurred.')); } }) .finally(() => { diff --git a/app/components/forms/session-speaker-form.js b/app/components/forms/session-speaker-form.js index c1dc0ed1290..4e15d274a6b 100644 --- a/app/components/forms/session-speaker-form.js +++ b/app/components/forms/session-speaker-form.js @@ -1,6 +1,6 @@ import Component from '@ember/component'; import { computed } from '@ember/object'; -import { groupBy, orderBy } from 'lodash'; +import { groupBy, orderBy } from 'lodash-es'; import FormMixin from 'open-event-frontend/mixins/form'; import { compulsoryProtocolValidUrlPattern, protocolLessValidUrlPattern, validTwitterProfileUrlPattern, validFacebookProfileUrlPattern, validGithubProfileUrlPattern, validLinkedinProfileUrlPattern, validPhoneNumber } from 'open-event-frontend/utils/validators'; @@ -25,7 +25,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter a title') + prompt : this.l10n.t('Please enter a title') } ] }, @@ -34,7 +34,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter a subtitle') + prompt : this.l10n.t('Please enter a subtitle') } ] }, @@ -43,7 +43,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter short abstract') + prompt : this.l10n.t('Please enter short abstract') } ] }, @@ -52,7 +52,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter a long abstract') + prompt : this.l10n.t('Please enter a long abstract') } ] }, @@ -61,7 +61,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter comments') + prompt : this.l10n.t('Please enter comments') } ] }, @@ -70,7 +70,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please select a track') + prompt : this.l10n.t('Please select a track') } ] }, @@ -79,7 +79,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please select a session type') + prompt : this.l10n.t('Please select a session type') } ] }, @@ -88,7 +88,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter a level') + prompt : this.l10n.t('Please enter a level') } ] }, @@ -97,7 +97,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter a language') + prompt : this.l10n.t('Please enter a language') } ] }, @@ -106,12 +106,12 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter a url') + prompt : this.l10n.t('Please enter a url') }, { type : 'regExp', value : compulsoryProtocolValidUrlPattern, - prompt : this.get('l10n').t('Please enter a valid url') + prompt : this.l10n.t('Please enter a valid url') } ] }, @@ -122,7 +122,7 @@ export default Component.extend(FormMixin, { { type : 'regExp', value : compulsoryProtocolValidUrlPattern, - prompt : this.get('l10n').t('Please enter a valid url') + prompt : this.l10n.t('Please enter a valid url') } ] }, @@ -131,12 +131,12 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter a url') + prompt : this.l10n.t('Please enter a url') }, { type : 'regExp', value : compulsoryProtocolValidUrlPattern, - prompt : this.get('l10n').t('Please enter a valid url') + prompt : this.l10n.t('Please enter a valid url') } ] }, @@ -147,7 +147,7 @@ export default Component.extend(FormMixin, { { type : 'regExp', value : compulsoryProtocolValidUrlPattern, - prompt : this.get('l10n').t('Please enter a valid url') + prompt : this.l10n.t('Please enter a valid url') } ] }, @@ -156,12 +156,12 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter a url') + prompt : this.l10n.t('Please enter a url') }, { type : 'regExp', value : compulsoryProtocolValidUrlPattern, - prompt : this.get('l10n').t('Please enter a valid url') + prompt : this.l10n.t('Please enter a valid url') } ] }, @@ -172,7 +172,7 @@ export default Component.extend(FormMixin, { { type : 'regExp', value : compulsoryProtocolValidUrlPattern, - prompt : this.get('l10n').t('Please enter a valid url') + prompt : this.l10n.t('Please enter a valid url') } ] }, @@ -181,7 +181,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter a name') + prompt : this.l10n.t('Please enter a name') } ] }, @@ -190,11 +190,11 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter an email') + prompt : this.l10n.t('Please enter an email') }, { type : 'email', - prompt : this.get('l10n').t('Please enter a valid email') + prompt : this.l10n.t('Please enter a valid email') } ] }, @@ -204,11 +204,11 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter an email') + prompt : this.l10n.t('Please enter an email') }, { type : 'email', - prompt : this.get('l10n').t('Please enter a valid email') + prompt : this.l10n.t('Please enter a valid email') } ] }, @@ -217,12 +217,12 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please select an image') + prompt : this.l10n.t('Please select an image') }, { type : 'regExp', value : compulsoryProtocolValidUrlPattern, - prompt : this.get('l10n').t('Please enter a valid url') + prompt : this.l10n.t('Please enter a valid url') } ] }, @@ -233,7 +233,7 @@ export default Component.extend(FormMixin, { { type : 'regExp', value : compulsoryProtocolValidUrlPattern, - prompt : this.get('l10n').t('Please enter a valid url') + prompt : this.l10n.t('Please enter a valid url') } ] }, @@ -242,7 +242,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter an organisation') + prompt : this.l10n.t('Please enter an organisation') } ] }, @@ -251,7 +251,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter a position') + prompt : this.l10n.t('Please enter a position') } ] }, @@ -260,7 +260,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter a country') + prompt : this.l10n.t('Please enter a country') } ] }, @@ -269,7 +269,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter a city') + prompt : this.l10n.t('Please enter a city') } ] }, @@ -278,7 +278,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter long biography') + prompt : this.l10n.t('Please enter long biography') } ] }, @@ -287,7 +287,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter short biography') + prompt : this.l10n.t('Please enter short biography') } ] }, @@ -296,7 +296,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter speaking experience') + prompt : this.l10n.t('Please enter speaking experience') } ] }, @@ -305,7 +305,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter select sponsorship') + prompt : this.l10n.t('Please enter select sponsorship') } ] }, @@ -314,7 +314,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please select a gender') + prompt : this.l10n.t('Please select a gender') } ] }, @@ -323,7 +323,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter where you heard about the event') + prompt : this.l10n.t('Please enter where you heard about the event') } ] }, @@ -334,7 +334,7 @@ export default Component.extend(FormMixin, { { type : 'regExp', value : validPhoneNumber, - prompt : this.get('l10n').t('Please enter a valid mobile number.') + prompt : this.l10n.t('Please enter a valid mobile number.') } ] }, @@ -343,12 +343,12 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter a mobile number') + prompt : this.l10n.t('Please enter a mobile number') }, { type : 'regExp', value : validPhoneNumber, - prompt : this.get('l10n').t('Please enter a valid mobile number.') + prompt : this.l10n.t('Please enter a valid mobile number.') } ] }, @@ -357,12 +357,12 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter url of website') + prompt : this.l10n.t('Please enter url of website') }, { type : 'regExp', value : protocolLessValidUrlPattern, - prompt : this.get('l10n').t('Please enter a valid url') + prompt : this.l10n.t('Please enter a valid url') } ] }, @@ -373,7 +373,7 @@ export default Component.extend(FormMixin, { { type : 'regExp', value : protocolLessValidUrlPattern, - prompt : this.get('l10n').t('Please enter a valid url') + prompt : this.l10n.t('Please enter a valid url') } ] }, @@ -382,12 +382,12 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter facebook link') + prompt : this.l10n.t('Please enter facebook link') }, { type : 'regExp', value : validFacebookProfileUrlPattern, - prompt : this.get('l10n').t('Please enter a valid facebook account url') + prompt : this.l10n.t('Please enter a valid facebook account url') } ] }, @@ -398,7 +398,7 @@ export default Component.extend(FormMixin, { { type : 'regExp', value : validFacebookProfileUrlPattern, - prompt : this.get('l10n').t('Please enter a valid facebook account url') + prompt : this.l10n.t('Please enter a valid facebook account url') } ] }, @@ -407,12 +407,12 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter twitter link') + prompt : this.l10n.t('Please enter twitter link') }, { type : 'regExp', value : validTwitterProfileUrlPattern, - prompt : this.get('l10n').t('Please enter a valid twitter profile url') + prompt : this.l10n.t('Please enter a valid twitter profile url') } ] }, @@ -423,7 +423,7 @@ export default Component.extend(FormMixin, { { type : 'regExp', value : validTwitterProfileUrlPattern, - prompt : this.get('l10n').t('Please enter a valid twitter profile url') + prompt : this.l10n.t('Please enter a valid twitter profile url') } ] }, @@ -432,12 +432,12 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter GitHub link') + prompt : this.l10n.t('Please enter GitHub link') }, { type : 'regExp', value : validGithubProfileUrlPattern, - prompt : this.get('l10n').t('Please enter a valid GitHub profile url') + prompt : this.l10n.t('Please enter a valid GitHub profile url') } ] }, @@ -448,7 +448,7 @@ export default Component.extend(FormMixin, { { type : 'regExp', value : validGithubProfileUrlPattern, - prompt : this.get('l10n').t('Please enter a valid GitHub profile url') + prompt : this.l10n.t('Please enter a valid GitHub profile url') } ] }, @@ -457,12 +457,12 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter linkedin link') + prompt : this.l10n.t('Please enter linkedin link') }, { type : 'regExp', value : validLinkedinProfileUrlPattern, - prompt : this.get('l10n').t('Please enter a valid linkedin profile url') + prompt : this.l10n.t('Please enter a valid linkedin profile url') } ] }, @@ -473,7 +473,7 @@ export default Component.extend(FormMixin, { { type : 'regExp', value : validLinkedinProfileUrlPattern, - prompt : this.get('l10n').t('Please enter a valid linkedin profile url') + prompt : this.l10n.t('Please enter a valid linkedin profile url') } ] } @@ -488,21 +488,21 @@ export default Component.extend(FormMixin, { genders: orderBy(genders, 'name'), allFields: computed('fields', function() { - return groupBy(this.get('fields').toArray(), field => field.get('form')); + return groupBy(this.fields.toArray(), field => field.get('form')); }), // Clicking on the add session button creates a blank record which increases the length of the speaker's list by 1. noSpeakerExists: computed('speakers', function() { - return (this.get('speakers').length === 1); + return this.speakers.length === 1; }), // Clicking on the add speaker button creates a blank record which increases the length of the session's list by 1. noSessionExists: computed('sessions', function() { - return (this.get('sessions').length === 1); + return this.sessions.length === 1; }), shouldShowNewSessionDetails: computed('sessionDetails', 'newSessionSelected', function() { - return this.get('newSessionSelected') && !this.get('sessionDetails'); + return this.newSessionSelected && !this.sessionDetails; }), actions: { @@ -519,11 +519,11 @@ export default Component.extend(FormMixin, { } }, didInsertElement() { - if (this.get('isSpeaker') && this.get('data.speaker') && this.get('data.speaker').length) { + if (this.isSpeaker && this.get('data.speaker') && this.get('data.speaker').length) { this.set('data.speaker', this.get('data.speaker').toArray()[0]); } - if (this.get('isSession') && this.get('data.session') && this.get('data.session').length) { + if (this.isSession && this.get('data.session') && this.get('data.session').length) { this.set('data.session', this.get('data.session').toArray()[0]); } } diff --git a/app/components/forms/user-profile-form.js b/app/components/forms/user-profile-form.js index ffaca3248d9..c8a64fbd07a 100644 --- a/app/components/forms/user-profile-form.js +++ b/app/components/forms/user-profile-form.js @@ -15,7 +15,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter your name') + prompt : this.l10n.t('Please enter your name') } ] }, @@ -24,7 +24,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter your family name') + prompt : this.l10n.t('Please enter your family name') } ] } @@ -36,13 +36,13 @@ export default Component.extend(FormMixin, { submit() { this.onValid(() => { this.set('isLoading', true); - this.get('user').save() + this.user.save() .then(() => { - this.get('notify').success(this.get('l10n').t('Your profile has been updated')); + this.notify.success(this.l10n.t('Your profile has been updated')); }) .catch(() => { this.get('authManager.currentUser').rollbackAttributes(); - this.get('notify').error(this.get('l10n').t('An unexpected error occurred')); + this.notify.error(this.l10n.t('An unexpected error occurred')); }) .finally(() => { this.set('isLoading', false); diff --git a/app/components/forms/wizard/basic-details-step.js b/app/components/forms/wizard/basic-details-step.js index d6daea03f61..8b5735d2ea9 100644 --- a/app/components/forms/wizard/basic-details-step.js +++ b/app/components/forms/wizard/basic-details-step.js @@ -2,13 +2,13 @@ import Component from '@ember/component'; import { later } from '@ember/runloop'; import { observer, computed } from '@ember/object'; import moment from 'moment'; -import { merge } from '@ember/polyfills'; +import { merge } from 'lodash-es'; import { licenses } from 'open-event-frontend/utils/dictionary/licenses'; import { timezones } from 'open-event-frontend/utils/dictionary/date-time'; import { paymentCountries, paymentCurrencies } from 'open-event-frontend/utils/dictionary/payment'; import { countries } from 'open-event-frontend/utils/dictionary/demography'; import FormMixin from 'open-event-frontend/mixins/form'; -import { orderBy, filter, find } from 'lodash'; +import { orderBy, filter, find } from 'lodash-es'; import { inject as service } from '@ember/service'; import EventWizardMixin from 'open-event-frontend/mixins/event-wizard'; import { protocolLessValidUrlPattern } from 'open-event-frontend/utils/validators'; @@ -63,18 +63,17 @@ export default Component.extend(FormMixin, EventWizardMixin, { * returns the validation rules for the social links. */ socialLinksValidationRules: computed('socialLinks', function() { - const socialLinks = this.get('socialLinks'); let validationRules = {}; - for (let i = 0; i < socialLinks.length; i++) { + for (let i = 0; i < this.socialLinks.length; i++) { validationRules = merge(validationRules, { - [socialLinks.get(i).identifier]: { - identifier : socialLinks.get(i).identifier, + [this.socialLinks.get(i).identifier]: { + identifier : this.socialLinks.get(i).identifier, optional : true, rules : [ { type : 'regExp', value : protocolLessValidUrlPattern, - prompt : this.get('l10n').t('Please enter a valid url') + prompt : this.l10n.t('Please enter a valid url') } ] } @@ -112,10 +111,10 @@ export default Component.extend(FormMixin, EventWizardMixin, { }), didInsertElement() { - if (!this.get('isCreate') && this.get('data.event.copyright') && !this.get('data.event.copyright.content')) { + if (!this.isCreate && this.get('data.event.copyright') && !this.get('data.event.copyright.content')) { this.set('data.event.copyright', this.store.createRecord('event-copyright')); } - if (!this.get('isCreate') && this.get('data.event.stripeAuthorization') && !this.get('data.event.stripeAuthorization.content')) { + if (!this.isCreate && this.get('data.event.stripeAuthorization') && !this.get('data.event.stripeAuthorization.content')) { this.set('data.event.stripeAuthorization', this.store.createRecord('stripe-authorization')); } }, @@ -131,7 +130,7 @@ export default Component.extend(FormMixin, EventWizardMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please give your event a name') + prompt : this.l10n.t('Please give your event a name') } ] }, @@ -140,7 +139,7 @@ export default Component.extend(FormMixin, EventWizardMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Choose a timezone for your event') + prompt : this.l10n.t('Choose a timezone for your event') } ] }, @@ -149,11 +148,11 @@ export default Component.extend(FormMixin, EventWizardMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please tell us when your event starts') + prompt : this.l10n.t('Please tell us when your event starts') }, { type : 'date', - prompt : this.get('l10n').t('Please give a valid start date') + prompt : this.l10n.t('Please give a valid start date') } ] }, @@ -162,11 +161,11 @@ export default Component.extend(FormMixin, EventWizardMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please tell us when your event ends') + prompt : this.l10n.t('Please tell us when your event ends') }, { type : 'date', - prompt : this.get('l10n').t('Please give a valid end date') + prompt : this.l10n.t('Please give a valid end date') } ] }, @@ -176,7 +175,7 @@ export default Component.extend(FormMixin, EventWizardMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please give a start time') + prompt : this.l10n.t('Please give a start time') } ] }, @@ -186,7 +185,7 @@ export default Component.extend(FormMixin, EventWizardMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please give an end time') + prompt : this.l10n.t('Please give an end time') } ] }, @@ -195,7 +194,7 @@ export default Component.extend(FormMixin, EventWizardMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please give your ticket a name') + prompt : this.l10n.t('Please give your ticket a name') } ] }, @@ -205,7 +204,7 @@ export default Component.extend(FormMixin, EventWizardMixin, { rules : [ { type : 'maxLength[160]', - prompt : this.get('l10n').t('Ticket description shouldn\'t contain more than {ruleValue} characters') + prompt : this.l10n.t('Ticket description shouldn\'t contain more than {ruleValue} characters') } ] }, @@ -214,15 +213,15 @@ export default Component.extend(FormMixin, EventWizardMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please give your ticket a price') + prompt : this.l10n.t('Please give your ticket a price') }, { type : 'number', - prompt : this.get('l10n').t('Please give a proper price for you ticket') + prompt : this.l10n.t('Please give a proper price for you ticket') }, { type : 'integer[1..]', - prompt : this.get('l10n').t('Ticket price should be greater than 0') + prompt : this.l10n.t('Ticket price should be greater than 0') } ] }, @@ -231,11 +230,11 @@ export default Component.extend(FormMixin, EventWizardMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please specify how many tickets of this type are available') + prompt : this.l10n.t('Please specify how many tickets of this type are available') }, { type : 'number', - prompt : this.get('l10n').t('Please give a proper quantity for you ticket') + prompt : this.l10n.t('Please give a proper quantity for you ticket') } ] }, @@ -244,11 +243,11 @@ export default Component.extend(FormMixin, EventWizardMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Minimum tickets per order required') + prompt : this.l10n.t('Minimum tickets per order required') }, { type : 'number', - prompt : this.get('l10n').t('Invalid number') + prompt : this.l10n.t('Invalid number') } ] }, @@ -257,15 +256,15 @@ export default Component.extend(FormMixin, EventWizardMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Maximum tickets per order required') + prompt : this.l10n.t('Maximum tickets per order required') }, { type : 'number', - prompt : this.get('l10n').t('Invalid number') + prompt : this.l10n.t('Invalid number') }, { type : 'integer[1..]', - prompt : this.get('l10n').t('Maximum tickets per order should be greater than 0') + prompt : this.l10n.t('Maximum tickets per order should be greater than 0') } ] }, @@ -274,11 +273,11 @@ export default Component.extend(FormMixin, EventWizardMixin, { rules : [ { type : 'email', - prompt : this.get('l10n').t('Please enter a valid email') + prompt : this.l10n.t('Please enter a valid email') }, { type : 'empty', - prompt : this.get('l10n').t('Please fill your paypal email for payment of tickets.') + prompt : this.l10n.t('Please fill your paypal email for payment of tickets.') } ] }, @@ -287,7 +286,7 @@ export default Component.extend(FormMixin, EventWizardMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please fill the details for payment of tickets.') + prompt : this.l10n.t('Please fill the details for payment of tickets.') } ] }, @@ -296,7 +295,7 @@ export default Component.extend(FormMixin, EventWizardMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please fill the bank details for payment of tickets.') + prompt : this.l10n.t('Please fill the bank details for payment of tickets.') } ] }, @@ -305,7 +304,7 @@ export default Component.extend(FormMixin, EventWizardMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please fill the cheque details for payment of tickets.') + prompt : this.l10n.t('Please fill the cheque details for payment of tickets.') } ] }, @@ -316,26 +315,26 @@ export default Component.extend(FormMixin, EventWizardMixin, { { type : 'regExp', value : protocolLessValidUrlPattern, - prompt : this.get('l10n').t('Please enter a valid url') + prompt : this.l10n.t('Please enter a valid url') } ] } } }; // Merging the predetermined rules with the rules for social links. - validationRules.fields = merge(validationRules.fields, this.get('socialLinksValidationRules')); + validationRules.fields = merge(validationRules.fields, this.socialLinksValidationRules); return validationRules; }, actions: { connectStripe() { this.get('data.event.stripeAuthorization.content') || this.set('data.event.stripeAuthorization', this.store.createRecord('stripe-authorization')); - this.get('torii').open('stripe') + this.torii.open('stripe') .then(authorization => { this.set('data.event.stripeAuthorization.stripeAuthCode', authorization.authorizationCode); }) .catch(error => { - this.get('notify').error(this.get('l10n').t(`${error.message}. Please try again`)); + this.notify.error(this.l10n.t(`${error.message}. Please try again`)); }); }, disconnectStripe() { @@ -396,7 +395,7 @@ export default Component.extend(FormMixin, EventWizardMixin, { // TODO do proper checks. Simulating now. later(this, () => { if (this.get('data.event.discountCode.code') !== 'AIYPWZQP') { - this.getForm().form('add prompt', 'discount_code', this.get('l10n').t('This discount code is invalid. Please try again.')); + this.getForm().form('add prompt', 'discount_code', this.l10n.t('This discount code is invalid. Please try again.')); } else { this.set('data.event.discountCode.code', 42); this.set('discountCodeDescription', 'Tester special discount'); @@ -418,9 +417,9 @@ export default Component.extend(FormMixin, EventWizardMixin, { }, updateDates() { - const { startsAtDate, endsAtDate, startsAtTime, endsAtTime, timezone } = this.get('data.event').getProperties('startsAtDate', 'endsAtDate', 'startsAtTime', 'endsAtTime', 'timezone'); - var startsAtConcatenated = moment(startsAtDate.concat(' ', startsAtTime)); - var endsAtConcatenated = moment(endsAtDate.concat(' ', endsAtTime)); + const { startsAtDate, endsAtDate, startsAtTime, endsAtTime, timezone } = this.get('data.event'); + let startsAtConcatenated = moment(startsAtDate.concat(' ', startsAtTime)); + let endsAtConcatenated = moment(endsAtDate.concat(' ', endsAtTime)); this.get('data.event').setProperties({ startsAt : moment.tz(startsAtConcatenated, timezone), endsAt : moment.tz(endsAtConcatenated, timezone) diff --git a/app/components/forms/wizard/sessions-speakers-step.js b/app/components/forms/wizard/sessions-speakers-step.js index 06f51f1c03c..073f2b08b8a 100644 --- a/app/components/forms/wizard/sessions-speakers-step.js +++ b/app/components/forms/wizard/sessions-speakers-step.js @@ -2,7 +2,7 @@ import Component from '@ember/component'; import { computed } from '@ember/object'; import FormMixin from 'open-event-frontend/mixins/form'; import EventWizardMixin from 'open-event-frontend/mixins/event-wizard'; -import { groupBy } from 'lodash'; +import { groupBy } from 'lodash-es'; export default Component.extend(EventWizardMixin, FormMixin, { @@ -17,7 +17,7 @@ export default Component.extend(EventWizardMixin, FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter name for session-type') + prompt : this.l10n.t('Please enter name for session-type') } ] }, @@ -26,7 +26,7 @@ export default Component.extend(EventWizardMixin, FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter name for track') + prompt : this.l10n.t('Please enter name for track') } ] }, @@ -35,7 +35,7 @@ export default Component.extend(EventWizardMixin, FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter a Private link') + prompt : this.l10n.t('Please enter a Private link') } ] }, @@ -44,7 +44,7 @@ export default Component.extend(EventWizardMixin, FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please select the Privacy') + prompt : this.l10n.t('Please select the Privacy') } ] } diff --git a/app/components/forms/wizard/sponsors-step.js b/app/components/forms/wizard/sponsors-step.js index e84f4850636..07e02f09650 100644 --- a/app/components/forms/wizard/sponsors-step.js +++ b/app/components/forms/wizard/sponsors-step.js @@ -14,7 +14,7 @@ export default Component.extend(FormMixin, { rules: [ { type : 'empty', - prompt : this.get('l10n').t('Please give your sponsor a name') + prompt : this.l10n.t('Please give your sponsor a name') } ] }, @@ -22,7 +22,7 @@ export default Component.extend(FormMixin, { rules: [ { type : 'empty', - prompt : this.get('l10n').t('Please upload sponsor\'s logo.') + prompt : this.l10n.t('Please upload sponsor\'s logo.') } ] } @@ -41,7 +41,7 @@ export default Component.extend(FormMixin, { return (!sponsor.get('name')); }); if (incorrect_sponsors.length > 0) { - this.notify.error(this.get('l10n').t('Please fill the required fields for existing sponsor items')); + this.notify.error(this.l10n.t('Please fill the required fields for existing sponsor items')); this.set('isLoading', false); } else { this.get('data.sponsors').addObject(this.store.createRecord('sponsor')); @@ -57,7 +57,7 @@ export default Component.extend(FormMixin, { return (!sponsor.get('name')); }); if (incorrect_sponsors.length > 0) { - this.notify.error(this.get('l10n').t('Please fill the required fields.')); + this.notify.error(this.l10n.t('Please fill the required fields.')); this.set('isLoading', false); } else { this.set('data.event.state', 'draft'); diff --git a/app/components/modals/add-system-role-modal.js b/app/components/modals/add-system-role-modal.js index daa42264b2a..63d420ffc3b 100644 --- a/app/components/modals/add-system-role-modal.js +++ b/app/components/modals/add-system-role-modal.js @@ -16,7 +16,7 @@ export default ModalBase.extend(FormMixin, { }, close() { if (!this.get('role.id')) { - this.get('role').unloadRecord(); + this.role.unloadRecord(); } this.set('isOpen', false); } @@ -32,7 +32,7 @@ export default ModalBase.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter a role name') + prompt : this.l10n.t('Please enter a role name') } ] } diff --git a/app/components/modals/add-user-role-modal.js b/app/components/modals/add-user-role-modal.js index 22546e83592..9fe9ed22cd7 100644 --- a/app/components/modals/add-user-role-modal.js +++ b/app/components/modals/add-user-role-modal.js @@ -12,8 +12,8 @@ export default ModalBase.extend(FormMixin, { }); }, close() { - if (!this.get('currentInvite').get('id')) { - this.get('currentInvite').unloadRecord(); + if (!this.currentInvite.get('id')) { + this.currentInvite.unloadRecord(); } this.set('isOpen', false); } @@ -31,11 +31,11 @@ export default ModalBase.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter an email for user') + prompt : this.l10n.t('Please enter an email for user') }, { type : 'email', - prompt : this.get('l10n').t('Please enter a valid email address for user') + prompt : this.l10n.t('Please enter a valid email address for user') } ] }, @@ -44,7 +44,7 @@ export default ModalBase.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please select a role') + prompt : this.l10n.t('Please select a role') } ] } diff --git a/app/components/modals/admin/content/new-event-sub-topic-modal.js b/app/components/modals/admin/content/new-event-sub-topic-modal.js index f5b0041bffd..23f8e4581ec 100644 --- a/app/components/modals/admin/content/new-event-sub-topic-modal.js +++ b/app/components/modals/admin/content/new-event-sub-topic-modal.js @@ -24,7 +24,7 @@ export default ModalBase.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter a sub topic name') + prompt : this.l10n.t('Please enter a sub topic name') } ] } diff --git a/app/components/modals/admin/content/new-event-topic-modal.js b/app/components/modals/admin/content/new-event-topic-modal.js index 15629335c4a..e4c6e9d0a01 100644 --- a/app/components/modals/admin/content/new-event-topic-modal.js +++ b/app/components/modals/admin/content/new-event-topic-modal.js @@ -23,7 +23,7 @@ export default ModalBase.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter a topic name') + prompt : this.l10n.t('Please enter a topic name') } ] } diff --git a/app/components/modals/admin/content/new-event-type-modal.js b/app/components/modals/admin/content/new-event-type-modal.js index a405f4cff57..8bb6cf76aea 100644 --- a/app/components/modals/admin/content/new-event-type-modal.js +++ b/app/components/modals/admin/content/new-event-type-modal.js @@ -23,7 +23,7 @@ export default ModalBase.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter a event type') + prompt : this.l10n.t('Please enter a event type') } ] } diff --git a/app/components/modals/change-image-modal.js b/app/components/modals/change-image-modal.js index 68ea185025c..4bb306ec924 100644 --- a/app/components/modals/change-image-modal.js +++ b/app/components/modals/change-image-modal.js @@ -4,14 +4,14 @@ export default ModalBase.extend({ isSmall : true, actions : { updatePlaceholder() { - this.get('placeholder').then(placeholder => { + this.placeholder.then(placeholder => { placeholder.save() .then(() => { this.set('isOpen', false); - this.notify.success(this.get('l10n').t('Placeholder has been saved successfully.')); + this.notify.success(this.l10n.t('Placeholder has been saved successfully.')); }) .catch(() => { - this.notify.error(this.get('l10n').t('An unexpected error has occurred. Placeholder not saved.')); + this.notify.error(this.l10n.t('An unexpected error has occurred. Placeholder not saved.')); }); }); } diff --git a/app/components/modals/cropper-modal.js b/app/components/modals/cropper-modal.js index bb32d448bc4..9ef7604bb4b 100644 --- a/app/components/modals/cropper-modal.js +++ b/app/components/modals/cropper-modal.js @@ -33,7 +33,7 @@ export default ModalBase.extend({ }, cropImage() { this.$('img').croppie('result', 'base64', 'original', 'jpeg').then(result => { - if (this.get('onImageCrop')) { + if (this.onImageCrop) { this.onImageCrop(result); } }); diff --git a/app/components/modals/edit-user-modal.js b/app/components/modals/edit-user-modal.js index 7ae904ffd86..a0c070bca85 100644 --- a/app/components/modals/edit-user-modal.js +++ b/app/components/modals/edit-user-modal.js @@ -3,7 +3,7 @@ import ModalBase from 'open-event-frontend/components/modals/modal-base'; export default ModalBase.extend({ actions: { saveRole(id) { - this.get('store').findRecord('user', id).then(function(user) { + this.store.findRecord('user', id).then(function(user) { user.save(); }); this.set('isOpen', false); diff --git a/app/components/modals/event-delete-modal.js b/app/components/modals/event-delete-modal.js index 135e728f5d2..ee241b3c257 100644 --- a/app/components/modals/event-delete-modal.js +++ b/app/components/modals/event-delete-modal.js @@ -5,6 +5,6 @@ export default ModalBase.extend({ isSmall : true, confirmName : '', isNameDifferent : computed('confirmName', function() { - return this.get('eventName') ? this.get('confirmName').toLowerCase() !== this.get('eventName').toLowerCase() : true; + return this.eventName ? this.confirmName.toLowerCase() !== this.eventName.toLowerCase() : true; }) }); diff --git a/app/components/modals/modal-base.js b/app/components/modals/modal-base.js index d70109147d4..e4b3882b8ad 100644 --- a/app/components/modals/modal-base.js +++ b/app/components/modals/modal-base.js @@ -1,5 +1,6 @@ import { observer } from '@ember/object'; -import { assign, merge } from '@ember/polyfills'; +import { assign } from '@ember/polyfills'; +import { merge } from 'lodash-es'; import UiModal from 'semantic-ui-ember/components/ui-modal'; import { isTesting } from 'open-event-frontend/utils/testing'; @@ -8,7 +9,7 @@ export default UiModal.extend({ classNameBindings : ['isFullScreen:fullscreen', 'isSmall:small', 'isLarge:large'], openObserver: observer('isOpen', function() { - if (this.get('isOpen')) { + if (this.isOpen) { this.$().modal('show'); } else { this.$().modal('hide'); @@ -44,23 +45,23 @@ export default UiModal.extend({ detachable : false, duration : isTesting ? 0 : 200, dimmerSettings : { - dimmerName : `${this.get('elementId')}-modal-dimmer`, + dimmerName : `${this.elementId}-modal-dimmer`, variation : 'inverted' }, onHide: () => { this.set('isOpen', false); - if (this.get('onHide')) { + if (this.onHide) { this.onHide(); } }, onDeny: () => { - if (this.get('onDeny')) { + if (this.onDeny) { this.onDeny(); } return true; }, onApprove: () => { - if (this.get('onApprove')) { + if (this.onApprove) { this.onApprove(); } return true; @@ -72,18 +73,18 @@ export default UiModal.extend({ this.$('[data-content]').popup({ inline: true }); - if (this.get('onVisible')) { + if (this.onVisible) { this.onVisible(); } } }; - const options = this.get('options') ? merge(defaultOptions, this.get('options')) : defaultOptions; + const options = this.options ? merge(defaultOptions, this.options) : defaultOptions; assign(settings, options); }, didInitSemantic() { - if (this.get('isOpen')) { + if (this.isOpen) { this.$().modal('show'); } } diff --git a/app/components/modals/tax-info-modal.js b/app/components/modals/tax-info-modal.js index 5244f0dfe18..51836404ba8 100644 --- a/app/components/modals/tax-info-modal.js +++ b/app/components/modals/tax-info-modal.js @@ -2,7 +2,7 @@ import { computed } from '@ember/object'; import ModalBase from 'open-event-frontend/components/modals/modal-base'; import FormMixin from 'open-event-frontend/mixins/form'; import { countries } from 'open-event-frontend/utils/dictionary/demography'; -import { orderBy } from 'lodash'; +import { orderBy } from 'lodash-es'; export default ModalBase.extend(FormMixin, { isSmall : false, @@ -24,7 +24,7 @@ export default ModalBase.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please give a name') + prompt : this.l10n.t('Please give a name') } ] }, @@ -33,11 +33,11 @@ export default ModalBase.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please tell us your tax rate (in %)') + prompt : this.l10n.t('Please tell us your tax rate (in %)') }, { type : 'number', - prompt : this.get('l10n').t('Please give a valid tax rate') + prompt : this.l10n.t('Please give a valid tax rate') } ] }, @@ -46,7 +46,7 @@ export default ModalBase.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please give us your tax ID') + prompt : this.l10n.t('Please give us your tax ID') } ] }, @@ -56,7 +56,7 @@ export default ModalBase.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please give us your company name') + prompt : this.l10n.t('Please give us your company name') } ] }, @@ -66,7 +66,7 @@ export default ModalBase.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please give us your address') + prompt : this.l10n.t('Please give us your address') } ] }, @@ -76,7 +76,7 @@ export default ModalBase.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please give a city') + prompt : this.l10n.t('Please give a city') } ] }, @@ -86,7 +86,7 @@ export default ModalBase.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please give a state') + prompt : this.l10n.t('Please give a state') } ] }, @@ -96,7 +96,7 @@ export default ModalBase.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please provide a zip code') + prompt : this.l10n.t('Please provide a zip code') } ] } @@ -116,7 +116,7 @@ export default ModalBase.extend(FormMixin, { updateTaxInfo() { this.$('.ui.form').form('validate form'); if (this.$('.ui.form').form('is valid')) { - this.set('tax.isTaxIncludedInPrice', this.get('isTaxIncludedInPrice') === 'include'); + this.set('tax.isTaxIncludedInPrice', this.isTaxIncludedInPrice === 'include'); this.close(); this.set('hasTaxInfo', true); } diff --git a/app/components/modals/user-delete-modal.js b/app/components/modals/user-delete-modal.js index 2b44aacb3dd..847b7e7b422 100644 --- a/app/components/modals/user-delete-modal.js +++ b/app/components/modals/user-delete-modal.js @@ -5,6 +5,6 @@ export default ModalBase.extend({ isSmall : true, confirmEmail : '', isEmailDifferent : computed('confirmEmail', function() { - return this.get('userEmail') ? this.get('confirmEmail') !== this.get('userEmail') : true; + return this.userEmail ? this.confirmEmail !== this.userEmail : true; }) }); diff --git a/app/components/nav-bar.js b/app/components/nav-bar.js index 11e86ba650b..a524307309d 100644 --- a/app/components/nav-bar.js +++ b/app/components/nav-bar.js @@ -3,8 +3,8 @@ import Component from '@ember/component'; export default Component.extend({ actions: { logout() { - this.get('authManager').logout(); - this.get('routing').transitionTo('index'); + this.authManager.logout(); + this.routing.transitionTo('index'); } } }); diff --git a/app/components/notification-dropdown.js b/app/components/notification-dropdown.js index a6af86c0726..b19d0704199 100644 --- a/app/components/notification-dropdown.js +++ b/app/components/notification-dropdown.js @@ -19,10 +19,10 @@ export default Component.extend({ notification.set('isRead', true); notification.save() .then(() => { - this.get('notify').success(this.get('l10n').t('Marked as Read successfully')); + this.notify.success(this.l10n.t('Marked as Read successfully')); }) .catch(() => { - this.get('notify').error(this.get('l10n').t('An unexpected error occurred.')); + this.notify.error(this.l10n.t('An unexpected error occurred.')); }); }, markAllRead() { diff --git a/app/components/orders/order-summary.js b/app/components/orders/order-summary.js index 09bf4f7478f..8e49de6ca82 100644 --- a/app/components/orders/order-summary.js +++ b/app/components/orders/order-summary.js @@ -1,7 +1,7 @@ import Component from '@ember/component'; import { computed } from '@ember/object'; import FormMixin from 'open-event-frontend/mixins/form'; -import { sumBy } from 'lodash'; +import { sumBy } from 'lodash-es'; export default Component.extend(FormMixin, { tickets: computed('data.tickets', function() { diff --git a/app/components/paypal-button.js b/app/components/paypal-button.js index 126d5da8e6a..93704ec1764 100644 --- a/app/components/paypal-button.js +++ b/app/components/paypal-button.js @@ -1,4 +1,4 @@ -import paypal from 'npm:paypal-checkout'; +import paypal from 'paypal-checkout'; import Component from '@ember/component'; import { inject as service } from '@ember/service'; @@ -8,10 +8,7 @@ export default Component.extend({ async didInsertElement() { this._super(...arguments); - let order = this.get('data'); - let loader = this.get('loader'); - let notify = this.get('notify'); - let router = this.get('router'); + let order = this.data; let createPayload = { 'data': { 'attributes': { @@ -33,7 +30,7 @@ export default Component.extend({ }, payment() { - return loader.post(`orders/${order.identifier}/create-paypal-payment`, createPayload) + return this.loader.post(`orders/${order.identifier}/create-paypal-payment`, createPayload) .then(res => { return res.payment_id; }); @@ -55,13 +52,13 @@ export default Component.extend({ skipDataTransform: true }; chargePayload = JSON.stringify(chargePayload); - return loader.post(`orders/${order.identifier}/charge`, chargePayload, config) + return this.loader.post(`orders/${order.identifier}/charge`, chargePayload, config) .then(charge => { if (charge.data.attributes.status) { - notify.success(charge.data.attributes.message); - router.transitionTo('orders.view', order.identifier); + this.notify.success(charge.data.attributes.message); + this.router.transitionTo('orders.view', order.identifier); } else { - notify.error(charge.data.attributes.message); + this.notify.error(charge.data.attributes.message); } }); } diff --git a/app/components/public/social-links.js b/app/components/public/social-links.js index 6c9332ad088..84cae78f0d7 100644 --- a/app/components/public/social-links.js +++ b/app/components/public/social-links.js @@ -8,6 +8,6 @@ export default Component.extend({ socialLinks: A(), twitterLink: computed('socialLinks.[]', function() { - return this.get('socialLinks').findBy('isTwitter', true); + return this.socialLinks.findBy('isTwitter', true); }) }); diff --git a/app/components/public/speaker-item.js b/app/components/public/speaker-item.js index 781a2e98d7f..08adc8fd5b1 100644 --- a/app/components/public/speaker-item.js +++ b/app/components/public/speaker-item.js @@ -4,10 +4,10 @@ import { computed } from '@ember/object'; export default Component.extend({ classNames : ['four wide speaker column'], socialLinks : computed(function() { - return this.get('speaker').getProperties('twitter', 'facebook', 'github', 'linkedin'); + return this.speaker.getProperties('twitter', 'facebook', 'github', 'linkedin'); }), hasSocialLinks: computed(function() { - var currentSpeaker = this.speaker; + let currentSpeaker = this.speaker; return (currentSpeaker.twitter || currentSpeaker.facebook || currentSpeaker.github || currentSpeaker.linkedin || currentSpeaker.shortBiography || currentSpeaker.longBiography || currentSpeaker.speakingExperience); }) }); diff --git a/app/components/public/sponsor-list.js b/app/components/public/sponsor-list.js index be4e6e3f8db..66aa0e2605c 100644 --- a/app/components/public/sponsor-list.js +++ b/app/components/public/sponsor-list.js @@ -1,12 +1,12 @@ import Component from '@ember/component'; import { computed } from '@ember/object'; -import { orderBy, groupBy } from 'lodash'; +import { orderBy, groupBy } from 'lodash-es'; export default Component.extend({ sponsorsGrouped: computed('sponsors.[]', function() { return groupBy( orderBy( - this.get('sponsors').toArray(), + this.sponsors.toArray(), sponsor => sponsor.get('level') ), sponsor => sponsor.get('type') diff --git a/app/components/public/ticket-list.js b/app/components/public/ticket-list.js index 999dae9198b..df596982198 100644 --- a/app/components/public/ticket-list.js +++ b/app/components/public/ticket-list.js @@ -2,7 +2,7 @@ import Component from '@ember/component'; import { computed } from '@ember/object'; import FormMixin from 'open-event-frontend/mixins/form'; import { inject as service } from '@ember/service'; -import { sumBy } from 'lodash'; +import { sumBy } from 'lodash-es'; import { A } from '@ember/array'; export default Component.extend(FormMixin, { @@ -16,7 +16,7 @@ export default Component.extend(FormMixin, { }), shouldDisableOrderButton: computed('isUnverified', 'hasTicketsInOrder', function() { - return !this.get('hasTicketsInOrder'); + return !this.hasTicketsInOrder; }), accessCodeTickets : A(), @@ -25,23 +25,23 @@ export default Component.extend(FormMixin, { invalidPromotionalCode: false, tickets: computed(function() { - return this.get('data').sortBy('position'); + return this.data.sortBy('position'); }), hasTicketsInOrder: computed('tickets.@each.orderQuantity', function() { - return sumBy(this.get('tickets').toArray(), + return sumBy(this.tickets.toArray(), ticket => ticket.getWithDefault('orderQuantity', 0) ) > 0; }), total: computed('tickets.@each.orderQuantity', 'tickets.@each.discount', function() { - return sumBy(this.get('tickets').toArray(), + return sumBy(this.tickets.toArray(), ticket => (ticket.getWithDefault('price', 0) - ticket.getWithDefault('discount', 0)) * ticket.getWithDefault('orderQuantity', 0) ); }), actions: { async togglePromotionalCode(queryParam) { this.toggleProperty('enterPromotionalCode'); - if (this.get('enterPromotionalCode') && !queryParam) { + if (this.enterPromotionalCode && !queryParam) { this.set('promotionalCode', ''); } else { if (queryParam) { @@ -50,59 +50,56 @@ export default Component.extend(FormMixin, { } else { this.set('promotionalCodeApplied', false); this.set('code', null); - let order = this.get('order'); - order.set('accessCode', undefined); - order.set('discountCode', undefined); - this.get('accessCodeTickets').forEach(ticket => { + this.order.set('accessCode', undefined); + this.order.set('discountCode', undefined); + this.accessCodeTickets.forEach(ticket => { ticket.set('isHidden', true); - this.get('tickets').removeObject(ticket); + this.tickets.removeObject(ticket); }); - this.get('discountedTickets').forEach(ticket => { + this.discountedTickets.forEach(ticket => { ticket.set('discount', 0); }); - this.get('accessCodeTickets').clear(); - this.get('discountedTickets').clear(); + this.accessCodeTickets.clear(); + this.discountedTickets.clear(); } } }, async applyPromotionalCode() { - let promotionalCode = this.get('promotionalCode'); - let order = this.get('order'); - if (!this.get('code')) { - this.set('code', promotionalCode); + if (!this.code) { + this.set('code', this.promotionalCode); } try { - let accessCode = await this.get('store').findRecord('access-code', promotionalCode, {}); - order.set('accessCode', accessCode); + let accessCode = await this.store.findRecord('access-code', this.promotionalCode, {}); + this.order.set('accessCode', accessCode); let tickets = await accessCode.get('tickets'); tickets.forEach(ticket => { ticket.set('isHidden', false); - this.get('tickets').addObject(ticket); - this.get('accessCodeTickets').addObject(ticket); + this.tickets.addObject(ticket); + this.accessCodeTickets.addObject(ticket); this.set('invalidPromotionalCode', false); }); } catch (e) { this.set('invalidPromotionalCode', true); } try { - let discountCode = await this.get('store').findRecord('discount-code', promotionalCode, { + let discountCode = await this.store.findRecord('discount-code', this.promotionalCode, { include: 'tickets' }); let discountCodeEvent = await discountCode.get('event'); if (this.currentEventIdentifier === discountCodeEvent.identifier) { let discountType = discountCode.get('type'); let discountValue = discountCode.get('value'); - order.set('discountCode', discountCode); + this.order.set('discountCode', discountCode); let tickets = await discountCode.get('tickets'); tickets.forEach(ticket => { let ticketPrice = ticket.get('price'); if (discountType === 'amount') { ticket.set('discount', Math.min(ticketPrice, discountValue)); - this.get('discountedTickets').addObject(ticket); + this.discountedTickets.addObject(ticket); } else { ticket.set('discount', ticketPrice * (discountValue / 100)); - this.get('discountedTickets').addObject(ticket); + this.discountedTickets.addObject(ticket); } this.set('invalidPromotionalCode', false); }); @@ -110,32 +107,31 @@ export default Component.extend(FormMixin, { this.set('invalidPromotionalCode', true); } } catch (e) { - if (this.get('invalidPromotionalCode')) { + if (this.invalidPromotionalCode) { this.set('invalidPromotionalCode', true); } } - if (this.get('invalidPromotionalCode')) { + if (this.invalidPromotionalCode) { this.set('promotionalCodeApplied', false); this.notify.error('This Promotional Code is not valid'); } else { this.set('promotionalCodeApplied', true); this.set('promotionalCode', 'Promotional code applied successfully'); } - order.set('amount', this.get('total')); + this.order.set('amount', this.total); }, updateOrder(ticket, count) { - let order = this.get('order'); ticket.set('orderQuantity', count); - order.set('amount', this.get('total')); - if (!this.get('total')) { - order.set('amount', 0); + this.order.set('amount', this.total); + if (!this.total) { + this.order.set('amount', 0); } if (count > 0) { - order.tickets.addObject(ticket); + this.order.tickets.addObject(ticket); } else { - if (order.tickets.includes(ticket)) { - order.tickets.removeObject(ticket); + if (this.order.tickets.includes(ticket)) { + this.order.tickets.removeObject(ticket); } } }, @@ -143,16 +139,16 @@ export default Component.extend(FormMixin, { handleKeyPress() { if (event.code === 'Enter') { this.send('applyPromotionalCode'); - this.set('code', this.get('promotionalCode')); + this.set('code', this.promotionalCode); } } }, didInsertElement() { - this.get('data').forEach(ticket => { + this.data.forEach(ticket => { ticket.set('discount', 0); }); - if (this.get('code')) { - this.send('togglePromotionalCode', this.get('code')); + if (this.code) { + this.send('togglePromotionalCode', this.code); } }, getValidationRules() { @@ -166,7 +162,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter the promotional Code') + prompt : this.l10n.t('Please enter the promotional Code') } ] } diff --git a/app/components/quick-filter.js b/app/components/quick-filter.js index 7e4d976534e..cf1b0d8c3d3 100644 --- a/app/components/quick-filter.js +++ b/app/components/quick-filter.js @@ -11,7 +11,7 @@ export default Component.extend({ let newStartDate = null; let newEndDate = null; - switch (this.get('filterDate')) { + switch (this.filterDate) { case 'all_dates': break; @@ -55,9 +55,9 @@ export default Component.extend({ init() { this._super(...arguments); - this.set('dummyLocation', this.get('location')); - this.set('dummyName', this.get('eventName')); - if (this.get('dummyName') || this.get('dummyLocation')) {this.set('disableClear', false)} + this.set('dummyLocation', this.location); + this.set('dummyName', this.eventName); + if (this.dummyName || this.dummyLocation) {this.set('disableClear', false)} }, actions: { handleKeyPress() { @@ -67,8 +67,8 @@ export default Component.extend({ }, search() { this.setDateFilter(); - this.set('location', this.get('dummyLocation')); - this.set('eventName', this.get('dummyName')); + this.set('location', this.dummyLocation); + this.set('eventName', this.dummyName); this.set('disableClear', false); }, @@ -77,8 +77,8 @@ export default Component.extend({ this.set('dummyName', null); this.set('filterDate', null); this.setDateFilter(); - this.set('location', this.get('dummyLocation')); - this.set('eventName', this.get('dummyName')); + this.set('location', this.dummyLocation); + this.set('eventName', this.dummyName); this.set('disableClear', true); } } diff --git a/app/components/settings/application-section.js b/app/components/settings/application-section.js index 70ddd0fe620..03501919128 100644 --- a/app/components/settings/application-section.js +++ b/app/components/settings/application-section.js @@ -10,9 +10,9 @@ export default Component.extend({ auth(provider) { try { if (provider === 'facebook') { - this.get('torii').open('facebook').then(authData => { + this.torii.open('facebook').then(authData => { this.set('isLoading', true); - this.get('loader').load(`/auth/oauth/login/${ provider }/${ authData.authorizationCode }/?redirect_uri=${ authData.redirectUri}`) + this.loader.load(`/auth/oauth/login/${ provider }/${ authData.authorizationCode }/?redirect_uri=${ authData.redirectUri}`) .then(async response => { let credentials = { 'identification' : response.email, @@ -20,13 +20,13 @@ export default Component.extend({ }; let authenticator = 'authenticator:jwt'; - this.get('session') + this.session .authenticate(authenticator, credentials) .then(async() => { - const tokenPayload = this.get('authManager').getTokenPayload(); + const tokenPayload = this.authManager.getTokenPayload(); if (tokenPayload) { - this.get('authManager').persistCurrentUser( - await this.get('store').findRecord('user', tokenPayload.identity) + this.authManager.persistCurrentUser( + await this.store.findRecord('user', tokenPayload.identity) ); this.set('data', this.get('authManager.currentUser')); } @@ -36,7 +36,7 @@ export default Component.extend({ }); } } catch (error) { - this.get('notify').error(this.get('l10n').t(error.message)); + this.notify.error(this.l10n.t(error.message)); this.set('isLoading', false); } } diff --git a/app/components/settings/contact-info-section.js b/app/components/settings/contact-info-section.js index e72ef630dc0..74a20a8ed8d 100644 --- a/app/components/settings/contact-info-section.js +++ b/app/components/settings/contact-info-section.js @@ -19,11 +19,11 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter your email ID') + prompt : this.l10n.t('Please enter your email ID') }, { type : 'email', - prompt : this.get('l10n').t('Please enter a valid email ID') + prompt : this.l10n.t('Please enter a valid email ID') } ] }, @@ -32,12 +32,12 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter a phone number.') + prompt : this.l10n.t('Please enter a phone number.') }, { type : 'regExp', value : validPhoneNumber, - prompt : this.get('l10n').t('Please enter a valid phone number.') + prompt : this.l10n.t('Please enter a valid phone number.') } ] } diff --git a/app/components/settings/danger-zone.js b/app/components/settings/danger-zone.js index 68a7b67fc70..1dbd0e64ff9 100644 --- a/app/components/settings/danger-zone.js +++ b/app/components/settings/danger-zone.js @@ -31,12 +31,12 @@ export default Component.extend({ this.set('isLoading', true); user.destroyRecord() .then(() => { - this.get('authManager').logout(); - this.get('routing').transitionTo('index'); - this.notify.success(this.get('l10n').t('Your account has been deleted successfully.')); + this.authManager.logout(); + this.routing.transitionTo('index'); + this.notify.success(this.l10n.t('Your account has been deleted successfully.')); }) .catch(() => { - this.notify.error(this.get('l10n').t('An unexpected error has occurred.')); + this.notify.error(this.l10n.t('An unexpected error has occurred.')); }) .finally(() => { this.setProperties({ diff --git a/app/components/settings/email-preferences-section.js b/app/components/settings/email-preferences-section.js index 049b0a8b98e..2af8e230e4a 100644 --- a/app/components/settings/email-preferences-section.js +++ b/app/components/settings/email-preferences-section.js @@ -5,11 +5,11 @@ export default Component.extend({ savePreference(emailPreference) { emailPreference.save() .then(() => { - this.get('notify').success(this.get('l10n').t('Email notifications updated successfully')); + this.notify.success(this.l10n.t('Email notifications updated successfully')); }) .catch(() => { emailPreference.rollbackAttributes(); - this.get('notify').error(this.get('l10n').t('An unexpected error occurred.')); + this.notify.error(this.l10n.t('An unexpected error occurred.')); }); } } diff --git a/app/components/settings/password-section.js b/app/components/settings/password-section.js index 156977e4dfa..a7b842b891c 100644 --- a/app/components/settings/password-section.js +++ b/app/components/settings/password-section.js @@ -13,7 +13,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter the current password') + prompt : this.l10n.t('Please enter the current password') } ] }, @@ -22,11 +22,11 @@ export default Component.extend(FormMixin, { rules : [ { type : 'empty', - prompt : this.get('l10n').t('Please enter a new password') + prompt : this.l10n.t('Please enter a new password') }, { type : 'minLength[8]', - prompt : this.get('l10n').t('Your password must have at least {ruleValue} characters') + prompt : this.l10n.t('Your password must have at least {ruleValue} characters') } ] }, @@ -35,7 +35,7 @@ export default Component.extend(FormMixin, { rules : [ { type : 'match[password_new]', - prompt : this.get('l10n').t('Passwords do not match') + prompt : this.l10n.t('Passwords do not match') } ] } diff --git a/app/components/side-bar.js b/app/components/side-bar.js index 4a4a42c257a..4d8936e5dd4 100644 --- a/app/components/side-bar.js +++ b/app/components/side-bar.js @@ -25,24 +25,24 @@ export default Component.extend({ this.set('$sidebarOpener', this.$('.open.sidebar')); this.set('$sidebarClosers', this.$('.ui.sidebar').find('.item,a,.link,button')); - this.get('$sidebarClosers').push(this.$('.main-container')[0]); + this.$sidebarClosers.push(this.$('.main-container')[0]); - if (this.get('$sidebarOpener')) { - this.get('$sidebarOpener').on('click', this.toggleSidebar.bind(this)); + if (this.$sidebarOpener) { + this.$sidebarOpener.on('click', this.toggleSidebar.bind(this)); } - if (this.get('$sidebarClosers') && this.get('$sidebarClosers').length > 0) { - this.get('$sidebarClosers').on('click', this.hideSidebar.bind(this)); + if (this.$sidebarClosers && this.$sidebarClosers.length > 0) { + this.$sidebarClosers.on('click', this.hideSidebar.bind(this)); } }, willDestroyElement() { this._super(...arguments); - if (this.get('$sidebarOpener')) { - this.get('$sidebarOpener').off('click', this.toggleSidebar.bind(this)); + if (this.$sidebarOpener) { + this.$sidebarOpener.off('click', this.toggleSidebar.bind(this)); } - if (this.get('$sidebarClosers') && this.get('$sidebarClosers').length > 0) { - this.get('$sidebarClosers').off('click', this.hideSidebar.bind(this)); + if (this.$sidebarClosers && this.$sidebarClosers.length > 0) { + this.$sidebarClosers.off('click', this.hideSidebar.bind(this)); } } }); diff --git a/app/components/smart-overflow.js b/app/components/smart-overflow.js index d40605e5568..cdef1b8d258 100644 --- a/app/components/smart-overflow.js +++ b/app/components/smart-overflow.js @@ -4,8 +4,8 @@ export default Component.extend({ classNames: ['smart-overflow'], didInsertElement() { this._super(...arguments); - var $headerSpan = this.$('span'); - var $header = this.$(); + let $headerSpan = this.$('span'); + let $header = this.$(); $header.attr('data-content', $headerSpan.text()); $header.attr('data-variation', 'tiny'); while ($headerSpan.outerHeight() > $header.height()) { @@ -20,8 +20,8 @@ export default Component.extend({ }, willDestroyElement() { this._super(...arguments); - if (this.get('$header')) { - this.get('$header').popup('destroy'); + if (this.$header) { + this.$header.popup('destroy'); } } }); diff --git a/app/components/tabbed-navigation.js b/app/components/tabbed-navigation.js index d7adbbda5ed..83843ed5c1f 100644 --- a/app/components/tabbed-navigation.js +++ b/app/components/tabbed-navigation.js @@ -8,7 +8,7 @@ export default Component.extend({ currentRoute: computed('session.currentRouteName', 'item', function() { const path = this.get('session.currentRouteName'); if (path) { - return this.get('item'); + return this.item; } }), didInsertElement() { diff --git a/app/components/ui-table-server.js b/app/components/ui-table-server.js index da68a92a8a7..d2a5197e3a3 100644 --- a/app/components/ui-table-server.js +++ b/app/components/ui-table-server.js @@ -5,7 +5,7 @@ import { run } from '@ember/runloop'; import { A } from '@ember/array'; import ModelsTable from 'open-event-frontend/components/ui-table'; import layout from 'open-event-frontend/templates/components/ui-table'; -import { merge, kebabCase } from 'lodash'; +import { merge, kebabCase } from 'lodash-es'; import moment from 'moment'; export default ModelsTable.extend({ @@ -39,25 +39,24 @@ export default ModelsTable.extend({ arrangedContent : alias('filteredContent'), arrangedContentLength: computed('router.currentURL', 'filteredContent.meta', function() { - let itemsCountProperty = get(this, 'metaItemsCountProperty'); + let itemsCountProperty = this.metaItemsCountProperty; let meta = get(this, 'filteredContent.meta') || {}; return get(meta, itemsCountProperty) || 0; }), pagesCount: computed('router.currentURL', 'currentPageNumber', 'pageSize', function() { - let itemsCountProperty = get(this, 'metaItemsCountProperty'); - let meta = get(this, 'filteredContent.meta') || {}; + let itemsCountProperty = this.metaItemsCountProperty; + let meta = this.get('filteredContent.meta') || {}; let items = (get(meta, itemsCountProperty)); - let pageSize = get(this, 'pageSize'); let pages = 0; - if (pageSize > items) { + if (this.pageSize > items) { this.$('.pagination').css({ display: 'none' }); } else { this.$('.pagination').removeAttr('style'); - pages = parseInt((items / pageSize)); - if (items % pageSize) { + pages = parseInt((items / this.pageSize)); + if (items % this.pageSize) { pages = pages + 1; } } @@ -65,47 +64,34 @@ export default ModelsTable.extend({ }), gotoForwardEnabled: computed('currentPageNumber', 'pagesCount', function() { - let currentPageNumber = get(this, 'currentPageNumber'); - let pagesCount = get(this, 'pagesCount'); - return currentPageNumber < pagesCount; + return this.currentPageNumber < this.pagesCount; }), gotoBackwardEnabled: computed('currentPageNumber', function() { - let currentPageNumber = get(this, 'currentPageNumber'); - return currentPageNumber > 1; + return this.currentPageNumber > 1; }), lastIndex: computed('router.currentURL', 'pageSize', 'currentPageNumber', 'arrangedContentLength', function() { - let pageMax = get(this, 'pageSize') * get(this, 'currentPageNumber'); - let itemsCount = get(this, 'arrangedContentLength'); + let pageMax = this.pageSize * this.currentPageNumber; + let itemsCount = this.arrangedContentLength; return Math.min(pageMax, itemsCount); }), _loadData() { - let data = get(this, 'data'); - let currentPageNumber = get(this, 'currentPageNumber'); - let pageSize = get(this, 'pageSize'); - let columns = get(this, 'processedColumns'); - let sortProperties = get(this, 'sortProperties'); - let filterString = get(this, 'filterString'); - var query, store, modelName; - - if (!get(data, 'query')) { + let query, store, modelName; + if (!get(this.data, 'query')) { console.warn('You must use https://emberjs.com/api/data/classes/DS.Store.html#method_query for loading data'); - store = get(this, 'store'); - query = merge({}, get(this, 'query')); - modelName = get(this, 'modelName'); - + query = merge({}, this.query); } else { - query = merge({}, get(data, 'query')); - store = get(data, 'store'); - modelName = get(data, 'type.modelName'); + query = merge({}, get(this.data, 'query')); + store = get(this.data, 'store'); + modelName = get(this.data, 'type.modelName'); } query.filter = JSON.parse(query.filter || '[]'); - query[get(this, 'filterQueryParameters.page')] = currentPageNumber; - query[get(this, 'filterQueryParameters.pageSize')] = pageSize; + query[get(this, 'filterQueryParameters.page')] = this.currentPageNumber; + query[get(this, 'filterQueryParameters.pageSize')] = this.pageSize; - let sort = sortProperties && get(sortProperties, 'firstObject'); + let sort = this.sortProperties && get(this.sortProperties, 'firstObject'); if (sort) { let [sortBy, sortDirection] = sort.split(':'); query = this.sortingWrapper(query, sortBy, sortDirection.toUpperCase()); @@ -121,31 +107,32 @@ export default ModelsTable.extend({ // delete query[globalFilter]; // } - let globalFilter = get(this, 'customGlobalFilter'); + let globalFilter = this.customGlobalFilter; if (globalFilter) { - if (filterString) { + if (this.filterString) { query.filter.pushObject({ name : globalFilter, op : 'ilike', - val : `%${filterString}%` + val : `%${this.filterString}%` }); } } else { query.filter.removeObject({ name : globalFilter, op : 'ilike', - val : `%${filterString}%` + val : `%${this.filterString}%` }); } - columns.forEach(column => { + this.processedColumns.forEach(column => { let filter = get(column, 'filterString'); let filterTitle = this.getCustomFilterTitle(column); let filterHeading = this.getFilterHeading(column); let isMomentQuery = false; + let queryParam; if (filterHeading && filterHeading === 'Date') { isMomentQuery = true; - var queryParam = moment(filter); + queryParam = moment(filter); } if (filter && !isMomentQuery) { query.filter.pushObject({ @@ -205,39 +192,35 @@ export default ModelsTable.extend({ actions: { gotoNext() { - if (!get(this, 'gotoForwardEnabled')) { + if (!this.gotoForwardEnabled) { return; } - let pagesCount = get(this, 'pagesCount'); - let currentPageNumber = get(this, 'currentPageNumber'); - if (pagesCount > currentPageNumber) { + if (this.pagesCount > this.currentPageNumber) { this.incrementProperty('currentPageNumber'); } }, gotoPrev() { - if (!get(this, 'gotoBackwardEnabled')) { + if (!this.gotoBackwardEnabled) { return; } - let pagesCount = get(this, 'pagesCount'); - if (pagesCount > 1) { + if (this.pagesCount > 1) { this.decrementProperty('currentPageNumber'); } }, gotoFirst() { - if (!get(this, 'gotoBackwardEnabled')) { + if (!this.gotoBackwardEnabled) { return; } set(this, 'currentPageNumber', 1); }, gotoLast() { - if (!get(this, 'gotoForwardEnabled')) { + if (!this.gotoForwardEnabled) { return; } - let pagesCount = get(this, 'pagesCount'); - set(this, 'currentPageNumber', pagesCount); + this.set('currentPageNumber', this.pagesCount); }, sort(column) { @@ -272,33 +255,30 @@ export default ModelsTable.extend({ didReceiveAttrs() { set(this, 'pageSize', 10); set(this, 'currentPageNumber', 1); - set(this, 'filteredContent', get(this, 'data')); + set(this, 'filteredContent', this.data); }, didInsertElement() { this._super(...arguments); - if (!get(this, 'pageSize')) { - set(this, 'pageSize', 10); + if (!this.pageSize) { + this.set('pageSize', 10); } }, _addPropertyObserver() { - run.debounce(this, this._loadData, get(this, 'debounceDataLoadTime')); + run.debounce(this, this._loadData, this.debounceDataLoadTime); }, willInsertElement() { this._super(...arguments); - - let observedProperties = get(this, 'observedProperties'); - observedProperties.forEach(propertyName => this.addObserver(propertyName, this._addPropertyObserver)); + this.observedProperties.forEach(propertyName => this.addObserver(propertyName, this._addPropertyObserver)); }, willDestroyElement() { this._super(...arguments); this.set('isLoading', false); this.set('isInitialLoad', true); - let observedProperties = get(this, 'observedProperties'); - observedProperties.forEach(propertyName => this.removeObserver(propertyName)); + this.observedProperties.forEach(propertyName => this.removeObserver(propertyName)); } }); diff --git a/app/components/unverified-user-message.js b/app/components/unverified-user-message.js index d6655444d09..e0ac4b751fe 100644 --- a/app/components/unverified-user-message.js +++ b/app/components/unverified-user-message.js @@ -8,7 +8,7 @@ export default Component.extend({ shouldShowMessage: computed('session.isAuthenticated', 'authManager.currentUser.isVerified', 'isMessageVisible', function() { return this.get('session.isAuthenticated') - && this.get('isMessageVisible') + && this.isMessageVisible && !this.get('authManager.currentUser.isVerified'); }), @@ -19,17 +19,17 @@ export default Component.extend({ 'email': this.get('authManager.currentUser.email') } }; - this.get('loader') + this.loader .post('/auth/resend-verification-email', payload) .then(() => { - this.get('notify').success(this.get('l10n').t('Verification mail sent successfully')); + this.notify.success(this.l10n.t('Verification mail sent successfully')); this.set('isMailSent', true); }) .catch(error => { if (error.error) { - this.get('notify').error(this.get('l10n').t(error.error)); + this.notify.error(this.l10n.t(error.error)); } else { - this.get('notify').error(this.get('l10n').t('An unexpected error has occurred.')); + this.notify.error(this.l10n.t('An unexpected error has occurred.')); } }); } diff --git a/app/components/widgets/forms/date-picker.js b/app/components/widgets/forms/date-picker.js index 39ebcc8723a..7d162e37c01 100644 --- a/app/components/widgets/forms/date-picker.js +++ b/app/components/widgets/forms/date-picker.js @@ -1,5 +1,5 @@ import Component from '@ember/component'; -import { merge } from '@ember/polyfills'; +import { merge } from 'lodash-es'; import moment from 'moment'; import { FORM_DATE_FORMAT } from 'open-event-frontend/utils/dictionary/date-time'; @@ -19,16 +19,16 @@ export default Component.extend({ this._super(...arguments); const defaultOptions = { type : 'date', - today : this.get('today'), + today : this.today, formatter : { date: date => { if (!date) {return ''} - return moment(date).format(this.get('format')); + return moment(date).format(this.format); } } }; - switch (this.get('rangePosition')) { + switch (this.rangePosition) { case 'start': defaultOptions.endCalendar = this.$().closest('.fields').find('.ui.calendar.date.picker'); break; @@ -37,13 +37,13 @@ export default Component.extend({ break; } - this.$().calendar(merge(defaultOptions, this.get('options'))); + this.$().calendar(merge(defaultOptions, this.options)); }, actions: { onChange() { - if (this.get('onChange')) { - this.sendAction('onChange', this.get('value')); + if (this.onChange) { + this.sendAction('onChange', this.value); } } } diff --git a/app/components/widgets/forms/file-upload.js b/app/components/widgets/forms/file-upload.js index 1d0126fc057..11e5ab6b440 100644 --- a/app/components/widgets/forms/file-upload.js +++ b/app/components/widgets/forms/file-upload.js @@ -9,24 +9,24 @@ export default Component.extend({ allowDragDrop : true, inputIdGenerated: computed('inputId', function() { - return this.get('inputId') ? this.get('inputId') : v4(); + return this.inputId ? this.inputId : v4(); }), maxSize: computed('maxSizeInKb', function() { - return humanReadableBytes(this.get('maxSizeInKb')); + return humanReadableBytes(this.maxSizeInKb); }), uploadFile() { this.set('needsConfirmation', false); this.set('uploadingFile', true); - this.get('loader') - .uploadFile('/upload/files', this.$(`#${this.get('inputIdGenerated')}`)) + this.loader + .uploadFile('/upload/files', this.$(`#${this.inputIdGenerated}`)) .then(file => { this.set('fileUrl', JSON.parse(file).url); - this.get('notify').success(this.get('l10n').t('File uploaded successfully')); + this.notify.success(this.l10n.t('File uploaded successfully')); }) .catch(() => { - this.get('notify').error(this.get('l10n').t('Oops something went wrong. Please try again')); + this.notify.error(this.l10n.t('Oops something went wrong. Please try again')); }) .finally(() => { this.set('uploadingFile', false); @@ -35,7 +35,7 @@ export default Component.extend({ processFiles(files) { if (files && files[0]) { - isFileValid(files[0], this.get('maxSizeInKb'), ['application/pdf', 'application/vnd.ms-powerpoint', 'video/mp4', 'application/vnd.oasis.opendocument.presentation']).then(() => { + isFileValid(files[0], this.maxSizeInKb, ['application/pdf', 'application/vnd.ms-powerpoint', 'video/mp4', 'application/vnd.oasis.opendocument.presentation']).then(() => { const reader = new FileReader(); reader.onload = () => { this.uploadFile(); @@ -45,7 +45,7 @@ export default Component.extend({ this.notify.error(error); }); } else { - this.notify.error(this.get('l10n').t('No FileReader support. Please use a more latest browser')); + this.notify.error(this.l10n.t('No FileReader support. Please use a more latest browser')); } }, @@ -58,7 +58,7 @@ export default Component.extend({ } }, removeSelection() { - if (!this.get('needsConfirmation') || this.get('edit') === true) { + if (!this.needsConfirmation || this.edit === true) { this.set('selectedFile', null); this.set('fileUrl', null); } else { @@ -69,8 +69,8 @@ export default Component.extend({ init() { this._super(...arguments); - this.set('selectedFile', this.get('fileUrl')); - if (this.get('selectedFile')) { + this.set('selectedFile', this.fileUrl); + if (this.selectedFile) { this.set('needsConfirmation', true); } }, diff --git a/app/components/widgets/forms/image-upload.js b/app/components/widgets/forms/image-upload.js index 62045ec9fa5..90b38d37275 100644 --- a/app/components/widgets/forms/image-upload.js +++ b/app/components/widgets/forms/image-upload.js @@ -10,22 +10,22 @@ export default Component.extend({ requiresDivider : false, inputIdGenerated: computed('inputId', function() { - return this.get('inputId') ? this.get('inputId') : v4(); + return this.inputId ? this.inputId : v4(); }), maxSize: computed('maxSizeInKb', function() { - return humanReadableBytes(this.get('maxSizeInKb')); + return humanReadableBytes(this.maxSizeInKb); }), allowReCrop: computed('selectedImage', 'needsCropper', function() { - return this.get('needsCropper') && !this.get('selectedImage').includes('http'); + return this.needsCropper && !this.selectedImage.includes('http'); }), uploadImage(imageData) { this.set('selectedImage', imageData); this.set('needsConfirmation', false); this.set('uploadingImage', true); - this.get('loader') + this.loader .post('/upload/image', { data: imageData }) @@ -45,7 +45,7 @@ export default Component.extend({ const reader = new FileReader(); reader.onload = e => { const untouchedImageData = e.target.result; - if (this.get('needsCropper')) { + if (this.needsCropper) { this.set('imgData', untouchedImageData); this.set('cropperModalIsShown', true); } else { @@ -58,7 +58,7 @@ export default Component.extend({ this.notify.error(error); }); } else { - this.notify.error(this.get('l10n').t('No FileReader support. Please use a more latest browser')); + this.notify.error(this.l10n.t('No FileReader support. Please use a more latest browser')); } }, @@ -75,7 +75,7 @@ export default Component.extend({ }, removeSelection() { - if (!this.get('needsConfirmation')) { + if (!this.needsConfirmation) { this.set('selectedImage', null); this.set('imageUrl', null); } else { @@ -90,8 +90,8 @@ export default Component.extend({ init() { this._super(...arguments); - this.set('selectedImage', this.get('imageUrl')); - if (this.get('selectedImage')) { + this.set('selectedImage', this.imageUrl); + if (this.selectedImage) { this.set('needsConfirmation', true); } }, diff --git a/app/components/widgets/forms/link-input.js b/app/components/widgets/forms/link-input.js index 03e984067ce..50966d07305 100644 --- a/app/components/widgets/forms/link-input.js +++ b/app/components/widgets/forms/link-input.js @@ -18,8 +18,8 @@ export default Component.extend({ }), protocolAddressObserver: observer('protocol', 'address', function() { - let add = this.get('address'); - let proto = this.get('protocol'); + let add = this.address; + let proto = this.protocol; if (add.includes('http://') || add.includes('https://')) { let temp = add.split('://'); proto = temp[0]; @@ -36,7 +36,7 @@ export default Component.extend({ didInsertElement() { this._super(...arguments); - if (this.get('segmentedLink')) { + if (this.segmentedLink) { this.setProperties({ protocol : this.get('segmentedLink.protocol'), address : this.get('segmentedLink.address') diff --git a/app/components/widgets/forms/location-input.js b/app/components/widgets/forms/location-input.js index 0ba19a5a87c..df4ba960be5 100644 --- a/app/components/widgets/forms/location-input.js +++ b/app/components/widgets/forms/location-input.js @@ -1,6 +1,6 @@ import Component from '@ember/component'; import { observer, computed } from '@ember/object'; -import { keys, values } from 'lodash'; +import { keys, values } from 'lodash-es'; export default Component.extend({ @@ -14,18 +14,18 @@ export default Component.extend({ }, combinedAddress: computed('address.{venue,line,city,state,zipCode,country}', function() { - return values(this.get('address')).join(' ').trim(); + return values(this.address).join(' ').trim(); }), placeNameChanger: observer('combinedAddress', function() { - this.set('placeName', this.get('combinedAddress')); + this.set('placeName', this.combinedAddress); }), actions: { showAddressView(show = true) { this.set('addressViewIsShown', show); if (!show) { - keys(this.get('address')).forEach(key => { + keys(this.address).forEach(key => { this.set(`address.${key}`, ''); }); this.setProperties({ diff --git a/app/components/widgets/forms/places-autocomplete.js b/app/components/widgets/forms/places-autocomplete.js index da3eda62c6e..8f40571a4eb 100644 --- a/app/components/widgets/forms/places-autocomplete.js +++ b/app/components/widgets/forms/places-autocomplete.js @@ -24,10 +24,10 @@ export default TextField.extend({ if (this.get('fastboot.isFastboot')) { return; } - let navigator = this.get('navigator') || ((window) ? window.navigator : null); + let navigator = this.navigator || ((window) ? window.navigator : null); if (navigator && navigator.geolocation) { navigator.geolocation.getCurrentPosition(position => { - let google = this.get('google') || window.google; + let google = this.google || window.google; let geolocation = { lat : position.coords.latitude, lng : position.coords.longitude @@ -36,7 +36,7 @@ export default TextField.extend({ center : geolocation, radius : position.coords.accuracy }); - this.get('autocomplete').setBounds(circle.getBounds()); + this.autocomplete.setBounds(circle.getBounds()); }); } }, @@ -48,32 +48,32 @@ export default TextField.extend({ setupComponent() { this.getAutocomplete(); - this.get('autocomplete').addListener('place_changed', () => { + this.autocomplete.addListener('place_changed', () => { run(() => { this.placeChanged() }); }); - if (this.get('withGeoLocate')) { + if (this.withGeoLocate) { this.geolocate(); } }, willDestroy() { - if (isPresent(this.get('autocomplete'))) { - let google = this.get('google') || ((window) ? window.google : null); + if (isPresent(this.autocomplete)) { + let google = this.google || ((window) ? window.google : null); if (google) { - google.maps.event.clearInstanceListeners(this.get('autocomplete')); + google.maps.event.clearInstanceListeners(this.autocomplete); } } }, getAutocomplete() { - if (isEmpty(this.get('autocomplete'))) { + if (isEmpty(this.autocomplete)) { if (document && window) { let [inputElement] = this.$(), - google = this.get('google') || window.google, + google = this.google || window.google, options = { types: this._typesToArray() }; - if (Object.keys(this.get('restrictions')).length > 0) { - options.componentRestrictions = this.get('restrictions'); + if (Object.keys(this.restrictions).length > 0) { + options.componentRestrictions = this.restrictions; } let autocomplete = new google.maps.places.Autocomplete(inputElement, options); this.set('autocomplete', autocomplete); @@ -82,16 +82,16 @@ export default TextField.extend({ }, placeChanged() { - if (this.get('placeChangedCallback')) { - let place = this.get('autocomplete').getPlace(); - this.get('placeChangedCallback')(place); - this.set('value', place[this.get('setValueWithProperty')]); + if (this.placeChangedCallback) { + let place = this.autocomplete.getPlace(); + this.placeChangedCallback(place); + this.set('value', place[this.setValueWithProperty]); } }, _typesToArray() { - if (this.get('types') !== '') { - return this.get('types').split(','); + if (this.types !== '') { + return this.types.split(','); } else { return []; } @@ -99,8 +99,8 @@ export default TextField.extend({ actions: { focusOut() { - if (this.get('focusOutCallback')) { - this.get('focusOutCallback')(); + if (this.focusOutCallback) { + this.focusOutCallback(); } } } diff --git a/app/components/widgets/forms/radio-button.js b/app/components/widgets/forms/radio-button.js index 2616186959d..707aacd6088 100644 --- a/app/components/widgets/forms/radio-button.js +++ b/app/components/widgets/forms/radio-button.js @@ -12,16 +12,16 @@ export default Component.extend({ checked : null, htmlChecked: computed('value', 'checked', function() { - return this.get('value') === this.get('checked'); + return this.value === this.checked; }), change() { - this.set('checked', this.get('value')); + this.set('checked', this.value); }, _setCheckedProp() { if (!this.$()) { return } - this.$().prop('checked', this.get('htmlChecked')); + this.$().prop('checked', this.htmlChecked); }, _updateElementValue: observer('htmlChecked', function() { diff --git a/app/components/widgets/forms/rich-text-editor.js b/app/components/widgets/forms/rich-text-editor.js index e3978806284..672070c05bb 100644 --- a/app/components/widgets/forms/rich-text-editor.js +++ b/app/components/widgets/forms/rich-text-editor.js @@ -33,18 +33,18 @@ export default Component.extend({ }, valueObserver: observer('value', function() { - if (this.get('editor') && this.get('value') !== this.get('_value')) { - this.get('editor').setValue(this.get('value')); + if (this.editor && this.value !== this._value) { + this.editor.setValue(this.value); } }), textareaIdGenerated: computed('textareaId', function() { - return this.get('textareaId') ? this.get('textareaId') : v4(); + return this.textareaId ? this.textareaId : v4(); }), didInsertElement() { this._super(...arguments); - this.set('_value', this.get('value')); + this.set('_value', this.value); this.$('.button') .popup({ inline : true, @@ -53,9 +53,9 @@ export default Component.extend({ // Don't initialize wysihtml5 when app is in testing mode if (!isTesting) { - this.editor = new wysihtml5.Editor(this.$(`#${this.get('textareaIdGenerated')}`)[0], { - toolbar : this.$(`#${this.get('textareaIdGenerated')}-toolbar`)[0], - parserRules : this.get('standardParserRules') + this.editor = new wysihtml5.Editor(this.$(`#${this.textareaIdGenerated}`)[0], { + toolbar : this.$(`#${this.textareaIdGenerated}-toolbar`)[0], + parserRules : this.standardParserRules }); const updateValue = () => { diff --git a/app/components/widgets/forms/time-picker.js b/app/components/widgets/forms/time-picker.js index b6646f22921..59436574888 100644 --- a/app/components/widgets/forms/time-picker.js +++ b/app/components/widgets/forms/time-picker.js @@ -1,5 +1,5 @@ import Component from '@ember/component'; -import { merge } from '@ember/polyfills'; +import { merge } from 'lodash-es'; import moment from 'moment'; import { FORM_TIME_FORMAT } from 'open-event-frontend/utils/dictionary/date-time'; @@ -23,12 +23,12 @@ export default Component.extend({ formatter : { time: date => { if (!date) {return ''} - return moment(date).format(this.get('format')); + return moment(date).format(this.format); } } }; - switch (this.get('rangePosition')) { + switch (this.rangePosition) { case 'start': defaultOptions.endCalendar = this.$().closest('.fields').find('.ui.calendar.time.picker'); break; @@ -37,7 +37,7 @@ export default Component.extend({ break; } - this.$().calendar(merge(defaultOptions, this.get('options'))); + this.$().calendar(merge(defaultOptions, this.options)); } }); diff --git a/app/components/widgets/safe-image.js b/app/components/widgets/safe-image.js index 455e9c14c4f..a2c1694c000 100644 --- a/app/components/widgets/safe-image.js +++ b/app/components/widgets/safe-image.js @@ -9,12 +9,12 @@ export default Component.extend({ fallbackAvatar : '/images/placeholders/avatar.png', didInsertElement() { - if (!this.get('src')) { - this.set('src', this.get('isAvatar') ? this.get('fallbackAvatar') : this.get('fallback')); + if (!this.src) { + this.set('src', this.isAvatar ? this.fallbackAvatar : this.fallback); } this.$().on('error', () => { run(this, () => { - this.set('src', this.get('isAvatar') ? this.get('fallbackAvatar') : this.get('fallback')); + this.set('src', this.isAvatar ? this.fallbackAvatar : this.fallback); }); }); }, diff --git a/app/components/widgets/steps-indicator.js b/app/components/widgets/steps-indicator.js index 9ac78f8e54e..8265b02fcb6 100644 --- a/app/components/widgets/steps-indicator.js +++ b/app/components/widgets/steps-indicator.js @@ -1,6 +1,6 @@ import Component from '@ember/component'; import Object, { observer, computed } from '@ember/object'; -import { map, findIndex } from 'lodash'; +import { map, findIndex } from 'lodash-es'; export default Component.extend({ @@ -9,25 +9,25 @@ export default Component.extend({ currentStep : 1, currentIndex: computed('currentStep', function() { - return this.get('currentStep') - 1; + return this.currentStep - 1; }), currentStepComputed: observer('session.currentRouteName', 'autoSteps', function() { - if (this.get('autoSteps')) { - this.set('currentStep', findIndex(this.get('steps'), ['route', this.get('session.currentRouteName')]) + 1); + if (this.autoSteps) { + this.set('currentStep', findIndex(this.steps, ['route', this.get('session.currentRouteName')]) + 1); } }), processedSteps: computed('steps', 'currentIndex', 'enableAll', function() { - return map(this.get('steps'), (step, index) => { + return map(this.steps, (step, index) => { step = Object.create(step); - if (!this.get('enableAll') && index > this.get('currentIndex')) { + if (!this.enableAll && index > this.currentIndex) { step.set('isDisabled', true); } - if (this.get('disableAll') && index !== this.get('currentIndex')) { + if (this.disableAll && index !== this.currentIndex) { step.set('isDisabled', true); } - if (index < this.get('currentIndex')) { + if (index < this.currentIndex) { step.set('isCompleted', true); } return step; diff --git a/app/components/widgets/twitter-timeline.js b/app/components/widgets/twitter-timeline.js index 71114a2368a..4dc1e96898b 100644 --- a/app/components/widgets/twitter-timeline.js +++ b/app/components/widgets/twitter-timeline.js @@ -3,19 +3,19 @@ import { computed } from '@ember/object'; export default Component.extend({ handle: computed('handleOrProfile', function() { - if (this.get('handleOrProfile') && this.get('handleOrProfile').includes('/')) { - const splitted = this.get('handleOrProfile').trim().split('/'); + if (this.handleOrProfile && this.handleOrProfile.includes('/')) { + const splitted = this.handleOrProfile.trim().split('/'); if (splitted.includes('hashtag')) { return null; } return splitted[splitted.length - 1]; } - return this.get('handleOrProfile'); + return this.handleOrProfile; }), normalizedUrl: computed('handle', function() { - if (this.get('handle')) { - return `https://twitter.com/${this.get('handle')}`; + if (this.handle) { + return `https://twitter.com/${this.handle}`; } return null; }) diff --git a/app/controllers/admin/content/events.js b/app/controllers/admin/content/events.js index eeaa05de844..7536a8c05e3 100644 --- a/app/controllers/admin/content/events.js +++ b/app/controllers/admin/content/events.js @@ -1,5 +1,5 @@ import Controller from '@ember/controller'; -import { camelCase, startCase } from 'lodash'; +import { camelCase, startCase } from 'lodash-es'; export default Controller.extend({ @@ -14,7 +14,7 @@ export default Controller.extend({ this.set('disableEventSubtopic', false); this.set('currentTopicSelected', topic); } catch (e) { - this.notify.error(this.get('l10n').t('An unexpected error has occurred. SubTopics not loaded.')); + this.notify.error(this.l10n.t('An unexpected error has occurred. SubTopics not loaded.')); } finally { this.set('isLoading', false); } @@ -32,10 +32,10 @@ export default Controller.extend({ eventProp.destroyRecord() .then(() => { this.get(`model.${modelName}s`).removeObject(eventProp); - this.notify.success(this.get('l10n').t('This Event Property has been deleted successfully.')); + this.notify.success(this.l10n.t('This Event Property has been deleted successfully.')); }) .catch(() => { - this.notify.error(this.get('l10n').t('An unexpected error has occurred. Event Type was not deleted.')); + this.notify.error(this.l10n.t('An unexpected error has occurred. Event Type was not deleted.')); }) .finally(() => { this.set('isLoading', false); @@ -47,10 +47,10 @@ export default Controller.extend({ modelInstance.save() .then(() => { this.get(`model.${camelCasedValue}s`).addObject(modelInstance); - this.notify.success(this.get('l10n').t(`${startCase(camelCasedValue)} has been added successfully.`)); + this.notify.success(this.l10n.t(`${startCase(camelCasedValue)} has been added successfully.`)); }) .catch(() => { - this.notify.error(this.get('l10n').t(`An unexpected error has occurred. ${startCase(camelCasedValue)} not saved.`)); + this.notify.error(this.l10n.t(`An unexpected error has occurred. ${startCase(camelCasedValue)} not saved.`)); }) .finally(() => { this.set('isLoading', false); diff --git a/app/controllers/admin/content/index.js b/app/controllers/admin/content/index.js index 91bf63eb519..9eab3c2fc75 100644 --- a/app/controllers/admin/content/index.js +++ b/app/controllers/admin/content/index.js @@ -4,13 +4,13 @@ export default Controller.extend({ actions: { saveSocials() { this.set('isLoading', true); - let settings = this.get('model'); + let settings = this.model; settings.save() .then(() => { - this.notify.success(this.get('l10n').t('Social links have been saved successfully.')); + this.notify.success(this.l10n.t('Social links have been saved successfully.')); }) .catch(() => { - this.notify.error(this.get('l10n').t('An unexpected error has occurred. Social links not saved.')); + this.notify.error(this.l10n.t('An unexpected error has occurred. Social links not saved.')); }) .finally(() => { this.set('isLoading', false); diff --git a/app/controllers/admin/content/pages.js b/app/controllers/admin/content/pages.js index 19ef8f4bde1..5837541c278 100644 --- a/app/controllers/admin/content/pages.js +++ b/app/controllers/admin/content/pages.js @@ -10,7 +10,7 @@ export default Controller.extend({ updateCurrentPage(page, type) { if (type === 'create') { this.set('isCreate', true); - this.set('currentForm', this.get('store').createRecord('page')); + this.set('currentForm', this.store.createRecord('page')); } else { this.set('isCreate', false); this.set('currentForm', page); @@ -20,13 +20,13 @@ export default Controller.extend({ savePage(page) { page.save() .then(() => { - if (this.get('isCreate')) { + if (this.isCreate) { this.set('isFormOpen', false); } - this.notify.success(this.get('l10n').t('Page details have been saved successfully.')); + this.notify.success(this.l10n.t('Page details have been saved successfully.')); }) .catch(() => { - this.notify.error(this.get('l10n').t('An unexpected error has occurred. Page Details not saved.')); + this.notify.error(this.l10n.t('An unexpected error has occurred. Page Details not saved.')); }); } } diff --git a/app/controllers/admin/content/translations.js b/app/controllers/admin/content/translations.js index 686a537a495..615f4057ad4 100644 --- a/app/controllers/admin/content/translations.js +++ b/app/controllers/admin/content/translations.js @@ -6,7 +6,7 @@ export default Controller.extend({ actions: { translationsDownload() { this.set('isLoading', true); - this.get('loader') + this.loader .downloadFile('/admin/content/translations/all') .then(res => { const anchor = document.createElement('a'); @@ -14,11 +14,11 @@ export default Controller.extend({ anchor.href = URL.createObjectURL(new Blob([res], { type: 'octet/stream' })); anchor.download = 'Translations.zip'; anchor.click(); - this.get('notify').success(this.get('l10n').t('Translations Zip generated successfully.')); + this.notify.success(this.l10n.t('Translations Zip generated successfully.')); }) .catch(e => { console.warn(e); - this.get('notify').error(this.get('l10n').t('Unexpected error occurred.')); + this.notify.error(this.l10n.t('Unexpected error occurred.')); }) .finally(() => { this.set('isLoading', false); diff --git a/app/controllers/admin/events/list.js b/app/controllers/admin/events/list.js index 887721318d4..9e4c3432852 100644 --- a/app/controllers/admin/events/list.js +++ b/app/controllers/admin/events/list.js @@ -85,17 +85,17 @@ export default Controller.extend({ }, deleteEvent() { this.set('isLoading', true); - this.store.findRecord('event', this.get('eventId'), { backgroundReload: false }).then(function(event) { + this.store.findRecord('event', this.eventId, { backgroundReload: false }).then(function(event) { event.destroyRecord(); }) .then(() => { this.set('isLoading', false); - this.notify.success(this.get('l10n').t('Event has been deleted successfully.')); + this.notify.success(this.l10n.t('Event has been deleted successfully.')); this.send('refreshRoute'); }) .catch(() => { this.set('isLoading', false); - this.notify.error(this.get('l10n').t('An unexpected error has occurred.')); + this.notify.error(this.l10n.t('An unexpected error has occurred.')); }); this.set('isEventDeleteModalOpen', false); }, @@ -104,11 +104,11 @@ export default Controller.extend({ event.set('deletedAt', null); event.save({ adapterOptions: { getTrashed: true } }) .then(() => { - this.notify.success(this.get('l10n').t('Event has been restored successfully.')); + this.notify.success(this.l10n.t('Event has been restored successfully.')); this.send('refreshRoute'); }) .catch(e => { - this.notify.error(this.get('l10n').t('An unexpected error has occurred.')); + this.notify.error(this.l10n.t('An unexpected error has occurred.')); console.warn(e); }) .finally(() => { @@ -119,10 +119,10 @@ export default Controller.extend({ event.toggleProperty('isFeatured'); event.save() .then(() => { - this.notify.success(this.get('l10n').t('Event details modified successfully')); + this.notify.success(this.l10n.t('Event details modified successfully')); }) .catch(() => { - this.notify.error(this.get('l10n').t('An unexpected error has occurred.')); + this.notify.error(this.l10n.t('An unexpected error has occurred.')); }); } } diff --git a/app/controllers/admin/messages.js b/app/controllers/admin/messages.js index ee6288e5318..5632970dd54 100644 --- a/app/controllers/admin/messages.js +++ b/app/controllers/admin/messages.js @@ -5,13 +5,13 @@ export default Controller.extend({ actions: { save() { try { - let systemMessages = this.get('model'); + let systemMessages = this.model; systemMessages.forEach(systemMessage => { systemMessage.save(); }); - this.get('notify').success(this.get('l10n').t('Changes have been saved successfully')); + this.notify.success(this.l10n.t('Changes have been saved successfully')); } catch (e) { - this.get('notify').error(this.get('l10n').t(e.errors[0].detail)); + this.notify.error(this.l10n.t(e.errors[0].detail)); } } } diff --git a/app/controllers/admin/modules.js b/app/controllers/admin/modules.js index d757edadc67..c6904d7a3a4 100644 --- a/app/controllers/admin/modules.js +++ b/app/controllers/admin/modules.js @@ -4,13 +4,13 @@ export default Controller.extend({ actions: { submit() { this.set('isLoading', true); - let modules = this.get('model'); + let modules = this.model; modules.save() .then(() => { - this.notify.success(this.get('l10n').t('Settings have been saved successfully.')); + this.notify.success(this.l10n.t('Settings have been saved successfully.')); }) .catch(() => { - this.notify.error(this.get('l10n').t('An unexpected error has occurred. Settings not saved.')); + this.notify.error(this.l10n.t('An unexpected error has occurred. Settings not saved.')); }) .finally(() => { this.set('isLoading', false); diff --git a/app/controllers/admin/permissions/event-roles.js b/app/controllers/admin/permissions/event-roles.js index 13be2bb038f..ae55868d545 100644 --- a/app/controllers/admin/permissions/event-roles.js +++ b/app/controllers/admin/permissions/event-roles.js @@ -12,10 +12,10 @@ export default Controller.extend({ this.set('isLoading', true); this.get('model.permissions').save() .then(() => { - this.notify.success(this.get('l10n').t('Admin Event role permissions have been saved successfully.')); + this.notify.success(this.l10n.t('Admin Event role permissions have been saved successfully.')); }) .catch(err => { - this.notify.error(this.get('l10n').t(err)); + this.notify.error(this.l10n.t(err)); }) .finally(() => { this.set('isLoading', false); diff --git a/app/controllers/admin/permissions/system-roles.js b/app/controllers/admin/permissions/system-roles.js index 2e64ac02a63..efd8663212d 100644 --- a/app/controllers/admin/permissions/system-roles.js +++ b/app/controllers/admin/permissions/system-roles.js @@ -30,10 +30,10 @@ export default Controller.extend({ this.set('isLoading', true); role.destroyRecord() .then(() => { - this.notify.success(this.get('l10n').t('System role has been deleted successfully.')); + this.notify.success(this.l10n.t('System role has been deleted successfully.')); }) .catch(() => { - this.notify.error(this.get('l10n').t('An unexpected error has occurred. System role was not deleted.')); + this.notify.error(this.l10n.t('An unexpected error has occurred. System role was not deleted.')); }) .finally(() => { this.set('isLoading', false); @@ -41,7 +41,7 @@ export default Controller.extend({ }, addSystemRole() { this.set('isLoading', true); - let panels = this.get('panelPermissions'); + let panels = this.panelPermissions; panels.forEach(panel => { if (panel.isChecked) { @@ -51,16 +51,16 @@ export default Controller.extend({ } }); if (!this.get('role.panelPermissions').length) { - this.notify.error(this.get('l10n').t('Please select atleast one panel.')); + this.notify.error(this.l10n.t('Please select atleast one panel.')); this.set('isLoading', false); } else { - this.get('role').save() + this.role.save() .then(() => { this.set('isAddSystemRoleModalOpen', false); - this.notify.success(this.get('l10n').t('System role have been saved successfully.')); + this.notify.success(this.l10n.t('System role have been saved successfully.')); }) .catch(() => { - this.notify.error(this.get('l10n').t('An unexpected error has occurred. System role not saved.')); + this.notify.error(this.l10n.t('An unexpected error has occurred. System role not saved.')); }) .finally(() => { this.set('isLoading', false); @@ -71,10 +71,10 @@ export default Controller.extend({ this.set('isLoading', true); this.get('model.userPermissions').save() .then(() => { - this.notify.success(this.get('l10n').t('User permissions have been saved successfully.')); + this.notify.success(this.l10n.t('User permissions have been saved successfully.')); }) .catch(() => { - this.notify.error(this.get('l10n').t('An unexpected error has occurred. User permissions not saved.')); + this.notify.error(this.l10n.t('An unexpected error has occurred. User permissions not saved.')); }) .finally(() => { this.set('isLoading', false); diff --git a/app/controllers/admin/sales/fees.js b/app/controllers/admin/sales/fees.js index 29f4b7c1d09..645d9e0f088 100644 --- a/app/controllers/admin/sales/fees.js +++ b/app/controllers/admin/sales/fees.js @@ -4,7 +4,7 @@ import { computed } from '@ember/object'; export default Controller.extend({ ticketsTotal: computed(function() { let sum = 0; - this.get('model').forEach(data => { + this.model.forEach(data => { sum += data.ticketCount; }); return sum; @@ -12,7 +12,7 @@ export default Controller.extend({ revenueTotal: computed(function() { let sum = 0; - this.get('model').forEach(data => { + this.model.forEach(data => { sum += data.revenue; }); return sum; diff --git a/app/controllers/admin/sales/marketer.js b/app/controllers/admin/sales/marketer.js index 0eea572f814..ed523c23575 100644 --- a/app/controllers/admin/sales/marketer.js +++ b/app/controllers/admin/sales/marketer.js @@ -4,14 +4,14 @@ import { computed } from '@ember/object'; export default Controller.extend({ salesTotal: computed(function() { let sum = 0; - this.get('model').forEach(data => { + this.model.forEach(data => { sum += data.sales.completed.ticket_count; }); return sum; }), discountsTotal: computed(function() { let sum = 0; - this.get('model').forEach(data => { + this.model.forEach(data => { sum += data.sales.completed.sales_total; }); return sum; diff --git a/app/controllers/admin/sessions/list.js b/app/controllers/admin/sessions/list.js index 9d13042ae1c..67f4ef312c1 100644 --- a/app/controllers/admin/sessions/list.js +++ b/app/controllers/admin/sessions/list.js @@ -52,10 +52,10 @@ export default Controller.extend({ this.set('isLoading', true); session.destroyRecord() .then(() => { - this.notify.success(this.get('l10n').t('Session has been deleted successfully.')); + this.notify.success(this.l10n.t('Session has been deleted successfully.')); }) .catch(() => { - this.notify.error(this.get('l10n').t('An unexpected error has occurred.')); + this.notify.error(this.l10n.t('An unexpected error has occurred.')); }) .finally(() => { this.set('isLoading', false); diff --git a/app/controllers/admin/settings/analytics.js b/app/controllers/admin/settings/analytics.js index 029fbe77228..71f90573c46 100644 --- a/app/controllers/admin/settings/analytics.js +++ b/app/controllers/admin/settings/analytics.js @@ -4,13 +4,13 @@ export default Controller.extend({ actions: { updateSettings() { this.set('isLoading', true); - let settings = this.get('model'); + let settings = this.model; settings.save() .then(() => { - this.notify.success(this.get('l10n').t('Settings have been saved successfully.')); + this.notify.success(this.l10n.t('Settings have been saved successfully.')); }) .catch(() => { - this.notify.error(this.get('l10n').t('An unexpected error has occurred. Settings not saved.')); + this.notify.error(this.l10n.t('An unexpected error has occurred. Settings not saved.')); }) .finally(() => { this.set('isLoading', false); diff --git a/app/controllers/admin/settings/images.js b/app/controllers/admin/settings/images.js index 7abdbd144ae..2aa4a2c26b1 100644 --- a/app/controllers/admin/settings/images.js +++ b/app/controllers/admin/settings/images.js @@ -8,14 +8,14 @@ export default Controller.extend({ .then(() => { this.get('model.speakerImageSize').save() .then(() => { - this.notify.success(this.get('l10n').t('Image sizes have been saved successfully.')); + this.notify.success(this.l10n.t('Image sizes have been saved successfully.')); }) .catch(() => { - this.notify.error(this.get('l10n').t('An unexpected error has occurred. Image sizes not saved.')); + this.notify.error(this.l10n.t('An unexpected error has occurred. Image sizes not saved.')); }); }) .catch(() => { - this.notify.error(this.get('l10n').t('An unexpected error has occurred. Image sizes not saved.')); + this.notify.error(this.l10n.t('An unexpected error has occurred. Image sizes not saved.')); }) .finally(() => { this.set('isLoading', false); diff --git a/app/controllers/admin/settings/index.js b/app/controllers/admin/settings/index.js index 029fbe77228..71f90573c46 100644 --- a/app/controllers/admin/settings/index.js +++ b/app/controllers/admin/settings/index.js @@ -4,13 +4,13 @@ export default Controller.extend({ actions: { updateSettings() { this.set('isLoading', true); - let settings = this.get('model'); + let settings = this.model; settings.save() .then(() => { - this.notify.success(this.get('l10n').t('Settings have been saved successfully.')); + this.notify.success(this.l10n.t('Settings have been saved successfully.')); }) .catch(() => { - this.notify.error(this.get('l10n').t('An unexpected error has occurred. Settings not saved.')); + this.notify.error(this.l10n.t('An unexpected error has occurred. Settings not saved.')); }) .finally(() => { this.set('isLoading', false); diff --git a/app/controllers/admin/settings/microservices.js b/app/controllers/admin/settings/microservices.js index 029fbe77228..71f90573c46 100644 --- a/app/controllers/admin/settings/microservices.js +++ b/app/controllers/admin/settings/microservices.js @@ -4,13 +4,13 @@ export default Controller.extend({ actions: { updateSettings() { this.set('isLoading', true); - let settings = this.get('model'); + let settings = this.model; settings.save() .then(() => { - this.notify.success(this.get('l10n').t('Settings have been saved successfully.')); + this.notify.success(this.l10n.t('Settings have been saved successfully.')); }) .catch(() => { - this.notify.error(this.get('l10n').t('An unexpected error has occurred. Settings not saved.')); + this.notify.error(this.l10n.t('An unexpected error has occurred. Settings not saved.')); }) .finally(() => { this.set('isLoading', false); diff --git a/app/controllers/admin/settings/payment-gateway.js b/app/controllers/admin/settings/payment-gateway.js index 029fbe77228..71f90573c46 100644 --- a/app/controllers/admin/settings/payment-gateway.js +++ b/app/controllers/admin/settings/payment-gateway.js @@ -4,13 +4,13 @@ export default Controller.extend({ actions: { updateSettings() { this.set('isLoading', true); - let settings = this.get('model'); + let settings = this.model; settings.save() .then(() => { - this.notify.success(this.get('l10n').t('Settings have been saved successfully.')); + this.notify.success(this.l10n.t('Settings have been saved successfully.')); }) .catch(() => { - this.notify.error(this.get('l10n').t('An unexpected error has occurred. Settings not saved.')); + this.notify.error(this.l10n.t('An unexpected error has occurred. Settings not saved.')); }) .finally(() => { this.set('isLoading', false); diff --git a/app/controllers/admin/settings/ticket-fees.js b/app/controllers/admin/settings/ticket-fees.js index 86b4c2f21cb..a2954cc5c49 100644 --- a/app/controllers/admin/settings/ticket-fees.js +++ b/app/controllers/admin/settings/ticket-fees.js @@ -4,20 +4,20 @@ export default Controller.extend({ actions: { updateSettings() { this.set('isLoading', true); - let settings = this.get('model'); + let settings = this.model; let incorrect_settings = settings.filter(function(setting) { return (!setting.get('currency') || !setting.get('country')); }); if (incorrect_settings.length > 0) { - this.notify.error(this.get('l10n').t('Please fill the required fields.')); + this.notify.error(this.l10n.t('Please fill the required fields.')); this.set('isLoading', false); } else { settings.save() .then(() => { - this.notify.success(this.get('l10n').t('Ticket Fee settings have been saved successfully.')); + this.notify.success(this.l10n.t('Ticket Fee settings have been saved successfully.')); }) .catch(() => { - this.notify.error(this.get('l10n').t('An unexpected error has occurred. Settings not saved.')); + this.notify.error(this.l10n.t('An unexpected error has occurred. Settings not saved.')); }) .finally(() => { this.set('isLoading', false); diff --git a/app/controllers/admin/users/list.js b/app/controllers/admin/users/list.js index 8b9e1366c37..9607cc86a46 100644 --- a/app/controllers/admin/users/list.js +++ b/app/controllers/admin/users/list.js @@ -75,10 +75,10 @@ export default Controller.extend({ this.set('isLoading', true); user.destroyRecord() .then(() => { - this.notify.success(this.get('l10n').t('User has been deleted successfully.')); + this.notify.success(this.l10n.t('User has been deleted successfully.')); }) .catch(() => { - this.notify.error(this.get('l10n').t('An unexpected error has occurred.')); + this.notify.error(this.l10n.t('An unexpected error has occurred.')); }) .finally(() => { this.set('isLoading', false); @@ -93,11 +93,11 @@ export default Controller.extend({ user.set('deletedAt', null); user.save({ adapterOptions: { getTrashed: true } }) .then(() => { - this.notify.success(this.get('l10n').t('User has been restored successfully.')); + this.notify.success(this.l10n.t('User has been restored successfully.')); this.send('refreshRoute'); }) .catch(e => { - this.notify.error(this.get('l10n').t('An unexpected error has occurred.')); + this.notify.error(this.l10n.t('An unexpected error has occurred.')); console.warn(e); }) .finally(() => { diff --git a/app/controllers/admin/users/view/events/list.js b/app/controllers/admin/users/view/events/list.js index 17c5b68f7ce..13b44efb2ba 100644 --- a/app/controllers/admin/users/view/events/list.js +++ b/app/controllers/admin/users/view/events/list.js @@ -63,14 +63,14 @@ export default Controller.extend({ }, deleteEvent() { this.set('isLoading', true); - this.store.findRecord('event', this.get('eventId'), { backgroundReload: false }).then(function(event) { + this.store.findRecord('event', this.eventId, { backgroundReload: false }).then(function(event) { event.destroyRecord(); }) .then(() => { - this.notify.success(this.get('l10n').t('Event has been deleted successfully.')); + this.notify.success(this.l10n.t('Event has been deleted successfully.')); }) .catch(() => { - this.notify.error(this.get('l10n').t('An unexpected error has occurred.')); + this.notify.error(this.l10n.t('An unexpected error has occurred.')); }) .finally(() => { this.set('isLoading', false); diff --git a/app/controllers/admin/users/view/settings/contact-info.js b/app/controllers/admin/users/view/settings/contact-info.js index 7eed1fcf5db..220df030732 100644 --- a/app/controllers/admin/users/view/settings/contact-info.js +++ b/app/controllers/admin/users/view/settings/contact-info.js @@ -7,10 +7,10 @@ export default Controller.extend({ let currentUser = this.get('model.user'); currentUser.save() .then(() => { - this.get('notify').success(this.get('l10n').t('Your Contact Info has been updated')); + this.notify.success(this.l10n.t('Your Contact Info has been updated')); }) .catch(() => { - this.get('notify').error(this.get('l10n').t('An unexpected error occurred')); + this.notify.error(this.l10n.t('An unexpected error occurred')); }) .finally(() => { this.set('isLoading', false); diff --git a/app/controllers/events/import.js b/app/controllers/events/import.js index efe4668164f..42c5e8014da 100644 --- a/app/controllers/events/import.js +++ b/app/controllers/events/import.js @@ -9,7 +9,7 @@ export default Controller.extend({ fileName : '', importTask(taskUrl) { run.later(() => { - this.get('loader') + this.loader .load(taskUrl) .then(data => { if (data.state !== 'SUCCESS') { @@ -32,9 +32,9 @@ export default Controller.extend({ actions: { uploadFile(files) { let [file] = files; - var data = new FormData(); - var endpoint = 'import/json'; - var ext = file.name.split('.'); + let data = new FormData(); + let endpoint = 'import/json'; + let ext = file.name.split('.'); ext = ext[ext.length - 1].toLowerCase(); if (ext === 'xml') { endpoint = 'import/pentabarf'; @@ -52,7 +52,7 @@ export default Controller.extend({ 'file' : true }); - this.get('loader').post( + this.loader.post( `/events/${endpoint}`, data, { isFile: true } diff --git a/app/controllers/events/list.js b/app/controllers/events/list.js index b4212587195..3d2c11b4281 100644 --- a/app/controllers/events/list.js +++ b/app/controllers/events/list.js @@ -67,15 +67,15 @@ export default Controller.extend({ }, deleteEvent() { this.set('isLoading', true); - this.store.findRecord('event', this.get('eventId'), { backgroundReload: false }).then(function(event) { + this.store.findRecord('event', this.eventId, { backgroundReload: false }).then(function(event) { event.destroyRecord(); }) .then(() => { - this.notify.success(this.get('l10n').t('Event has been deleted successfully.')); + this.notify.success(this.l10n.t('Event has been deleted successfully.')); this.send('refreshRoute'); }) .catch(() => { - this.notify.error(this.get('l10n').t('An unexpected error has occurred.')); + this.notify.error(this.l10n.t('An unexpected error has occurred.')); }) .finally(() => { this.set('isLoading', false); diff --git a/app/controllers/events/view.js b/app/controllers/events/view.js index 35707aebec5..dca42afdc76 100644 --- a/app/controllers/events/view.js +++ b/app/controllers/events/view.js @@ -8,23 +8,23 @@ export default Controller.extend({ }, togglePublishState() { if (isEmpty(this.get('model.locationName'))) { - this.notify.error(this.get('l10n').t('Your event must have a location before it can be published.')); + this.notify.error(this.l10n.t('Your event must have a location before it can be published.')); return; } this.set('isLoading', true); const state = this.get('model.state'); this.set('model.state', state === 'draft' ? 'published' : 'draft'); - this.get('model').save() + this.model.save() .then(() => { if (state === 'draft') { - this.notify.success(this.get('l10n').t('Your event has been published successfully.')); + this.notify.success(this.l10n.t('Your event has been published successfully.')); } else { - this.notify.success(this.get('l10n').t('Your event has been unpublished.')); + this.notify.success(this.l10n.t('Your event has been unpublished.')); } }) .catch(() => { this.set('model.state', state); - this.notify.error(this.get('l10n').t('An unexpected error has occurred.')); + this.notify.error(this.l10n.t('An unexpected error has occurred.')); }) .finally(() => { this.set('isLoading', false); @@ -32,13 +32,13 @@ export default Controller.extend({ }, deleteEvent() { this.set('isLoading', true); - this.get('model').destroyRecord() + this.model.destroyRecord() .then(() => { this.transitionToRoute('events'); - this.notify.success(this.get('l10n').t('Event has been deleted successfully.')); + this.notify.success(this.l10n.t('Event has been deleted successfully.')); }) .catch(() => { - this.notify.error(this.get('l10n').t('An unexpected error has occurred.')); + this.notify.error(this.l10n.t('An unexpected error has occurred.')); }) .finally(() => { this.set('isLoading', false); @@ -47,14 +47,14 @@ export default Controller.extend({ }, copyEvent() { this.set('isCopying', true); - this.get('loader') + this.loader .post(`events/${this.get('model.id')}/copy`, {}) .then(copiedEvent => { this.transitionToRoute('events.view.edit', copiedEvent.identifier); - this.get('notify').success(this.get('l10n').t('Event copied successfully')); + this.notify.success(this.l10n.t('Event copied successfully')); }) .catch(() => { - this.get('notify').error(this.get('l10n').t('Copying of event failed')); + this.notify.error(this.l10n.t('Copying of event failed')); }) .finally(() => { this.set('isCopying', false); diff --git a/app/controllers/events/view/export.js b/app/controllers/events/view/export.js index ea7044550a1..d131897563d 100644 --- a/app/controllers/events/view/export.js +++ b/app/controllers/events/view/export.js @@ -12,26 +12,26 @@ export default Controller.extend({ }, requestLoop(exportJobInfo) { run.later(() => { - this.get('loader') + this.loader .load(exportJobInfo.task_url, { withoutPrefix: true }) .then(exportJobStatus => { if (exportJobStatus.state === 'SUCCESS') { this.set('isDownloadDisabled', false); this.set('eventDownloadUrl', exportJobStatus.result.download_url); this.set('eventExportStatus', exportJobStatus.state); - this.get('notify').success(this.get('l10n').t('Event exported.')); + this.notify.success(this.l10n.t('Event exported.')); } else if (exportJobStatus.state === 'WAITING') { this.requestLoop(exportJobInfo); this.set('eventExportStatus', exportJobStatus.state); - this.get('notify').alert(this.get('l10n').t('Event export is going on.')); + this.notify.alert(this.l10n.t('Event export is going on.')); } else { this.set('eventExportStatus', exportJobStatus.state); - this.get('notify').error(this.get('l10n').t('Event export failed.')); + this.notify.error(this.l10n.t('Event export failed.')); } }) .catch(() => { this.set('eventExportStatus', 'FAILURE'); - this.get('notify').error(this.get('l10n').t('Event export failed.')); + this.notify.error(this.l10n.t('Event export failed.')); }) .finally(() => { this.set('isLoading', false); @@ -41,15 +41,15 @@ export default Controller.extend({ actions: { startGeneration() { this.set('isLoading', true); - let payload = this.get('data'); - this.get('loader') + let payload = this.data; + this.loader .post(`/events/${this.get('model.id')}/export/json`, payload) .then(exportJobInfo => { this.requestLoop(exportJobInfo); }) .catch(() => { this.set('isLoading', false); - this.get('notify').error(this.get('l10n').t('Unexpected error occurred.')); + this.notify.error(this.l10n.t('Unexpected error occurred.')); }); } } diff --git a/app/controllers/events/view/index.js b/app/controllers/events/view/index.js index 715248254e9..849d382b4a9 100644 --- a/app/controllers/events/view/index.js +++ b/app/controllers/events/view/index.js @@ -34,11 +34,11 @@ export default Controller.extend({ this.set('isLoading', true); sponsor.destroyRecord() .then(() => { - this.notify.success(this.get('l10n').t('Sponsor has been deleted successfully.')); + this.notify.success(this.l10n.t('Sponsor has been deleted successfully.')); this.get('model.sponsors').removeObject(sponsor); }) .catch(() => { - this.notify.error(this.get('l10n').t('An unexpected error has occurred.')); + this.notify.error(this.l10n.t('An unexpected error has occurred.')); }) .finally(() => { this.set('isLoading', false); diff --git a/app/controllers/events/view/scheduler.js b/app/controllers/events/view/scheduler.js index ceccf45e68b..2d6a2f435a5 100644 --- a/app/controllers/events/view/scheduler.js +++ b/app/controllers/events/view/scheduler.js @@ -46,20 +46,20 @@ export default Controller.extend({ let config = { skipDataTransform: true }; - return this.get('loader') + return this.loader .patch(`sessions/${sessionId}`, JSON.stringify(payload), config) .then(() => { - this.get('notify').success('Changes have been made successfully'); + this.notify.success('Changes have been made successfully'); }) .catch(reason => { this.set('error', reason); - this.get('notify').error(`Error: ${reason}`); + this.notify.error(`Error: ${reason}`); }); }, unscheduleSession(session) { $('.full-calendar').fullCalendar('removeEvents', session._id); this.updateSession(null, null, session.resourceId, session.serverId); - this.get('target').send('refresh'); + this.target.send('refresh'); }, actions: { @@ -85,18 +85,17 @@ export default Controller.extend({ }, togglePublishState() { this.set('isLoading', true); - let isSchedulePublished = this.get('isSchedulePublished'); - let action = isSchedulePublished ? 'unpublished' : 'published'; - let publishedAt = isSchedulePublished ? moment(0) : moment(); + let action = this.isSchedulePublished ? 'unpublished' : 'published'; + let publishedAt = this.isSchedulePublished ? moment(0) : moment(); let event = this.get('model.eventDetails'); event.set('schedulePublishedOn', publishedAt); event.save() .then(() => { - this.get('notify').success(`The schedule has been ${action} successfully`); + this.notify.success(`The schedule has been ${action} successfully`); }) .catch(reason => { this.set('error', reason); - this.get('notify').error(`Error: ${reason}`); + this.notify.error(`Error: ${reason}`); }) .finally(() => { this.set('isLoading', false); diff --git a/app/controllers/events/view/sessions.js b/app/controllers/events/view/sessions.js index 06c2509deda..f9b4b67a5ad 100644 --- a/app/controllers/events/view/sessions.js +++ b/app/controllers/events/view/sessions.js @@ -14,35 +14,35 @@ export default Controller.extend({ actions: { export() { this.set('isLoading', true); - this.get('loader') + this.loader .load(`/events/${this.get('model.id')}/export/sessions/csv`) .then(exportJobInfo => { this.requestLoop(exportJobInfo); }) .catch(() => { this.set('isLoading', false); - this.get('notify').error(this.get('l10n').t('An unexpected error has occurred.')); + this.notify.error(this.l10n.t('An unexpected error has occurred.')); }); } }, requestLoop(exportJobInfo) { run.later(() => { - this.get('loader') + this.loader .load(exportJobInfo.task_url, { withoutPrefix: true }) .then(exportJobStatus => { if (exportJobStatus.state === 'SUCCESS') { window.location = exportJobStatus.result.download_url; - this.get('notify').success(this.get('l10n').t('Download Ready')); + this.notify.success(this.l10n.t('Download Ready')); } else if (exportJobStatus.state === 'WAITING') { this.requestLoop(exportJobInfo); - this.get('notify').alert(this.get('l10n').t('Task is going on.')); + this.notify.alert(this.l10n.t('Task is going on.')); } else { - this.get('notify').error(this.get('l10n').t('CSV Export has failed.')); + this.notify.error(this.l10n.t('CSV Export has failed.')); } }) .catch(() => { - this.get('notify').error(this.get('l10n').t('CSV Export has failed.')); + this.notify.error(this.l10n.t('CSV Export has failed.')); }) .finally(() => { this.set('isLoading', false); diff --git a/app/controllers/events/view/sessions/create.js b/app/controllers/events/view/sessions/create.js index 1aa12cf1fd1..36d003cf2e5 100644 --- a/app/controllers/events/view/sessions/create.js +++ b/app/controllers/events/view/sessions/create.js @@ -2,9 +2,9 @@ import Controller from '@ember/controller'; export default Controller.extend({ actions: { async save() { - var _this = this; + let _this = this; await this.get('model.session').save(); - if (this.get('addNewSpeaker')) { + if (this.addNewSpeaker) { let newSpeaker = this.get('model.speaker'); newSpeaker.save() .then(() => { @@ -15,14 +15,14 @@ export default Controller.extend({ _this.transitionToRoute('events.view.sessions', _this.get('model.event.id')); }) .catch(() => { - _this.get('notify').error(this.get('l10n').t('Oops something went wrong. Please try again')); + _this.get('notify').error(this.l10n.t('Oops something went wrong. Please try again')); }) .finally(() => { _this.set('isLoading', false); }); }) .catch(() => { - this.get('notify').error(this.get('l10n').t('Oops something went wrong. Please try again')); + this.notify.error(this.l10n.t('Oops something went wrong. Please try again')); }) .finally(() => { this.set('isLoading', false); @@ -30,11 +30,11 @@ export default Controller.extend({ } else { this.get('model.session').save() .then(() => { - this.get('notify').success(this.get('l10n').t('Your session has been saved')); + this.notify.success(this.l10n.t('Your session has been saved')); this.transitionToRoute('events.view.sessions', this.get('model.event.id')); }) .catch(() => { - this.get('notify').error(this.get('l10n').t('Oops something went wrong. Please try again')); + this.notify.error(this.l10n.t('Oops something went wrong. Please try again')); }) .finally(() => { this.set('isLoading', false); diff --git a/app/controllers/events/view/sessions/edit.js b/app/controllers/events/view/sessions/edit.js index 26518448289..0e784ae5a02 100644 --- a/app/controllers/events/view/sessions/edit.js +++ b/app/controllers/events/view/sessions/edit.js @@ -4,8 +4,8 @@ export default Controller.extend({ actions: { save() { this.set('isLoading', true); - var _this = this; - if (this.get('addNewSpeaker')) { + let _this = this; + if (this.addNewSpeaker) { let newSpeaker = this.get('model.speaker'); newSpeaker.save() .then(() => { @@ -16,14 +16,14 @@ export default Controller.extend({ _this.transitionToRoute('events.view.sessions', _this.get('model.event.id')); }) .catch(() => { - _this.get('notify').error(this.get('l10n').t('Oops something went wrong. Please try again')); + _this.get('notify').error(this.l10n.t('Oops something went wrong. Please try again')); }) .finally(() => { _this.set('isLoading', false); }); }) .catch(() => { - this.get('notify').error(this.get('l10n').t('Oops something went wrong. Please try again')); + this.notify.error(this.l10n.t('Oops something went wrong. Please try again')); }) .finally(() => { this.set('isLoading', false); @@ -32,11 +32,11 @@ export default Controller.extend({ this.get('model.speaker').deleteRecord(); this.get('model.session').save() .then(() => { - this.get('notify').success(this.get('l10n').t('Your session has been saved')); + this.notify.success(this.l10n.t('Your session has been saved')); this.transitionToRoute('events.view.sessions', this.get('model.event.id')); }) .catch(() => { - this.get('notify').error(this.get('l10n').t('Oops something went wrong. Please try again')); + this.notify.error(this.l10n.t('Oops something went wrong. Please try again')); }) .finally(() => { this.set('isLoading', false); diff --git a/app/controllers/events/view/sessions/list.js b/app/controllers/events/view/sessions/list.js index 5069670f296..7fc09b442ef 100644 --- a/app/controllers/events/view/sessions/list.js +++ b/app/controllers/events/view/sessions/list.js @@ -63,10 +63,10 @@ export default Controller.extend({ this.set('isLoading', true); session.destroyRecord() .then(() => { - this.notify.success(this.get('l10n').t('Session has been deleted successfully.')); + this.notify.success(this.l10n.t('Session has been deleted successfully.')); }) .catch(() => { - this.notify.error(this.get('l10n').t('An unexpected error has occurred.')); + this.notify.error(this.l10n.t('An unexpected error has occurred.')); }) .finally(() => { this.set('isLoading', false); @@ -115,12 +115,12 @@ export default Controller.extend({ this.set('isLoading', true); session.save() .then(() => { - sendEmail ? this.notify.success(this.get('l10n').t('Session has been accepted and speaker has been notified via email.')) - : this.notify.success(this.get('l10n').t('Session has been accepted')); + sendEmail ? this.notify.success(this.l10n.t('Session has been accepted and speaker has been notified via email.')) + : this.notify.success(this.l10n.t('Session has been accepted')); this.send('refreshRoute'); }) .catch(() => { - this.notify.error(this.get('l10n').t('An unexpected error has occurred.')); + this.notify.error(this.l10n.t('An unexpected error has occurred.')); }) .finally(() => { this.set('isLoading', false); @@ -133,12 +133,12 @@ export default Controller.extend({ this.set('isLoading', true); session.save() .then(() => { - sendEmail ? this.notify.success(this.get('l10n').t('Session has been confirmed and speaker has been notified via email.')) - : this.notify.success(this.get('l10n').t('Session has been confirmed')); + sendEmail ? this.notify.success(this.l10n.t('Session has been confirmed and speaker has been notified via email.')) + : this.notify.success(this.l10n.t('Session has been confirmed')); this.send('refreshRoute'); }) .catch(() => { - this.notify.error(this.get('l10n').t('An unexpected error has occurred.')); + this.notify.error(this.l10n.t('An unexpected error has occurred.')); }) .finally(() => { this.set('isLoading', false); @@ -151,12 +151,12 @@ export default Controller.extend({ this.set('isLoading', true); session.save() .then(() => { - sendEmail ? this.notify.success(this.get('l10n').t('Session has been rejected and speaker has been notified via email.')) - : this.notify.success(this.get('l10n').t('Session has been rejected')); + sendEmail ? this.notify.success(this.l10n.t('Session has been rejected and speaker has been notified via email.')) + : this.notify.success(this.l10n.t('Session has been rejected')); this.send('refreshRoute'); }) .catch(() => { - this.notify.error(this.get('l10n').t('An unexpected error has occurred.')); + this.notify.error(this.l10n.t('An unexpected error has occurred.')); }) .finally(() => { this.set('isLoading', false); diff --git a/app/controllers/events/view/speakers.js b/app/controllers/events/view/speakers.js index 4fb463941bc..9f5a61d691c 100644 --- a/app/controllers/events/view/speakers.js +++ b/app/controllers/events/view/speakers.js @@ -8,35 +8,35 @@ export default Controller.extend({ actions: { export() { this.set('isLoading', true); - this.get('loader') + this.loader .load(`/events/${this.get('model.id')}/export/speakers/csv`) .then(exportJobInfo => { this.requestLoop(exportJobInfo); }) .catch(() => { this.set('isLoading', false); - this.get('notify').error(this.get('l10n').t('An unexpected error has occurred.')); + this.notify.error(this.l10n.t('An unexpected error has occurred.')); }); } }, requestLoop(exportJobInfo) { run.later(() => { - this.get('loader') + this.loader .load(exportJobInfo.task_url, { withoutPrefix: true }) .then(exportJobStatus => { if (exportJobStatus.state === 'SUCCESS') { window.location = exportJobStatus.result.download_url; - this.get('notify').success(this.get('l10n').t('Download Ready')); + this.notify.success(this.l10n.t('Download Ready')); } else if (exportJobStatus.state === 'WAITING') { this.requestLoop(exportJobInfo); - this.get('notify').alert(this.get('l10n').t('Task is going on.')); + this.notify.alert(this.l10n.t('Task is going on.')); } else { - this.get('notify').error(this.get('l10n').t('CSV Export has failed.')); + this.notify.error(this.l10n.t('CSV Export has failed.')); } }) .catch(() => { - this.get('notify').error(this.get('l10n').t('CSV Export has failed.')); + this.notify.error(this.l10n.t('CSV Export has failed.')); }) .finally(() => { this.set('isLoading', false); diff --git a/app/controllers/events/view/speakers/create.js b/app/controllers/events/view/speakers/create.js index 3d8539034a8..a21cbe96e8d 100644 --- a/app/controllers/events/view/speakers/create.js +++ b/app/controllers/events/view/speakers/create.js @@ -15,10 +15,10 @@ export default Controller.extend({ this.get('model.speaker.sessions').pushObject(sessionDetails); } await this.get('model.speaker').save(); - this.get('notify').success(this.get('l10n').t('Your session has been saved')); + this.notify.success(this.l10n.t('Your session has been saved')); this.transitionToRoute('events.view.speakers', this.get('model.event.id')); } catch (e) { - this.get('notify').error(this.get('l10n').t('Oops something went wrong. Please try again')); + this.notify.error(this.l10n.t('Oops something went wrong. Please try again')); } } } diff --git a/app/controllers/events/view/speakers/edit.js b/app/controllers/events/view/speakers/edit.js index 4ea1d6c3958..96d6a5f6ebe 100644 --- a/app/controllers/events/view/speakers/edit.js +++ b/app/controllers/events/view/speakers/edit.js @@ -6,11 +6,11 @@ export default Controller.extend({ this.set('isLoading', true); this.get('model.speaker').save() .then(() => { - this.get('notify').success(this.get('l10n').t('Speaker details have been saved')); + this.notify.success(this.l10n.t('Speaker details have been saved')); this.transitionToRoute('events.view.speakers'); }) .catch(() => { - this.get('notify').error(this.get('l10n').t('Oops something went wrong. Please try again')); + this.notify.error(this.l10n.t('Oops something went wrong. Please try again')); }) .finally(() => { this.set('isLoading', false); diff --git a/app/controllers/events/view/speakers/list.js b/app/controllers/events/view/speakers/list.js index 6cf4f35e166..10d651addfe 100644 --- a/app/controllers/events/view/speakers/list.js +++ b/app/controllers/events/view/speakers/list.js @@ -44,10 +44,10 @@ export default Controller.extend({ this.set('isLoading', true); speaker.destroyRecord() .then(() => { - this.notify.success(this.get('l10n').t('Speaker has been deleted successfully.')); + this.notify.success(this.l10n.t('Speaker has been deleted successfully.')); }) .catch(e => { - this.notify.error(this.get('l10n').t('An unexpected error has occurred.')); + this.notify.error(this.l10n.t('An unexpected error has occurred.')); console.warn(e); }) .finally(() => { @@ -64,10 +64,10 @@ export default Controller.extend({ speaker.toggleProperty('isFeatured'); speaker.save() .then(() => { - this.notify.success(this.get('l10n').t('Speaker details modified successfully')); + this.notify.success(this.l10n.t('Speaker details modified successfully')); }) .catch(() => { - this.notify.error(this.get('l10n').t('An unexpected error has occurred.')); + this.notify.error(this.l10n.t('An unexpected error has occurred.')); }); } } diff --git a/app/controllers/events/view/tickets/access-codes/create.js b/app/controllers/events/view/tickets/access-codes/create.js index 62996d6d1dd..2d2720933e4 100644 --- a/app/controllers/events/view/tickets/access-codes/create.js +++ b/app/controllers/events/view/tickets/access-codes/create.js @@ -5,11 +5,11 @@ export default Controller.extend({ save(accessCode) { accessCode.save() .then(() => { - this.get('notify').success(this.get('l10n').t('Access code has been successfully created.')); + this.notify.success(this.l10n.t('Access code has been successfully created.')); this.transitionToRoute('events.view.tickets.access-codes'); }) .catch(() => { - this.get('notify').error(this.get('l10n').t('An unexpected error has occured. Access code cannot be created.')); + this.notify.error(this.l10n.t('An unexpected error has occured. Access code cannot be created.')); }); } } diff --git a/app/controllers/events/view/tickets/access-codes/edit.js b/app/controllers/events/view/tickets/access-codes/edit.js index d0efd7d5848..6ed026bdf7b 100644 --- a/app/controllers/events/view/tickets/access-codes/edit.js +++ b/app/controllers/events/view/tickets/access-codes/edit.js @@ -5,11 +5,11 @@ export default Controller.extend({ save(accessCode) { accessCode.save() .then(() => { - this.get('notify').success(this.get('l10n').t('Access code has been successfully updated.')); + this.notify.success(this.l10n.t('Access code has been successfully updated.')); this.transitionToRoute('events.view.tickets.access-codes'); }) .catch(() => { - this.get('notify').error(this.get('l10n').t('An unexpected error has occured. Access code cannot be created.')); + this.notify.error(this.l10n.t('An unexpected error has occured. Access code cannot be created.')); }); } } diff --git a/app/controllers/events/view/tickets/access-codes/list.js b/app/controllers/events/view/tickets/access-codes/list.js index 3bf479b4141..74a4465b43e 100644 --- a/app/controllers/events/view/tickets/access-codes/list.js +++ b/app/controllers/events/view/tickets/access-codes/list.js @@ -35,11 +35,11 @@ export default Controller.extend({ this.set('isLoading', true); accessCode.destroyRecord() .then(() => { - this.get('model').reload(); - this.notify.success(this.get('l10n').t('Access Code has been deleted successfully.')); + this.model.reload(); + this.notify.success(this.l10n.t('Access Code has been deleted successfully.')); }) .catch(() => { - this.notify.error(this.get('l10n').t('An unexpected error has occurred.')); + this.notify.error(this.l10n.t('An unexpected error has occurred.')); }) .finally(() => { this.set('isLoading', false); @@ -50,11 +50,11 @@ export default Controller.extend({ accessCode.toggleProperty('isActive'); accessCode.save() .then(() => { - this.notify.success(this.get('l10n').t('Access Code has been updated successfully.')); + this.notify.success(this.l10n.t('Access Code has been updated successfully.')); this.send('refreshRoute'); }) .catch(() => { - this.notify.error(this.get('l10n').t('An unexpected error has occurred.')); + this.notify.error(this.l10n.t('An unexpected error has occurred.')); }) .finally(() => { this.set('isLoading', false); diff --git a/app/controllers/events/view/tickets/add-order.js b/app/controllers/events/view/tickets/add-order.js index 727401805ef..0d839cbbc12 100644 --- a/app/controllers/events/view/tickets/add-order.js +++ b/app/controllers/events/view/tickets/add-order.js @@ -1,6 +1,6 @@ import Controller from '@ember/controller'; import { computed } from '@ember/object'; -import { sumBy } from 'lodash'; +import { sumBy } from 'lodash-es'; export default Controller.extend({ hasTicketsInOrder: computed('model.tickets.@each.orderQuantity', function() { @@ -41,8 +41,8 @@ export default Controller.extend({ updateOrder(ticket, count) { let order = this.get('model.order'); ticket.set('orderQuantity', count); - order.set('amount', this.get('total')); - if (!this.get('total')) { + order.set('amount', this.total); + if (!this.total) { order.set('amount', 0); } if (count > 0) { @@ -78,20 +78,20 @@ export default Controller.extend({ order.set('attendees', attendees.slice()); await order.save() .then(order => { - this.get('notify').success(this.get('l10n').t('Order details saved. Please fill further details within 10 minutes.')); + this.notify.success(this.l10n.t('Order details saved. Please fill further details within 10 minutes.')); this.transitionToRoute('orders.new', order.identifier); }) .catch(async() => { for (const attendee of attendees ? attendees.toArray() : []) { await attendee.destroyRecord(); } - this.get('notify').error(this.get('l10n').t('Oops something went wrong. Please try again')); + this.notify.error(this.l10n.t('Oops something went wrong. Please try again')); }) .finally(() => { this.set('isLoading', false); }); } catch (e) { - this.get('notify').error(this.get('l10n').t('Oops something went wrong. Please try again')); + this.notify.error(this.l10n.t('Oops something went wrong. Please try again')); } } } diff --git a/app/controllers/events/view/tickets/attendees.js b/app/controllers/events/view/tickets/attendees.js index 94d39f3c65a..bb9df14c266 100644 --- a/app/controllers/events/view/tickets/attendees.js +++ b/app/controllers/events/view/tickets/attendees.js @@ -9,34 +9,34 @@ export default Controller.extend({ actions: { export(mode) { this.set(`isLoading${mode}`, true); - this.get('loader') + this.loader .load(`/events/${this.get('model.id')}/export/attendees/${mode}`) .then(exportJobInfo => { this.requestLoop(exportJobInfo, mode); }) .catch(() => { this.set(`isLoading${mode}`, false); - this.get('notify').error(this.get('l10n').t('An unexpected error has occurred.')); + this.notify.error(this.l10n.t('An unexpected error has occurred.')); }); } }, requestLoop(exportJobInfo, mode) { run.later(() => { - this.get('loader') + this.loader .load(exportJobInfo.task_url, { withoutPrefix: true }) .then(exportJobStatus => { if (exportJobStatus.state === 'SUCCESS') { window.location = exportJobStatus.result.download_url; - this.get('notify').success(this.get('l10n').t('Download Ready')); + this.notify.success(this.l10n.t('Download Ready')); } else if (exportJobStatus.state === 'WAITING') { this.requestLoop(exportJobInfo); - this.get('notify').alert(this.get('l10n').t('Task is going on.')); + this.notify.alert(this.l10n.t('Task is going on.')); } else { - this.get('notify').error(this.get('l10n').t(`${mode.toUpperCase()} Export has failed.`)); + this.notify.error(this.l10n.t(`${mode.toUpperCase()} Export has failed.`)); } }) .catch(() => { - this.get('notify').error(this.get('l10n').t(`${mode.toUpperCase()} Export has failed.`)); + this.notify.error(this.l10n.t(`${mode.toUpperCase()} Export has failed.`)); }) .finally(() => { this.set('isLoading', false); diff --git a/app/controllers/events/view/tickets/attendees/list.js b/app/controllers/events/view/tickets/attendees/list.js index 3056881d6f1..55071259b9c 100644 --- a/app/controllers/events/view/tickets/attendees/list.js +++ b/app/controllers/events/view/tickets/attendees/list.js @@ -44,11 +44,11 @@ export default Controller.extend({ } attendee.save() .then(savedAttendee => { - this.notify.success(this.get('l10n').t(`Attendee ${savedAttendee.isCheckedIn ? 'Checked-In' : 'Checked-Out'} Successfully`)); + this.notify.success(this.l10n.t(`Attendee ${savedAttendee.isCheckedIn ? 'Checked-In' : 'Checked-Out'} Successfully`)); this.send('refreshRoute'); }) .catch(() => { - this.notify.error(this.get('l10n').t('An unexpected error has occurred')); + this.notify.error(this.l10n.t('An unexpected error has occurred')); }); } } diff --git a/app/controllers/events/view/tickets/discount-codes/create.js b/app/controllers/events/view/tickets/discount-codes/create.js index 08659daf472..40ef9ed8cc5 100644 --- a/app/controllers/events/view/tickets/discount-codes/create.js +++ b/app/controllers/events/view/tickets/discount-codes/create.js @@ -5,11 +5,11 @@ export default Controller.extend({ saveCode(discountCode) { discountCode.save() .then(() => { - this.get('notify').success(this.get('l10n').t('Discount code has been successfully created.')); + this.notify.success(this.l10n.t('Discount code has been successfully created.')); this.transitionToRoute('events.view.tickets.discount-codes'); }) .catch(() => { - this.get('notify').error(this.get('l10n').t('An unexpected error has occured. Discount code cannot be created.')); + this.notify.error(this.l10n.t('An unexpected error has occured. Discount code cannot be created.')); }); } } diff --git a/app/controllers/events/view/tickets/discount-codes/edit.js b/app/controllers/events/view/tickets/discount-codes/edit.js index b7d446e18b0..dd1db98e00b 100644 --- a/app/controllers/events/view/tickets/discount-codes/edit.js +++ b/app/controllers/events/view/tickets/discount-codes/edit.js @@ -5,11 +5,11 @@ export default Controller.extend({ saveCode(discountCode) { discountCode.save() .then(() => { - this.get('notify').success(this.get('l10n').t('Discount code has been successfully updated.')); + this.notify.success(this.l10n.t('Discount code has been successfully updated.')); this.transitionToRoute('events.view.tickets.discount-codes'); }) .catch(() => { - this.get('notify').error(this.get('l10n').t('An unexpected error has occurred. Discount code cannot be updated.')); + this.notify.error(this.l10n.t('An unexpected error has occurred. Discount code cannot be updated.')); }); } } diff --git a/app/controllers/events/view/tickets/discount-codes/list.js b/app/controllers/events/view/tickets/discount-codes/list.js index 22d37c1b7f1..cc398aca241 100644 --- a/app/controllers/events/view/tickets/discount-codes/list.js +++ b/app/controllers/events/view/tickets/discount-codes/list.js @@ -39,11 +39,11 @@ export default Controller.extend({ this.set('isLoading', true); discountCode.destroyRecord() .then(() => { - this.get('model').reload(); - this.notify.success(this.get('l10n').t('Discount Code has been deleted successfully.')); + this.model.reload(); + this.notify.success(this.l10n.t('Discount Code has been deleted successfully.')); }) .catch(() => { - this.notify.error(this.get('l10n').t('An unexpected error has occurred.')); + this.notify.error(this.l10n.t('An unexpected error has occurred.')); }) .finally(() => { this.set('isLoading', false); @@ -54,12 +54,12 @@ export default Controller.extend({ discountCode.toggleProperty('isActive'); discountCode.save() .then(() => { - this.notify.success(this.get('l10n').t('Discount Code has been updated successfully.')); + this.notify.success(this.l10n.t('Discount Code has been updated successfully.')); this.send('refreshRoute'); }) .catch(() => { discountCode.toggleProperty('isActive'); - this.notify.error(this.get('l10n').t('An unexpected error has occurred.')); + this.notify.error(this.l10n.t('An unexpected error has occurred.')); }) .finally(() => { this.set('isLoading', false); diff --git a/app/controllers/events/view/tickets/order-form.js b/app/controllers/events/view/tickets/order-form.js index 2016c011ea2..a0450ad684e 100644 --- a/app/controllers/events/view/tickets/order-form.js +++ b/app/controllers/events/view/tickets/order-form.js @@ -17,11 +17,11 @@ export default Controller.extend({ this.set('isLoading', true); this.saveForms(data) .then(() => { - this.get('notify').success(this.get('l10n').t('Your Attendee form has been saved')); + this.notify.success(this.l10n.t('Your Attendee form has been saved')); }) .catch(e => { console.error(e); - this.get('notify').error(this.get('l10n').t(e.errors[0].detail)); + this.notify.error(this.l10n.t(e.errors[0].detail)); }) .finally(() => { this.set('isLoading', false); diff --git a/app/controllers/events/view/tickets/orders.js b/app/controllers/events/view/tickets/orders.js index c582700019c..6493f8bc954 100644 --- a/app/controllers/events/view/tickets/orders.js +++ b/app/controllers/events/view/tickets/orders.js @@ -9,34 +9,34 @@ export default Controller.extend({ actions: { export(mode) { this.set(`isLoading${mode}`, true); - this.get('loader') + this.loader .load(`/events/${this.get('model.id')}/export/orders/${mode}`) .then(exportJobInfo => { this.requestLoop(exportJobInfo, mode); }) .catch(() => { this.set(`isLoading${mode}`, false); - this.get('notify').error(this.get('l10n').t('An unexpected error has occurred.')); + this.notify.error(this.l10n.t('An unexpected error has occurred.')); }); } }, requestLoop(exportJobInfo, mode) { run.later(() => { - this.get('loader') + this.loader .load(exportJobInfo.task_url, { withoutPrefix: true }) .then(exportJobStatus => { if (exportJobStatus.state === 'SUCCESS') { window.location = exportJobStatus.result.download_url; - this.get('notify').success(this.get('l10n').t('Download Ready')); + this.notify.success(this.l10n.t('Download Ready')); } else if (exportJobStatus.state === 'WAITING') { this.requestLoop(exportJobInfo); - this.get('notify').alert(this.get('l10n').t('Task is going on.')); + this.notify.alert(this.l10n.t('Task is going on.')); } else { - this.get('notify').error(this.get('l10n').t(`${mode.toUpperCase()} Export has failed.`)); + this.notify.error(this.l10n.t(`${mode.toUpperCase()} Export has failed.`)); } }) .catch(() => { - this.get('notify').error(this.get('l10n').t(`${mode.toUpperCase()} Export has failed.`)); + this.notify.error(this.l10n.t(`${mode.toUpperCase()} Export has failed.`)); }) .finally(() => { this.set('isLoading', false); diff --git a/app/controllers/events/view/tickets/orders/list.js b/app/controllers/events/view/tickets/orders/list.js index f758a90fe4a..bcdfe3c1901 100644 --- a/app/controllers/events/view/tickets/orders/list.js +++ b/app/controllers/events/view/tickets/orders/list.js @@ -37,10 +37,10 @@ export default Controller.extend({ order.save() .then(() => { this.send('refreshRoute'); - this.notify.success(this.get('l10n').t('Order has been marked completed successfully.')); + this.notify.success(this.l10n.t('Order has been marked completed successfully.')); }) .catch(() => { - this.notify.error(this.get('l10n').t('An unexpected error has occurred.')); + this.notify.error(this.l10n.t('An unexpected error has occurred.')); }) .finally(() => { this.set('isLoading', false); @@ -51,10 +51,10 @@ export default Controller.extend({ order.destroyRecord() .then(() => { this.send('refreshRoute'); - this.notify.success(this.get('l10n').t('Order has been deleted successfully.')); + this.notify.success(this.l10n.t('Order has been deleted successfully.')); }) .catch(() => { - this.notify.error(this.get('l10n').t('An unexpected error has occurred.')); + this.notify.error(this.l10n.t('An unexpected error has occurred.')); }) .finally(() => { this.set('isLoading', false); @@ -66,10 +66,10 @@ export default Controller.extend({ order.save() .then(() => { this.send('refreshRoute'); - this.notify.success(this.get('l10n').t('Order has been cancelled successfully.')); + this.notify.success(this.l10n.t('Order has been cancelled successfully.')); }) .catch(() => { - this.notify.error(this.get('l10n').t('An unexpected error has occurred.')); + this.notify.error(this.l10n.t('An unexpected error has occurred.')); }) .finally(() => { this.set('isLoading', false); diff --git a/app/controllers/index.js b/app/controllers/index.js index 1971a04f859..ad8d2a6446c 100644 --- a/app/controllers/index.js +++ b/app/controllers/index.js @@ -11,7 +11,7 @@ export default Controller.extend({ filterDate : null, callForSpeakersEvents: computed('filteredEvents.[]', function() { - return this.get('filteredEvents').filter(event => { + return this.filteredEvents.filter(event => { const callForPapers = event.get('speakersCall'); const sessionEnabled = event.isSessionsSpeakersEnabled; if (!callForPapers || !callForPapers.get('startsAt') || !callForPapers.get('endsAt')) { diff --git a/app/controllers/my-sessions/view.js b/app/controllers/my-sessions/view.js index 37db1203dd7..2d6b24793d7 100644 --- a/app/controllers/my-sessions/view.js +++ b/app/controllers/my-sessions/view.js @@ -17,13 +17,13 @@ export default Controller.extend({ }, deleteProposal() { this.set('isLoading', true); - this.get('model').destroyRecord() + this.model.destroyRecord() .then(() => { this.transitionToRoute('my-sessions.index'); - this.notify.success(this.get('l10n').t('Proposal has been deleted successfully.')); + this.notify.success(this.l10n.t('Proposal has been deleted successfully.')); }) .catch(() => { - this.notify.error(this.get('l10n').t('An unexpected error has occurred.')); + this.notify.error(this.l10n.t('An unexpected error has occurred.')); }) .finally(() => { this.set('isLoading', false); diff --git a/app/controllers/notifications.js b/app/controllers/notifications.js index 2bd83999a53..d22f8b7e397 100644 --- a/app/controllers/notifications.js +++ b/app/controllers/notifications.js @@ -11,10 +11,10 @@ export default Controller.extend({ item.save(); } }); - this.get('notify').success(this.get('l10n').t('All notifications marked read successfully')); + this.notify.success(this.l10n.t('All notifications marked read successfully')); }) .catch(() => { - this.get('notify').error(this.get('l10n').t('An unexpected error occurred.')); + this.notify.error(this.l10n.t('An unexpected error occurred.')); }); } } diff --git a/app/controllers/oauth/callback.js b/app/controllers/oauth/callback.js index fd5dcb47413..0657410013d 100644 --- a/app/controllers/oauth/callback.js +++ b/app/controllers/oauth/callback.js @@ -2,7 +2,7 @@ import Controller from '@ember/controller'; export default Controller.extend({ oauth(queryParams) { - this.get('loader').post(`/auth/oauth/login/${ queryParams.provider }?code=${ queryParams.code }`) + this.loader.post(`/auth/oauth/login/${ queryParams.provider }?code=${ queryParams.code }`) .then(response => { let credentials = { identification : response.email, @@ -10,23 +10,23 @@ export default Controller.extend({ }, authenticator = 'authenticator:jwt'; - this.get('session') + this.session .authenticate(authenticator, credentials) .then(async() => { - const tokenPayload = this.get('authManager').getTokenPayload(); + const tokenPayload = this.authManager.getTokenPayload(); if (tokenPayload) { - this.get('authManager').persistCurrentUser( - await this.get('store').findRecord('user', tokenPayload.identity) + this.authManager.persistCurrentUser( + await this.store.findRecord('user', tokenPayload.identity) ); } this.transitionToRoute('/'); }) .catch(reason => { - if (!(this.get('isDestroyed') || this.get('isDestroying'))) { + if (!(this.isDestroyed || this.isDestroying)) { if (reason && reason.hasOwnProperty('status_code') && reason.status_code === 401) { - this.set('errorMessage', this.get('l10n').t('Your credentials were incorrect.')); + this.set('errorMessage', this.l10n.t('Your credentials were incorrect.')); } else { - this.set('errorMessage', this.get('l10n').t('An unexpected error occurred.')); + this.set('errorMessage', this.l10n.t('An unexpected error occurred.')); } this.set('isLoading', false); } else { @@ -34,7 +34,7 @@ export default Controller.extend({ } }) .finally(() => { - if (!(this.get('isDestroyed') || this.get('isDestroying'))) { + if (!(this.isDestroyed || this.isDestroying)) { this.set('password', ''); } }); diff --git a/app/controllers/orders/new.js b/app/controllers/orders/new.js index 5e35140b3f6..282a02d5734 100644 --- a/app/controllers/orders/new.js +++ b/app/controllers/orders/new.js @@ -25,22 +25,22 @@ export default Controller.extend({ await order.save() .then(order => { if (order.status === 'pending') { - this.get('notify').success(this.get('l10n').t('Order details saved. Please fill the payment details')); + this.notify.success(this.l10n.t('Order details saved. Please fill the payment details')); this.transitionToRoute('orders.pending', order.identifier); } else if (order.status === 'completed' || order.status === 'placed') { - this.get('notify').success(this.get('l10n').t('Order details saved. Your order is successful')); + this.notify.success(this.l10n.t('Order details saved. Your order is successful')); this.transitionToRoute('orders.view', order.identifier); } }) .catch(e => { order.set('status', 'initializing'); - this.get('notify').error(this.get('l10n').t(` ${e} Oops something went wrong. Please try again`)); + this.notify.error(this.l10n.t(` ${e} Oops something went wrong. Please try again`)); }) .finally(() => { this.set('isLoading', false); }); } catch (e) { - this.get('notify').error(this.get('l10n').t('Oops something went wrong. Please try again')); + this.notify.error(this.l10n.t('Oops something went wrong. Please try again')); } } } diff --git a/app/controllers/orders/pending.js b/app/controllers/orders/pending.js index 6f95ed7111a..1d09f2a2768 100644 --- a/app/controllers/orders/pending.js +++ b/app/controllers/orders/pending.js @@ -35,13 +35,13 @@ export default Controller.extend({ skipDataTransform: true }; chargePayload = JSON.stringify(chargePayload); - return this.get('loader').post(`orders/${order.identifier}/charge`, chargePayload, config) + return this.loader.post(`orders/${order.identifier}/charge`, chargePayload, config) .then(charge => { if (charge.data.attributes.status) { - this.get('notify').success(charge.data.attributes.message); + this.notify.success(charge.data.attributes.message); this.transitionToRoute('orders.view', order.identifier); } else { - this.get('notify').error(charge.data.attributes.message); + this.notify.error(charge.data.attributes.message); } }); }, diff --git a/app/controllers/public/cfs/edit-session.js b/app/controllers/public/cfs/edit-session.js index cfb7a90767f..1cab8edf640 100644 --- a/app/controllers/public/cfs/edit-session.js +++ b/app/controllers/public/cfs/edit-session.js @@ -6,11 +6,11 @@ export default Controller.extend({ this.set('isLoading', true); this.get('model.session').save() .then(() => { - this.get('notify').success(this.get('l10n').t('Session details have been saved')); + this.notify.success(this.l10n.t('Session details have been saved')); this.transitionToRoute('public.cfs'); }) .catch(() => { - this.get('notify').error(this.get('l10n').t('Oops something went wrong. Please try again')); + this.notify.error(this.l10n.t('Oops something went wrong. Please try again')); }) .finally(() => { this.set('isLoading', false); diff --git a/app/controllers/public/cfs/edit-speaker.js b/app/controllers/public/cfs/edit-speaker.js index 58db7799967..bd24ff29f24 100644 --- a/app/controllers/public/cfs/edit-speaker.js +++ b/app/controllers/public/cfs/edit-speaker.js @@ -6,11 +6,11 @@ export default Controller.extend({ this.set('isLoading', true); this.get('model.speaker').save() .then(() => { - this.get('notify').success(this.get('l10n').t('Speaker details have been saved')); + this.notify.success(this.l10n.t('Speaker details have been saved')); this.transitionToRoute('public.cfs.index'); }) .catch(() => { - this.get('notify').error(this.get('l10n').t('Oops something went wrong. Please try again')); + this.notify.error(this.l10n.t('Oops something went wrong. Please try again')); }) .finally(() => { this.set('isLoading', false); diff --git a/app/controllers/public/cfs/new-session.js b/app/controllers/public/cfs/new-session.js index 4f5b925cbaf..d2953ffdd4a 100644 --- a/app/controllers/public/cfs/new-session.js +++ b/app/controllers/public/cfs/new-session.js @@ -7,10 +7,10 @@ export default Controller.extend({ await this.get('model.session').save(); speakerDetails.sessions.pushObject(this.get('model.session')); await this.get('model.session').save(); - this.get('notify').success(this.get('l10n').t('Your session has been saved')); + this.notify.success(this.l10n.t('Your session has been saved')); this.transitionToRoute('public.cfs.index'); } catch (e) { - this.get('notify').error(this.get('l10n').t('Oops something went wrong. Please try again')); + this.notify.error(this.l10n.t('Oops something went wrong. Please try again')); } } } diff --git a/app/controllers/public/cfs/new-speaker.js b/app/controllers/public/cfs/new-speaker.js index 58db7799967..bd24ff29f24 100644 --- a/app/controllers/public/cfs/new-speaker.js +++ b/app/controllers/public/cfs/new-speaker.js @@ -6,11 +6,11 @@ export default Controller.extend({ this.set('isLoading', true); this.get('model.speaker').save() .then(() => { - this.get('notify').success(this.get('l10n').t('Speaker details have been saved')); + this.notify.success(this.l10n.t('Speaker details have been saved')); this.transitionToRoute('public.cfs.index'); }) .catch(() => { - this.get('notify').error(this.get('l10n').t('Oops something went wrong. Please try again')); + this.notify.error(this.l10n.t('Oops something went wrong. Please try again')); }) .finally(() => { this.set('isLoading', false); diff --git a/app/controllers/public/index.js b/app/controllers/public/index.js index 29430cb5e1d..5d69c5db55a 100644 --- a/app/controllers/public/index.js +++ b/app/controllers/public/index.js @@ -34,14 +34,14 @@ export default Controller.extend({ let credentials = newUser.getProperties('email', 'password'), authenticator = 'authenticator:jwt'; credentials.identification = newUser.email; - this.get('session') + this.session .authenticate(authenticator, credentials) .then(async() => { - const tokenPayload = this.get('authManager').getTokenPayload(); + const tokenPayload = this.authManager.getTokenPayload(); if (tokenPayload) { this.set('session.skipRedirectOnInvalidation', true); - this.get('authManager').persistCurrentUser( - await this.get('store').findRecord('user', tokenPayload.identity) + this.authManager.persistCurrentUser( + await this.store.findRecord('user', tokenPayload.identity) ); this.set('isLoginModalOpen', false); this.send('placeOrder'); @@ -59,7 +59,7 @@ export default Controller.extend({ if (error.errors[0].status === 409) { this.set('userExists', true); } else { - this.get('notify').error(this.get('l10n').t(error.errors[0].detail)); + this.notify.error(this.l10n.t(error.errors[0].detail)); } } }) @@ -76,25 +76,25 @@ export default Controller.extend({ password }; let authenticator = 'authenticator:jwt'; - this.get('session') + this.session .authenticate(authenticator, credentials) .then(async() => { - const tokenPayload = this.get('authManager').getTokenPayload(); + const tokenPayload = this.authManager.getTokenPayload(); if (tokenPayload) { this.set('session.skipRedirectOnInvalidation', true); - this.get('authManager').persistCurrentUser( - await this.get('store').findRecord('user', tokenPayload.identity) + this.authManager.persistCurrentUser( + await this.store.findRecord('user', tokenPayload.identity) ); this.set('isLoginModalOpen', false); this.send('placeOrder'); } }) .catch(reason => { - if (!(this.get('isDestroyed') || this.get('isDestroying'))) { + if (!(this.isDestroyed || this.isDestroying)) { if (reason && reason.hasOwnProperty('status_code') && reason.status_code === 401) { - this.set('errorMessage', this.get('l10n').t('Your credentials were incorrect.')); + this.set('errorMessage', this.l10n.t('Your credentials were incorrect.')); } else { - this.set('errorMessage', this.get('l10n').t('An unexpected error occurred.')); + this.set('errorMessage', this.l10n.t('An unexpected error occurred.')); } } else { console.warn(reason); @@ -146,20 +146,20 @@ export default Controller.extend({ order.set('attendees', attendees); await order.save() .then(order => { - this.get('notify').success(this.get('l10n').t('Order details saved. Please fill further details within 10 minutes.')); + this.notify.success(this.l10n.t('Order details saved. Please fill further details within 10 minutes.')); this.transitionToRoute('orders.new', order.identifier); }) .catch(async e => { for (const attendee of attendees ? attendees.toArray() : []) { await attendee.destroyRecord(); } - this.get('notify').error(this.get('l10n').t(e.errors[0].detail)); + this.notify.error(this.l10n.t(e.errors[0].detail)); }) .finally(() => { this.set('isLoading', false); }); } catch (e) { - this.get('notify').error(this.get('l10n').t(e)); + this.notify.error(this.l10n.t(e)); } } } diff --git a/app/controllers/register.js b/app/controllers/register.js index 8c48b165a15..c318306c331 100644 --- a/app/controllers/register.js +++ b/app/controllers/register.js @@ -6,7 +6,7 @@ export default Controller.extend({ inviteEmail : null, inviteToken : null, willDestroy() { - const user = this.get('model'); + const user = this.model; if (user) { this.store.unloadRecord(user); } @@ -15,20 +15,20 @@ export default Controller.extend({ actions: { createUser() { const password = this.get('model.password'); - this.get('model').save() + this.model.save() .then(user => { this.set('session.newUser', user.get('email')); - if (this.get('inviteToken')) { - this.send('loginExistingUser', user.get('email'), password, this.get('inviteToken'), this.get('event')); + if (this.inviteToken) { + this.send('loginExistingUser', user.get('email'), password, this.inviteToken, this.event); } else { this.transitionToRoute('login'); } }) .catch(reason => { if (reason && reason.hasOwnProperty('errors') && reason.errors[0].status === 409) { - this.set('errorMessage', this.get('l10n').t('User already exists.')); + this.set('errorMessage', this.l10n.t('User already exists.')); } else { - this.set('errorMessage', this.get('l10n').t('An unexpected error occurred.')); + this.set('errorMessage', this.l10n.t('An unexpected error occurred.')); } }) .finally(() => { @@ -43,24 +43,24 @@ export default Controller.extend({ password }; let authenticator = 'authenticator:jwt'; - this.get('session') + this.session .authenticate(authenticator, credentials) .then(async() => { - const tokenPayload = this.get('authManager').getTokenPayload(); + const tokenPayload = this.authManager.getTokenPayload(); if (tokenPayload) { this.set('session.skipRedirectOnInvalidation', true); - this.get('authManager').persistCurrentUser( - await this.get('store').findRecord('user', tokenPayload.identity) + this.authManager.persistCurrentUser( + await this.store.findRecord('user', tokenPayload.identity) ); } this.transitionToRoute('public.role-invites', eventId, { queryParams: { token } }); }) .catch(reason => { - if (!(this.get('isDestroyed') || this.get('isDestroying'))) { + if (!(this.isDestroyed || this.isDestroying)) { if (reason && reason.hasOwnProperty('status_code') && reason.status_code === 401) { - this.set('errorMessage', this.get('l10n').t('Your credentials were incorrect.')); + this.set('errorMessage', this.l10n.t('Your credentials were incorrect.')); } else { - this.set('errorMessage', this.get('l10n').t('An unexpected error occurred.')); + this.set('errorMessage', this.l10n.t('An unexpected error occurred.')); } } else { console.warn(reason); diff --git a/app/controllers/settings/contact-info.js b/app/controllers/settings/contact-info.js index 66e0119c89d..91454a4b992 100644 --- a/app/controllers/settings/contact-info.js +++ b/app/controllers/settings/contact-info.js @@ -4,13 +4,13 @@ export default Controller.extend({ actions: { updateContactInfo() { this.set('isLoading', true); - let currentUser = this.get('model'); + let currentUser = this.model; currentUser.save() .then(() => { - this.get('notify').success(this.get('l10n').t('Your Contact Info has been updated')); + this.notify.success(this.l10n.t('Your Contact Info has been updated')); }) .catch(() => { - this.get('notify').error(this.get('l10n').t('An unexpected error occurred')); + this.notify.error(this.l10n.t('An unexpected error occurred')); }) .finally(() => { this.set('isLoading', false); diff --git a/app/controllers/settings/password.js b/app/controllers/settings/password.js index 6abb88a49ae..6abab1d81b6 100644 --- a/app/controllers/settings/password.js +++ b/app/controllers/settings/password.js @@ -10,16 +10,16 @@ export default Controller.extend({ 'new-password' : passwordData.passwordNew } }; - this.get('loader') + this.loader .post('/auth/change-password', payload) .then(() => { - this.get('notify').success(this.get('l10n').t('Password updated successfully')); + this.notify.success(this.l10n.t('Password updated successfully')); }) .catch(error => { if (error.errors) { - this.get('notify').error(this.get('l10n').t(`${error.errors[0].detail}`)); + this.notify.error(this.l10n.t(`${error.errors[0].detail}`)); } else { - this.get('notify').error(this.get('l10n').t('Unexpected error. Password did not change.')); + this.notify.error(this.l10n.t('Unexpected error. Password did not change.')); } }) .finally(() => { diff --git a/app/controllers/verify.js b/app/controllers/verify.js index c47463091c5..8cde2478477 100644 --- a/app/controllers/verify.js +++ b/app/controllers/verify.js @@ -14,7 +14,7 @@ export default Controller.extend({ token: tokenVal } }; - return this.get('loader') + return this.loader .post('auth/verify-email', payload) .then(() => { this.set('success', true); diff --git a/app/helpers/confirm.js b/app/helpers/confirm.js index d05b434301a..c397caf16f9 100644 --- a/app/helpers/confirm.js +++ b/app/helpers/confirm.js @@ -10,12 +10,12 @@ export default Helper.extend({ compute(params) { return () => { if (params.length >= 2) { - this.get('confirm').prompt(params[0]) + this.confirm.prompt(params[0]) .then(() => { params[1](); }); } else { - this.get('confirm').prompt() + this.confirm.prompt() .then(() => { params[0](); }); diff --git a/app/helpers/css.js b/app/helpers/css.js index 761c12af6ee..6cbf98b1b45 100644 --- a/app/helpers/css.js +++ b/app/helpers/css.js @@ -1,6 +1,6 @@ import Helper from '@ember/component/helper'; import { inject as service } from '@ember/service'; -import { forOwn } from 'lodash'; +import { forOwn } from 'lodash-es'; import { htmlSafe } from '@ember/string'; export default Helper.extend({ @@ -11,6 +11,6 @@ export default Helper.extend({ forOwn(hash, (value, key) => { style += `${key}: ${value};`; }); - return htmlSafe(this.get('sanitizer').strip(style)); + return htmlSafe(this.sanitizer.strip(style)); } }); diff --git a/app/helpers/currency-name.js b/app/helpers/currency-name.js index 6306d4f8661..1f439a7ddb8 100644 --- a/app/helpers/currency-name.js +++ b/app/helpers/currency-name.js @@ -1,5 +1,5 @@ import Helper from '@ember/component/helper'; -import { find } from 'lodash'; +import { find } from 'lodash-es'; import { paymentCurrencies } from 'open-event-frontend/utils/dictionary/payment'; export function currencyName(params) { diff --git a/app/helpers/currency-symbol.js b/app/helpers/currency-symbol.js index 62dbcc6fda1..a5d549bb78c 100644 --- a/app/helpers/currency-symbol.js +++ b/app/helpers/currency-symbol.js @@ -1,5 +1,5 @@ import Helper from '@ember/component/helper'; -import { find } from 'lodash'; +import { find } from 'lodash-es'; import { paymentCurrencies } from 'open-event-frontend/utils/dictionary/payment'; export function currencySymbol(params) { diff --git a/app/helpers/sanitize.js b/app/helpers/sanitize.js index 61a5cfb6217..cc877c1bf58 100644 --- a/app/helpers/sanitize.js +++ b/app/helpers/sanitize.js @@ -9,6 +9,6 @@ export default Helper.extend({ sanitizer: service(), compute(params) { - return htmlSafe(this.get('sanitizer').purify(params[0])); + return htmlSafe(this.sanitizer.purify(params[0])); } }); diff --git a/app/helpers/ticket-attendees.js b/app/helpers/ticket-attendees.js index e266161e01e..63e96ba4be2 100644 --- a/app/helpers/ticket-attendees.js +++ b/app/helpers/ticket-attendees.js @@ -1,5 +1,5 @@ import { helper } from '@ember/component/helper'; -import { intersection } from 'lodash'; +import { intersection } from 'lodash-es'; export function ticketAttendees(params/* , hash*/) { diff --git a/app/mixins/admin-sales.js b/app/mixins/admin-sales.js index ccafa1a74d8..f1577fc33bf 100644 --- a/app/mixins/admin-sales.js +++ b/app/mixins/admin-sales.js @@ -4,42 +4,42 @@ import { computed } from '@ember/object'; export default Mixin.create({ totalCompletedTickets: computed(function() { let sum = 0; - this.get('model').forEach(data => { + this.model.forEach(data => { sum += data.sales.completed.ticket_count; }); return sum; }), totalCompletedSales: computed(function() { let sum = 0; - this.get('model').forEach(data => { + this.model.forEach(data => { sum += data.sales.completed.sales_total; }); return sum; }), totalPlacedTickets: computed(function() { let sum = 0; - this.get('model').forEach(data => { + this.model.forEach(data => { sum += data.sales.placed.ticket_count; }); return sum; }), totalPlacedSales: computed(function() { let sum = 0; - this.get('model').forEach(data => { + this.model.forEach(data => { sum += data.sales.placed.sales_total; }); return sum; }), totalPendingTickets: computed(function() { let sum = 0; - this.get('model').forEach(data => { + this.model.forEach(data => { sum += data.sales.pending.ticket_count; }); return sum; }), totalPendingSales: computed(function() { let sum = 0; - this.get('model').forEach(data => { + this.model.forEach(data => { sum += data.sales.pending.sales_total; }); return sum; diff --git a/app/mixins/custom-primary-key.js b/app/mixins/custom-primary-key.js index a2035488e39..52e610be8f4 100644 --- a/app/mixins/custom-primary-key.js +++ b/app/mixins/custom-primary-key.js @@ -1,5 +1,5 @@ import Mixin from '@ember/object/mixin'; -import { get, unset } from 'lodash'; +import { get, unset } from 'lodash-es'; import { coerceId } from 'open-event-frontend/utils/internal'; import attr from 'ember-data/attr'; @@ -8,16 +8,14 @@ export default Mixin.create({ originalId: attr(), extractId(modelClass, resourceHash) { - let primaryKey = this.get('primaryKey'); - let id = get(resourceHash, primaryKey); + let id = get(resourceHash, this.primaryKey); return coerceId(id); }, serialize() { - let primaryKey = this.get('primaryKey'); const json = this._super(...arguments); - if (primaryKey !== 'id') { - unset(json, ['data', primaryKey]); // Remove the custom primary key + if (this.primaryKey !== 'id') { + unset(json, ['data', this.primaryKey]); // Remove the custom primary key json.data.id = json.data.attributes['original-id']; // Restore the original from copy unset(json, 'data.attributes.original-id'); // Remove the original's copy } @@ -25,9 +23,8 @@ export default Mixin.create({ }, extractAttributes(modelClass, resourceHash) { - let primaryKey = this.get('primaryKey'); let attributes = this._super(...arguments); - if (primaryKey !== 'id') { + if (this.primaryKey !== 'id') { attributes.originalId = resourceHash.id; } return attributes; diff --git a/app/mixins/event-wizard.js b/app/mixins/event-wizard.js index d8825e10a44..74468c224ee 100644 --- a/app/mixins/event-wizard.js +++ b/app/mixins/event-wizard.js @@ -14,20 +14,20 @@ export default Mixin.create(MutableArray, CustomFormMixin, { getSteps() { return [ { - title : this.get('l10n').t('Basic Details'), - description : this.get('l10n').t('Tell about your event'), + title : this.l10n.t('Basic Details'), + description : this.l10n.t('Tell about your event'), icon : 'info icon', route : 'events.view.edit.basic-details' }, { - title : this.get('l10n').t('Sponsors'), - description : this.get('l10n').t('Advertise your sponsors'), + title : this.l10n.t('Sponsors'), + description : this.l10n.t('Advertise your sponsors'), icon : 'dollar icon', route : 'events.view.edit.sponsors' }, { - title : this.get('l10n').t('Sessions & Speakers'), - description : this.get('l10n').t('Expand your event'), + title : this.l10n.t('Sessions & Speakers'), + description : this.l10n.t('Expand your event'), icon : 'list icon', route : 'events.view.edit.sessions-speakers' } @@ -118,12 +118,12 @@ export default Mixin.create(MutableArray, CustomFormMixin, { this.set('isLoading', true); this.saveEventData(propsToSave) .then(data => { - this.get('notify').success(this.get('l10n').t('Your event has been saved')); + this.notify.success(this.l10n.t('Your event has been saved')); this.transitionToRoute(route, data.id); }) .catch(e => { console.error(e); - this.get('notify').error(this.get('l10n').t(e.errors[0].detail)); + this.notify.error(this.l10n.t(e.errors[0].detail)); }) .finally(() => { this.set('isLoading', false); diff --git a/app/mixins/form.js b/app/mixins/form.js index f527e75a821..8e185022f3a 100644 --- a/app/mixins/form.js +++ b/app/mixins/form.js @@ -1,6 +1,6 @@ import $ from 'jquery'; import Mixin from '@ember/object/mixin'; -import { merge } from '@ember/polyfills'; +import { merge } from 'lodash-es'; import { debounce } from '@ember/runloop'; import moment from 'moment'; import { FORM_DATE_FORMAT } from 'open-event-frontend/utils/dictionary/date-time'; @@ -16,7 +16,7 @@ export default Mixin.create({ autoScrollSpeed : 200, getForm() { - return this.get('$form'); + return this.$form; }, onValid(callback) { @@ -55,7 +55,7 @@ export default Mixin.create({ } let $form; - if ((this.get('tagName') && this.get('tagName').toLowerCase() === 'form') || (this.$() && this.$().prop('tagName').toLowerCase() === 'form')) { + if ((this.tagName && this.tagName.toLowerCase() === 'form') || (this.$() && this.$().prop('tagName').toLowerCase() === 'form')) { $form = this.$(); $form.addClass('ui form'); } else { @@ -63,7 +63,7 @@ export default Mixin.create({ } if ($form) { $form = $form.first(); - if (this.get('getValidationRules') && $form) { + if (this.getValidationRules && $form) { $form.form(merge(defaultFormRules, this.getValidationRules())); } if ($form && this) { @@ -75,7 +75,7 @@ export default Mixin.create({ didInsertElement() { this._super(...arguments); - $.fn.form.settings.rules.date = (value, format = FORM_DATE_FORMAT) => { + window.$.fn.form.settings.rules.date = (value, format = FORM_DATE_FORMAT) => { if (value && value.length > 0 && format) { return moment(value, format).isValid(); } diff --git a/app/mixins/notifications.js b/app/mixins/notifications.js index 371b36a29e9..7da6609dadb 100644 --- a/app/mixins/notifications.js +++ b/app/mixins/notifications.js @@ -6,10 +6,10 @@ export default Mixin.create({ notification.set('isRead', true); notification.save() .then(() => { - this.get('notify').success(this.get('l10n').t('Marked as Read successfully')); + this.notify.success(this.l10n.t('Marked as Read successfully')); }) .catch(() => { - this.get('notify').error(this.get('l10n').t('An unexpected error occurred.')); + this.notify.error(this.l10n.t('An unexpected error occurred.')); }); }, markAllAsRead(notifications) { @@ -23,10 +23,10 @@ export default Mixin.create({ Promise .all(bulkPromises) .then(() => { - this.get('notify').success(this.get('l10n').t('Marked all as Read successfully')); + this.notify.success(this.l10n.t('Marked all as Read successfully')); }) .catch(() => { - this.get('notify').error(this.get('l10n').t('An unexpected error occurred.')); + this.notify.error(this.l10n.t('An unexpected error occurred.')); }); } } diff --git a/app/models/access-code.js b/app/models/access-code.js index e1d2ff0f796..7715c1b45a6 100644 --- a/app/models/access-code.js +++ b/app/models/access-code.js @@ -17,7 +17,7 @@ export default ModelBase.extend({ tickets : hasMany('ticket'), marketer : belongsTo('user', { inverse: 'accessCodes' }), isExpired : computed('validTill', function() { - return (new Date() > new Date(this.get('validTill'))); + return new Date() > new Date(this.validTill); }), event: belongsTo('event', { inverse: 'accessCodes' diff --git a/app/models/admin-statistics-user.js b/app/models/admin-statistics-user.js index 3ba29947335..4c0b8545b6d 100644 --- a/app/models/admin-statistics-user.js +++ b/app/models/admin-statistics-user.js @@ -13,6 +13,6 @@ export default ModelBase.extend({ trackOrganizer : attr('number'), total: computed('superAdmin', 'admin', 'verified', 'unverified', function() { - return this.get('superAdmin') + this.get('admin') + this.get('verified') + this.get('unverified'); + return this.superAdmin + this.admin + this.verified + this.unverified; }) }); diff --git a/app/models/custom-form.js b/app/models/custom-form.js index bbedc10ab71..d1c13e8db45 100644 --- a/app/models/custom-form.js +++ b/app/models/custom-form.js @@ -78,10 +78,10 @@ export default ModelBase.extend({ }, name: computed('fieldIdentifier', 'form', function() { - let name = this.get('fieldIdentifier'); - if (this.get('form') === 'session') { + let name = this.fieldIdentifier; + if (this.form === 'session') { name = this.get(`session.${name}`); - } else if (this.get('form') === 'speaker') { + } else if (this.form === 'speaker') { name = this.get(`speaker.${name}`); } else { name = this.get(`attendee.${name}`); @@ -90,18 +90,18 @@ export default ModelBase.extend({ }), isLongText: computed('type', function() { - return this.get('type') === 'text' - && (['shortBiography', 'longBiography', 'longAbstract', 'shortAbstract', 'comments', 'speakingExperience'].includes(this.get('fieldIdentifier'))); + return this.type === 'text' + && (['shortBiography', 'longBiography', 'longAbstract', 'shortAbstract', 'comments', 'speakingExperience'].includes(this.fieldIdentifier)); }), isIncludedObserver: observer('isIncluded', function() { - if (!this.get('isIncluded') && this.get('isRequired')) { + if (!this.isIncluded && this.isRequired) { this.set('isRequired', false); } }), isRequiredObserver: observer('isRequired', function() { - if (!this.get('isIncluded') && this.get('isRequired')) { + if (!this.isIncluded && this.isRequired) { this.set('isIncluded', true); } }) diff --git a/app/models/discount-code.js b/app/models/discount-code.js index 6f794445cdf..f3024847fa2 100644 --- a/app/models/discount-code.js +++ b/app/models/discount-code.js @@ -32,7 +32,7 @@ export default ModelBase.extend({ tickets : hasMany('ticket'), orders : hasMany('order'), isExpired : computed('validTill', function() { - return (new Date() > new Date(this.get('validTill'))); + return new Date() > new Date(this.validTill); }), event: belongsTo('event', { inverse: 'discountCodes' diff --git a/app/models/event.js b/app/models/event.js index 51c23281c57..3632418606a 100644 --- a/app/models/event.js +++ b/app/models/event.js @@ -10,7 +10,7 @@ import { computedSegmentedLink } from 'open-event-frontend/utils/computed-helpers'; import CustomPrimaryKeyMixin from 'open-event-frontend/mixins/custom-primary-key'; -import { groupBy } from 'lodash'; +import { groupBy } from 'lodash-es'; const detectedTimezone = moment.tz.guess(); @@ -153,13 +153,12 @@ export default ModelBase.extend(CustomPrimaryKeyMixin, { segmentedTicketUrl : computedSegmentedLink.bind(this)('ticketUrl'), shortLocationName: computed('locationName', function() { - let eventLocation = this.get('locationName'); - if (!eventLocation) { + if (!this.locationName) { return ''; } - let splitLocations = eventLocation.split(','); + let splitLocations = this.locationName.split(','); if (splitLocations.length <= 3) { - return eventLocation; + return this.locationName; } else { return splitLocations.splice(1, splitLocations.length).join(); } @@ -167,11 +166,11 @@ export default ModelBase.extend(CustomPrimaryKeyMixin, { url: computed('identifier', function() { const origin = this.get('fastboot.isFastBoot') ? `${this.get('fastboot.request.protocol')}//${this.get('fastboot.request.host')}` : location.origin; - return origin + this.get('router').urlFor('public', this.get('id')); + return origin + this.router.urlFor('public', this.id); }), sessionsByState: computed('sessions', function() { - return groupBy(this.get('sessions').toArray(), 'data.state'); + return groupBy(this.sessions.toArray(), 'data.state'); }), _ready: on('ready', function() { diff --git a/app/models/notification-action.js b/app/models/notification-action.js index 71ec2bd2d76..4ac00890175 100644 --- a/app/models/notification-action.js +++ b/app/models/notification-action.js @@ -17,8 +17,7 @@ export default ModelBase.extend({ */ buttonTitle: computed('subject', 'actionType', function() { let action; - const actionType = this.get('actionType'); - switch (actionType) { + switch (this.actionType) { case 'download': action = 'Download'; break; @@ -32,8 +31,7 @@ export default ModelBase.extend({ } let buttonSubject; - const subject = this.get('subject'); - switch (subject) { + switch (this.subject) { case 'event-export': buttonSubject = ' Event'; break; @@ -63,7 +61,7 @@ export default ModelBase.extend({ break; case 'call-for-speakers': - if (this.get('actionType') === 'submit') { + if (this.actionType === 'submit') { buttonSubject = ' Proposal'; } else { buttonSubject = ' Call for Speakers'; @@ -80,9 +78,8 @@ export default ModelBase.extend({ * The route name to which the action button will direct the user to. */ buttonRoute: computed('subject', function() { - const subject = this.get('subject'); let routeName; - switch (subject) { + switch (this.subject) { case 'event-export': routeName = 'events.view'; break; diff --git a/app/models/session.js b/app/models/session.js index 82415d33a6a..5fe1cf2f5e9 100644 --- a/app/models/session.js +++ b/app/models/session.js @@ -38,10 +38,10 @@ export default ModelBase.extend({ creator : belongsTo('user'), status: computed('state', 'deletedAt', function() { - if (this.get('deletedAt') !== null) { + if (this.deletedAt !== null) { return 'deleted'; } else { - return this.get('state'); + return this.state; } }), diff --git a/app/models/social-link.js b/app/models/social-link.js index 4c1521b616d..c2345da1cb5 100644 --- a/app/models/social-link.js +++ b/app/models/social-link.js @@ -13,7 +13,7 @@ export default ModelBase.extend({ event: belongsTo('event'), normalizedName: computed('name', function() { - return this.get('name').trim().toLowerCase(); + return this.name.trim().toLowerCase(); }), isTwitter: equal('normalizedName', 'twitter'), diff --git a/app/models/speakers-call.js b/app/models/speakers-call.js index b1a4480da08..365e373baec 100644 --- a/app/models/speakers-call.js +++ b/app/models/speakers-call.js @@ -23,10 +23,10 @@ export default ModelBase.extend({ endsAtTime : computedDateTimeSplit.bind(this)('endsAt', 'time'), isOpen: computed('startsAt', 'endsAt', function() { - return moment().isAfter(this.get('startsAt')) && moment().isBefore(this.get('endsAt')); + return moment().isAfter(this.startsAt) && moment().isBefore(this.endsAt); }), isInFuture: computed('startsAt', function() { - return moment(this.get('startsAt')).isAfter(); + return moment(this.startsAt).isAfter(); }) }); diff --git a/app/models/ticket.js b/app/models/ticket.js index 5c72b545196..b892ba23271 100644 --- a/app/models/ticket.js +++ b/app/models/ticket.js @@ -43,6 +43,6 @@ export default ModelBase.extend({ salesEndsAtTime : computedDateTimeSplit.bind(this)('salesEndsAt', 'time'), itemTotal: computed('price', 'quantity', function() { - return this.get('price') * this.get('quantity'); + return this.price * this.quantity; }) }); diff --git a/app/models/user.js b/app/models/user.js index f5c7a701a98..57763e3efe6 100644 --- a/app/models/user.js +++ b/app/models/user.js @@ -5,7 +5,7 @@ import { inject as service } from '@ember/service'; import attr from 'ember-data/attr'; import ModelBase from 'open-event-frontend/models/base'; import { hasMany } from 'ember-data/relationships'; -import { toString } from 'lodash'; +import { toString } from 'lodash-es'; export default ModelBase.extend({ @@ -48,11 +48,11 @@ export default ModelBase.extend({ lastAccessedAt : attr('moment', { readOnly: true }), status: computed('lastAccessedAt', 'deletedAt', function() { - if (this.get('deletedAt') == null) { - if (this.get('lastAccessedAt') == null) { + if (this.deletedAt == null) { + if (this.lastAccessedAt == null) { return 'inactive'; } - return ((new Date().getMonth() - new Date(this.get('lastAccessedAt')).getMonth() <= 12) ? 'active' : 'inactive'); + return (new Date().getMonth() - new Date(this.lastAccessedAt).getMonth() <= 12) ? 'active' : 'inactive'; } else { return 'deleted'; } @@ -83,8 +83,8 @@ export default ModelBase.extend({ _didUpdate: on('didUpdate', function(user) { if (toString(user.id) === toString(this.get('authManager.currentUser.id'))) { - user = this.get('store').peekRecord('user', user.id); - this.get('authManager').persistCurrentUser(user); + user = this.store.peekRecord('user', user.id); + this.authManager.persistCurrentUser(user); } }) }); diff --git a/app/router.js b/app/router.js index 8b0d3985c66..2cdf009c540 100644 --- a/app/router.js +++ b/app/router.js @@ -11,20 +11,22 @@ const router = Router.extend(RouterScroll, { session : service(), headData : service(), - didTransition() { - this._super(...arguments); - this._trackPage(); + setTitle(title) { + this.headData.set('title', title); }, - setTitle(title) { - this.get('headData').set('title', title); + init() { + this._super(...arguments); + this.on('routeDidChange', () => { + this._trackPage(); + }); }, _trackPage() { scheduleOnce('afterRender', this, () => { - const page = this.get('url'); + const page = this.url; const title = this.getWithDefault('currentRouteName', 'unknown'); - this.get('metrics').trackPage({ page, title }); + this.metrics.trackPage({ page, title }); this.set('session.currentRouteName', title); }); } diff --git a/app/routes/admin.js b/app/routes/admin.js index 2c895932032..fc884c68296 100644 --- a/app/routes/admin.js +++ b/app/routes/admin.js @@ -3,6 +3,6 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout export default Route.extend(AuthenticatedRouteMixin, { titleToken() { - return this.get('l10n').t('Administration'); + return this.l10n.t('Administration'); } }); diff --git a/app/routes/admin/content.js b/app/routes/admin/content.js index 990adf55278..afc61926371 100644 --- a/app/routes/admin/content.js +++ b/app/routes/admin/content.js @@ -2,6 +2,6 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Content'); + return this.l10n.t('Content'); } }); diff --git a/app/routes/admin/content/events.js b/app/routes/admin/content/events.js index b0302c3a1ab..34e95446152 100644 --- a/app/routes/admin/content/events.js +++ b/app/routes/admin/content/events.js @@ -2,16 +2,16 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Social Links'); + return this.l10n.t('Social Links'); }, async model() { return { - 'eventTopics': await this.get('store').query('event-topic', { + 'eventTopics': await this.store.query('event-topic', { sort : 'name', include : 'event-sub-topics' }), - 'eventTypes': await this.get('store').query('event-type', {}) + 'eventTypes': await this.store.query('event-type', {}) }; }, setupController(controller, model) { diff --git a/app/routes/admin/content/index.js b/app/routes/admin/content/index.js index ed9af364fb5..881ce46914b 100644 --- a/app/routes/admin/content/index.js +++ b/app/routes/admin/content/index.js @@ -2,10 +2,10 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Social Links'); + return this.l10n.t('Social Links'); }, model() { - return this.get('store').queryRecord('setting', {}); + return this.store.queryRecord('setting', {}); }, actions: { willTransition() { diff --git a/app/routes/admin/content/pages.js b/app/routes/admin/content/pages.js index 0230a8bc400..62b2069b3d2 100644 --- a/app/routes/admin/content/pages.js +++ b/app/routes/admin/content/pages.js @@ -2,10 +2,10 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Pages'); + return this.l10n.t('Pages'); }, model() { - return this.get('store').findAll('page'); + return this.store.findAll('page'); } }); diff --git a/app/routes/admin/content/system-images.js b/app/routes/admin/content/system-images.js index 81ef32410c1..aa3ca598abe 100644 --- a/app/routes/admin/content/system-images.js +++ b/app/routes/admin/content/system-images.js @@ -2,7 +2,7 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('System Images'); + return this.l10n.t('System Images'); }, model() { return this.store.query('event-topic', { diff --git a/app/routes/admin/content/system-images/list.js b/app/routes/admin/content/system-images/list.js index 2ef85ba9c6a..c3f226725f0 100644 --- a/app/routes/admin/content/system-images/list.js +++ b/app/routes/admin/content/system-images/list.js @@ -2,7 +2,7 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Sub topics'); + return this.l10n.t('Sub topics'); }, model(params) { this.set('params', params); diff --git a/app/routes/admin/content/translations.js b/app/routes/admin/content/translations.js index be6fd0a06c2..cf07a0cba0b 100644 --- a/app/routes/admin/content/translations.js +++ b/app/routes/admin/content/translations.js @@ -2,7 +2,7 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Translations'); + return this.l10n.t('Translations'); }, model() { diff --git a/app/routes/admin/events.js b/app/routes/admin/events.js index 24ad026eaf2..47f5eae9bad 100644 --- a/app/routes/admin/events.js +++ b/app/routes/admin/events.js @@ -2,6 +2,6 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Events'); + return this.l10n.t('Events'); } }); diff --git a/app/routes/admin/events/import.js b/app/routes/admin/events/import.js index 2a2ad1c3a90..e5078787194 100644 --- a/app/routes/admin/events/import.js +++ b/app/routes/admin/events/import.js @@ -2,6 +2,6 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Import'); + return this.l10n.t('Import'); } }); diff --git a/app/routes/admin/events/list.js b/app/routes/admin/events/list.js index d1213b99086..5e1208e98b0 100644 --- a/app/routes/admin/events/list.js +++ b/app/routes/admin/events/list.js @@ -5,13 +5,13 @@ export default Route.extend({ titleToken() { switch (this.get('params.events_status')) { case 'live': - return this.get('l10n').t('Live'); + return this.l10n.t('Live'); case 'draft': - return this.get('l10n').t('Draft'); + return this.l10n.t('Draft'); case 'past': - return this.get('l10n').t('Past'); + return this.l10n.t('Past'); case 'deleted': - return this.get('l10n').t('Deleted'); + return this.l10n.t('Deleted'); } }, model(params) { diff --git a/app/routes/admin/index.js b/app/routes/admin/index.js index 8f9b9dbfe71..16df88f790d 100644 --- a/app/routes/admin/index.js +++ b/app/routes/admin/index.js @@ -3,28 +3,28 @@ import Route from '@ember/routing/route'; export default Route.extend({ async model() { return { - events: await this.get('store').queryRecord('admin-statistics-event', { + events: await this.store.queryRecord('admin-statistics-event', { filter: { name : 'id', op : 'eq', val : 1 } }), - users: await this.get('store').queryRecord('admin-statistics-user', { + users: await this.store.queryRecord('admin-statistics-user', { filter: { name : 'id', op : 'eq', val : 1 } }), - mails: await this.get('store').queryRecord('admin-statistics-mail', { + mails: await this.store.queryRecord('admin-statistics-mail', { filter: { name : 'id', op : 'eq', val : 1 } }), - sessions: await this.get('store').queryRecord('admin-statistics-session', { + sessions: await this.store.queryRecord('admin-statistics-session', { filter: { name : 'id', op : 'eq', diff --git a/app/routes/admin/messages.js b/app/routes/admin/messages.js index 971c58676c3..db4b555656e 100644 --- a/app/routes/admin/messages.js +++ b/app/routes/admin/messages.js @@ -2,9 +2,9 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Messages'); + return this.l10n.t('Messages'); }, model() { - return this.get('store').query('message-setting', {}); + return this.store.query('message-setting', {}); } }); diff --git a/app/routes/admin/modules.js b/app/routes/admin/modules.js index c3a78774753..5c8d6aaf50b 100644 --- a/app/routes/admin/modules.js +++ b/app/routes/admin/modules.js @@ -2,9 +2,9 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Modules'); + return this.l10n.t('Modules'); }, model() { - return this.get('store').queryRecord('module', {}); + return this.store.queryRecord('module', {}); } }); diff --git a/app/routes/admin/permissions.js b/app/routes/admin/permissions.js index a4e37dc3c57..6708d50c7c6 100644 --- a/app/routes/admin/permissions.js +++ b/app/routes/admin/permissions.js @@ -2,6 +2,6 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Permissions'); + return this.l10n.t('Permissions'); } }); diff --git a/app/routes/admin/permissions/event-roles.js b/app/routes/admin/permissions/event-roles.js index 82d4e06444c..7a4dc069dc3 100644 --- a/app/routes/admin/permissions/event-roles.js +++ b/app/routes/admin/permissions/event-roles.js @@ -2,13 +2,13 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Event Roles'); + return this.l10n.t('Event Roles'); }, async model() { return { roles : ['Attendee', 'Co-organizer', 'Moderator', 'Organizer', 'Track Organizer', 'Registrar'], - services : await this.get('store').query('service', {}), - permissions : await this.get('store').query('event-role-permission', { 'page[size]': 30 }) + services : await this.store.query('service', {}), + permissions : await this.store.query('event-role-permission', { 'page[size]': 30 }) }; } }); diff --git a/app/routes/admin/permissions/system-roles.js b/app/routes/admin/permissions/system-roles.js index a20e884f1e4..f48855be1cd 100644 --- a/app/routes/admin/permissions/system-roles.js +++ b/app/routes/admin/permissions/system-roles.js @@ -2,13 +2,13 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('System Roles'); + return this.l10n.t('System Roles'); }, async model() { return { - userPermissions : await this.get('store').findAll('user-permission'), - systemRoles : await this.get('store').findAll('custom-system-role'), - panelPermissions : await this.get('store').findAll('panel-permission') + userPermissions : await this.store.findAll('user-permission'), + systemRoles : await this.store.findAll('custom-system-role'), + panelPermissions : await this.store.findAll('panel-permission') }; }, actions: { diff --git a/app/routes/admin/reports.js b/app/routes/admin/reports.js index 6a5b9731a4d..c7edec58ca3 100644 --- a/app/routes/admin/reports.js +++ b/app/routes/admin/reports.js @@ -2,6 +2,6 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Reports'); + return this.l10n.t('Reports'); } }); diff --git a/app/routes/admin/reports/kubernetes-server-logs.js b/app/routes/admin/reports/kubernetes-server-logs.js index b08c584c4e2..647a0c93307 100644 --- a/app/routes/admin/reports/kubernetes-server-logs.js +++ b/app/routes/admin/reports/kubernetes-server-logs.js @@ -2,6 +2,6 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Kubernetes Server Logs'); + return this.l10n.t('Kubernetes Server Logs'); } }); diff --git a/app/routes/admin/reports/system-logs.js b/app/routes/admin/reports/system-logs.js index 83881ce259f..a6d3f00f009 100644 --- a/app/routes/admin/reports/system-logs.js +++ b/app/routes/admin/reports/system-logs.js @@ -2,6 +2,6 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('System Logs'); + return this.l10n.t('System Logs'); } }); diff --git a/app/routes/admin/reports/system-logs/activity-logs.js b/app/routes/admin/reports/system-logs/activity-logs.js index d5c3e167c42..c9f41cf61dc 100644 --- a/app/routes/admin/reports/system-logs/activity-logs.js +++ b/app/routes/admin/reports/system-logs/activity-logs.js @@ -2,11 +2,11 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Activity Logs'); + return this.l10n.t('Activity Logs'); }, model() { - return this.get('store').query('activity', { + return this.store.query('activity', { 'page[size]' : 100, sort : '-time' }); diff --git a/app/routes/admin/reports/system-logs/mail-logs.js b/app/routes/admin/reports/system-logs/mail-logs.js index af1b5f64f8f..778014e725f 100644 --- a/app/routes/admin/reports/system-logs/mail-logs.js +++ b/app/routes/admin/reports/system-logs/mail-logs.js @@ -2,11 +2,11 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Mail Logs'); + return this.l10n.t('Mail Logs'); }, model() { - return this.get('store').query('mail', { + return this.store.query('mail', { 'page[size]' : 100, sort : '-time' }); diff --git a/app/routes/admin/reports/system-logs/notification-logs.js b/app/routes/admin/reports/system-logs/notification-logs.js index c7a2be8bc16..3c43b86c33c 100644 --- a/app/routes/admin/reports/system-logs/notification-logs.js +++ b/app/routes/admin/reports/system-logs/notification-logs.js @@ -2,11 +2,11 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Notification Logs'); + return this.l10n.t('Notification Logs'); }, model() { - return this.get('store').query('notification', { + return this.store.query('notification', { include : 'user', 'page[size]' : 100, sort : '-received-at' diff --git a/app/routes/admin/sales.js b/app/routes/admin/sales.js index def406948cf..0b3253e915e 100644 --- a/app/routes/admin/sales.js +++ b/app/routes/admin/sales.js @@ -2,6 +2,6 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Sales'); + return this.l10n.t('Sales'); } }); diff --git a/app/routes/admin/sales/discounted-events.js b/app/routes/admin/sales/discounted-events.js index c586b4b83f7..6e2bd2ee1aa 100644 --- a/app/routes/admin/sales/discounted-events.js +++ b/app/routes/admin/sales/discounted-events.js @@ -2,7 +2,7 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Discounted Events'); + return this.l10n.t('Discounted Events'); }, model() { diff --git a/app/routes/admin/sales/fees.js b/app/routes/admin/sales/fees.js index cb8a01d1540..d7f9d25c387 100644 --- a/app/routes/admin/sales/fees.js +++ b/app/routes/admin/sales/fees.js @@ -2,7 +2,7 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Fees'); + return this.l10n.t('Fees'); }, model() { diff --git a/app/routes/admin/sales/index.js b/app/routes/admin/sales/index.js index a4116e00c5d..acacddfbcc5 100644 --- a/app/routes/admin/sales/index.js +++ b/app/routes/admin/sales/index.js @@ -2,7 +2,7 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Overview'); + return this.l10n.t('Overview'); }, model() { diff --git a/app/routes/admin/sales/locations.js b/app/routes/admin/sales/locations.js index b3eb8ab8320..cc31cb5fe4a 100644 --- a/app/routes/admin/sales/locations.js +++ b/app/routes/admin/sales/locations.js @@ -2,7 +2,7 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Location'); + return this.l10n.t('Location'); }, model() { diff --git a/app/routes/admin/sales/marketer.js b/app/routes/admin/sales/marketer.js index e42546308d4..df4694a7400 100644 --- a/app/routes/admin/sales/marketer.js +++ b/app/routes/admin/sales/marketer.js @@ -2,7 +2,7 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Marketer'); + return this.l10n.t('Marketer'); }, model() { diff --git a/app/routes/admin/sales/organizers.js b/app/routes/admin/sales/organizers.js index 1eb6c29c9fd..8db04cafeac 100644 --- a/app/routes/admin/sales/organizers.js +++ b/app/routes/admin/sales/organizers.js @@ -2,7 +2,7 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Organizer'); + return this.l10n.t('Organizer'); }, model() { diff --git a/app/routes/admin/sales/status.js b/app/routes/admin/sales/status.js index 478d92c4177..82841b966c3 100644 --- a/app/routes/admin/sales/status.js +++ b/app/routes/admin/sales/status.js @@ -2,7 +2,7 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Status'); + return this.l10n.t('Status'); }, model() { return this.store.query('event-invoice', { include: 'event,user' }); diff --git a/app/routes/admin/sessions.js b/app/routes/admin/sessions.js index 9b7a3fc908e..7fdce30055a 100644 --- a/app/routes/admin/sessions.js +++ b/app/routes/admin/sessions.js @@ -2,6 +2,6 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Sessions'); + return this.l10n.t('Sessions'); } }); diff --git a/app/routes/admin/sessions/list.js b/app/routes/admin/sessions/list.js index 9fd14a442e2..be62eab8b86 100644 --- a/app/routes/admin/sessions/list.js +++ b/app/routes/admin/sessions/list.js @@ -4,17 +4,17 @@ export default Route.extend({ titleToken() { switch (this.get('params.sessions_state')) { case 'confirmed': - return this.get('l10n').t('Confirmed'); + return this.l10n.t('Confirmed'); case 'pending': - return this.get('l10n').t('Pending'); + return this.l10n.t('Pending'); case 'accepted': - return this.get('l10n').t('Accepted'); + return this.l10n.t('Accepted'); case 'rejected': - return this.get('l10n').t('Rejected'); + return this.l10n.t('Rejected'); case 'deleted': - return this.get('l10n').t('Deleted'); + return this.l10n.t('Deleted'); default: - return this.get('l10n').t('Session'); + return this.l10n.t('Session'); } }, model(params) { @@ -163,7 +163,7 @@ export default Route.extend({ } ]; } - return this.get('store').query('session', { + return this.store.query('session', { get_trashed : true, include : 'event,speakers', filter : filterOptions, diff --git a/app/routes/admin/settings.js b/app/routes/admin/settings.js index a2cdfeb9e42..1a66242959e 100644 --- a/app/routes/admin/settings.js +++ b/app/routes/admin/settings.js @@ -2,9 +2,9 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Settings'); + return this.l10n.t('Settings'); }, model() { - return this.get('store').queryRecord('setting', {}); + return this.store.queryRecord('setting', {}); } }); diff --git a/app/routes/admin/settings/analytics.js b/app/routes/admin/settings/analytics.js index 8c61bc9c80a..7ecdc0cbc05 100644 --- a/app/routes/admin/settings/analytics.js +++ b/app/routes/admin/settings/analytics.js @@ -2,7 +2,7 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Analytics'); + return this.l10n.t('Analytics'); }, actions: { willTransition() { diff --git a/app/routes/admin/settings/images.js b/app/routes/admin/settings/images.js index a79612c0fc3..dbc07ae1c6c 100644 --- a/app/routes/admin/settings/images.js +++ b/app/routes/admin/settings/images.js @@ -2,13 +2,13 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Images'); + return this.l10n.t('Images'); }, async model() { return { - speakerImageSize : await this.get('store').queryRecord('speaker-image-size', 1), - eventImageSize : await this.get('store').queryRecord('event-image-size', 1) + speakerImageSize : await this.store.queryRecord('speaker-image-size', 1), + eventImageSize : await this.store.queryRecord('event-image-size', 1) }; }, actions: { diff --git a/app/routes/admin/settings/index.js b/app/routes/admin/settings/index.js index 566345967a7..7f559df5cfd 100644 --- a/app/routes/admin/settings/index.js +++ b/app/routes/admin/settings/index.js @@ -2,7 +2,7 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('System'); + return this.l10n.t('System'); }, actions: { willTransition() { diff --git a/app/routes/admin/settings/microservices.js b/app/routes/admin/settings/microservices.js index 35c7f1f377b..8dce2fadc5a 100644 --- a/app/routes/admin/settings/microservices.js +++ b/app/routes/admin/settings/microservices.js @@ -2,7 +2,7 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Microservices'); + return this.l10n.t('Microservices'); }, actions: { willTransition() { diff --git a/app/routes/admin/settings/payment-gateway.js b/app/routes/admin/settings/payment-gateway.js index f5eb07a8c77..9899f51b979 100644 --- a/app/routes/admin/settings/payment-gateway.js +++ b/app/routes/admin/settings/payment-gateway.js @@ -2,7 +2,7 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Payment Gateway'); + return this.l10n.t('Payment Gateway'); }, actions: { willTransition() { diff --git a/app/routes/admin/settings/ticket-fees.js b/app/routes/admin/settings/ticket-fees.js index 58c97476850..28ed4fcbdd1 100644 --- a/app/routes/admin/settings/ticket-fees.js +++ b/app/routes/admin/settings/ticket-fees.js @@ -2,10 +2,10 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Ticket Fees'); + return this.l10n.t('Ticket Fees'); }, model() { - return this.get('store').findAll('ticket-fee'); + return this.store.findAll('ticket-fee'); }, actions: { willTransition() { diff --git a/app/routes/admin/users.js b/app/routes/admin/users.js index 04a6d778cdd..c9bf10fac5c 100644 --- a/app/routes/admin/users.js +++ b/app/routes/admin/users.js @@ -2,6 +2,6 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Users'); + return this.l10n.t('Users'); } }); diff --git a/app/routes/admin/users/list.js b/app/routes/admin/users/list.js index 8c6e0451f3c..52fd0bdc3dc 100644 --- a/app/routes/admin/users/list.js +++ b/app/routes/admin/users/list.js @@ -5,16 +5,16 @@ export default Route.extend({ titleToken() { switch (this.get('params.users_status')) { case 'active': - return this.get('l10n').t('Active'); + return this.l10n.t('Active'); case 'deleted': - return this.get('l10n').t('Deleted'); + return this.l10n.t('Deleted'); case 'inactive': - return this.get('l10n').t('Inactive'); + return this.l10n.t('Inactive'); } }, beforeModel(transition) { this._super(...arguments); - const userState = transition.params[transition.targetName].users_status; + const userState = transition.to.params.users_status; if (!['all', 'deleted', 'active', 'inactive'].includes(userState)) { this.replaceWith('admin.users.view', userState); } @@ -74,7 +74,7 @@ export default Route.extend({ } ]; } - return this.get('store').query('user', { + return this.store.query('user', { include : 'events', get_trashed : true, filter : filterOptions, diff --git a/app/routes/admin/users/view/events.js b/app/routes/admin/users/view/events.js index 96706d47ffc..4837989373d 100644 --- a/app/routes/admin/users/view/events.js +++ b/app/routes/admin/users/view/events.js @@ -3,6 +3,6 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout export default Route.extend(AuthenticatedRouteMixin, { titleToken() { - return this.get('l10n').t('Events'); + return this.l10n.t('Events'); } }); diff --git a/app/routes/admin/users/view/events/list.js b/app/routes/admin/users/view/events/list.js index 49e3099b610..dca4b4c300a 100644 --- a/app/routes/admin/users/view/events/list.js +++ b/app/routes/admin/users/view/events/list.js @@ -6,11 +6,11 @@ export default Route.extend(AuthenticatedRouteMixin, { titleToken() { switch (this.get('params.event_status')) { case 'live': - return this.get('l10n').t('Live'); + return this.l10n.t('Live'); case 'draft': - return this.get('l10n').t('Draft'); + return this.l10n.t('Draft'); case 'past': - return this.get('l10n').t('Past'); + return this.l10n.t('Past'); } }, async model(params) { diff --git a/app/routes/admin/users/view/sessions.js b/app/routes/admin/users/view/sessions.js index 2d69bf613ba..2a2a1ec56b9 100644 --- a/app/routes/admin/users/view/sessions.js +++ b/app/routes/admin/users/view/sessions.js @@ -3,6 +3,6 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout export default Route.extend(AuthenticatedRouteMixin, { titleToken() { - return this.get('l10n').t('My sessions'); + return this.l10n.t('My sessions'); } }); diff --git a/app/routes/admin/users/view/sessions/list.js b/app/routes/admin/users/view/sessions/list.js index bb46101d5b1..206cdabe114 100644 --- a/app/routes/admin/users/view/sessions/list.js +++ b/app/routes/admin/users/view/sessions/list.js @@ -6,9 +6,9 @@ export default Route.extend(AuthenticatedRouteMixin, { titleToken() { switch (this.get('params.session_status')) { case 'upcoming': - return this.get('l10n').t('Upcoming'); + return this.l10n.t('Upcoming'); case 'past': - return this.get('l10n').t('Past'); + return this.l10n.t('Past'); } }, model(params) { diff --git a/app/routes/admin/users/view/settings.js b/app/routes/admin/users/view/settings.js index 18b322c95f1..1affd3ed9f0 100644 --- a/app/routes/admin/users/view/settings.js +++ b/app/routes/admin/users/view/settings.js @@ -3,7 +3,7 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout export default Route.extend(AuthenticatedRouteMixin, { titleToken() { - return this.get('l10n').t('Settings'); + return this.l10n.t('Settings'); }, model() { const currentUser = this.modelFor('admin.users.view'); diff --git a/app/routes/admin/users/view/settings/applications.js b/app/routes/admin/users/view/settings/applications.js index c6b34d05a49..c7fabb7845e 100644 --- a/app/routes/admin/users/view/settings/applications.js +++ b/app/routes/admin/users/view/settings/applications.js @@ -3,6 +3,6 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout export default Route.extend(AuthenticatedRouteMixin, { titleToken() { - return this.get('l10n').t('Applications'); + return this.l10n.t('Applications'); } }); diff --git a/app/routes/admin/users/view/settings/email-preferences.js b/app/routes/admin/users/view/settings/email-preferences.js index 32c0ec95195..eb9f0460043 100644 --- a/app/routes/admin/users/view/settings/email-preferences.js +++ b/app/routes/admin/users/view/settings/email-preferences.js @@ -3,7 +3,7 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout export default Route.extend(AuthenticatedRouteMixin, { titleToken() { - return this.get('l10n').t('Email Preferences'); + return this.l10n.t('Email Preferences'); }, model() { const currentUser = this.modelFor('admin.users.view'); diff --git a/app/routes/admin/users/view/tickets.js b/app/routes/admin/users/view/tickets.js index eb6cd9c5fd7..21029fcd7e8 100644 --- a/app/routes/admin/users/view/tickets.js +++ b/app/routes/admin/users/view/tickets.js @@ -3,6 +3,6 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout export default Route.extend(AuthenticatedRouteMixin, { titleToken() { - return this.get('l10n').t('My Tickets'); + return this.l10n.t('My Tickets'); } }); diff --git a/app/routes/admin/users/view/tickets/index.js b/app/routes/admin/users/view/tickets/index.js index 66db93e1f80..8769227e6ae 100644 --- a/app/routes/admin/users/view/tickets/index.js +++ b/app/routes/admin/users/view/tickets/index.js @@ -2,7 +2,7 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Upcoming'); + return this.l10n.t('Upcoming'); }, beforeModel() { this._super(...arguments); diff --git a/app/routes/admin/users/view/tickets/list.js b/app/routes/admin/users/view/tickets/list.js index dcabccffa8a..558a836be23 100644 --- a/app/routes/admin/users/view/tickets/list.js +++ b/app/routes/admin/users/view/tickets/list.js @@ -6,9 +6,9 @@ export default Route.extend(AuthenticatedRouteMixin, { titleToken() { switch (this.get('params.tickets_status')) { case 'upcoming': - return this.get('l10n').t('Upcoming'); + return this.l10n.t('Upcoming'); case 'past': - return this.get('l10n').t('Past'); + return this.l10n.t('Past'); } }, async model(params) { diff --git a/app/routes/application.js b/app/routes/application.js index f4f1e491435..e35ea21df1d 100644 --- a/app/routes/application.js +++ b/app/routes/application.js @@ -1,7 +1,7 @@ import Route from '@ember/routing/route'; import ApplicationRouteMixin from 'ember-simple-auth/mixins/application-route-mixin'; import { inject as service } from '@ember/service'; -import { merge, values, isEmpty } from 'lodash'; +import { merge, values, isEmpty } from 'lodash-es'; export default Route.extend(ApplicationRouteMixin, { session: service(), @@ -16,8 +16,8 @@ export default Route.extend(ApplicationRouteMixin, { async beforeModel(transition) { this._super(...arguments); - await this.get('authManager').initialize(); - await this.get('settings').initialize(); + await this.authManager.initialize(); + await this.settings.initialize(); if (!transition.intent.url.includes('login') && !transition.intent.url.includes('reset-password')) { this.set('session.previousRouteName', transition.intent.url); } else { @@ -28,7 +28,7 @@ export default Route.extend(ApplicationRouteMixin, { async model() { let notifications = []; if (this.get('session.isAuthenticated')) { - notifications = await this.get('authManager.currentUser').query('notifications', { + notifications = await this.authManager.currentUser.query('notifications', { filter: [ { name : 'is-read', @@ -42,14 +42,14 @@ export default Route.extend(ApplicationRouteMixin, { return { notifications, - pages: await this.get('store').query('page', { + pages: await this.store.query('page', { sort: 'index' }), cookiePolicy : this.get('settings.cookiePolicy'), cookiePolicyLink : this.get('settings.cookiePolicyLink'), - socialLinks : await this.get('store').queryRecord('setting', {}), - eventTypes : await this.get('store').findAll('event-type'), - eventLocations : await this.get('store').findAll('event-location') + socialLinks : await this.store.queryRecord('setting', {}), + eventTypes : await this.store.findAll('event-type'), + eventLocations : await this.store.findAll('event-location') }; }, diff --git a/app/routes/create.js b/app/routes/create.js index b5de84790d2..e76b1ce0ca7 100644 --- a/app/routes/create.js +++ b/app/routes/create.js @@ -4,7 +4,7 @@ import EventWizardMixin from 'open-event-frontend/mixins/event-wizard'; export default Route.extend(AuthenticatedRouteMixin, EventWizardMixin, { titleToken() { - return this.get('l10n').t('Create an Event'); + return this.l10n.t('Create an Event'); }, async model() { return { @@ -14,7 +14,7 @@ export default Route.extend(AuthenticatedRouteMixin, EventWizardMixin, { copyright : this.store.createRecord('event-copyright'), stripeAuthorization : this.store.createRecord('stripe-authorization') }), - module : await this.get('store').queryRecord('module', {}), + module : await this.store.queryRecord('module', {}), types : await this.store.query('event-type', { sort: 'name' }), diff --git a/app/routes/events.js b/app/routes/events.js index 96706d47ffc..4837989373d 100644 --- a/app/routes/events.js +++ b/app/routes/events.js @@ -3,6 +3,6 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout export default Route.extend(AuthenticatedRouteMixin, { titleToken() { - return this.get('l10n').t('Events'); + return this.l10n.t('Events'); } }); diff --git a/app/routes/events/import.js b/app/routes/events/import.js index 102ba55029d..32796399877 100644 --- a/app/routes/events/import.js +++ b/app/routes/events/import.js @@ -2,11 +2,11 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Import'); + return this.l10n.t('Import'); }, async model() { - const data = await this.get('store').findAll('importJob'); + const data = await this.store.findAll('importJob'); return { data, diff --git a/app/routes/events/list.js b/app/routes/events/list.js index 56bc4bcd39a..ae9b1d6286c 100644 --- a/app/routes/events/list.js +++ b/app/routes/events/list.js @@ -5,16 +5,16 @@ export default Route.extend({ titleToken() { switch (this.get('params.event_state')) { case 'live': - return this.get('l10n').t('Live'); + return this.l10n.t('Live'); case 'draft': - return this.get('l10n').t('Draft'); + return this.l10n.t('Draft'); case 'past': - return this.get('l10n').t('Past'); + return this.l10n.t('Past'); } }, beforeModel(transition) { this._super(...arguments); - const eventState = transition.params[transition.targetName].event_state; + const eventState = transition.to.params.event_state; if (!['live', 'draft', 'past'].includes(eventState)) { this.replaceWith('events.view', eventState); } diff --git a/app/routes/events/view.js b/app/routes/events/view.js index d688d9b3c39..b807a247b11 100644 --- a/app/routes/events/view.js +++ b/app/routes/events/view.js @@ -1,8 +1,7 @@ import Route from '@ember/routing/route'; -import Ember from 'ember'; +import { set } from '@ember/object'; import { inject as service } from '@ember/service'; -const { set } = Ember; export default Route.extend({ headData: service(), titleToken(model) { diff --git a/app/routes/events/view/edit.js b/app/routes/events/view/edit.js index 9f28baa0253..d79494367c7 100644 --- a/app/routes/events/view/edit.js +++ b/app/routes/events/view/edit.js @@ -4,7 +4,7 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout export default Route.extend(AuthenticatedRouteMixin, EventWizardMixin, { titleToken() { - return this.get('l10n').t('Edit Event'); + return this.l10n.t('Edit Event'); }, beforeModel(transition) { diff --git a/app/routes/events/view/edit/basic-details.js b/app/routes/events/view/edit/basic-details.js index 00c98f044a2..b4f0c677c69 100644 --- a/app/routes/events/view/edit/basic-details.js +++ b/app/routes/events/view/edit/basic-details.js @@ -4,7 +4,7 @@ import EventWizardMixin from 'open-event-frontend/mixins/event-wizard'; export default Route.extend(EventWizardMixin, { titleToken() { - return this.get('l10n').t('Basic Details'); + return this.l10n.t('Basic Details'); }, model() { diff --git a/app/routes/events/view/edit/sessions-speakers.js b/app/routes/events/view/edit/sessions-speakers.js index d3930c810ff..eb82f583fc5 100644 --- a/app/routes/events/view/edit/sessions-speakers.js +++ b/app/routes/events/view/edit/sessions-speakers.js @@ -4,7 +4,7 @@ import EventWizardMixin from 'open-event-frontend/mixins/event-wizard'; export default Route.extend(EventWizardMixin, { titleToken() { - return this.get('l10n').t('Sessions & Speakers'); + return this.l10n.t('Sessions & Speakers'); }, async model() { diff --git a/app/routes/events/view/edit/sponsors.js b/app/routes/events/view/edit/sponsors.js index e4f1b41d268..fab8213eaae 100644 --- a/app/routes/events/view/edit/sponsors.js +++ b/app/routes/events/view/edit/sponsors.js @@ -4,7 +4,7 @@ import EventWizardMixin from 'open-event-frontend/mixins/event-wizard'; export default Route.extend(EventWizardMixin, { titleToken() { - return this.get('l10n').t('Sponsors'); + return this.l10n.t('Sponsors'); }, async model() { diff --git a/app/routes/events/view/export.js b/app/routes/events/view/export.js index ac536e6a903..94f08faab28 100644 --- a/app/routes/events/view/export.js +++ b/app/routes/events/view/export.js @@ -2,6 +2,6 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Export'); + return this.l10n.t('Export'); } }); diff --git a/app/routes/events/view/scheduler.js b/app/routes/events/view/scheduler.js index c2a3b3b8e76..7e70701c874 100644 --- a/app/routes/events/view/scheduler.js +++ b/app/routes/events/view/scheduler.js @@ -1,7 +1,7 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Scheduler'); + return this.l10n.t('Scheduler'); }, actions: { refresh() { diff --git a/app/routes/events/view/sessions.js b/app/routes/events/view/sessions.js index 1647fe83509..b47e6802985 100644 --- a/app/routes/events/view/sessions.js +++ b/app/routes/events/view/sessions.js @@ -2,7 +2,7 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Sessions'); + return this.l10n.t('Sessions'); }, model() { return this.modelFor('events.view'); diff --git a/app/routes/events/view/sessions/create.js b/app/routes/events/view/sessions/create.js index 02b38e30606..b5004d32b4c 100644 --- a/app/routes/events/view/sessions/create.js +++ b/app/routes/events/view/sessions/create.js @@ -2,7 +2,7 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Create session'); + return this.l10n.t('Create session'); }, async model() { const eventDetails = this.modelFor('events.view'); @@ -16,14 +16,14 @@ export default Route.extend({ include : 'sessions', 'page[size]' : 0 }), - session: await this.get('store').createRecord('session', { + session: await this.store.createRecord('session', { event : eventDetails, creator : this.get('authManager.currentUser'), startsAt : null, endsAt : null, speakers : [] }), - speaker: await this.get('store').createRecord('speaker', { + speaker: await this.store.createRecord('speaker', { event : eventDetails, user : this.get('authManager.currentUser') }), @@ -33,7 +33,7 @@ export default Route.extend({ }, resetController(controller) { this._super(...arguments); - const model = controller.get('model'); + const { model } = controller; if (!model.speaker.id) { model.speaker.unloadRecord(); } diff --git a/app/routes/events/view/sessions/edit.js b/app/routes/events/view/sessions/edit.js index 17a04a6fe14..ec2130642e2 100644 --- a/app/routes/events/view/sessions/edit.js +++ b/app/routes/events/view/sessions/edit.js @@ -3,8 +3,8 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout export default Route.extend(AuthenticatedRouteMixin, { titleToken(model) { - var sessionTitle = model.session.title; - return this.get('l10n').t(sessionTitle.concat('-Edit')); + let sessionTitle = model.session.title; + return this.l10n.t(sessionTitle.concat('-Edit')); }, async model(params) { const eventDetails = this.modelFor('events.view'); @@ -14,7 +14,7 @@ export default Route.extend(AuthenticatedRouteMixin, { 'page[size]' : 50, sort : 'id' }), - session: await this.get('store').findRecord('session', params.session_id, { + session: await this.store.findRecord('session', params.session_id, { include: 'track,session-type,speakers' }), tracks : await eventDetails.query('tracks', {}), @@ -22,7 +22,7 @@ export default Route.extend(AuthenticatedRouteMixin, { speakers : await eventDetails.query('speakers', { 'page[size]': 0 }), - speaker: await this.get('store').createRecord('speaker', { + speaker: await this.store.createRecord('speaker', { event : eventDetails, user : this.get('authManager.currentUser') }) diff --git a/app/routes/events/view/sessions/list.js b/app/routes/events/view/sessions/list.js index 00f537cb44c..cc51aaac164 100644 --- a/app/routes/events/view/sessions/list.js +++ b/app/routes/events/view/sessions/list.js @@ -4,15 +4,15 @@ export default Route.extend({ titleToken() { switch (this.get('params.session_status')) { case 'pending': - return this.get('l10n').t('Pending'); + return this.l10n.t('Pending'); case 'confirmed': - return this.get('l10n').t('Confirmed'); + return this.l10n.t('Confirmed'); case 'accepted': - return this.get('l10n').t('Accepted'); + return this.l10n.t('Accepted'); case 'rejected': - return this.get('l10n').t('Rejected'); + return this.l10n.t('Rejected'); default: - return this.get('l10n').t('Session'); + return this.l10n.t('Session'); } }, async model(params) { diff --git a/app/routes/events/view/speakers.js b/app/routes/events/view/speakers.js index f376e224cd5..c4d570d8f46 100644 --- a/app/routes/events/view/speakers.js +++ b/app/routes/events/view/speakers.js @@ -2,7 +2,7 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Speakers'); + return this.l10n.t('Speakers'); }, model() { return this.modelFor('events.view'); diff --git a/app/routes/events/view/speakers/create.js b/app/routes/events/view/speakers/create.js index baa43e4068f..63f84bfae6f 100644 --- a/app/routes/events/view/speakers/create.js +++ b/app/routes/events/view/speakers/create.js @@ -2,7 +2,7 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Create session'); + return this.l10n.t('Create session'); }, async model() { const eventDetails = this.modelFor('events.view'); @@ -12,13 +12,13 @@ export default Route.extend({ 'page[size]' : 50, sort : 'id' }), - session: await this.get('store').createRecord('session', { + session: await this.store.createRecord('session', { event : eventDetails, creator : this.get('authManager.currentUser') }), sessions: await eventDetails.query('sessions', { }), - speaker: await this.get('store').createRecord('speaker', { + speaker: await this.store.createRecord('speaker', { event : eventDetails, user : this.get('authManager.currentUser') }), @@ -28,7 +28,7 @@ export default Route.extend({ }, resetController(controller) { this._super(...arguments); - const model = controller.get('model'); + const { model } = controller; if (!controller.get('model.speaker.id')) { model.speaker.unloadRecord(); } diff --git a/app/routes/events/view/speakers/edit.js b/app/routes/events/view/speakers/edit.js index 2c0701878e5..bd4eefedf9c 100644 --- a/app/routes/events/view/speakers/edit.js +++ b/app/routes/events/view/speakers/edit.js @@ -3,8 +3,8 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout export default Route.extend(AuthenticatedRouteMixin, { titleToken(model) { - var speakerName = model.speaker.get('name'); - return this.get('l10n').t(speakerName.concat('-Edit')); + let speakerName = model.speaker.get('name'); + return this.l10n.t(speakerName.concat('-Edit')); }, async model(params) { const eventDetails = this.modelFor('events.view'); @@ -14,7 +14,7 @@ export default Route.extend(AuthenticatedRouteMixin, { 'page[size]' : 50, sort : 'id' }), - speaker: await this.get('store').findRecord('speaker', params.speaker_id) + speaker: await this.store.findRecord('speaker', params.speaker_id) }; } }); diff --git a/app/routes/events/view/speakers/list.js b/app/routes/events/view/speakers/list.js index d322d910a6c..75f8418feb3 100644 --- a/app/routes/events/view/speakers/list.js +++ b/app/routes/events/view/speakers/list.js @@ -4,11 +4,11 @@ export default Route.extend({ titleToken() { switch (this.get('params.speakers_status')) { case 'pending': - return this.get('l10n').t('Pending'); + return this.l10n.t('Pending'); case 'accepted': - return this.get('l10n').t('Accepted'); + return this.l10n.t('Accepted'); case 'rejected': - return this.get('l10n').t('Rejected'); + return this.l10n.t('Rejected'); } }, async model(params) { diff --git a/app/routes/events/view/tickets.js b/app/routes/events/view/tickets.js index 3ab0746e693..f7b1cd073df 100644 --- a/app/routes/events/view/tickets.js +++ b/app/routes/events/view/tickets.js @@ -2,6 +2,6 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Tickets'); + return this.l10n.t('Tickets'); } }); diff --git a/app/routes/events/view/tickets/access-codes.js b/app/routes/events/view/tickets/access-codes.js index 30da3b0154f..8fbc6581c56 100644 --- a/app/routes/events/view/tickets/access-codes.js +++ b/app/routes/events/view/tickets/access-codes.js @@ -2,6 +2,6 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Access codes'); + return this.l10n.t('Access codes'); } }); diff --git a/app/routes/events/view/tickets/access-codes/create.js b/app/routes/events/view/tickets/access-codes/create.js index a1679be4a28..dacd2e34002 100644 --- a/app/routes/events/view/tickets/access-codes/create.js +++ b/app/routes/events/view/tickets/access-codes/create.js @@ -4,11 +4,11 @@ import RSVP from 'rsvp'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Create'); + return this.l10n.t('Create'); }, async model() { return RSVP.hash({ - accessCode: this.get('store').createRecord('access-code', { + accessCode: this.store.createRecord('access-code', { event : this.modelFor('events.view'), tickets : [], marketer : this.get('authManager.currentUser'), diff --git a/app/routes/events/view/tickets/access-codes/edit.js b/app/routes/events/view/tickets/access-codes/edit.js index f953bbc7f10..b932ecd8a68 100644 --- a/app/routes/events/view/tickets/access-codes/edit.js +++ b/app/routes/events/view/tickets/access-codes/edit.js @@ -4,8 +4,8 @@ import RSVP from 'rsvp'; export default Route.extend(AuthenticatedRouteMixin, { titleToken(model) { - var access_code = model.accessCode.get('code'); - return this.get('l10n').t(access_code.concat('-Edit')); + let access_code = model.accessCode.get('code'); + return this.l10n.t(access_code.concat('-Edit')); }, model(params) { return RSVP.hash({ diff --git a/app/routes/events/view/tickets/access-codes/list.js b/app/routes/events/view/tickets/access-codes/list.js index a948f05645d..42730d9c346 100644 --- a/app/routes/events/view/tickets/access-codes/list.js +++ b/app/routes/events/view/tickets/access-codes/list.js @@ -5,11 +5,11 @@ export default Route.extend({ titleToken() { switch (this.get('params.access_status')) { case 'active': - return this.get('l10n').t('Active'); + return this.l10n.t('Active'); case 'inactive': - return this.get('l10n').t('Inactive'); + return this.l10n.t('Inactive'); case 'expired': - return this.get('l10n').t('Expired'); + return this.l10n.t('Expired'); } }, async model(params) { diff --git a/app/routes/events/view/tickets/add-order.js b/app/routes/events/view/tickets/add-order.js index 8d2f618452c..121b87cf3b3 100644 --- a/app/routes/events/view/tickets/add-order.js +++ b/app/routes/events/view/tickets/add-order.js @@ -2,7 +2,7 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Add Order'); + return this.l10n.t('Add Order'); }, async model() { const eventDetails = this.modelFor('events.view'); diff --git a/app/routes/events/view/tickets/attendees.js b/app/routes/events/view/tickets/attendees.js index c9c34bf662f..691cf8add70 100644 --- a/app/routes/events/view/tickets/attendees.js +++ b/app/routes/events/view/tickets/attendees.js @@ -2,6 +2,6 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Attendees'); + return this.l10n.t('Attendees'); } }); diff --git a/app/routes/events/view/tickets/attendees/list.js b/app/routes/events/view/tickets/attendees/list.js index a09aae0be7a..8afabd01189 100644 --- a/app/routes/events/view/tickets/attendees/list.js +++ b/app/routes/events/view/tickets/attendees/list.js @@ -4,19 +4,19 @@ export default Route.extend({ titleToken() { switch (this.get('params.attendees_status')) { case 'placed': - return this.get('l10n').t('Placed'); + return this.l10n.t('Placed'); case 'pending': - return this.get('l10n').t('Pending'); + return this.l10n.t('Pending'); case 'expired': - return this.get('l10n').t('Expired'); + return this.l10n.t('Expired'); case 'cancelled': - return this.get('l10n').t('Cancelled'); + return this.l10n.t('Cancelled'); case 'checkedIn': - return this.get('l10n').t('Checked In'); + return this.l10n.t('Checked In'); case 'notCheckedIn': - return this.get('l10n').t('Not Checked In'); + return this.l10n.t('Not Checked In'); case 'all': - return this.get('l10n').t('All'); + return this.l10n.t('All'); } }, async model(params) { diff --git a/app/routes/events/view/tickets/discount-codes.js b/app/routes/events/view/tickets/discount-codes.js index b4197253401..b40884a773f 100644 --- a/app/routes/events/view/tickets/discount-codes.js +++ b/app/routes/events/view/tickets/discount-codes.js @@ -3,6 +3,6 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Discount codes'); + return this.l10n.t('Discount codes'); } }); diff --git a/app/routes/events/view/tickets/discount-codes/create.js b/app/routes/events/view/tickets/discount-codes/create.js index adf299abee3..76b54288e67 100644 --- a/app/routes/events/view/tickets/discount-codes/create.js +++ b/app/routes/events/view/tickets/discount-codes/create.js @@ -3,17 +3,17 @@ import moment from 'moment'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Create'); + return this.l10n.t('Create'); }, async model() { let tickets = await this.modelFor('events.view').query('tickets', {}); let event = this.modelFor('events.view'); return { - discountCode: this.get('store').createRecord('discount-code', { + discountCode: this.store.createRecord('discount-code', { event, tickets : [], usedFor : 'ticket', - marketer : this.get('authManager.currentUser') + marketer : this.authManager.currentUser }), tickets, event diff --git a/app/routes/events/view/tickets/discount-codes/edit.js b/app/routes/events/view/tickets/discount-codes/edit.js index 4f9a1663f4a..5aaff04cc2d 100644 --- a/app/routes/events/view/tickets/discount-codes/edit.js +++ b/app/routes/events/view/tickets/discount-codes/edit.js @@ -4,8 +4,8 @@ import RSVP from 'rsvp'; export default Route.extend(AuthenticatedRouteMixin, { titleToken(model) { - var discount_code = model.discountCode.get('code'); - return this.get('l10n').t(discount_code.concat('-Edit')); + let discount_code = model.discountCode.get('code'); + return this.l10n.t(discount_code.concat('-Edit')); }, model(params) { return RSVP.hash({ diff --git a/app/routes/events/view/tickets/discount-codes/list.js b/app/routes/events/view/tickets/discount-codes/list.js index 533b49386c6..331b92cb839 100644 --- a/app/routes/events/view/tickets/discount-codes/list.js +++ b/app/routes/events/view/tickets/discount-codes/list.js @@ -5,11 +5,11 @@ export default Route.extend({ titleToken() { switch (this.get('params.discount_status')) { case 'active': - return this.get('l10n').t('Active'); + return this.l10n.t('Active'); case 'inactive': - return this.get('l10n').t('Inactive'); + return this.l10n.t('Inactive'); case 'expired': - return this.get('l10n').t('Expired'); + return this.l10n.t('Expired'); } }, async model(params) { diff --git a/app/routes/events/view/tickets/index.js b/app/routes/events/view/tickets/index.js index 80748d1d958..2ccdd9ee3de 100644 --- a/app/routes/events/view/tickets/index.js +++ b/app/routes/events/view/tickets/index.js @@ -2,7 +2,7 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Overview'); + return this.l10n.t('Overview'); }, async model() { return { diff --git a/app/routes/events/view/tickets/order-form.js b/app/routes/events/view/tickets/order-form.js index 633d4c5d67a..1a7703541fa 100644 --- a/app/routes/events/view/tickets/order-form.js +++ b/app/routes/events/view/tickets/order-form.js @@ -4,7 +4,7 @@ import { A } from '@ember/array'; export default Route.extend(CustomFormMixin, { titleToken() { - return this.get('l10n').t('Order Form'); + return this.l10n.t('Order Form'); }, async model() { let filterOptions = [{ diff --git a/app/routes/events/view/tickets/orders.js b/app/routes/events/view/tickets/orders.js index bab4ca38969..79df5d0a41b 100644 --- a/app/routes/events/view/tickets/orders.js +++ b/app/routes/events/view/tickets/orders.js @@ -2,7 +2,7 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Orders'); + return this.l10n.t('Orders'); }, model() { return this.modelFor('events.view'); diff --git a/app/routes/events/view/tickets/orders/list.js b/app/routes/events/view/tickets/orders/list.js index 385c2f79b19..f68d6a28904 100644 --- a/app/routes/events/view/tickets/orders/list.js +++ b/app/routes/events/view/tickets/orders/list.js @@ -4,15 +4,15 @@ export default Route.extend({ titleToken() { switch (this.get('params.orders_status')) { case 'placed': - return this.get('l10n').t('Placed'); + return this.l10n.t('Placed'); case 'pending': - return this.get('l10n').t('Pending'); + return this.l10n.t('Pending'); case 'expired': - return this.get('l10n').t('Expired'); + return this.l10n.t('Expired'); case 'cancelled': - return this.get('l10n').t('Cancelled'); + return this.l10n.t('Cancelled'); case 'all': - return this.get('l10n').t('All'); + return this.l10n.t('All'); } }, diff --git a/app/routes/explore.js b/app/routes/explore.js index bbf56b34e57..f92ecd19c12 100644 --- a/app/routes/explore.js +++ b/app/routes/explore.js @@ -2,7 +2,7 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Explore'); + return this.l10n.t('Explore'); }, /** @@ -168,9 +168,9 @@ export default Route.extend({ actions: { async queryParamsDidChange(change, params) { - if (this.get('controller')) { - this.get('controller').set('filteredEvents', await this._loadEvents(params)); - this.get('controller').set('filters', params); + if (this.controller) { + this.controller.set('filteredEvents', await this._loadEvents(params)); + this.controller.set('filters', params); } } } diff --git a/app/routes/index.js b/app/routes/index.js index 807a2d9c04e..7b03897d5cf 100644 --- a/app/routes/index.js +++ b/app/routes/index.js @@ -141,8 +141,8 @@ export default Route.extend({ actions: { async queryParamsDidChange(change, params) { - if (this.get('controller')) { - this.get('controller').set('filteredEvents', await this._loadEvents(params)); + if (this.controller) { + this.controller.set('filteredEvents', await this._loadEvents(params)); } }, loading(transition) { diff --git a/app/routes/login.js b/app/routes/login.js index 038703a995c..bea0213ccdf 100644 --- a/app/routes/login.js +++ b/app/routes/login.js @@ -3,6 +3,6 @@ import UnauthenticatedRouteMixin from 'ember-simple-auth/mixins/unauthenticated- export default Route.extend(UnauthenticatedRouteMixin, { titleToken() { - return this.get('l10n').t('Login'); + return this.l10n.t('Login'); } }); diff --git a/app/routes/logout.js b/app/routes/logout.js index 8e05bdb7fc3..564e7ad13d6 100644 --- a/app/routes/logout.js +++ b/app/routes/logout.js @@ -3,7 +3,7 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout export default Route.extend(AuthenticatedRouteMixin, { beforeModel() { - this.get('authManager').logout(); + this.authManager.logout(); this.transitionTo('index'); } }); diff --git a/app/routes/my-sessions.js b/app/routes/my-sessions.js index 2d69bf613ba..2a2a1ec56b9 100644 --- a/app/routes/my-sessions.js +++ b/app/routes/my-sessions.js @@ -3,6 +3,6 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout export default Route.extend(AuthenticatedRouteMixin, { titleToken() { - return this.get('l10n').t('My sessions'); + return this.l10n.t('My sessions'); } }); diff --git a/app/routes/my-sessions/index.js b/app/routes/my-sessions/index.js index 214f77a5572..2fdef498acc 100644 --- a/app/routes/my-sessions/index.js +++ b/app/routes/my-sessions/index.js @@ -3,7 +3,7 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout export default Route.extend(AuthenticatedRouteMixin, { titleToken() { - return this.get('l10n').t('Upcoming'); + return this.l10n.t('Upcoming'); }, beforeModel() { this._super(...arguments); diff --git a/app/routes/my-sessions/list.js b/app/routes/my-sessions/list.js index ccd7fe3d72c..902925258c1 100644 --- a/app/routes/my-sessions/list.js +++ b/app/routes/my-sessions/list.js @@ -6,9 +6,9 @@ export default Route.extend(AuthenticatedRouteMixin, { titleToken() { switch (this.get('params.session_status')) { case 'upcoming': - return this.get('l10n').t('Upcoming'); + return this.l10n.t('Upcoming'); case 'past': - return this.get('l10n').t('Past'); + return this.l10n.t('Past'); } }, model(params) { @@ -49,7 +49,7 @@ export default Route.extend(AuthenticatedRouteMixin, { } ]; } - return this.get('authManager.currentUser').query('sessions', { + return this.authManager.currentUser.query('sessions', { include : 'event', filter : filterOptions, sort : 'starts-at' diff --git a/app/routes/my-sessions/view.js b/app/routes/my-sessions/view.js index e3f5677b0c3..92224308f89 100644 --- a/app/routes/my-sessions/view.js +++ b/app/routes/my-sessions/view.js @@ -3,7 +3,7 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout export default Route.extend(AuthenticatedRouteMixin, { titleToken() { - return this.get('l10n').t('Sessions'); + return this.l10n.t('Sessions'); }, model(params) { return this.store.findRecord('session', params.session_id, { diff --git a/app/routes/my-tickets.js b/app/routes/my-tickets.js index eb6cd9c5fd7..21029fcd7e8 100644 --- a/app/routes/my-tickets.js +++ b/app/routes/my-tickets.js @@ -3,6 +3,6 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout export default Route.extend(AuthenticatedRouteMixin, { titleToken() { - return this.get('l10n').t('My Tickets'); + return this.l10n.t('My Tickets'); } }); diff --git a/app/routes/my-tickets/past.js b/app/routes/my-tickets/past.js index 1936a439e4b..73fbcaf7c25 100644 --- a/app/routes/my-tickets/past.js +++ b/app/routes/my-tickets/past.js @@ -3,7 +3,7 @@ import moment from 'moment'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Past'); + return this.l10n.t('Past'); }, model() { let filterOptions = []; @@ -45,7 +45,7 @@ export default Route.extend({ ] } ); - return this.get('authManager.currentUser').query('orders', { + return this.authManager.currentUser.query('orders', { include : 'event', filter : filterOptions }); diff --git a/app/routes/my-tickets/upcoming.js b/app/routes/my-tickets/upcoming.js index 198dbd92a4e..5af5c0f72c3 100644 --- a/app/routes/my-tickets/upcoming.js +++ b/app/routes/my-tickets/upcoming.js @@ -2,6 +2,6 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Upcoming'); + return this.l10n.t('Upcoming'); } }); diff --git a/app/routes/my-tickets/upcoming/index.js b/app/routes/my-tickets/upcoming/index.js index 92052194f59..97430e1a77e 100644 --- a/app/routes/my-tickets/upcoming/index.js +++ b/app/routes/my-tickets/upcoming/index.js @@ -2,7 +2,7 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Completed'); + return this.l10n.t('Completed'); }, beforeModel() { this._super(...arguments); diff --git a/app/routes/my-tickets/upcoming/list.js b/app/routes/my-tickets/upcoming/list.js index 629c12c771b..a362c53885b 100644 --- a/app/routes/my-tickets/upcoming/list.js +++ b/app/routes/my-tickets/upcoming/list.js @@ -5,9 +5,9 @@ export default Route.extend({ titleToken() { switch (this.get('params.ticket_status')) { case 'completed': - return this.get('l10n').t('Completed'); + return this.l10n.t('Completed'); case 'open': - return this.get('l10n').t('Open'); + return this.l10n.t('Open'); } }, model(params) { @@ -74,7 +74,7 @@ export default Route.extend({ } ); } - return this.get('authManager.currentUser').query('orders', { + return this.authManager.currentUser.query('orders', { include : 'event', filter : filterOptions }); diff --git a/app/routes/not-found.js b/app/routes/not-found.js index ea183ad0974..8a97ab38be2 100644 --- a/app/routes/not-found.js +++ b/app/routes/not-found.js @@ -2,6 +2,6 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Page Not Found'); + return this.l10n.t('Page Not Found'); } }); diff --git a/app/routes/notifications.js b/app/routes/notifications.js index 878d2ada4e8..e3a64bcb6dc 100644 --- a/app/routes/notifications.js +++ b/app/routes/notifications.js @@ -3,6 +3,6 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout export default Route.extend(AuthenticatedRouteMixin, { titleToken() { - return this.get('l10n').t('Notifications'); + return this.l10n.t('Notifications'); } }); diff --git a/app/routes/notifications/all.js b/app/routes/notifications/all.js index 86a23560b2f..3ad84d562fb 100644 --- a/app/routes/notifications/all.js +++ b/app/routes/notifications/all.js @@ -4,9 +4,9 @@ export default Route.extend({ titleToken() { switch (this.get('params.notification_state')) { case 'unread': - return this.get('l10n').t('Unread'); + return this.l10n.t('Unread'); case 'all': - return this.get('l10n').t('All'); + return this.l10n.t('All'); } }, async model(params) { @@ -28,7 +28,7 @@ export default Route.extend({ data.unread = true; } - data.notifications = await this.get('authManager.currentUser').query('notifications', { + data.notifications = await this.authManager.currentUser.query('notifications', { include : 'notification-actions', sort : '-received-at', filter : filterOptions diff --git a/app/routes/orders.js b/app/routes/orders.js index 798329e3dee..b45a118a92f 100644 --- a/app/routes/orders.js +++ b/app/routes/orders.js @@ -3,6 +3,6 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout export default Route.extend(AuthenticatedRouteMixin, { titleToken() { - return this.get('l10n').t('Orders'); + return this.l10n.t('Orders'); } }); diff --git a/app/routes/orders/expired.js b/app/routes/orders/expired.js index 3df072ae0c5..b5a14063def 100644 --- a/app/routes/orders/expired.js +++ b/app/routes/orders/expired.js @@ -2,8 +2,8 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken(model) { - var order = model.get('identifier'); - return this.get('l10n').t(`Expired Order -${order}`); + let order = model.get('identifier'); + return this.l10n.t(`Expired Order -${order}`); }, model(params) { diff --git a/app/routes/orders/new.js b/app/routes/orders/new.js index f131d559ce1..cf8b8235e00 100644 --- a/app/routes/orders/new.js +++ b/app/routes/orders/new.js @@ -3,8 +3,8 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken(model) { - var order = model.order.get('identifier'); - return this.get('l10n').t(`New Order -${order}`); + let order = model.order.get('identifier'); + return this.l10n.t(`New Order -${order}`); }, async model(params) { diff --git a/app/routes/orders/pending.js b/app/routes/orders/pending.js deleted file mode 100644 index 74a276f82c2..00000000000 --- a/app/routes/orders/pending.js +++ /dev/null @@ -1,33 +0,0 @@ -import Route from '@ember/routing/route'; - -export default Route.extend({ - titleToken(model) { - var order = model.order.get('identifier'); - return this.get('l10n').t(`Pending Order -${order}`); - }, - - async model(params) { - const order = await this.store.findRecord('order', params.order_id, { - include : 'attendees,tickets,event', - reload : true - }); - const eventDetails = await order.query('event', { include: 'tax' }); - return { - order, - form: await eventDetails.query('customForms', { - 'page[size]' : 50, - sort : 'id' - }) - }; - }, - - afterModel(model) { - if (model.order.get('status') === 'expired') { - this.transitionTo('orders.expired', model.order.get('identifier')); - } else if (model.order.get('status') === 'completed' || model.order.get('status') === 'placed') { - this.transitionTo('orders.view', model.order.get('identifier')); - } else if (model.order.get('status') === 'pending') { - this.transitionTo('orders.pending', model.order.get('identifier')); - } - } -}); diff --git a/app/routes/orders/view.js b/app/routes/orders/view.js index bfc029d755a..566878e92d5 100644 --- a/app/routes/orders/view.js +++ b/app/routes/orders/view.js @@ -2,7 +2,7 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken(model) { - var order = model.order.get('identifier'); + let order = model.order.get('identifier'); if (model.order.status === 'completed') { return this.l10n.t(`Completed Order -${order}`); } else if (model.order.status === 'placed') { diff --git a/app/routes/pages.js b/app/routes/pages.js index 5e0f004aa9a..f7f1e4fd03d 100644 --- a/app/routes/pages.js +++ b/app/routes/pages.js @@ -2,7 +2,7 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Pages'); + return this.l10n.t('Pages'); }, model(params) { return this.modelFor('application').pages.findBy('url', params.path); diff --git a/app/routes/profile.js b/app/routes/profile.js index 644542de5ac..983cb12835c 100644 --- a/app/routes/profile.js +++ b/app/routes/profile.js @@ -3,7 +3,7 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout export default Route.extend(AuthenticatedRouteMixin, { titleToken() { - return this.get('l10n').t('Profile'); + return this.l10n.t('Profile'); }, model() { diff --git a/app/routes/public/cfs.js b/app/routes/public/cfs.js index 7ad70c95fba..ed741e163a3 100644 --- a/app/routes/public/cfs.js +++ b/app/routes/public/cfs.js @@ -2,6 +2,6 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Call for Speakers'); + return this.l10n.t('Call for Speakers'); } }); diff --git a/app/routes/public/cfs/edit-session.js b/app/routes/public/cfs/edit-session.js index 8d7f95d3747..ac64569ebd0 100644 --- a/app/routes/public/cfs/edit-session.js +++ b/app/routes/public/cfs/edit-session.js @@ -2,7 +2,7 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Edit Session'); + return this.l10n.t('Edit Session'); }, async model(params) { @@ -13,7 +13,7 @@ export default Route.extend({ sort : 'id', 'page[size]' : 50 }), - session: await this.get('store').findRecord('session', params.session_id, { + session: await this.store.findRecord('session', params.session_id, { include: 'session-type,track' }) }; diff --git a/app/routes/public/cfs/edit-speaker.js b/app/routes/public/cfs/edit-speaker.js index a4186c28d57..c0e91330fde 100644 --- a/app/routes/public/cfs/edit-speaker.js +++ b/app/routes/public/cfs/edit-speaker.js @@ -2,7 +2,7 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Edit Speaker'); + return this.l10n.t('Edit Speaker'); }, async model(params) { @@ -13,7 +13,7 @@ export default Route.extend({ sort : 'id', 'page[size]' : 50 }), - speaker: await this.get('store').findRecord('speaker', params.speaker_id) + speaker: await this.store.findRecord('speaker', params.speaker_id) }; } }); diff --git a/app/routes/public/cfs/index.js b/app/routes/public/cfs/index.js index 205c06d00cd..62d22435dd1 100644 --- a/app/routes/public/cfs/index.js +++ b/app/routes/public/cfs/index.js @@ -2,7 +2,7 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Call for Speakers'); + return this.l10n.t('Call for Speakers'); }, async beforeModel(transition) { @@ -17,7 +17,7 @@ export default Route.extend({ - CFS is private and a valid hash is entered */ if (!speakersCall.announcement) { - this.get('notify').error(this.get('l10n').t('Call For Speakers has not been issued yet.')); + this.notify.error(this.l10n.t('Call For Speakers has not been issued yet.')); this.transitionTo('public', eventDetails.identifier); } if (!((speakersCall.privacy === 'public' && (!hash || speakersCall.hash === hash)) || (speakersCall.privacy === 'private' && hash === speakersCall.hash))) { diff --git a/app/routes/public/cfs/new-session.js b/app/routes/public/cfs/new-session.js index 7acd1e7fc54..ef243229b7b 100644 --- a/app/routes/public/cfs/new-session.js +++ b/app/routes/public/cfs/new-session.js @@ -2,7 +2,7 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('New Session'); + return this.l10n.t('New Session'); }, async model() { @@ -13,7 +13,7 @@ export default Route.extend({ sort : 'id', 'page[size]' : 50 }), - session: await this.get('store').createRecord('session', { + session: await this.store.createRecord('session', { event : eventDetails, creator : this.get('authManager.currentUser') }), diff --git a/app/routes/public/cfs/new-speaker.js b/app/routes/public/cfs/new-speaker.js index 2801b9e372b..cade50e6f84 100644 --- a/app/routes/public/cfs/new-speaker.js +++ b/app/routes/public/cfs/new-speaker.js @@ -2,7 +2,7 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('New Speaker'); + return this.l10n.t('New Speaker'); }, async model() { @@ -18,7 +18,7 @@ export default Route.extend({ sort : 'id', 'page[size]' : 50 }), - speaker: await this.get('store').createRecord('speaker', { + speaker: await this.store.createRecord('speaker', { email : currentUser.email, name : userName, photoUrl : currentUser.avatarUrl, diff --git a/app/routes/public/coc.js b/app/routes/public/coc.js index 8c54466fe2a..23161e94d56 100644 --- a/app/routes/public/coc.js +++ b/app/routes/public/coc.js @@ -2,6 +2,6 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Code of Conduct'); + return this.l10n.t('Code of Conduct'); } }); diff --git a/app/routes/public/index.js b/app/routes/public/index.js index 29d3917642e..0bdcfbbf20a 100644 --- a/app/routes/public/index.js +++ b/app/routes/public/index.js @@ -1,10 +1,8 @@ import Route from '@ember/routing/route'; import moment from 'moment'; -import Ember from 'ember'; +import { set } from '@ember/object'; import { inject as service } from '@ember/service'; -const { set } = Ember; - export default Route.extend({ headData: service(), async model() { diff --git a/app/routes/public/role-invites.js b/app/routes/public/role-invites.js index d587767f2fa..5355c1f1145 100644 --- a/app/routes/public/role-invites.js +++ b/app/routes/public/role-invites.js @@ -7,23 +7,23 @@ export default Route.extend({ token: transition.queryParams.token } }; - this.get('loader') + this.loader .post('/role_invites/user', payload) .then(user => { if (this.get('session.isAuthenticated')) { if (this.get('authManager.currentUser.email') === user.email) { - this.get('loader') + this.loader .post('/role_invites/accept-invite', payload) .then(invite => { this.transitionTo('events.view', invite.event); }) .catch(e => { - this.get('notify').error(this.get('l10n').t('An unexpected error has occurred')); + this.notify.error(this.l10n.t('An unexpected error has occurred')); console.warn(e); }); } else { this.set('session.skipRedirectOnInvalidation', true); - this.get('session').invalidate(); + this.session.invalidate(); this.transitionTo('register', { queryParams: { event : `${transition.params.public.event_id}`, @@ -44,7 +44,7 @@ export default Route.extend({ } }) .catch(e => { - this.get('notify').error(this.get('l10n').t('An unexpected error has occurred')); + this.notify.error(this.l10n.t('An unexpected error has occurred')); console.warn(e); }); } diff --git a/app/routes/public/schedule.js b/app/routes/public/schedule.js index 57a3aeb07ca..b2e886bd63f 100644 --- a/app/routes/public/schedule.js +++ b/app/routes/public/schedule.js @@ -2,7 +2,7 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Schedule'); + return this.l10n.t('Schedule'); }, async model() { diff --git a/app/routes/public/sessions.js b/app/routes/public/sessions.js index 9b7a3fc908e..7fdce30055a 100644 --- a/app/routes/public/sessions.js +++ b/app/routes/public/sessions.js @@ -2,6 +2,6 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Sessions'); + return this.l10n.t('Sessions'); } }); diff --git a/app/routes/public/sessions/list.js b/app/routes/public/sessions/list.js index b90deb7ec0f..78e5612d6e3 100644 --- a/app/routes/public/sessions/list.js +++ b/app/routes/public/sessions/list.js @@ -5,20 +5,20 @@ export default Route.extend({ titleToken() { switch (this.get('params.session_status')) { case 'all': - return this.get('l10n').t('All sessions'); + return this.l10n.t('All sessions'); case 'today': - return this.get('l10n').t('Today\'s Sessions'); + return this.l10n.t('Today\'s Sessions'); case 'week': - return this.get('l10n').t('Week\'s Sessions'); + return this.l10n.t('Week\'s Sessions'); case 'month': - return this.get('l10n').t('Month\'s Sessions'); + return this.l10n.t('Month\'s Sessions'); } }, async model(params) { const eventDetails = this.modelFor('public'); let sessions = null; if (params.session_status === 'today') { - sessions = await this.get('store').query('session', { + sessions = await this.store.query('session', { filter: [ { and: [ @@ -60,7 +60,7 @@ export default Route.extend({ ] }); } else if (params.session_status === 'week') { - sessions = await this.get('store').query('session', { + sessions = await this.store.query('session', { filter: [ { and: [ @@ -102,7 +102,7 @@ export default Route.extend({ ] }); } else if (params.session_status === 'month') { - sessions = await this.get('store').query('session', { + sessions = await this.store.query('session', { filter: [ { and: [ @@ -144,7 +144,7 @@ export default Route.extend({ ] }); } else { - sessions = await this.get('store').query('session', { + sessions = await this.store.query('session', { filter: [ { and: [ diff --git a/app/routes/register.js b/app/routes/register.js index ef56a7095f1..a7196ef9de4 100644 --- a/app/routes/register.js +++ b/app/routes/register.js @@ -3,7 +3,7 @@ import UnauthenticatedRouteMixin from 'ember-simple-auth/mixins/unauthenticated- export default Route.extend(UnauthenticatedRouteMixin, { titleToken() { - return this.get('l10n').t('Register'); + return this.l10n.t('Register'); }, model() { return this.store.createRecord('user'); diff --git a/app/routes/reset-password.js b/app/routes/reset-password.js index 185a6460a64..7cef5a57f56 100644 --- a/app/routes/reset-password.js +++ b/app/routes/reset-password.js @@ -2,12 +2,12 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Reset Password'); + return this.l10n.t('Reset Password'); }, beforeModel() { if (this.get('session.isAuthenticated')) { this.set('session.skipRedirectOnInvalidation', true); - this.get('authManager').logout(); + this.authManager.logout(); } }, afterModel() { diff --git a/app/routes/settings.js b/app/routes/settings.js index 4e6711f93b6..3846e4efb38 100644 --- a/app/routes/settings.js +++ b/app/routes/settings.js @@ -2,6 +2,6 @@ import Route from '@ember/routing/route'; export default Route.extend({ titleToken() { - return this.get('l10n').t('Settings'); + return this.l10n.t('Settings'); } }); diff --git a/app/routes/settings/applications.js b/app/routes/settings/applications.js index 3cbb6f40f82..f2813b14c0e 100644 --- a/app/routes/settings/applications.js +++ b/app/routes/settings/applications.js @@ -3,7 +3,7 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout export default Route.extend(AuthenticatedRouteMixin, { titleToken() { - return this.get('l10n').t('Applications'); + return this.l10n.t('Applications'); }, model() { return this.get('authManager.currentUser'); diff --git a/app/routes/settings/contact-info.js b/app/routes/settings/contact-info.js index b47f270f6f6..9364f0b9284 100644 --- a/app/routes/settings/contact-info.js +++ b/app/routes/settings/contact-info.js @@ -3,7 +3,7 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout export default Route.extend(AuthenticatedRouteMixin, { titleToken() { - return this.get('l10n').t('Contact Info'); + return this.l10n.t('Contact Info'); }, model() { return this.get('authManager.currentUser'); diff --git a/app/routes/settings/danger-zone.js b/app/routes/settings/danger-zone.js index 7c9600cd6e9..a5985704516 100644 --- a/app/routes/settings/danger-zone.js +++ b/app/routes/settings/danger-zone.js @@ -3,7 +3,7 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout export default Route.extend(AuthenticatedRouteMixin, { titleToken() { - return this.get('l10n').t('Danger Zone'); + return this.l10n.t('Danger Zone'); }, async model() { diff --git a/app/routes/settings/email-preferences.js b/app/routes/settings/email-preferences.js index 2f81afa9f8c..336385d3ab7 100644 --- a/app/routes/settings/email-preferences.js +++ b/app/routes/settings/email-preferences.js @@ -3,9 +3,9 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout export default Route.extend(AuthenticatedRouteMixin, { titleToken() { - return this.get('l10n').t('Email Preferences'); + return this.l10n.t('Email Preferences'); }, model() { - return this.get('authManager.currentUser').query('emailNotifications', { include: 'event' }); + return this.authManager.currentUser.query('emailNotifications', { include: 'event' }); } }); diff --git a/app/routes/settings/password.js b/app/routes/settings/password.js index d60930c081d..8290582b3af 100644 --- a/app/routes/settings/password.js +++ b/app/routes/settings/password.js @@ -3,6 +3,6 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout export default Route.extend(AuthenticatedRouteMixin, { titleToken() { - return this.get('l10n').t('Password'); + return this.l10n.t('Password'); } }); diff --git a/app/routes/verify.js b/app/routes/verify.js index b5980e1c606..f4d2cdf4260 100644 --- a/app/routes/verify.js +++ b/app/routes/verify.js @@ -3,7 +3,7 @@ import UnauthenticatedRouteMixin from 'ember-simple-auth/mixins/unauthenticated- export default Route.extend(UnauthenticatedRouteMixin, { titleToken() { - return this.get('l10n').t('Verify'); + return this.l10n.t('Verify'); }, beforeModel(transition) { diff --git a/app/serializers/user.js b/app/serializers/user.js index fbce00388de..6f2bb1adbb1 100644 --- a/app/serializers/user.js +++ b/app/serializers/user.js @@ -1,5 +1,5 @@ import ApplicationSerializer from 'open-event-frontend/serializers/application'; -import { pick, omit } from 'lodash'; +import { pick, omit } from 'lodash-es'; export default ApplicationSerializer.extend({ serialize(snapshot, options) { diff --git a/app/services/auth-manager.js b/app/services/auth-manager.js index 62bd28682e1..ad359f5fcbc 100644 --- a/app/services/auth-manager.js +++ b/app/services/auth-manager.js @@ -1,7 +1,7 @@ import { observer, computed } from '@ember/object'; import Service, { inject as service } from '@ember/service'; import { camelize } from '@ember/string'; -import { mapKeys } from 'lodash'; +import { mapKeys } from 'lodash-es'; export default Service.extend({ @@ -10,11 +10,11 @@ export default Service.extend({ store : service(), currentUser: computed('session.data.currentUserFallback.id', 'currentUserModel', function() { - if (this.get('currentUserModel')) { - return this.get('currentUserModel'); + if (this.currentUserModel) { + return this.currentUserModel; } if (this.get('session.data.currentUserFallback')) { - let userModel = this.get('store').peekRecord('user', this.get('session.data.currentUserFallback.id')); + let userModel = this.store.peekRecord('user', this.get('session.data.currentUserFallback.id')); if (!userModel) { return this.restoreCurrentUser(); } @@ -30,7 +30,7 @@ export default Service.extend({ }), currentUserChangeListener: observer('currentUser', function() { - if (this.get('currentUser') && this.get('session.isAuthenticated')) { + if (this.currentUser && this.get('session.isAuthenticated')) { this.identify(); } }), @@ -44,34 +44,33 @@ export default Service.extend({ }, logout() { - this.get('session').invalidate(); + this.session.invalidate(); this.set('currentUserModel', null); - this.get('session').set('data.currentUserFallback', null); + this.session.set('data.currentUserFallback', null); }, identify() { - let currentUser = this.get('currentUser'); - if (currentUser) { - this.get('metrics').identify({ - distinctId : currentUser.id, - email : currentUser.email + if (this.currentUser) { + this.metrics.identify({ + distinctId : this.currentUser.id, + email : this.currentUser.email }); } }, identifyStranger() { - this.get('metrics').identify(null); + this.metrics.identify(null); }, persistCurrentUser(user = null) { if (!user) { - user = this.get('currentUserModel'); + user = this.currentUserModel; } else { this.set('currentUserModel', user); } let userData = user.serialize(false).data.attributes; userData.id = user.get('id'); - this.get('session').set('data.currentUserFallback', userData); + this.session.set('data.currentUserFallback', userData); }, restoreCurrentUser(data = null) { @@ -84,14 +83,14 @@ export default Service.extend({ if (!data.email) { data.email = null; } - this.get('store').push({ + this.store.push({ data: { id : userId, type : 'user', attributes : data } }); - let userModel = this.get('store').peekRecord('user', userId); + let userModel = this.store.peekRecord('user', userId); this.set('currentUserModel', userModel); return userModel; }, @@ -99,7 +98,7 @@ export default Service.extend({ async initialize() { if (this.get('session.isAuthenticated')) { if (this.get('session.data.currentUserFallback.id')) { - const user = await this.get('store').findRecord('user', this.get('session.data.currentUserFallback.id')); + const user = await this.store.findRecord('user', this.get('session.data.currentUserFallback.id')); this.set('currentUserModel', user); this.identify(); } else { diff --git a/app/services/device.js b/app/services/device.js index 854272ba6b0..5000d087e9e 100644 --- a/app/services/device.js +++ b/app/services/device.js @@ -3,7 +3,7 @@ import Service from '@ember/service'; import { computed } from '@ember/object'; import { equal, or } from '@ember/object/computed'; import { debounce } from '@ember/runloop'; -import { forOwn } from 'lodash'; +import { forOwn } from 'lodash-es'; import { inject as service } from '@ember/service'; /** @@ -38,9 +38,8 @@ export default Service.extend({ deviceType: computed('currentWidth', function() { let deviceType = 'computer'; - const currentWidth = this.get('currentWidth'); forOwn(breakpoints, (value, key) => { - if (currentWidth >= value.min && (!value.hasOwnProperty('max') || currentWidth <= value.max)) { + if (this.currentWidth >= value.min && (!value.hasOwnProperty('max') || this.currentWidth <= value.max)) { deviceType = key; } }); @@ -90,7 +89,7 @@ export default Service.extend({ $(window).resize(() => { debounce(() => { - if (!(this.get('isDestroyed') || this.get('isDestroying'))) { + if (!(this.isDestroyed || this.isDestroying)) { this.set('currentWidth', document.body.clientWidth); } }, 200); diff --git a/app/services/l10n.js b/app/services/l10n.js index 449db44310d..5ff3a232152 100644 --- a/app/services/l10n.js +++ b/app/services/l10n.js @@ -35,7 +35,7 @@ export default L10n.extend({ switchLanguage(locale) { this.setLocale(locale); - this.get('cookies').write(this.localStorageKey, locale); + this.cookies.write(this.localStorageKey, locale); if (!this.get('fastboot.isFastBoot')) { location.reload(); } @@ -43,7 +43,7 @@ export default L10n.extend({ init() { this._super(...arguments); - const currentLocale = this.get('cookies').read(this.localStorageKey); + const currentLocale = this.cookies.read(this.localStorageKey); const detectedLocale = this.detectLocale(); if (currentLocale) { this.setLocale(currentLocale); diff --git a/app/services/loader.js b/app/services/loader.js index f0715a53992..56a62076bdc 100644 --- a/app/services/loader.js +++ b/app/services/loader.js @@ -3,10 +3,10 @@ import { getOwner } from '@ember/application'; import $ from 'jquery'; import { getErrorMessage } from 'open-event-frontend/utils/errors'; import { buildUrl } from 'open-event-frontend/utils/url'; -import httpStatus from 'npm:http-status'; -import objectToFormData from 'npm:object-to-formdata'; +import httpStatus from 'http-status'; +import objectToFormData from 'object-to-formdata'; import fetch from 'fetch'; -import { clone, assign, merge } from 'lodash'; +import { clone, assign, merge } from 'lodash-es'; const bodyAllowedIn = ['PATCH', 'POST', 'PUT']; export default Service.extend({ diff --git a/app/services/sanitizer.js b/app/services/sanitizer.js index 5f5c654fedb..a7585849581 100644 --- a/app/services/sanitizer.js +++ b/app/services/sanitizer.js @@ -1,5 +1,5 @@ import Service from '@ember/service'; -import sanitizeHtml from 'npm:sanitize-html'; +import sanitizeHtml from 'sanitize-html'; export default Service.extend({ diff --git a/app/services/settings.js b/app/services/settings.js index f30f9bf9b0d..9e143618378 100644 --- a/app/services/settings.js +++ b/app/services/settings.js @@ -13,7 +13,7 @@ export default Service.extend({ * Reload settings when the authentication state changes. */ _authenticationObserver: observer('session.isAuthenticated', function() { - this.get('_lastPromise') + this._lastPromise .then(() => this.set('_lastPromise', this._loadSettings())) .catch(() => this.set('_lastPromise', this._loadSettings())); }), @@ -25,8 +25,8 @@ export default Service.extend({ * @private */ async _loadSettings() { - const settingsModel = await this.get('store').queryRecord('setting', {}); - this.get('store').modelFor('setting').eachAttribute(attributeName => { + const settingsModel = await this.store.queryRecord('setting', {}); + this.store.modelFor('setting').eachAttribute(attributeName => { this.set(attributeName, settingsModel.get(attributeName)); }); }, diff --git a/app/templates/admin/sales/discounted-events.hbs b/app/templates/admin/sales/discounted-events.hbs index 110044c329f..0d34c81e0df 100644 --- a/app/templates/admin/sales/discounted-events.hbs +++ b/app/templates/admin/sales/discounted-events.hbs @@ -63,19 +63,19 @@ {{entry.sales.completed.ticket_count}}