Giter VIP home page Giter VIP logo

cakelte's Introduction

CakeLTE: AdminLTE plugin for CakePHP 5.x

If it's helpful you can buy me a coffee, thanks!

ko-fi

Getting Started

Dependencies

Installing

You can install this plugin into your CakePHP application using composer.

The recommended way to install composer packages is:

composer require arodu/cakelte

Configuration

You can load the plugin using the shell command:

bin/cake plugin load CakeLte

add AdminLTE symlink to webroot

bin/cake cakelte install

How to use

Copy the file vendor/arodu/cakelte/config/cakelte.php to config/cakelte.php

cp vendor/arodu/cakelte/config/cakelte.php config/cakelte.php

In this file you can change the cakelte configuration options

use trait into src/View/AppView.php (Recomended)

namespace App\View;

use Cake\View\View;
use CakeLte\View\CakeLteTrait;

class AppView extends View{
  use CakeLteTrait;

  public string $layout = 'CakeLte.default';

  public function initialize(): void{
      parent::initialize();
      $this->initializeCakeLte();
      //...
  }
}

or you can extends from CakeLteView

namespace App\View;

use Cake\View\View;
use CakeLte\View\CakeLteView;

class AppView extends CakeLteView{

  public function initialize(): void{
    parent::initialize();
    //...
  }
}

Options layouts

  • CakeLte.default
  • CakeLte.login
  • CakeLte.top-nav

Create code from bake

bin/cake bake all [command] -t CakeLte

bin/cake bake template [command] -t CakeLte login
bin/cake bake template [command] -t CakeLte register
bin/cake bake template [command] -t CakeLte recovery

To modify the template you can copy one or all the files within your project, copying the following files in the folder templates/plugin/CakeLte/ and keeping the same structure of templates/

Replace the files elements

  • Layouts
    • templates/layout/default.php
    • templates/layout/login.php
    • templates/layout/top-nav.php
  • Content
    • templates/element/content/header.php
  • Header navbar
    • templates/element/header/main.php
    • templates/element/header/menu.php
    • templates/element/header/messages.php
    • templates/element/header/notifications.php
    • templates/element/header/search-default.php
    • templates/element/header/search-block.php
  • Footer
    • templates/element/footer/main.php
  • Left sidebar
    • templates/element/sidebar/main.php
    • templates/element/sidebar/menu.php
    • templates/element/sidebar/search.php
    • templates/element/sidebar/user.php
  • Right sidebar
    • templates/element/aside/main.php

Or you can use the following command to copy all files

bin/cake cakelte copy_files --all

Page debug

Link to debug

echo $this->Html->link(__('CakeLTE debug page'), '/cake_lte/debug' );

// {your-url}/cake_lte/debug

Page Debug with default layout

Page Debug with top-nav layour

License

This project is licensed under the MIT License - see the LICENSE file for details

cakelte's People

Contributors

arodu avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cakelte's Issues

Layout not auto-loading after composer update

Hello.
The plugin was applying CakeLte.starter layout automaticaly.

Today I ran composer update and now the layout is null.
I have no changes in the code so it must be some incompatibility or something.

Actually, I prefer it this way but it took me some time to find out what was going on.

Debug:

debug( $this->viewBuilder()->getLayout() );
// null

Now, I have to manually add this:

$this->viewBuilder()->setlayout( 'CakeLte.starter' );

Componer update log:

$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 5 installs, 17 updates, 0 removals
  - Updating laminas/laminas-httphandlerrunner (1.1.0 => 1.2.0): Downloading (100%)
  - Updating cakephp/chronos (2.0.4 => 2.0.5): Downloading (100%)
  - Updating cakephp/cakephp (4.0.7 => 4.0.8): Downloading (100%)
  - Updating arodu/cakelte (v0.1.0 => v0.1.1): Downloading (100%)
  - Installing symfony/polyfill-php80 (v1.17.0): Downloading (100%)
  - Updating symfony/process (v5.0.8 => v5.1.0): Downloading (100%)
  - Updating symfony/finder (v5.0.8 => v5.1.0): Downloading (100%)
  - Updating symfony/filesystem (v5.0.8 => v5.1.0): Downloading (100%)
  - Updating symfony/service-contracts (v2.0.1 => v2.1.2): Downloading (100%)
  - Installing symfony/polyfill-intl-normalizer (v1.17.0): Downloading (100%)
  - Installing symfony/polyfill-intl-grapheme (v1.17.0): Downloading (100%)
  - Installing symfony/string (v5.1.0): Downloading (100%)
  - Updating symfony/console (v5.0.8 => v5.1.0): Downloading (100%)
  - Updating justinrainbow/json-schema (5.2.9 => 5.2.10): Downloading (100%)
  - Updating composer/xdebug-handler (1.4.1 => 1.4.2): Downloading (100%)
  - Updating composer/composer (1.10.6 => 1.10.7): Downloading (100%)
  - Updating cakephp/debug_kit (4.1.2 => 4.2.0): Downloading (100%)
  - Installing symfony/deprecation-contracts (v2.1.2): Downloading (100%)
  - Updating symfony/config (v5.0.8 => v5.1.0): Downloading (100%)
  - Updating doctrine/instantiator (1.3.0 => 1.3.1): Downloading (100%)
  - Updating nikic/php-parser (v4.4.0 => v4.5.0): Downloading (100%)
  - Updating symfony/var-dumper (v5.0.8 => v5.1.0): Downloading (100%)
