diff --git a/app/controllers/events/view/speakers/list.js b/app/controllers/events/view/speakers/list.js index 098af13dc42..87696ef4d85 100644 --- a/app/controllers/events/view/speakers/list.js +++ b/app/controllers/events/view/speakers/list.js @@ -90,8 +90,8 @@ export default class extends Controller.extend(EmberTableControllerMixin) { } @action - viewSpeaker(id) { - this.transitionToRoute('events.view.speakers.edit', id); + viewSpeaker(speaker) { + this.transitionToRoute('public.speaker.view', speaker.event.get('identifier'), speaker.id); } @action diff --git a/app/controllers/public/speaker/view.js b/app/controllers/public/speaker/view.js new file mode 100644 index 00000000000..4072d987d89 --- /dev/null +++ b/app/controllers/public/speaker/view.js @@ -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); + } +} diff --git a/app/router.js b/app/router.js index f1d6a0bb994..bb7d1444e5a 100644 --- a/app/router.js +++ b/app/router.js @@ -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'); diff --git a/app/routes/public/speaker/view.js b/app/routes/public/speaker/view.js new file mode 100644 index 00000000000..0881d806b10 --- /dev/null +++ b/app/routes/public/speaker/view.js @@ -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); + } +} diff --git a/app/templates/components/ui-table/cell/events/view/speakers/cell-buttons.hbs b/app/templates/components/ui-table/cell/events/view/speakers/cell-buttons.hbs index bc03d56e0fd..a971257a400 100644 --- a/app/templates/components/ui-table/cell/events/view/speakers/cell-buttons.hbs +++ b/app/templates/components/ui-table/cell/events/view/speakers/cell-buttons.hbs @@ -1,16 +1,12 @@ {{this.record}} - +

- - - - - - - - - - + + + + + + diff --git a/app/templates/public/speaker/view.hbs b/app/templates/public/speaker/view.hbs new file mode 100644 index 00000000000..0d7d11629c4 --- /dev/null +++ b/app/templates/public/speaker/view.hbs @@ -0,0 +1,20 @@ +
+ {{#if this.showEditSection}} +
+ + + {{#if this.device.isMobile}} + + {{/if}} + +
+ {{/if}} +
+ +
+
diff --git a/tests/unit/routes/public/speaker/view-test.js b/tests/unit/routes/public/speaker/view-test.js new file mode 100644 index 00000000000..adb8c5960ea --- /dev/null +++ b/tests/unit/routes/public/speaker/view-test.js @@ -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); + }); +});