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

feat: View Action for Speaker #5390

Merged
merged 12 commits into from
Oct 28, 2020
Merged
Show file tree
Hide file tree
Changes from 2 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
5 changes: 3 additions & 2 deletions app/controllers/events/view/speakers/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@ export default class extends Controller.extend(EmberTableControllerMixin) {
}

@action
viewSpeaker(id) {
this.transitionToRoute('events.view.speakers.edit', id);
viewSpeaker(speaker_id, event) {
const event_id = event.router.location.location.pathname.split('/')[2];
divyamtayal marked this conversation as resolved.
Show resolved Hide resolved
this.transitionToRoute('public.speaker.view', event_id, speaker_id);
}

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

export default class extends Controller {}
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>
divyamtayal marked this conversation as resolved.
Show resolved Hide resolved
<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}} @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>
iamareebjamal marked this conversation as resolved.
Show resolved Hide resolved
18 changes: 18 additions & 0 deletions app/templates/public/speaker/view.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<div class="ui container">
<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>
<div class="ui row">
<Public::SpeakerItem
@speaker={{this.model}}
/>
</div>
</div>
iamareebjamal marked this conversation as resolved.
Show resolved Hide resolved
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);
});
});