Skip to content

Releases: LaravelRUS/SleepingOwlAdmin

4.17.88-beta: Merge pull request #38 from LaravelRUS/analysis-ze72MK

17 Mar 10:50
Compare
Choose a tag to compare

Fixed display actions

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');

actions-top

Placement block list:

  • before.panel
  • panel.buttons
  • panel.heading.actions
  • panel.heading
  • panel.footer
  • after.panel

4.17.87-beta

17 Mar 10:47
Compare
Choose a tag to compare
4.17.87-beta Pre-release
Pre-release
Added default form methods

4.17.86-beta: issue #30

15 Mar 08:24
Compare
Choose a tag to compare

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


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()`

13 Mar 20:16
Compare
Choose a tag to compare

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
$this->app->bind(PageInterface::class, Navigation\Page::class);
$this->app->bind(BadgeInterface::class, Navigation\Badge::class);

4.15.84-beta: fixed #25

10 Mar 06:33
Compare
Choose a tag to compare

4.15.83-beta

05 Mar 09:09
Compare
Choose a tag to compare
  • Fixed DisplayTree
  • Update Javascripts
  • Remove rule params by setting custom validation message

4.15.80-beta

04 Mar 19:42
Compare
Choose a tag to compare
  • 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

29 Feb 12:51
Compare
Choose a tag to compare

4.14.73-beta

29 Feb 11:02
Compare
Choose a tag to compare

4.14.72-beta

28 Feb 14:04
Compare
Choose a tag to compare
  • 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.