Skip to content

Releases: LaravelRUS/SleepingOwlAdmin

4.14.64-beta: Added Navigation Badge class to append badge to page

27 Feb 11:04
Compare
Choose a tag to compare
  • Added Navigation Badge class to append badge to page
    Example
(new Page(\App\Model\Contact2::class))
                ->setIcon('fa fa-fax')
                ->setPriority(100)
                ->addBadge(23, function($badge) {
                    $badge->setAttribute('class', 'bg-green');
                });

or custom badge class

(new Page(\App\Model\Contact2::class))
                ->setIcon('fa fa-fax')
                ->setPriority(100)
                ->setBadge(new CustomBadge);
  • Added HtmlAttributes in Navigation page class

Examle

(new Page(\App\Model\Contact2::class))->setAttribute('class', 'test-class');

4.13.64-beta

26 Feb 19:51
Compare
Choose a tag to compare
  • Added navigation checking access rights
    You can set global access rights rules
AdminNavigation::setAccessLogic(function(Page $page) {
   return auth()->user()->isSuperAdmin();
});

or by section

AdminNavigation::addPage(...)->setAccessLogic(...)->setPages(function(Page $page) {

});

or by page

AdminNavigation::addPage(...)->setAccessLogic(...)->seturl(...);
  • Nagigation can be build from array

app/Admin/navigation.php

AdminNavigation::setAccessLogic(function(Page $page) {
       return auth()->user()->isSuperAdmin();
});

AdminNavigation::addPage(\App\User::class)->setTitle('test')->setPages(function(Page $page) {
      $page
          ->addPage()
          ->setTitle('Dashboard')
          ->setUrl(route('admin.dashboard'))
          ->setPriority(100);

      $page->addPage(\App\User::class);
});

return [
    [
        'title' => 'Dashboard',
        'icon'  => 'fa fa-dashboard',
        'url'   => route('admin.dashboard'),
    ],

    [
        'title' => 'Information',
        'icon'  => 'fa fa-exclamation-circle',
        'url'   => route('admin.information'),
    ],
    [
        'title' => 'Content',
        'pages' => [

            \App\User::class,

            (new Page(\App\User::class))
                ->setPriority(100)
                ->setIcon('fa fa-user')
                ->setUrl('users')
                ->setAccessLogic(function (Page $page) {
                    return auth()->user()->isSuperAdmin();
            }),

            new Page([
                'title'    => 'News',
                'priority' => 200,
                'model'    => \App\News::class
            ]),

            (new Page(/* ... */))->setPages(function (Page $page) {
                $page->addPage([
                    'title'    => 'Blog',
                    'priority' => 100,
                    'model'    => \App\Blog::class
                ));

                $page->addPage(\App\Blog::class);
            }),

            [
                'title'       => 'News',
                'priority'    => 300,
                'accessLogic' => function ($page) {
                    return $page->isActive();
                },
                'pages'       => [
                    // ...
                ]
            ]
        ]
     ]
];
  • Fixed routes
  • Renamed BaseDateTime to DateTime

4.12.60-beta: Added Navigation class.

26 Feb 15:19
Compare
Choose a tag to compare
  • Added Navigation class
  • Removed composer package kodicms/laravel-navigation

Example

AdminSection::addMenuPage(\App\Model\News::class)->setItems(function() {

    AdminSection::addMenuPage()->setTitle('test')->setUrl('user/profile');

});

4.12.57-beta

26 Feb 10:50
Compare
Choose a tag to compare
  • Fixed problem with create new record when used FormElement::multiselect
  • Added new parameter to setting menu item priority

4.12.55-beta

26 Feb 09:34
Compare
Choose a tag to compare
  • Added new table column AdminColumn::relatedLink to show link to related section
  • Added AdminColumn::email table column view template
  • Fixed access checking for AdminColumn::link table column
  • Fixed problem with validation before creating
  • Fixed filter column template styles
  • Fixed content title.

4.12.48-beta

25 Feb 21:37
Compare
Choose a tag to compare
  • Renamed Template class method TemplateDefault::getTemplateViewPath -> TemplateDefault::getViewPath
  • Added Template class method TemplateDefault::makeTitle
  • Added config logo key and renamed title_mini -> logo_mini

4.12.45-beta

25 Feb 16:08
Compare
Choose a tag to compare
  • Added belongsTo and hasOne relations support in forms.
AdminFormElement::text('country.title', 'Country title')->required()
  • Added validation labels
  • Added new class FormButtons
$form = AdminForm::panel();
$form->getButtons()
    ->setSaveButtonText('Save news')
    ->hideSaveAndCloseButton();

// or set custom buttons

$form->setButtons(new \App\Form\Buttons);
  • Added class alias prefix in config file
  • Added success message for creating, updating, deleting and restoring record.
$model->setMessageOnDelete('<i class="fa fa-comment-o fa-lg"></i> Contact deleted');
$model->setMessageOnCreate('<i class="fa fa-check fa-lg"></i> Contact created');
$model->setMessageOnUpdate('<i class="fa fa-check fa-lg"></i> Contact updated');
$model->setMessageOnRestore('<i class="fa fa-check fa-lg"></i> Contact restored');

By default uses messages from lang file.

  • AdminDisplay moved to src directory and renamed to Display
  • Remove getParams method. Use toArray()
  • Move Filter directory to Display

4.10.41-beta

24 Feb 15:01
Compare
Choose a tag to compare
  • Fixed routes priority bug

4.10.40-beta

24 Feb 13:26
Compare
Choose a tag to compare
  • Add more flexibility for table header column and table control column

Header column customization

$display->setColumns([
    ...
    $fullNameColumn = AdminColumn::link('fullName')->setLabel('Name'),
    ...
]);

$fullNameColumn->getHeader()->setAttribute('class', 'bg-primary')->setTitle('Full name');

Control column customization

$display = AdminDisplay::table();
$display->getControlColumn()->getHeader()->setTitle('Control')->setAttribute('class', 'bg-black');
// or
$display->setControlColumn(new AdminColumn::customControl(...));
  • Fixed styles for table control buttons
  • Fixed form panel elements initialization
  • Fixed tabbed display rendering
  • Removed unused media library from common.less
  • Form buttons grouped and moved to the dropdown menu.

4.9.35-beta: Добавлена проверка прав доступа на работу с разделом.

23 Feb 16:55
Compare
Choose a tag to compare

Добавлена проверка прав доступа на работу с разделом.

По умолчанию проверка прав отключена и доступ к разделам можно отключать посредством методов

$model->disableDisplay();
$model->disableCreating();
$model->disableEditing();
$model->disableDeleting();
$model->disableRestoring();

Также можно включить проверку прав с помощью Policies
Для этого необходимо включить ее

$model->enableAccessCheck();

После чего создать для модели Policy класс для модели, которая используется в текущем разделе https://laravel.com/docs/5.2/authorization#policies

И в класс Policy добавить методы

public function display(User $user, Model $model);
public function create(User $user, Model $model);
public function edit(User $user, Model $model);
public function restore(User $user, Model $model);
public function delete(User $user, Model $model);

После чего проверка прав будет дополнительно осуществляться на его основе