Releases: LaravelRUS/SleepingOwlAdmin
4.17.88-beta: Merge pull request #38 from LaravelRUS/analysis-ze72MK
Fixed display actions
Display
// Display
$model->onDisplay(function () {
$display = AdminDisplay::table()
->setActions([
AdminColumn::action('export', 'Export')
->setIcon('fa fa-share')
->setAction(route('admin.news.export'))
->usePost()
])
->setColumns([
AdminColumn::checkbox(),
...
AdminColumn::link('title')->setLabel('Title'),
...
]);
return $display;
});
Route
Route::post('/news/export', ['as' => 'admin.news.export', function () {
return new \Illuminate\Http\JsonResponse([
'title' => 'Congratulation! You exported news.',
'news' => App\Model\News5::whereIn('id', Request::get('id', []))->get()
]);
}]);
You can change buttons placement
$display->getActions()->setPlacement('panel.buttons')->setAttribute('class', 'pull-right');
Placement block list:
before.panel
panel.buttons
panel.heading.actions
panel.heading
panel.footer
after.panel
4.17.87-beta
Added default form methods
4.17.86-beta: issue #30
- issue #30
Added new display column type Column\Editabe
for editing table data in place.
Example
// Display
$model->onDisplay(function () {
return AdminDisplay::table()->setApply(function($query) {
$query->orderBy('date', 'desc');
})->setColumns([
AdminColumn::link('title')->setLabel('Title'),
...
AdminColumnEditable::checkbox('published', 'Yes', 'No')->setLabel('Published'),
...
])->paginate(5);
});
For editing used jquery plugin http://vitalets.github.io/x-editable/ . Need help with creating other column types
IMPORTANT! After composer update
you should remove assets public\packages\sleepingowl
, config sleeping_owl.php
and run artisan command php artisan sleepingowl:install
- issue #34
Sometimes, form has field (for example: password
), which should not update if empty.
Example
User model App\User
has field password
// Create And Edit
$model->onCreate(function() {
return AdminForm::panel()->addBody([
...
AdminFormElement::password('password', 'Password')->required()->addValidationRule('min:6'),
...
]);
});
$model->onEdit(function() {
return AdminForm::panel()->addBody([
...
AdminFormElement::password('password', 'Password')->updateIfFilled(), // or updateIfNotEmpty()
...
]);
});
Enjoy!
4.16.86-beta: Added link to current page `AdminNavigation::getCurrent()`
- issue #32
Example
AdminSection::registerModel(Contact3::class, function (ModelConfiguration $model) {
$model->setControllerClass(\App\Http\Controller\MyCustomContact3Controller::class);
$model->onDisplay(function () { ... });
});
And then you will create controller
class MyCustomContact3Controller extends \SleepingOwl\Admin\Http\Controllers\AdminController
{
public function getCreate(ModelConfiguration $model)
{
...
// Custom logic
...
return $this->render($model, $create);
}
}
- Filter display table data by realted field
Example
You have model Contact
with relation country
$display->setFilters([
AdminDisplayFilter::field('country.title') // Search in country relation and field title
->setOperator(\SleepingOwl\Admin\Display\Filter\FilterBase::CONTAINS) // Like
]);
And send request with query string http://.....?country[title]=Bot
List of operators is here https://github.com/LaravelRUS/SleepingOwlAdmin/blob/development/src/Display/Filter/FilterBase.php#L13
- Updated navigation
- Added link to current page
AdminNavigation::getCurrent()
- Improved searching for current page.
- Added service container binding for navigation page and badge classes
- Added link to current page
$this->app->bind(PageInterface::class, Navigation\Page::class);
$this->app->bind(BadgeInterface::class, Navigation\Badge::class);
4.15.84-beta: fixed #25
- issue #25
4.15.83-beta
- Fixed DisplayTree
- Update Javascripts
- Remove rule params by setting custom validation message
4.15.80-beta
- Added pagination page key name
AdminDisplay::table()->paginate(10, 'news');
- Added setActive method default value
DisplayTab::setActive($active = true)
AdminDisplay::extend('columns', new \SleepingOwl\Admin\Display\Extension\Columns);
AdminDisplay::table()->getColumns() // Will return class \SleepingOwl\Admin\Display\Extension\Columns
// Will append columns to display extension class Columns
AdminDisplay::table()->setColumns([
....
]);
// Equal
AdminDisplay::table()->getColumns()->set([...]);
You can extend Display class
AdminDisplay::extend('some_extansion', new \App\SomeDisplayExtension)
More example
AdminDisplay::setActions([
....
])
AdminDisplay::getActions()->setPosition('panel.footer')->setView('custom.view');
- Fixed DisplayTree control column initialization
- Fixed Display Filter initialization
- Refactored Display classes. Added extensions. Display columns, actions, filters, columnFilters moved to extensions.
- Fixed aliases initialization and registering column routes
4.14.74-beta
- Fixed #14
4.14.73-beta
- Fixed #13
4.14.72-beta
- Added new methods for class TextAddon.
TextAddon::placeBefore()
TextAddon::placeAfter()
- Renamed method Select::setNullable to nullable
- BaseColumn renamed to TableColumn and moved to parent directory
- ColumnHeader renamed to TableHeaderColumn and moved to parent directory
- BaseFormElement renamed to FormElement and moved to parent directory
- Updated default config file.
- Refactored alias registering.