Make the 'new' button on the edit-list page optional

This commit is contained in:
Kevin MacMartin 2016-12-19 22:45:11 -05:00
parent c031c6d18a
commit 61233c887e
2 changed files with 10 additions and 4 deletions

View file

@ -50,6 +50,7 @@ First add a function to generate the page:
'column' => 'title', 'column' => 'title',
'sortcol' => false, 'sortcol' => false,
'delete' => true, 'delete' => true,
'create' => true,
'export' => true 'export' => true
]); ]);
} }
@ -68,7 +69,9 @@ First add a function to generate the page:
'rows' => News::getNewsList(), 'rows' => News::getNewsList(),
'column' => 'title', 'column' => 'title',
'sortcol' => 'order', 'sortcol' => 'order',
'delete' => false 'delete' => false,
'create' => true,
'export' => true
]); ]);
} }
``` ```
@ -78,8 +81,9 @@ First add a function to generate the 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`: A `delete` button will appear in the list if this is set to `true`
* `export`: An export button will appear in the heading if this is set to `true` * `create`: A `new` button will appear in the heading if this is set to `true`
* `export`: An `export` button will appear in the heading if this is set to `true`
#### Editable Item #### Editable Item

View file

@ -5,7 +5,9 @@
<a href="/dashboard/export/{{ $model }}"><button type="button" class="btn btn-default">Export</button></a> <a href="/dashboard/export/{{ $model }}"><button type="button" class="btn btn-default">Export</button></a>
@endif @endif
<button type="button" class="new-button btn btn-default">New</button> @if($create == true)
<button type="button" class="new-button btn btn-default">New</button>
@endif
@endsection @endsection
@section('dashboard-body') @section('dashboard-body')