GithubHelp home page GithubHelp logo

admin's Introduction

Admin pack for Yii 2

This extension provides actions, widgets and other tools for admin panel creation in Yii2 project.

For license information check the LICENSE-file.

Latest Stable Version Total Downloads Build Status

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist yii2tech/admin

or add

"yii2tech/admin": "*"

to the require section of your composer.json.

Usage

This extension provides actions, widgets and other tools for admin panel creation in Yii2 project. These tools are meant to be used together for the rapid web application administration panel composition.

Actions

This extension provides several independent action classes, which provides particular operation support:

  • [[yii2tech\admin\actions\Index]] - displays the models listing with search support.
  • [[yii2tech\admin\actions\Create]] - supports creation of the new model using web form.
  • [[yii2tech\admin\actions\Update]] - supports updating of the existing model using web form.
  • [[yii2tech\admin\actions\Delete]] - performs the deleting of the existing record.
  • [[yii2tech\admin\actions\View]] - displays an existing model.
  • [[yii2tech\admin\actions\SoftDelete]] - performs the "soft" deleting of the existing record.
  • [[yii2tech\admin\actions\Restore]] - performs the restoration of the "soft" deleted record.
  • [[yii2tech\admin\actions\Callback]] - allows invocation of specified method of the model.

Please refer to the particular action class for more details.

For example CRUD controller based on provided actions may look like following:

namespace app\controllers;

use yii\web\Controller;

class ItemController extends Controller
{
    public function actions()
    {
        return [
            'index' => [
                'class' => 'yii2tech\admin\actions\Index',
                'modelClass' => $this->modelClass,
                'searchModelClass' => 'app\models\ItemSearch',
            ],
            'view' => [
                'class' => 'yii2tech\admin\actions\View',
                'modelClass' => 'app\models\Item',
            ],
            'create' => [
                'class' => 'yii2tech\admin\actions\Create',
                'modelClass' => 'app\models\Item',
            ],
            'update' => [
                'class' => 'yii2tech\admin\actions\Update',
                'modelClass' => 'app\models\Item',
            ],
            'delete' => [
                'class' => 'yii2tech\admin\actions\Delete',
                'modelClass' => 'app\models\Item',
            ],
        ];
    }
}

Controllers

This extension provides several predefined controllers, which can be used as a base controller classes while creating particular controllers:

  • [[yii2tech\admin\CrudController]] - implements a common set of actions for supporting CRUD for ActiveRecord.

Please refer to the particular controller class for more details.

Widgets

This extension provides several widgets, which simplifies view composition for the typical use cases:

  • [[yii2tech\admin\widgets\Alert]] - renders a message from session flash.
  • [[yii2tech\admin\widgets\ButtonContextMenu]] - simplifies rendering of the context links such as 'update', 'view', 'delete' etc.
  • [[yii2tech\admin\widgets\Nav]] - enhanced version of [[\yii\bootstrap\Nav]], which simplifies icon rendering.

Using Gii

This extension provides a code generators, which can be integrated with yii 'gii' module. In order to enable them, you should adjust your application configuration in following way:

return [
    //....
    'modules' => [
        // ...
        'gii' => [
            'class' => 'yii\gii\Module',
            'generators' => [
                'adminMainFrame' => [
                    'class' => 'yii2tech\admin\gii\mainframe\Generator'
                ],
                'adminCrud' => [
                    'class' => 'yii2tech\admin\gii\crud\Generator'
                ]
            ],
        ],
    ]
];

"MainFrame" generator creates a basic admin panel code, which includes layout files, main controller file and basic view files. The created structure is necessary for the correct rendering of the code created by "Admin CRUD" generator.

"Admin CRUD" generator is similar to regular "CRUD" generator, but it generates code, which use tools from this extension, so the result code is much more easier.

Internationalization

All text and messages introduced in this extension are translatable under category 'yii2tech-admin'. You may use translations provided within this extension, using following application configuration:

return [
    'components' => [
        'i18n' => [
            'translations' => [
                'yii2tech-admin' => [
                    'class' => 'yii\i18n\PhpMessageSource',
                    'basePath' => '@yii2tech/admin/messages',
                ],
                // ...
            ],
        ],
        // ...
    ],
    // ...
];

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.