Skip to content

Commit

Permalink
fix: simplify sponsor box (#5466)
Browse files Browse the repository at this point in the history
Co-authored-by: Mario Behling <mb@mariobehling.de>
  • Loading branch information
maze-runnar and mariobehling authored Nov 18, 2020
1 parent b11184d commit 91a069b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 67 deletions.
51 changes: 4 additions & 47 deletions app/controllers/events/view/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Controller from '@ember/controller';
import { action } from '@ember/object';
import EmberTableControllerMixin from 'open-event-frontend/mixins/ember-table-controller';

export default class extends Controller.extend(EmberTableControllerMixin) {
Expand All @@ -15,58 +14,16 @@ export default class extends Controller.extend(EmberTableControllerMixin) {
name : 'Name',
valuePath : 'name',
headerComponent : 'tables/headers/sort',
isSortable : true
isSortable : true,
width : 300

},
{
name : 'Type',
valuePath : 'type',
cellComponent : 'ui-table/cell/cell-sponsor-sanitize'
},
{
name : 'Level',
valuePath : 'level',
cellComponent : 'ui-table/cell/cell-sponsor-sanitize'
},
{
name : 'Options',
valuePath : 'id',
cellComponent : 'ui-table/cell/cell-sponsor-options',
actions : {
editSponsor : this.editSponsor.bind(this),
deleteSponsor : this.deleteSponsor.bind(this)
}
cellComponent : 'ui-table/cell/cell-sponsor-sanitize',
width : 150
}
];
}

@action
deleteSponsor(sponsor_id) {
this.set('isLoading', true);
const sponsor = this.store.peekRecord('sponsor', sponsor_id, { backgroundReload: false });
sponsor.destroyRecord()
.then(() => {
this.notify.success(this.l10n.t('Sponsor has been deleted successfully.'),
{
id: 'spons_deleted'
});
this.refreshModel.bind(this)();
})
.catch(e => {
console.error('Error while deleting sponsor', e);
this.notify.error(this.l10n.t('An unexpected error has occurred.'),
{
id: 'spons_deleted_error'
});
})
.finally(() => {
this.set('isLoading', false);
});
}

@action
editSponsor() {
this.transitionToRoute('events.view.edit.sponsors');
}
}

39 changes: 21 additions & 18 deletions app/templates/components/events/view/overview/event-sponsors.hbs
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
<div class="content">
<div class="content d-flex" style="align-items: center;">
<div class="header">{{t 'Event sponsors'}}</div>
<LinkTo
@route="events.view.edit.sponsors"
@tagName="button" class="ui right floated blue button">
{{t 'Add Sponsors'}}
@tagName="button" class="ui right floated blue button item ml-auto">
{{t 'Edit'}}
</LinkTo>
<div class="header">{{t 'Sponsors'}}</div>
</div>

<div class="content">
<Tables::Default
@columns={{this.columns}}
@rows={{this.data.data}}
@currentPage={{this.page}}
@pageSize={{this.per_page}}
@searchQuery={{this.search}}
@hideSearchBox={{true}}
@sortBy={{this.sort_by}}
@sortDir={{this.sort_dir}}
@metaData={{this.data.meta}}
@filterOptions={{this.filterOptions}}
@widthConstraint="eq-container"
@resizeMode="fluid"
@fillMode="equal-column" />
<div style="width: 95%;margin-left:2.5%">
<Tables::Default
@columns={{this.columns}}
@rows={{this.data.data}}
@currentPage={{this.page}}
@pageSize={{this.per_page}}
@searchQuery={{this.search}}
@hideSearchBox={{true}}
@sortBy={{this.sort_by}}
@sortDir={{this.sort_dir}}
@metaData={{this.data.meta}}
@filterOptions={{this.filterOptions}}
@widthConstraint="eq-container"
@resizeMode="fluid"
@fillMode="equal-column" />
</div>
</div>
4 changes: 2 additions & 2 deletions app/templates/components/tables/default.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</div>
{{/if}}
</div>
<div class="row">
<div class="ui no bottom padding row">
<EmberTable as |t|>
<t.head
@sortFunction={{null}}
Expand Down Expand Up @@ -56,7 +56,7 @@
</EmberTable>
</div>

<div class="row">
<div class="ui no top padding row">
<Tables::Utilities::Pagination
@currentPage={{this.currentPage}}
@pageSize={{this.pageSize}}
Expand Down

1 comment on commit 91a069b

@vercel
Copy link

@vercel vercel bot commented on 91a069b Nov 18, 2020

Choose a reason for hiding this comment

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

Please sign in to comment.