maiconpinto / cakephp-adminlte-theme

CakePHP AdminLTE Theme
http://maiconpinto.github.io/cakephp-adminlte-theme/
MIT License
173 stars 111 forks source link

CakePHP4.0 support #93

Closed yKanazawa closed 4 years ago

yKanazawa commented 4 years ago

The result of https://github.com/maiconpinto/cakephp-adminlte-theme/issues/91 .

I think CakePHP4.0 support version must be major versionup. (e.x. 2.0.0)

CakePHP4.0 requires at least PHP7.2, but 1.1.0 support PHP5.4 - PHP5.6 for CakePHP3.x.

yKanazawa commented 4 years ago

README.md update example

CakePHP AdminLTE Theme (2.0.0)

What's the news

The AdminLTE was updated version to 2.4.5.

The CakePHP was updated version compatible to 4.0.0.

This release 2.0.0 is can be considered the stable version, as indicated in the SemVer.org recommendations.

Installation

You can install using composer.

composer require maiconpinto/cakephp-adminlte-theme

Enable Plugin

// src/Application.php

public function bootstrap()
{
    $this->addPlugin('AdminLTE');
}

Enable Theme

// src/Controller/AppController.php

public function beforeRender(EventInterface $event)
{
    $this->viewBuilder()->setTheme('AdminLTE');
}

Enable Form

// src/View/AppView.php

public function initialize()
{
    $this->loadHelper('Form', ['className' => 'AdminLTE.Form']);
}

Configure

// new config/adminlte.php file

return [
    'Theme' => [
        'title' => 'AdminLTE',
        'logo' => [
            'mini' => '<b>A</b>LT',
            'large' => '<b>Admin</b>LTE'
        ],
        'login' => [
            'show_remember' => true,
            'show_register' => true,
            'show_social' => true
        ],
        'folder' => ROOT,
        'skin' => 'blue'
    ]
];

// config/bootstrap.php

Configure::load('adminlte', 'default');

Customize Layout

If you want to Customize Layout

What's the features

Layouts

There are 10 layout files.

View Blocks

There are 3 Blocks where you can extend your theme.

<?php echo $this->fetch('css'); ?>

One example is templates/Pages/home.ctp:

<?php echo $this->Html->css('AdminLTE./bower_components/morris.js/morris', ['block' => 'css']); ?>
<?php echo $this->fetch('script'); ?>

One example is templates/Pages/home.ctp:

<?php echo $this->Html->script('AdminLTE./bower_components/morris.js/morris.min', ['block' => 'script']); ?>
<?php echo $this->fetch('scriptBottom'); ?>

One example is templates/Pages/home.ctp:

<?php $this->start('scriptBottom'); ?>
    <script>
      $.widget.bridge('uibutton', $.ui.button);
    </script>
<?php  $this->end(); ?>

Elements

There are 7 element files.

Flash Message

The theme is prepared to show Flash Messages.

<?php echo $this->Flash->render(); ?>
<?php echo $this->Flash->render('auth'); ?>

Bake

One of the better Cake features. The theme is prepared to use Bake.

bin/cake bake all user --theme AdminLTE

View

This is one the better theme feature. It change the pattern how Cake show view files.

Basically, you overwrite any theme, plugin and prefix files.

  1. templates/plugin/$theme/Plugin/$plugin/$prefix/
  2. templates/plugin/$theme/Plugin/$plugin/
  3. templates/plugin/$theme/$prefix/
  4. templates/plugin/$theme/

FormHelper

FormHelper by default has format template based on Foundation template. This helper overwrite these templates.

Behavior

When you configure App.defaultLocale to pt_BR this Behavior is util.

Locale

When you configure App.defaultLocale to pt_BR this Locale is util.

Page debug

Added link to default page of CakePHP.

Page debug

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request
yKanazawa commented 4 years ago

The result of PHPUnit is OK.

bash-4.2# vendor/phpunit/phpunit/phpunit --configuration=phpunit.xml.dist tests/TestCase/ConfiguresTest.php
PHPUnit 4.8.36 by Sebastian Bergmann and contributors.

..

Time: 372 ms, Memory: 6.00MB

OK (2 tests, 2 assertions)
bash-4.2#
hareshpatel1990 commented 4 years ago

Customize Layout Documents needs to be updated in order to cakephp 4