Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
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
2 changes: 1 addition & 1 deletion app/components/modals/tax-info-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { countries } from 'open-event-frontend/utils/dictionary/demography';
import { orderBy } from 'lodash-es';

export default ModalBase.extend(FormMixin, {
isSmall : false,
isSmall: false,

autoScrollToErrors : true,
isTaxIncludedInPrice : 'include',
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/events/view/speakers/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default class extends Controller.extend(EmberTableControllerMixin) {
{
name : 'Name',
valuePath : 'name',
extraValuePaths : ['id'],
extraValuePaths : ['id', 'event'],
isSortable : true,
headerComponent : 'tables/headers/sort',
cellComponent : 'ui-table/cell/events/view/speakers/cell-buttons',
Expand Down Expand Up @@ -90,8 +90,8 @@ export default class extends Controller.extend(EmberTableControllerMixin) {
}

@action
viewSpeaker(id) {
this.transitionToRoute('events.view.speakers.edit', id);
viewSpeaker(speaker_id, event_id) {
this.transitionToRoute('public.speaker.view', event_id, speaker_id);
}

@action
Expand Down
9 changes: 9 additions & 0 deletions app/controllers/public/speaker/view.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Controller from '@ember/controller';
import { computed } from '@ember/object';

export default class extends Controller {
@computed('speaker.isAuthenticated', 'authManager.currentUser.email', 'authManager.currentUser.isAdmin', 'model.speakers')
get showEditSection() {
return this.session.isAuthenticated && (this.authManager.currentUser.isAdmin || this.model.email === this.authManager.currentUser.email);
}
}
3 changes: 3 additions & 0 deletions app/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ Router.map(function() {
this.route('session', function() {
this.route('view', { path: '/:session_id' });
});
this.route('speaker', function() {
this.route('view', { path: '/:speaker_id' });
});
this.route('cfs', { path: '/cfs/:speaker_call_hash' }, function() {
this.route('new-speaker');
this.route('new-session');
Expand Down
13 changes: 13 additions & 0 deletions app/routes/public/speaker/view.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import classic from 'ember-classic-decorator';
import Route from '@ember/routing/route';

@classic
export default class ViewRoute extends Route {
titleToken(model) {
return model.title;
}

model(params) {
return this.store.findRecord('speaker', params.speaker_id);
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
{{this.record}}
<div class="hidden ui divider"></div>
<br><br>
<div class="ui horizontal compact basic buttons">
<LinkTo @route="events.view.speakers.edit" @model={{this.extraRecords.id}}>
<UiPopup @content={{t "View"}} @class="ui icon button" @click={{action this.props.actions.viewSpeaker this.extraRecords.id}} @position="left center">
<i class="unhide icon"></i>
</UiPopup>
</LinkTo>
<LinkTo @route="events.view.speakers.edit" @model={{this.extraRecords.id}}>
<UiPopup @content={{t "Edit"}} @class="ui icon button" @click={{action this.props.actions.editSpeaker this.extraRecords.id}} @position="left center">
<i class="edit icon"></i>
</UiPopup>
</LinkTo>
<UiPopup @content={{t "View"}} @class="ui icon button" @click={{action this.props.actions.viewSpeaker this.extraRecords.id this.extraRecords.event.id}} @position="left center">
<i class="unhide icon"></i>
</UiPopup>
<UiPopup @content={{t "Edit"}} @class="ui icon button" @click={{action this.props.actions.editSpeaker this.extraRecords.id }} @position="left center">
<i class="edit icon"></i>
</UiPopup>
<UiPopup @content={{t "Delete"}} @click={{action (confirm (t "Are you sure you would like to delete this Speaker?") (action this.props.actions.deleteSpeaker this.extraRecords.id))}} @class="ui icon button" @position="left center">
<i class="trash icon"></i>
</UiPopup>
</div>
</div>
20 changes: 20 additions & 0 deletions app/templates/public/speaker/view.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<div class="ui container">
{{#if this.showEditSection}}
<div class="ui row mb-8">
<LinkTo
@route="public.cfs.edit-speaker"
@models={{array this.model.event.id this.model.id}}>
<button
class="ui blue button {{if this.device.isMobile 'fluid' 'right floated'}}">{{t 'Edit Speaker'}}</button>
{{#if this.device.isMobile}}
<div class="ui hidden fitted divider"></div>
{{/if}}
</LinkTo>
</div>
{{/if}}
<div class="ui row">
<Public::SpeakerItem
@speaker={{this.model}}
/>
</div>
</div>
11 changes: 11 additions & 0 deletions tests/unit/routes/public/speaker/view-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';

module('Unit | Route | public/speaker/view', function(hooks) {
setupTest(hooks);

test('it exists', function(assert) {
const route = this.owner.lookup('route:public/speaker/view');
assert.ok(route);
});
});