Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Correcting the routes for my-session #3606

Merged
merged 4 commits into from
Nov 10, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 28 additions & 24 deletions app/controllers/my-sessions/view.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,38 @@
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);
});
}
}

kushthedude marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 2 additions & 2 deletions app/templates/my-sessions/view.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="ui container">
<div class="ui row">
{{#if (not model.isLocked)}}
{{#link-to 'events.view.sessions.edit' model.event.id model.id}}
{{#link-to 'public.cfs.edit-session' model.event.id model.id}}
<button class="ui blue button {{if device.isMobile 'fluid' 'right floated'}}">{{t 'Edit Session Proposal'}}</button>
{{#if device.isMobile}}
<div class="ui hidden fitted divider"></div>
Expand All @@ -10,7 +10,7 @@
{{/if}}
{{#each model.speakers as |speaker|}}
{{#if (eq speaker.email authManager.currentUser.email)}}
{{#link-to 'events.view.speakers.edit' model.event.id speaker.id}}
{{#link-to 'public.cfs.edit-speaker' model.event.id speaker.id}}
<button class="ui blue button {{if device.isMobile 'fluid' 'right floated'}}">{{t 'Edit Speaker- '}}{{speaker.name}}</button>
{{#if device.isMobile}}
<div class="ui hidden fitted divider"></div>
Expand Down