crabstudio / ace
CakePHP 3 bake theme, integrated with Ace Admin template, UserActivityLogging, SoftDeleteRestore. For more, please look at README.md file
Installs: 161
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 0
Open Issues: 0
Language:JavaScript
Type:cakephp-plugin
Requires
- php: >=5.4.16
- cakephp/cakephp: ~3.1
- crabstudio/recaptcha: ^1.0
- crabstudio/search: ^1.0
Requires (Dev)
This package is not auto-updated.
Last update: 2016-05-09 08:44:42 UTC
README
DEPRECATED: use this Skeleton as replacement
Introduction
This plugin integrated with ACE responsive theme, breadcrumb automatic add to your view.
You can generate all (controller, model, template) with this plugin.
By default, the generated controller integrated with UserActivityTrait (need Auth component to run)
If you do not need this feature, do not bake controller with Crabstudio/Ace
The generated model integrated with SoftDeleteRestoreTrait, this trait allow you to soft delete (not really wiped out record) and you can restore.
If you do not need this feature, do not bake model with Crabstudio/Ace
I just hold single license, you must buy ACE theme license for your project
Installation
You can install this plugin into your CakePHP application using composer.
The recommended way to install composer packages is:
composer require crabstudio/ace
Or add the following lines to your application's composer.json:
"require": {
"crabstudio/ace": "^1.0"
}
followed by the command:
composer update
Load plugin
Add this line to Your_project\config\bootstrap.php
Plugin::load('Crabstudio/Ace', ['bootstrap' => true]);
Use backend layout
Your must copy all files, folders in Crabstudio/Ace/webroot/ to your_project/webroot
Copy Crabstudio/Ace/src/Template/Layout/backend.ctp to your_project/src/Template/Layout/
Copy all files in folder Crabstudio/Ace/src/Template/Element/ to your_project/src/Template/Layout/Element/
Then in your controller, set layout
$this->_viewBuilder->layout('backend');
Bake template
Windows:
your_project>bin\cake bake all Users --theme Crabstudio/Ace
Linux, Unix:
your_project>bin/cake bake all Users --theme Crabstudio/Ace
Bonus more offer
This plugin provide some global function and you can call from anywhere:
format_date($time, $timezone, $format);
str_slug($source);
SluggableBehavior
Usage format_date function
/**
* Format date use Cake\I18n\Time class with default timezone "Asia/Tokyo"
* and default format "yyyy/MM/dd HH:mm:ss"
*
* @param date $time
* @param string $timezone
* @param string $format
* @return string
*/
Ex:
$formatedDate = format_date($user->created_at);
echo $formatedDate; //2015/09/24 03:00:00
$formatedDate = format_date($user->created_at, 'Asia/Bangkok');
echo $formatedDate; //2015/09/24 01:00:00
$formatedDate = format_date($user->created_at, 'Asia/Bangkok', 'HH:mm:ss dd/MM/yyyy');
echo $formatedDate; //01:00:00 24/09/2015
Usage str_slug function
/**
* Do unsigned utf-8 characters and make friendly-link-like-this
*
* @param string $source
* @return string
*/
echo str_slug('Nguyễn Anh Tuấn'); //nguyen-anh-tuan
Usage SluggableBehavior
In your Model Table, insert this one into function initialize:
/**
* Do unsigned utf-8 characters and make friendly-link-like-this
*
* @param string $source name of field hold source string
* @param string $replacement name of field will store slugged string
* @return string
*/
$this->addBehavior('Crabstudio/Ace.Sluggable', [
'field' => 'title',
'slug' => 'slug',
]);