mirror of
https://github.com/prurigro/hypothetical.git
synced 2024-11-22 07:54:11 -05:00
Add an option-select option to the set of available form items in the dashboard edit item page and document its use in the readme
This commit is contained in:
parent
ebbec6119b
commit
c4538a06eb
2 changed files with 20 additions and 6 deletions
|
@ -174,6 +174,7 @@ This function should be named the same as the one above except with `Edit` at th
|
|||
'columns' => [
|
||||
[ 'name' => 'title', 'type' => 'text', 'label' => 'The Title' ],
|
||||
[ 'name' => 'iframe', 'type' => 'text' ],
|
||||
[ 'name' => 'halign', 'type' => 'select', 'options' => [ 'left', 'center', 'right' ] ],
|
||||
[ 'name' => 'story', 'type' => 'mkd' ],
|
||||
[ 'name' => 'order', 'type' => 'hidden' ]
|
||||
]
|
||||
|
@ -199,6 +200,7 @@ The following is a list of possible `types` in the `columns` array for Editable
|
|||
* `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
|
||||
* `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)
|
||||
|
||||
#### Edit Item Functionality
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
<input type="hidden" name="_token" id="_token" value="{{ csrf_token() }}" />
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
@foreach($columns as $column)
|
||||
<div class="row">
|
||||
@set('value', $item[$column['name']])
|
||||
|
||||
@if($column['type'] == 'hidden')
|
||||
|
@ -35,12 +35,24 @@
|
|||
<input class="date-time-picker" type="text" name="{{ $column['name'] }}" id="{{ $column['name'] }}" value="{{ preg_replace('/:[0-9][0-9]$/', '', $value) }}" />
|
||||
@elseif($column['type'] == 'mkd')
|
||||
<textarea class="mkd-editor" name="{{ $column['name'] }}" id="{{ $column['name'] }}" value="{{ $value }}"></textarea>
|
||||
@elseif($column['type'] == 'select')
|
||||
<select class="text-input" name="{{ $column['name'] }}" id="{{ $column['name'] }}">
|
||||
@foreach($column['options'] as $option)
|
||||
@if($option === $value)
|
||||
<option value="{{ $option }}" selected="selected">{{ $option }}</option>
|
||||
@else
|
||||
<option value="{{ $option }}">{{ $option }}</option>
|
||||
@endif
|
||||
@endforeach
|
||||
</select>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
@if(!empty($imgup) && $imgup)
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-2">
|
||||
<label for="{{ $column['name'] }}">Picture:</label>
|
||||
</div>
|
||||
|
@ -55,8 +67,8 @@
|
|||
<div>(No Image Set)</div>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="row">
|
||||
<button id="back" type="button" class="back-button btn btn-default">Back</button>
|
||||
|
|
Loading…
Reference in a new issue