mirror of
https://github.com/prurigro/hypothetical.git
synced 2024-11-09 11:16:39 -05:00
Add an option to enable/disable the delete button on edit-list dashboard items
This commit is contained in:
parent
2819ed5582
commit
318ca8a80c
2 changed files with 9 additions and 5 deletions
11
readme.md
11
readme.md
|
@ -66,7 +66,8 @@ Viewable models must have an entry in the switch statement of the `getExport` fu
|
||||||
'model' => 'shows',
|
'model' => 'shows',
|
||||||
'rows' => Shows::getShowsList(),
|
'rows' => Shows::getShowsList(),
|
||||||
'column' => 'title',
|
'column' => 'title',
|
||||||
'sortcol' => 'false'
|
'sortcol' => false,
|
||||||
|
'delete' => true
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -83,7 +84,8 @@ Viewable models must have an entry in the switch statement of the `getExport` fu
|
||||||
'model' => 'news',
|
'model' => 'news',
|
||||||
'rows' => News::getNewsList(),
|
'rows' => News::getNewsList(),
|
||||||
'column' => 'title',
|
'column' => 'title',
|
||||||
'sortcol' => 'order'
|
'sortcol' => 'order',
|
||||||
|
'delete' => false
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -92,11 +94,12 @@ Viewable models must have an entry in the switch statement of the `getExport` fu
|
||||||
* `model`: The model that will be accessed on this page
|
* `model`: The model that will be accessed on this page
|
||||||
* `rows`: A function returning an array containing the data to be shown on this page
|
* `rows`: A function returning an array containing the data to be shown on this page
|
||||||
* `column`: The column name in the array that contains the data to display in each row
|
* `column`: The column name in the array that contains the data to display in each row
|
||||||
* `sortcol`: The name of the column containing the sort order or `'false'` to disable
|
* `sortcol`: The name of the column containing the sort order or `false` to disable
|
||||||
|
* `delete`: A delete button will appear in the list if this is set to `true`
|
||||||
|
|
||||||
#### Delete Functionality
|
#### Delete Functionality
|
||||||
|
|
||||||
Editable models must have an entry in the switch statement of the `deleteDelete` function to make deletion functionality work:
|
Editable models with `delete` set to `true` must have an entry in the switch statement of the `deleteDelete` function to make deletion functionality work:
|
||||||
|
|
||||||
```php
|
```php
|
||||||
switch ($request['model']) {
|
switch ($request['model']) {
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
@section('dashboard-body')
|
@section('dashboard-body')
|
||||||
@set('sort_data', $sortcol != false ? "data-sort=$sortcol" : '')
|
@set('sort_data', $sortcol != false ? "data-sort=$sortcol" : '')
|
||||||
@set('sort_icon', $sortcol != false ? '<i class="fa fa-bars sort-icon" title="Click and drag to reorder"></i>' : '')
|
@set('sort_icon', $sortcol != false ? '<i class="fa fa-bars sort-icon" title="Click and drag to reorder"></i>' : '')
|
||||||
|
@set('delete_button', $delete == true ? '<button type="button" class="delete-button btn btn-danger">Delete</button>' : '')
|
||||||
|
|
||||||
<ul id="edit-list" class="list-group edit-list" data-model="{{ $model }}" {{ $sort_data }}>
|
<ul id="edit-list" class="list-group edit-list" data-model="{{ $model }}" {{ $sort_data }}>
|
||||||
<input type="hidden" name="_token" id="token" value="{{ csrf_token() }}" />
|
<input type="hidden" name="_token" id="token" value="{{ csrf_token() }}" />
|
||||||
|
@ -22,7 +23,7 @@
|
||||||
|
|
||||||
<div class="col-xs-3 button-column">
|
<div class="col-xs-3 button-column">
|
||||||
<button type="button" class="edit-button btn btn-warning">Edit</button>
|
<button type="button" class="edit-button btn btn-warning">Edit</button>
|
||||||
<button type="button" class="delete-button btn btn-danger">Delete</button>
|
{!! $delete_button !!}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue