From 318ca8a80c1f6861a67cf1f116f3423112b91363 Mon Sep 17 00:00:00 2001 From: Kevin MacMartin Date: Mon, 19 Dec 2016 22:17:13 -0500 Subject: [PATCH] Add an option to enable/disable the delete button on edit-list dashboard items --- readme.md | 11 +++++++---- resources/views/dashboard/edit-list.blade.php | 3 ++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/readme.md b/readme.md index c1e664f..4ff0187 100644 --- a/readme.md +++ b/readme.md @@ -66,7 +66,8 @@ Viewable models must have an entry in the switch statement of the `getExport` fu 'model' => 'shows', 'rows' => Shows::getShowsList(), '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', 'rows' => News::getNewsList(), '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 * `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 -* `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 -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 switch ($request['model']) { diff --git a/resources/views/dashboard/edit-list.blade.php b/resources/views/dashboard/edit-list.blade.php index 2f19392..9b60233 100644 --- a/resources/views/dashboard/edit-list.blade.php +++ b/resources/views/dashboard/edit-list.blade.php @@ -7,6 +7,7 @@ @section('dashboard-body') @set('sort_data', $sortcol != false ? "data-sort=$sortcol" : '') @set('sort_icon', $sortcol != false ? '' : '') + @set('delete_button', $delete == true ? '' : '')