Skip to content
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
28 changes: 0 additions & 28 deletions app/controllers/events/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ import { isEmpty } from '@ember/utils';
import { action } from '@ember/object';

export default class extends Controller {
@action
openDeleteEventModal() {
this.set('isEventDeleteModalOpen', true);
}

@action
togglePublishState() {
if (isEmpty(this.model.locationName)) {
Expand Down Expand Up @@ -46,29 +41,6 @@ export default class extends Controller {
});
}

@action
deleteEvent() {
this.set('isLoading', true);
this.model.destroyRecord()
.then(() => {
this.transitionToRoute('events');
this.notify.success(this.l10n.t('Event has been deleted successfully.'),
{
id: 'event_deleted_succ'
});
})
.catch(() => {
this.notify.error(this.l10n.t('An unexpected error has occurred.'),
{
id: 'event_deleted_error'
});
})
.finally(() => {
this.set('isLoading', false);
});
this.set('isEventDeleteModalOpen', false);
}

@action
copyEvent() {
this.set('isCopying', true);
Expand Down
28 changes: 28 additions & 0 deletions app/controllers/events/view/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,34 @@ import { action } from '@ember/object';

export default class extends Controller {

@action
openDeleteEventModal() {
this.set('isEventDeleteModalOpen', true);
}

@action
deleteEvent() {
this.set('isLoading', true);
this.model.event.destroyRecord()
.then(() => {
this.transitionToRoute('events');
this.notify.success(this.l10n.t('Event has been deleted successfully.'),
{
id: 'event_deleted_succ'
});
})
.catch(() => {
this.notify.error(this.l10n.t('An unexpected error has occurred.'),
{
id: 'event_deleted_error'
});
})
.finally(() => {
this.set('isLoading', false);
});
this.set('isEventDeleteModalOpen', false);
}

@action
openEventTransferModal(id, name) {
this.setProperties({
Expand Down
9 changes: 0 additions & 9 deletions app/templates/events/view.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
<button class="ui button {{if isCopying 'loading'}}" {{action 'copyEvent'}} data-tooltip={{t 'Copy'}} data-position="top left">
<i class="copy icon"></i>
</button>
<button class="ui red button" {{action 'openDeleteEventModal'}} data-tooltip={{t 'Delete'}} data-position="top left"><i class="trash icon"></i></button>
</div>
{{else}}
<a href="{{model.url}}" class="ui button labeled icon small">
Expand All @@ -51,10 +50,6 @@
{{t 'Copy'}}
</button>
</div>
<button class="ui red button labeled icon small" {{action 'openDeleteEventModal'}}>
<i class="trash icon"></i>
{{t 'Delete'}}
</button>
{{/if}}
</div>
</div>
Expand Down Expand Up @@ -90,10 +85,6 @@
</div>
</div>

{{modals/event-delete-modal isLoading=isLoading
isOpen=isEventDeleteModalOpen
eventName=model.name
deleteEvent=(action 'deleteEvent')}}
<div class="ui {{if isLoading 'loading'}} basic segment">
{{outlet}}
</div>
Expand Down
14 changes: 13 additions & 1 deletion app/templates/events/view/settings.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,21 @@
<p>
{{t 'Transfer ownership of this event to another user. You\'ll lose all the owner rights once they accept the ownership.'}}
</p>
<button {{action 'openEventTransferModal' model.event.id model.event.name}} class='ui red button'>
<button {{action 'openEventTransferModal'}} class='ui red button'>
{{t 'Transfer Ownership'}}
</button>
<div class="ui divider"></div>
<p>
{{t 'Once you delete an event, there is no going back. Please be certain'}}
</p>
<button {{action 'openDeleteEventModal'}} class='ui red labeled icon button'>
<i class="trash icon"></i>
{{t 'Delete Event'}}
</button>
</div>
{{modals/event-transfer-modal isLoading=isLoading isOpen=isEventTransferModalOpen confirmEventName=confirmEventName eventName=eventName openConfirmEventTransferModal=(action 'openConfirmEventTransferModal') transferEvent=(action 'transferEvent' model)}}
{{modals/confirm-event-transfer-modal currentInvite=currentInvite isLoading=isLoading isOpen=isConfirmEventTransferModalOpen checked=checked transferEvent=(action 'transferEvent')}}
{{modals/event-delete-modal isLoading=isLoading
isOpen=isEventDeleteModalOpen
eventName=model.event.name
deleteEvent=(action 'deleteEvent')}}