Writing lock file
Generating autoload files
> Cake\Composer\Installer\PluginInstaller::postAutoloadDump

Thanks.

CakeLteHelper could not be found.

I have followed the steps given here, but I am getting this error.

Missing Helper
Cake\View\Exception\MissingHelperException

I couldn't understand following,

  • To modify the template you can copy one or all the files within your project
  • Page debug

If someone could help me, please share how to resolve this issue.

Unable to add menu items in Sidebar.

Dear Arodu,

I have followed the steps given in your readme file and I was trying to update the menu items but after adding one more item inside menu.php file inside templates/plugin/CakeLte/templates/element/sidebar/menu.php the item is not displaying in left handside of the menubar.

Please let me know If I am doing anything wrong.

Regards
Ashish

Bootstrap 5

Is there any plans to make a Bootstrap 5 version ?

Possible improvement to layout?

Not sure if I'm doing this right. I had added an Icon on the page title e.g.

$this->assign('title', '<i class="nav-icon fas fa-user-cog"></i> Users');
CleanShot 2022-01-21 at 23 55 14

However as this is also used in the page title I see this in the page title

CleanShot 2022-01-21 at 23 56 20@2x

Is this the correct way to do this?

Adding strip_tags to the title should fix this

<title><?= strip_tags($this->fetch('title')) . ' | ' . strip_tags($this->CakeLte->getConfig('app-name')) ?></title>
Is it possible to override the default in the plugin with my own? I tries added a copy to src/templates/layout but didn't work.

Form Class

how to configure form-horizontal, because
I have added class class-horizontal but it's still not running

thanks

Breadcrumbs title strings without __ function for internationalization

All title strings generated for breadcrumbs are not wrapped by the __ function.

For example, when baking a template, it produces:
$this->Breadcrumbs->add([ ['title' => 'Home', 'url' => '/'], ['title' => 'List Users'], ]);

instead of

$this->Breadcrumbs->add([ ['title' => __('Home'), 'url' => '/'], ['title' => __('List Users')], ]);

Most of the code generated does come with __ function, however, Breadcrumbs generation does not.

Button [Save] is not formatted

When we execute cake bake all [] -t CakeLte, the forms add and edit into /templates/[]/add and edit the buttons [SAVE] are come without fomatetion.

Thanks..
image

Top-nav layout menu not showing

Hi,

First of all, great work. I now have an alternative CakePHP theme aside from cakephp-adminlte-them by maiconpinto.

I found an issue on top-nav layout menu where the top menu does not show during expand. Only the search bar will show up but not the menu.

Thanks a lot.

Related Not found record string without __ function for internationalization

Hi, its me again! Sorry for not spotting this on the prevous issue.

When baking a view template, if the entity has related entities, the record not found string does not contain the __ function.

Example:
Users record not found!
Instead of:

<?=__('Users record not found!')?>

I believe the change must be done on line 130 of bake/template/view.twig.

Thanks for the previous fix!

Replace Date Picker?

Is is possible to update the Data Picker from the standard drop down to use DatePicker as used in the AdminLTE sample page (eg here ? The standard is a bit plain and out of step with the rest of the theme, and I would also like to incorporate the DateRangePicker in some reports also seen on the same page.

issue with the template

i used cakelte withe cakephp4 and it was great, but now with cakephp5 and this new version of cakelte, i have an issue with the template, some help plz
adminlte5

Unable to overwrite layout files (v1.1.1 / cakephp4.5.2)

Thanks for this wonderful AdminLTE plugin.

I was able to overwrite correctly the folders under the "templates/element/" dir.
But The Layout files ( "templates/layout/" ) were not able to overwrite.

Layouts

  • copy from
    vendor/arodu/cakelte/templates/layout/default.php

  • to
    templates/layout/default.php
    ... I customized this file

Do I need any settings?
I use trait into src/View/AppView.php (Recomended)

My environment.

  • cakephp/cakephp 4.5.2
  • arodu/cakelte v1.1.1

overwrite

Unable to install plugin

Hello

I have just created a clean CakePHP 4.3 install, and used composer to install the plugin as detailed by your page. However, when I enable as per the AppView method, I end up with

syntax error, unexpected 'Helper' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)
ROOT/vendor/arodu/cakelte/src/View/Styles/Header.php
Error in: ROOT/vendor/arodu/cakelte/src/View/Styles/Header.php, line 34

and the page does not load up now.

Any assistance would be appreciated.

Using CakePHP 4.3.2
PHP: 7.3.29

UPDATE
If I comment out the two private variable lines from Header.php and Sidebar.php files, it seems to be working. Haven't done much more testing, other than load up the debug page a click around

Are there other alternatives to AdminLTE?

Hi all..

bootstrap 5 was released in 2021, and in AdminLTE there is no beta version of it yet, and possibly bootstrap 6 will released soon

Is there any other project similar to AdminLTE that I can use as a base in a new cakephp plugin?
I would like to do the same work I have been doing here, but with a new theme

CakePHP 5?

Will cakelte be updated for CakePHP5?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.