-
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: Migrate my-session, ticket and billing forms to ES6 (#3619)
- Loading branch information
1 parent
fa27eac
commit 416260b
Showing
5 changed files
with
79 additions
and
74 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
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,34 +1,37 @@ | ||
import Controller from '@ember/controller'; | ||
import { computed } from '@ember/object'; | ||
import { computed, action } from '@ember/object'; | ||
import moment from 'moment'; | ||
|
||
export default Controller.extend({ | ||
isUpcoming: computed('model.endsAt', function() { | ||
export default class extends Controller { | ||
|
||
@computed('model.endsAt') | ||
get isUpcoming() { | ||
let endAt = this.get('model.endsAt'); | ||
if (endAt < moment()) { | ||
return false; | ||
} | ||
return true; | ||
}), | ||
} | ||
|
||
actions: { | ||
openProposalDeleteModal() { | ||
this.set('isProposalDeleteModalOpen', true); | ||
}, | ||
deleteProposal() { | ||
this.set('isLoading', true); | ||
this.model.destroyRecord() | ||
.then(() => { | ||
this.transitionToRoute('my-sessions.index'); | ||
this.notify.success(this.l10n.t('Proposal has been deleted successfully.')); | ||
}) | ||
.catch(() => { | ||
this.notify.error(this.l10n.t('An unexpected error has occurred.')); | ||
}) | ||
.finally(() => { | ||
this.set('isLoading', false); | ||
this.set('isProposalDeleteModalOpen', false); | ||
}); | ||
} | ||
@action | ||
openProposalDeleteModal() { | ||
this.set('isProposalDeleteModalOpen', true); | ||
} | ||
|
||
@action | ||
deleteProposal() { | ||
this.set('isLoading', true); | ||
this.model.destroyRecord() | ||
.then(() => { | ||
this.transitionToRoute('my-sessions.index'); | ||
this.notify.success(this.l10n.t('Proposal has been deleted successfully.')); | ||
}) | ||
.catch(() => { | ||
this.notify.error(this.l10n.t('An unexpected error has occurred.')); | ||
}) | ||
.finally(() => { | ||
this.set('isLoading', false); | ||
this.set('isProposalDeleteModalOpen', 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,9 +1,10 @@ | ||
import Controller from '@ember/controller'; | ||
export default Controller.extend({ | ||
actions: { | ||
shareEvent(event) { | ||
this.set('eventToShare', event); | ||
this.set('isShareModalOpen', true); | ||
} | ||
import { action } from '@ember/object'; | ||
|
||
export default class extends Controller { | ||
@action | ||
shareEvent(event) { | ||
this.set('eventToShare', event); | ||
this.set('isShareModalOpen', true); | ||
} | ||
}); | ||
} |
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,9 +1,10 @@ | ||
import Controller from '@ember/controller'; | ||
export default Controller.extend({ | ||
actions: { | ||
shareEvent(event) { | ||
this.set('eventToShare', event); | ||
this.set('isShareModalOpen', true); | ||
} | ||
import { action } from '@ember/object'; | ||
|
||
export default class extends Controller { | ||
@action | ||
shareEvent(event) { | ||
this.set('eventToShare', event); | ||
this.set('isShareModalOpen', true); | ||
} | ||
}); | ||
} |