Skip to content

Commit 91a069b

Browse files
fix: simplify sponsor box (#5466)
Co-authored-by: Mario Behling <mb@mariobehling.de>
1 parent b11184d commit 91a069b

File tree

3 files changed

+27
-67
lines changed

3 files changed

+27
-67
lines changed

app/controllers/events/view/index.js

Lines changed: 4 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import Controller from '@ember/controller';
2-
import { action } from '@ember/object';
32
import EmberTableControllerMixin from 'open-event-frontend/mixins/ember-table-controller';
43

54
export default class extends Controller.extend(EmberTableControllerMixin) {
@@ -15,58 +14,16 @@ export default class extends Controller.extend(EmberTableControllerMixin) {
1514
name : 'Name',
1615
valuePath : 'name',
1716
headerComponent : 'tables/headers/sort',
18-
isSortable : true
17+
isSortable : true,
18+
width : 300
1919

2020
},
2121
{
2222
name : 'Type',
2323
valuePath : 'type',
24-
cellComponent : 'ui-table/cell/cell-sponsor-sanitize'
25-
},
26-
{
27-
name : 'Level',
28-
valuePath : 'level',
29-
cellComponent : 'ui-table/cell/cell-sponsor-sanitize'
30-
},
31-
{
32-
name : 'Options',
33-
valuePath : 'id',
34-
cellComponent : 'ui-table/cell/cell-sponsor-options',
35-
actions : {
36-
editSponsor : this.editSponsor.bind(this),
37-
deleteSponsor : this.deleteSponsor.bind(this)
38-
}
24+
cellComponent : 'ui-table/cell/cell-sponsor-sanitize',
25+
width : 150
3926
}
4027
];
4128
}
42-
43-
@action
44-
deleteSponsor(sponsor_id) {
45-
this.set('isLoading', true);
46-
const sponsor = this.store.peekRecord('sponsor', sponsor_id, { backgroundReload: false });
47-
sponsor.destroyRecord()
48-
.then(() => {
49-
this.notify.success(this.l10n.t('Sponsor has been deleted successfully.'),
50-
{
51-
id: 'spons_deleted'
52-
});
53-
this.refreshModel.bind(this)();
54-
})
55-
.catch(e => {
56-
console.error('Error while deleting sponsor', e);
57-
this.notify.error(this.l10n.t('An unexpected error has occurred.'),
58-
{
59-
id: 'spons_deleted_error'
60-
});
61-
})
62-
.finally(() => {
63-
this.set('isLoading', false);
64-
});
65-
}
66-
67-
@action
68-
editSponsor() {
69-
this.transitionToRoute('events.view.edit.sponsors');
70-
}
7129
}
72-
Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
1-
<div class="content">
1+
<div class="content d-flex" style="align-items: center;">
2+
<div class="header">{{t 'Event sponsors'}}</div>
23
<LinkTo
34
@route="events.view.edit.sponsors"
4-
@tagName="button" class="ui right floated blue button">
5-
{{t 'Add Sponsors'}}
5+
@tagName="button" class="ui right floated blue button item ml-auto">
6+
{{t 'Edit'}}
67
</LinkTo>
7-
<div class="header">{{t 'Sponsors'}}</div>
88
</div>
9+
910
<div class="content">
10-
<Tables::Default
11-
@columns={{this.columns}}
12-
@rows={{this.data.data}}
13-
@currentPage={{this.page}}
14-
@pageSize={{this.per_page}}
15-
@searchQuery={{this.search}}
16-
@hideSearchBox={{true}}
17-
@sortBy={{this.sort_by}}
18-
@sortDir={{this.sort_dir}}
19-
@metaData={{this.data.meta}}
20-
@filterOptions={{this.filterOptions}}
21-
@widthConstraint="eq-container"
22-
@resizeMode="fluid"
23-
@fillMode="equal-column" />
11+
<div style="width: 95%;margin-left:2.5%">
12+
<Tables::Default
13+
@columns={{this.columns}}
14+
@rows={{this.data.data}}
15+
@currentPage={{this.page}}
16+
@pageSize={{this.per_page}}
17+
@searchQuery={{this.search}}
18+
@hideSearchBox={{true}}
19+
@sortBy={{this.sort_by}}
20+
@sortDir={{this.sort_dir}}
21+
@metaData={{this.data.meta}}
22+
@filterOptions={{this.filterOptions}}
23+
@widthConstraint="eq-container"
24+
@resizeMode="fluid"
25+
@fillMode="equal-column" />
26+
</div>
2427
</div>

app/templates/components/tables/default.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</div>
1313
{{/if}}
1414
</div>
15-
<div class="row">
15+
<div class="ui no bottom padding row">
1616
<EmberTable as |t|>
1717
<t.head
1818
@sortFunction={{null}}
@@ -56,7 +56,7 @@
5656
</EmberTable>
5757
</div>
5858

59-
<div class="row">
59+
<div class="ui no top padding row">
6060
<Tables::Utilities::Pagination
6161
@currentPage={{this.currentPage}}
6262
@pageSize={{this.pageSize}}

0 commit comments

Comments
 (0)