Skip to content

Releases: LaravelRUS/SleepingOwlAdmin

4.60.13: Fix problem with console command `route:list`

02 Sep 22:21
Compare
Choose a tag to compare
  • fixed problem with reordering tree list
  • fixed problem with using Display columns in form
  • fixed problem with ordering datatable by date field
  • fixed bug with using several wysiwyg filelds
  • fixed problem with ModelConfiguration events updating and creating. Added new event saving
  • fixed multiselect template
  • fixed problem with display placable extensions
  • added additional parameters to DisplayTab constructor
  • fixed problem with console command route:list #263
  • fix #243
  • fix #248
  • pull request #246
  • pull request #251

After update:
php artisan vendor:publish --tag=assets --force

4.60.0

16 Aug 07:21
Compare
Choose a tag to compare
  • use webpack for javascript building
  • use vuejs
  • Fixed datatables range search
  • Refactoring form elements - image, images and file. Use vuejs to render fields data
  • Replaced flowjs with dropbox
  • Replaced bootbox with sweetalets
  • Added confirm dialog for tree control
  • Wysiwyg Editor config array replaced to Config\Repository
  • Added javascript modules system
  • issue #237

After update:
php artisan vendor:publish --tag=assets --force

4.55.51

11 Aug 07:49
Compare
Choose a tag to compare
  • fix #207
  • pull request #208
  • pull request #210
  • pull request #211
  • fix #212
  • pull request #215
  • pull request #216
  • pull request #224
  • pull request #230
  • pull request #231
  • new element AdminForm::elements
  • Improvements of form image, images and file elements .

You can use validators for files

AdminFormElement::image(...)->maxSize('2028') // kilobytes
AdminFormElement::image(...)->minSize('1024') // kilobytes
AdminFormElement::image(...)->addValidationRule('mimes:....') // 
AdminFormElement::image(...)->addValidationRule('dimensions:min_width=100,min_height=200') // https://laravel.com/docs/5.2/validation#rule-dimensions
// etc
  • Add new console command sleepingowl:section:provider
  • Update Ukraine language
  • Fix problem with searching page by id

4.52.36

19 Jul 06:38
Compare
Choose a tag to compare

4.48.25

04 Jul 07:46
Compare
Choose a tag to compare
AdminSection::registerModel(User::class, function (ModelConfiguration $model){

    // Add section to navigation menu
    $model->addToNavigation($priority = 100);


    // Add section to navigation menu with badge
    $model->addToNavigation($priority = 100, $badge = 100);

    $model->addToNavigation($priority = 100, function() {
         return User::count();
    });
});

You can activate service provider App\Providers\AdminSectionsServiceProvider (Run artisan command php artisan sleepingowl:install if file is not exists) in config sleeping_owl.

Add sections in App\Providers\AdminSectionsServiceProvider

// App\Providers\AdminSectionsServiceProvider

/**
 * @var array
 */
protected $sections = [
    \App\Role::class => 'App\Http\Admin\Roles',
    \App\User::class => 'App\Http\Admin\Users',
];

And run artisan command php artisan sleepingowl:section:generate for generate section classes.

Section class example

<?php

namespace App\Http\Admin;

use AdminColumn;
use AdminDisplay;
use AdminForm;
use AdminFormElement;
use SleepingOwl\Admin\Contracts\DisplayInterface;
use SleepingOwl\Admin\Contracts\FormInterface;
use SleepingOwl\Admin\Contracts\Initializable;
use SleepingOwl\Admin\Section;

class Roles extends Section implements Initializable
{
    /**
     * @var \App\Role
     */
    protected $model;

    /**
     * Initialize class.
     */
    public function initialize()
    {
        // Добавление пункта меню и счетчика кол-ва записей в разделе
        $this->addToNavigation($priority = 500, function() {
            return \App\Role::count();
        });

        $this->creating(function($config, \Illuminate\Database\Eloquent\Model $model) {
            ...
        });
    }

    /**
     * @return string
     */
    public function getIcon()
    {
        return 'fa fa-group';
    }

    /**
     * @return string|\Symfony\Component\Translation\TranslatorInterface
     */
    public function getTitle()
    {
        return trans('core.title.roles');
    }

