Skip to content

fix: Enable link on view and edit in event overview #4643

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

Merged
merged 6 commits into from
Jul 27, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
26 changes: 7 additions & 19 deletions app/controllers/admin/events/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ export default class extends Controller.extend(EmberTableControllerMixin) {
hasRestorePrivileges: this.hasRestorePrivileges
},
actions: {
moveToDetails : this.moveToDetails.bind(this),
editEvent : this.editEvent.bind(this),
openDeleteEventModal : this.openDeleteEventModal.bind(this),
deleteEvent : this.deleteEvent.bind(this),
restoreEvent : this.restoreEvent.bind(this)
Expand Down Expand Up @@ -104,25 +102,15 @@ export default class extends Controller.extend(EmberTableControllerMixin) {
}

@action
moveToDetails(id) {
this.transitionToRoute('events.view', id);
openDeleteEventModal(id, name) {
this.setProperties({
isEventDeleteModalOpen : true,
confirmName : '',
eventName : name,
eventId : id
});
}

@action
editEvent(id) {
this.transitionToRoute('events.view.edit.basic-details', id);
}

@action
openDeleteEventModal(id, name) {
this.setProperties({
isEventDeleteModalOpen : true,
confirmName : '',
eventName : name,
eventId : id
});
}

@action
async deleteEvent() {
this.set('isLoading', true);
Expand Down
12 changes: 0 additions & 12 deletions app/controllers/admin/users/view/events/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ export default class extends Controller.extend(EmberTableControllerMixin) {
hasRestorePrivileges: this.hasRestorePrivileges
},
actions: {
moveToDetails : this.moveToDetails.bind(this),
editEvent : this.editEvent.bind(this),
openDeleteEventModal : this.openDeleteEventModal.bind(this),
deleteEvent : this.deleteEvent.bind(this),
restoreEvent : this.restoreEvent.bind(this)
Expand Down Expand Up @@ -61,16 +59,6 @@ export default class extends Controller.extend(EmberTableControllerMixin) {
];
}

@action
moveToDetails(id) {
this.transitionToRoute('events.view', id);
}

@action
editEvent(id) {
this.transitionToRoute('events.view.edit.basic-details', id);
}

@action
openDeleteEventModal(id, name) {
this.setProperties({
Expand Down
20 changes: 0 additions & 20 deletions app/controllers/events/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ export default class extends Controller.extend(EmberTableControllerMixin) {
cellComponent : 'ui-table/cell/cell-event-general',
options : {
dateFormat: 'MMMM DD, YYYY - HH:mm A'
},
actions: {
moveToPublic : this.moveToPublic.bind(this),
moveToDetails : this.moveToDetails.bind(this),
editEvent : this.editEvent.bind(this)
}
},
{
Expand Down Expand Up @@ -59,21 +54,6 @@ export default class extends Controller.extend(EmberTableControllerMixin) {
];
}

@action
moveToPublic(id) {
this.transitionToRoute('public', id);
}

@action
moveToDetails(id) {
this.transitionToRoute('events.view', id);
}

@action
editEvent(id) {
this.transitionToRoute('events.view.edit.basic-details', id);
}

@action
openDeleteEventModal(id, name) {
this.setProperties({
Expand Down
16 changes: 10 additions & 6 deletions app/templates/components/ui-table/cell/cell-buttons.hbs
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
<div class="ui {{if this.device.isMobile 'horizontal' 'vertical'}} compact basic buttons">
<UiPopup @tagName="a" @click={{action this.moveToDetails this.record.identifier}} @content={{t "View"}} @class="ui icon button" @position="left center">
<i class="unhide icon"></i>
</UiPopup>
<UiPopup @content={{t "Edit"}} @click={{action this.editEvent this.record.identifier}} @class="ui icon button" @position="left center">
<i class="edit icon"></i>
</UiPopup>
<LinkTo @route="events.view" @model={{this.record.identifier}}>
<UiPopup @content={{t "View"}} @class="ui icon button" @position="left center">
<i class="unhide icon"></i>
</UiPopup>
</LinkTo>
<LinkTo @route="events.view.edit.basic-details" @model={{this.record.identifier}}>
<UiPopup @content={{t "Edit"}} @class="ui icon button" @position="left center">
<i class="edit icon"></i>
</UiPopup>
</LinkTo>
{{#if (and this.hasRestorePrivileges (get this.record this.column.propertyName))}}
<UiPopup @content={{t "Restore"}} @click={{action this.restoreEvent this.record}} @class="ui icon button" @position="left center">
<i class="undo icon"></i>
Expand Down
24 changes: 15 additions & 9 deletions app/templates/components/ui-table/cell/cell-event-general.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@
<img src="{{if this.extraRecords.logoUrl this.extraRecords.logoUrl '/images/placeholders/Other.jpg'}}" alt="Event Logo" class="ui image"> <br> {{this.record}}
</div>
<div class="ui horizontal large basic buttons">
<UiPopup @tagName="a" @click={{action this.props.actions.moveToDetails this.extraRecords.identifier}} @content={{t "Event Dashboard"}} @class="ui icon button" @position="top center">
<i class="tasks icon"></i>
</UiPopup>
<UiPopup @tagName="a" @click={{action this.props.actions.moveToPublic this.extraRecords.identifier}} @content={{t "View"}} @class="ui icon button" @position="top center">
Copy link
Member

Choose a reason for hiding this comment

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

If moveToPublic isn't being used now, please remove it from code

<i class="unhide icon"></i>
</UiPopup>
<UiPopup @content={{t "Edit"}} @click={{action this.props.actions.editEvent this.extraRecords.identifier}} @class="ui icon button" @position="top center">
<i class="edit icon"></i>
</UiPopup>
<LinkTo @route="events.view" @model={{this.extraRecords.identifier}}>
<UiPopup @content={{t "Event Dashboard"}} @class="ui icon button" @position="top center">
<i class="tasks icon"></i>
</UiPopup>
</LinkTo>
<LinkTo @route="public" @model={{this.extraRecords.identifier}}>
<UiPopup @content={{t "View"}} @class="ui icon button" @position="top center">
<i class="unhide icon"></i>
</UiPopup>
</LinkTo>
<LinkTo @route="events.view.edit.basic-details" @model={{this.extraRecords.identifier}}>
<UiPopup @content={{t "Edit"}} @class="ui icon button" @position="top center">
<i class="edit icon"></i>
</UiPopup>
</LinkTo>
</div>
16 changes: 10 additions & 6 deletions app/templates/components/ui-table/cell/cell-event.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
</div>

<div class="ui horizontal compact basic buttons">
<UiPopup @tagName="a" @click={{action this.props.actions.moveToDetails this.extraRecords.identifier}} @content={{t "View"}} @class="ui icon button" @position="left center">
<i class="unhide icon"></i>
</UiPopup>
<UiPopup @content={{t "Edit"}} @click={{action this.props.actions.editEvent this.extraRecords.identifier}} @class="ui icon button" @position="left center">
<i class="edit icon"></i>
</UiPopup>
<LinkTo @route="events.view" @model={{this.extraRecords.identifier}}>
<UiPopup @content={{t "View"}} @class="ui icon button" @position="left center">
<i class="unhide icon"></i>
</UiPopup>
</LinkTo>
<LinkTo @route="events.view.edit.basic-details" @model={{this.extraRecords.identifier}}>
<UiPopup @content={{t "Edit"}} @class="ui icon button" @position="left center">
<i class="edit icon"></i>
</UiPopup>
</LinkTo>
{{#if (and this.props.options.hasRestorePrivileges this.extraRecords.deletedAt)}}
<UiPopup @content={{t "Restore"}} @click={{action this.props.actions.restoreEvent this.extraRecords.identifier}} @class="ui icon button" @position="left center">
<i class="undo icon"></i>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ module('Integration | Component | ui table/cell/cell buttons', function(hooks) {
setupIntegrationTest(hooks);

test('it renders', async function(assert) {
this.set('editEvent', () => {});
this.set('moveToDetails', () => {});
this.set('openDeleteEventModal', () => {});
await render(hbs`{{ui-table/cell/cell-buttons editEvent=(action editEvent) moveToDetails=(action moveToDetails) openDeleteEventModal=(action openDeleteEventModal)}}`);
await render(hbs`{{ui-table/cell/cell-buttons openDeleteEventModal=(action openDeleteEventModal)}}`);
assert.ok(this.element.textContent.trim().includes(''));
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,14 @@ module('Integration | Component | ui table/cell/cell event general', function(ho
const extraRecords = { identifier: 'abc215f', logoUrl: 'url' };
const record = 'Event';

const props = {
actions: {
editEvent : () => {},
moveToDetails : () => {},
moveToPublic : () => {}
}
};

test('it renders', async function(assert) {

this.setProperties({
record,
props,
extraRecords
});

await render(hbs`{{ui-table/cell/cell-event-general extraRecords=extraRecords record=record props=props}}`);
await render(hbs`{{ui-table/cell/cell-event-general extraRecords=extraRecords record=record}}`);
assert.ok(this.element.textContent.trim().includes('Event'));
});
});
2 changes: 0 additions & 2 deletions tests/integration/components/ui-table/cell/cell-event-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ module('Integration | Component | ui table/cell/cell event', function(hooks) {
const record = { name: 'Event', image: 'url' };
const props = {
actions: {
moveToDetails : () => {},
editEvent : () => {},
openDeleteEventModal : () => {},
deleteEvent : () => {},
restoreEvent : () => {}
Expand Down