Skip to content

Commit 6960af3

Browse files
committed
Standardised the datatables buttons.
1 parent 55f5e33 commit 6960af3

3 files changed

Lines changed: 11 additions & 79 deletions

File tree

app/Views/admin/groups.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,11 @@ class="d-inline js-delete-form">
8989
],
9090
buttons: [
9191
{
92-
text: '<i class="bi bi-plus-lg me-1" aria-hidden="true"></i><span class="visually-hidden">New Group</span>',
93-
className: 'btn btn-sm btn-primary',
92+
text: '<i class="bi bi-plus-lg" aria-hidden="true"></i><span class="visually-hidden">New Group</span>',
93+
className: 'btn-primary',
94+
init: function (dt, node){
95+
$(node).removeClass('btn-secondary');
96+
},
9497
titleAttr: 'New Group',
9598
action: function (e, dt, node, config) {
9699
window.location.href = '/admin/groups/create';

app/Views/admin/permissions.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,11 @@ class="btn btn-sm btn-outline-secondary"
6161
],
6262
buttons: [
6363
{
64-
text: '<i class="bi bi-plus-lg me-1" aria-hidden="true"></i><span class="visually-hidden">New Permission</span>',
65-
className: 'btn btn-sm btn-primary',
64+
text: '<i class="bi bi-plus-lg" aria-hidden="true"></i><span class="visually-hidden">New Permission</span>',
65+
className: 'btn-primary',
66+
init: function (dt, node){
67+
$(node).removeClass('btn-secondary');
68+
},
6669
titleAttr: 'New Permission',
6770
action: function (e, dt, node, config) {
6871
window.location.href = '/admin/permissions/create';

app/Views/admin/users.php

Lines changed: 1 addition & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class="d-inline">
8484
],
8585
buttons: [
8686
{
87-
text: '<i class="bi bi-person-plus" aria-hidden="true"></i><span class="visually-hidden">New User</span>',
87+
text: '<i class="bi bi-plus-lg" aria-hidden="true"></i><span class="visually-hidden">New User</span>',
8888
className: 'btn-primary',
8989
init: function (dt, node){
9090
$(node).removeClass('btn-secondary');
@@ -93,80 +93,6 @@ className: 'btn-primary',
9393
action: function (e, dt, node, config) {
9494
window.location.href = '/admin/users/create';
9595
}
96-
},
97-
{
98-
extend: 'collection',
99-
text: '<i class="bi-check2-square"></i><span class="visually-hidden">Select</span>',
100-
buttons: [
101-
{
102-
extend: 'selectAll',
103-
text: '<i class="bi-check2-all me-2"></i>All',
104-
},
105-
{
106-
extend: 'selectNone',
107-
text: '<i class="bi-x-square me-2"></i>None',
108-
},
109-
{
110-
name: 'selectFiltered',
111-
text: '<i class="bi-eye me-2"></i>Filtered',
112-
action: function (e, dt, node, config) {
113-
dt.rows({ selected: true }).deselect();
114-
dt.rows({ search: 'applied', page: 'all' }).select();
115-
},
116-
},
117-
{
118-
name: 'selectUnfiltered',
119-
text: '<i class="bi-eye-slash me-2"></i>Unfiltered',
120-
action: function (e, dt, node, config) {
121-
dt.rows({ selected: true }).deselect();
122-
dt.rows({ search: 'removed', page: 'all' }).select();
123-
},
124-
},
125-
]
126-
},
127-
{
128-
extend: 'collection',
129-
text: '<i class="bi-arrow-bar-down"></i><span class="visually-hidden">Export</span>',
130-
buttons: [
131-
{
132-
extend: 'copy',
133-
text: '<i class="bi-clipboard me-2"></i>Clipboard',
134-
exportOptions: {
135-
columns: ':visible:not(:last-child)',
136-
},
137-
},
138-
{
139-
extend: 'excel',
140-
text: '<i class="bi-filetype-xlsx me-2"></i>Excel',
141-
exportOptions: {
142-
columns: ':visible:not(:last-child)',
143-
},
144-
},
145-
{
146-
extend: 'csv',
147-
text: '<i class="bi-filetype-csv me-2"></i>CSV',
148-
exportOptions: {
149-
columns: ':visible:not(:last-child)',
150-
},
151-
},
152-
{
153-
extend: 'pdf',
154-
text: '<i class="bi-filetype-pdf me-2"></i>PDF',
155-
exportOptions: {
156-
columns: ':visible:not(:last-child)',
157-
},
158-
},
159-
],
160-
},
161-
{
162-
text: '<i class="bi bi-layout-sidebar-inset" aria-hidden="true"></i><span class="visually-hidden">Column Visibility</span>',
163-
titleAttr: 'Column Visibility',
164-
extend: 'colvis'
165-
},
166-
{
167-
text: '<i class="bi bi-list" aria-hidden="true"></i><span class="visually-hidden">Number of rows</span>',
168-
titleAttr: 'Number of rows',
169-
extend: 'pageLength'
17096
}
17197
]
17298
});

0 commit comments

Comments
 (0)