Skip to content
11 changes: 0 additions & 11 deletions app/components/modals/cfs-proposal-modal.js

This file was deleted.

21 changes: 19 additions & 2 deletions app/components/public/call-for-speakers.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,35 @@
import classic from 'ember-classic-decorator';
import { action, computed } from '@ember/object';
import Component from '@ember/component';
import { inject as service } from '@ember/service';

@classic
export default class CallForSpeakers extends Component {
@service
router;

@action
openModal() {
addSpeaker() {
if (this.session.isAuthenticated) {
this.set('isCfsModalOpen', true);
this.router.transitionTo('public.cfs.new-speaker');
} else {
this.set('isLoginModalOpen', true);
}
}

@action
addSession() {
if (this.data.userSpeaker && this.data.userSpeaker.toArray().length) {
// speaker detail exists
Comment on lines +20 to +23
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iamareebjamal Should I add this.transitionToRoute here for directing towards public.cfs.new-session route?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

this.router.transitionTo('public.cfs.new-session');
} else {
this.notify.error(this.l10n.t('You need to add your speaker details first before submitting a session'),
{
id: 'add_new_session_error'
});
}
}

@computed('data.userSpeaker')
get isNewSpeaker() {
return !(this.data.userSpeaker && this.data.userSpeaker.toArray().length);
Expand Down
29 changes: 0 additions & 29 deletions app/templates/components/modals/cfs-proposal-modal.hbs

This file was deleted.

21 changes: 18 additions & 3 deletions app/templates/components/public/call-for-speakers.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,25 @@
{{/unless}}
{{/unless}}
<div class="ui hidden divider"></div>
{{#if this.isNewSession}}
<p>{{t 'No session have been submitted'}}</p>
{{/if}}
{{#if this.data.speakersCall.isOpen}}
<button type="submit" class="ui teal submit button" {{action 'openModal'}}>
{{t 'Submit Proposal'}}
{{#if this.isNewSpeaker}}
<button class="ui teal {{if this.device.isMobile 'tiny'}} button" {{action 'addSpeaker'}}>
{{t 'Add Speaker Details'}}
</button>
{{else}}
{{#each this.data.userSpeaker as |speaker|}}
{{#if speaker.id}}
<LinkTo @route="public.cfs.edit-speaker" @model={{speaker.id}}>
<button class="ui teal {{if this.device.isMobile 'tiny'}} button">{{t 'Edit Speaker Details'}}</button>
</LinkTo>
{{/if}}
{{/each}}
{{/if}}
<button class="ui teal {{if this.device.isMobile 'tiny'}} button" {{action 'addSession'}}>
{{t 'Add New Session'}}
</button>
{{/if}}
<Modals::CfsProposalModal @isOpen={{this.isCfsModalOpen}} @isNewSpeaker={{this.isNewSpeaker}} @isNewSession={{this.isNewSession}} @data={{this.data}} />
<Modals::LoginSignupModal @isOpen={{this.isLoginModalOpen}} />