-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Convert components to ES6 classes
- Loading branch information
1 parent
33b228a
commit 3a77a26
Showing
173 changed files
with
1,458 additions
and
1,097 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,50 @@ | ||
import Component from '@ember/component'; | ||
import classic from 'ember-classic-decorator'; | ||
import { action } from '@ember/object'; | ||
import { inject as service } from '@ember/service'; | ||
import Component from '@ember/component'; | ||
|
||
export default Component.extend({ | ||
torii: service(), | ||
@classic | ||
export default class ApplicationSection extends Component { | ||
@service | ||
torii; | ||
|
||
isLoading: false, | ||
isLoading = false; | ||
|
||
actions: { | ||
auth(provider) { | ||
try { | ||
if (provider === 'facebook') { | ||
this.torii.open('facebook').then(authData => { | ||
this.set('isLoading', true); | ||
this.loader.load(`/auth/oauth/login/${ provider }/${ authData.authorizationCode }/?redirect_uri=${ authData.redirectUri}`) | ||
.then(async response => { | ||
let credentials = { | ||
'username' : response.email, | ||
'password' : response.facebook_login_hash | ||
}; | ||
@action | ||
auth(provider) { | ||
try { | ||
if (provider === 'facebook') { | ||
this.torii.open('facebook').then(authData => { | ||
this.set('isLoading', true); | ||
this.loader.load(`/auth/oauth/login/${ provider }/${ authData.authorizationCode }/?redirect_uri=${ authData.redirectUri}`) | ||
.then(async response => { | ||
let credentials = { | ||
'username' : response.email, | ||
'password' : response.facebook_login_hash | ||
}; | ||
|
||
let authenticator = 'authenticator:jwt'; | ||
this.session | ||
.authenticate(authenticator, credentials) | ||
.then(async() => { | ||
const tokenPayload = this.authManager.getTokenPayload(); | ||
if (tokenPayload) { | ||
this.authManager.persistCurrentUser( | ||
await this.store.findRecord('user', tokenPayload.identity) | ||
); | ||
this.set('data', this.authManager.currentUser); | ||
} | ||
let authenticator = 'authenticator:jwt'; | ||
this.session | ||
.authenticate(authenticator, credentials) | ||
.then(async() => { | ||
const tokenPayload = this.authManager.getTokenPayload(); | ||
if (tokenPayload) { | ||
this.authManager.persistCurrentUser( | ||
await this.store.findRecord('user', tokenPayload.identity) | ||
); | ||
this.set('data', this.authManager.currentUser); | ||
} | ||
|
||
this.set('isLoading', false); | ||
}); | ||
}); | ||
}); | ||
} | ||
} catch (error) { | ||
this.notify.error(this.l10n.t(error.message), { | ||
id: 'error_message' | ||
this.set('isLoading', false); | ||
}); | ||
}); | ||
}); | ||
this.set('isLoading', false); | ||
} | ||
} catch (error) { | ||
this.notify.error(this.l10n.t(error.message), { | ||
id: 'error_message' | ||
}); | ||
this.set('isLoading', false); | ||
} | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,60 @@ | ||
import { computed } from '@ember/object'; | ||
import classic from 'ember-classic-decorator'; | ||
import { action, computed } from '@ember/object'; | ||
import Component from '@ember/component'; | ||
|
||
export default Component.extend({ | ||
|
||
isUserDeletable: computed('data.events', 'data.orders', function() { | ||
@classic | ||
export default class DangerZone extends Component { | ||
@computed('data.events', 'data.orders') | ||
get isUserDeletable() { | ||
if (this.data.events.length || this.data.orders.length) { | ||
return false; | ||
} | ||
return true; | ||
}), | ||
} | ||
|
||
actions: { | ||
openDeleteUserModal(id, email) { | ||
this.setProperties({ | ||
'isUserDeleteModalOpen' : true, | ||
'confirmEmail' : '', | ||
'userEmail' : email, | ||
'userId' : id | ||
}); | ||
}, | ||
openConfirmDeleteUserModal() { | ||
this.setProperties({ | ||
'isUserDeleteModalOpen' : false, | ||
'confirmEmail' : '', | ||
'isConfirmUserDeleteModalOpen' : true, | ||
'checked' : false | ||
}); | ||
}, | ||
deleteUser(user) { | ||
this.set('isLoading', true); | ||
user.destroyRecord() | ||
.then(() => { | ||
this.authManager.logout(); | ||
this.routing.transitionTo('index'); | ||
this.notify.success(this.l10n.t('Your account has been deleted successfully.'), { | ||
id: 'account_Delete' | ||
}); | ||
}) | ||
.catch(e => { | ||
console.error('Error while deleting account', e); | ||
this.notify.error(this.l10n.t('An unexpected error has occurred.'), { | ||
id: 'account_del_error' | ||
}); | ||
}) | ||
.finally(() => { | ||
this.setProperties({ | ||
'isLoading' : false, | ||
'isConfirmUserDeleteModalOpen' : false, | ||
'checked' : false | ||
}); | ||
@action | ||
openDeleteUserModal(id, email) { | ||
this.setProperties({ | ||
'isUserDeleteModalOpen' : true, | ||
'confirmEmail' : '', | ||
'userEmail' : email, | ||
'userId' : id | ||
}); | ||
} | ||
|
||
@action | ||
openConfirmDeleteUserModal() { | ||
this.setProperties({ | ||
'isUserDeleteModalOpen' : false, | ||
'confirmEmail' : '', | ||
'isConfirmUserDeleteModalOpen' : true, | ||
'checked' : false | ||
}); | ||
} | ||
|
||
@action | ||
deleteUser(user) { | ||
this.set('isLoading', true); | ||
user.destroyRecord() | ||
.then(() => { | ||
this.authManager.logout(); | ||
this.routing.transitionTo('index'); | ||
this.notify.success(this.l10n.t('Your account has been deleted successfully.'), { | ||
id: 'account_Delete' | ||
}); | ||
} | ||
}) | ||
.catch(e => { | ||
console.error('Error while deleting account', e); | ||
this.notify.error(this.l10n.t('An unexpected error has occurred.'), { | ||
id: 'account_del_error' | ||
}); | ||
}) | ||
.finally(() => { | ||
this.setProperties({ | ||
'isLoading' : false, | ||
'isConfirmUserDeleteModalOpen' : false, | ||
'checked' : false | ||
}); | ||
}); | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
import classic from 'ember-classic-decorator'; | ||
import { action } from '@ember/object'; | ||
import Component from '@ember/component'; | ||
|
||
export default Component.extend({ | ||
actions: { | ||
savePreference(emailPreference) { | ||
emailPreference.save() | ||
.then(() => { | ||
this.notify.success(this.l10n.t('Email notifications updated successfully'), { | ||
id: 'email_notif' | ||
}); | ||
}) | ||
.catch(e => { | ||
console.error('Error while updating email notifications.', e); | ||
emailPreference.rollbackAttributes(); | ||
this.notify.error(this.l10n.t('An unexpected error occurred.'), { | ||
id: 'email_error' | ||
}); | ||
@classic | ||
export default class EmailPreferencesSection extends Component { | ||
@action | ||
savePreference(emailPreference) { | ||
emailPreference.save() | ||
.then(() => { | ||
this.notify.success(this.l10n.t('Email notifications updated successfully'), { | ||
id: 'email_notif' | ||
}); | ||
} | ||
}) | ||
.catch(e => { | ||
console.error('Error while updating email notifications.', e); | ||
emailPreference.rollbackAttributes(); | ||
this.notify.error(this.l10n.t('An unexpected error occurred.'), { | ||
id: 'email_error' | ||
}); | ||
}); | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,23 @@ | ||
import Component from '@ember/component'; | ||
import classic from 'ember-classic-decorator'; | ||
import { computed } from '@ember/object'; | ||
import Component from '@ember/component'; | ||
|
||
export default Component.extend({ | ||
@classic | ||
export default class CreateSessionMessage extends Component { | ||
isMessageVisible = true; | ||
|
||
isMessageVisible : true, | ||
shouldShowMessage : computed('session.isAuthenticated', 'isMessageVisible', 'isNewSpeaker', 'isNewSession', function() { | ||
@computed( | ||
'session.isAuthenticated', | ||
'isMessageVisible', | ||
'isNewSpeaker', | ||
'isNewSession' | ||
) | ||
get shouldShowMessage() { | ||
let speakerIDlength = this.data.userSpeaker ? this.data.userSpeaker.toArray().length : 0; | ||
return this.session.isAuthenticated | ||
&& this.isMessageVisible | ||
&& !this.isNewSpeaker | ||
&& this.isNewSession | ||
&& (speakerIDlength > 0); | ||
}) | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import classic from 'ember-classic-decorator'; | ||
import Component from '@ember/component'; | ||
|
||
export default Component.extend({ | ||
}); | ||
@classic | ||
export default class ForbiddenError extends Component {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import classic from 'ember-classic-decorator'; | ||
import Component from '@ember/component'; | ||
|
||
export default Component.extend({ | ||
}); | ||
@classic | ||
export default class GenericError extends Component {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import classic from 'ember-classic-decorator'; | ||
import Component from '@ember/component'; | ||
|
||
export default Component.extend({ | ||
}); | ||
@classic | ||
export default class NotFound extends Component {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import classic from 'ember-classic-decorator'; | ||
import Component from '@ember/component'; | ||
|
||
export default Component.extend({ | ||
}); | ||
@classic | ||
export default class ServerError extends Component {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import classic from 'ember-classic-decorator'; | ||
import Component from '@ember/component'; | ||
|
||
export default Component.extend({ | ||
}); | ||
@classic | ||
export default class BillingInfo extends Component {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import classic from 'ember-classic-decorator'; | ||
import Component from '@ember/component'; | ||
|
||
export default Component.extend({ | ||
}); | ||
@classic | ||
export default class EventInfo extends Component {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import classic from 'ember-classic-decorator'; | ||
import Component from '@ember/component'; | ||
|
||
export default Component.extend({ | ||
}); | ||
@classic | ||
export default class InvoiceSummary extends Component {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import classic from 'ember-classic-decorator'; | ||
import Component from '@ember/component'; | ||
|
||
export default Component.extend({ | ||
}); | ||
@classic | ||
export default class PayeeInfo extends Component {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
import classic from 'ember-classic-decorator'; | ||
import { classNames } from '@ember-decorators/component'; | ||
import UiTable from 'open-event-frontend/components/ui-table-server'; | ||
|
||
export default UiTable.extend({ | ||
classNames: ['ui', 'main-container'] | ||
}); | ||
@classic | ||
@classNames('ui', 'main-container') | ||
export default class EventsTable extends UiTable {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
import classic from 'ember-classic-decorator'; | ||
import { classNames } from '@ember-decorators/component'; | ||
import Component from '@ember/component'; | ||
|
||
export default Component.extend({ | ||
classNames: ['ui', 'stackable', 'centered', 'grid'] | ||
}); | ||
@classic | ||
@classNames('ui', 'stackable', 'centered', 'grid') | ||
export default class ImportsHistorySection extends Component {} |
Oops, something went wrong.