From c03d2fc6594d16c16b2c0ab425112753fd2eea03 Mon Sep 17 00:00:00 2001 From: Kevin MacMartin Date: Wed, 17 Jul 2019 00:21:28 -0400 Subject: [PATCH] Add the ability to declare a select with options that have different values and text --- readme.md | 3 ++- .../views/dashboard/pages/edit-item.blade.php | 14 +++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/readme.md b/readme.md index cbd1670..b48b4ee 100644 --- a/readme.md +++ b/readme.md @@ -202,13 +202,14 @@ Models with their `$dashboard_type` set to `edit` also use: * `text`: Text input field for text data * `mkd`: Markdown editor for text data containing markdown * `date`: Date and time selection tool for date/time data - * `select`: Text input via option select with possible options in an `options` array + * `select`: Text input via option select * `hidden`: Fields that will contain values to pass to the update function but won't appear on the page (this must be used for the sort column) * `image`: Fields that contain image uploads * `file`: Fields that contains file uploads * `display`: Displayed information that can't be edited * `user`: This should point to a foreign key that references the id on the users table; setting this will bind items to the user that created them * `type-new`: This takes the same options as `type` and overrides it when creating new items (eg: to allow input on a field during creation but not after) +* `options` (required by `select`) Takes an array of options that are either strings or arrays containing the keys `title` (for what will display with the option) and `value` (for what will be recorded) * `name`: (required by `file` and `image`) Used along with the record id to determine the filename * `delete`: (optional for `file` and `image`) Enables a delete button for the upload when set to true * `ext`: (required by `file`) Configures the file extension of the upload diff --git a/resources/views/dashboard/pages/edit-item.blade.php b/resources/views/dashboard/pages/edit-item.blade.php index d19bbae..ff170ae 100644 --- a/resources/views/dashboard/pages/edit-item.blade.php +++ b/resources/views/dashboard/pages/edit-item.blade.php @@ -43,10 +43,18 @@ @elseif($type == 'select')