    /**
     * @return DisplayInterface
     */
    public function onDisplay()
    {
        return AdminDisplay::table()->with('users')
           ->setHtmlAttribute('class', 'table-primary')
           ->setColumns(
               AdminColumn::text('id', '#')->setWidth('30px'),
               AdminColumn::link('label', 'Label')->setWidth('100px'),
               AdminColumn::text('name', 'Name')
           )->paginate(20);
    }

    /**
     * @param int $id
     *
     * @return FormInterface
     */
    public function onEdit($id)
    {
        return AdminForm::panel()->addBody([
            AdminFormElement::text('name', 'Key')->required(),
            AdminFormElement::text('label', 'Label')->required()
        ]);
    }

    /**
     * @return FormInterface
     */
    public function onCreate()
    {
        // Создание и редактирование записи идентичны, поэтому перенаправляем на метод редактирования
        return $this->onEdit(null);
    }

    /**
     * Переопределение метода содержащего заголовок создания записи
     *
     * @return string|\Symfony\Component\Translation\TranslatorInterface
     */
    public function getCreateTitle()
    {
        return 'Добавление роли';
    }

    /**
     * Переопределение метода для запрета удаления записи
     *
     * @param \Illuminate\Database\Eloquent\Model $model
     *
     * @return bool
     */
    public function isDeletable(\Illuminate\Database\Eloquent\Model $model)
    {
        return false;
    }

    /**
     * Переопределение метода содержащего ссылку на редактирование записи
     *
     * @param string|int $id
     *
     * @return string
     */
    public function getEditUrl($id)
    {
        return 'Ссылка на страницу редактирования';
    }

    /**
     * Переопределение метода содержащего ссылку на удаление записи
     *
     * @param string|int $id
     *
     * @return string
     */
    public function getDeleteUrl($id)
    {
        return 'Ссылка на удаление записи';
    }
}

4.45.16: Merge pull request #180 from LaravelRUS/analysis-q5464l

30 Jun 12:09
Compare
Choose a tag to compare
  • improvement of form columns
$form = AdminForm::form();

 $columns = AdminFormElement::columns();

 $columns->addColumn(function() {
    return [
        AdminFormElement::image('photo', 'Photo'),
        AdminFormElement::date('birthday', 'Birthday')->setFormat('d.m.Y'),
    ];
});

// or 

$columns->addColumn($column = new SleepingOwl\Admin\Form\Columns\Column([
    AdminFormElement::date('birthday', 'Birthday')->setFormat('d.m.Y'),
    ....
]));

// Set columns width
$column->setWidth(6); // from 1 to 12. If width is not set, it will be auto calculated


// Set columns size
$column->setSize('lg'); // or 'col-md-' | 'md'

// Set size for all columns
$columns->setSize('lg');

// Get column
$column = $columns->getColumns()->last();

// Set html attributes
$column->setHtmlAttribute('class', 'bg-success');
$columns->setHtmlAttribute('class', 'bg-success');
  • fix routes priority(System routes will be initialized after bootstraping all providers)
  • fix problem with registration routes from classes
  • Add feature to using view object as class template
AdminForm::form()->setView(view('path.to.view'));
AdminDisplay::table()->setView(view('path.to.view'));
AdminFormElement::date('birthday', 'Birthday')->setView(view('path.to.view'));
  • improvement of bage using
$page = new SleepingOwl\Admin\Navigation\Page(\App\Model\Contact::class);
$page->setIcon('fa fa-fax');
$page->setBadge(new \SleepingOwl\Admin\Navigation\Badge(function() {
    return \App\Model\Contact::count();
}));
  • Simplified models add to the menu
AdminSection::registerModel(User::class, function (ModelConfiguration $model) {
      ....
      $model->addToNavigation()->setIcon('fa fa-users');
});

4.41.8: Merge pull request #153 from LaravelRUS/analysis-87Wxp6

10 Jun 10:05
Compare
Choose a tag to compare
  • Add new form field
AdminFormElement::html('<hr />')
  • fix support laravel 5.1

4.40.8: Passing current url from controller to navigation class.

09 Jun 11:47
Compare
Choose a tag to compare

4.40.1: Update Columns.php

01 Jun 09:46
Compare
Choose a tag to compare
fix error 'Call to a member function getName() on null' in ...\Traits\Assets.php:77

4.40.0

30 May 14:37
Compare
Choose a tag to compare
Fix admin meta title