Browse Source
* master: (131 commits) css fix. Finished model generator. more tests for FileHelper Added note about theme asset bundle to bootstrap widgets guide fixed typos in ArrayHelperBase phpdoc More tests for ArrayHelper and Inflector Fixed typo and code style Fixes #21: implemented jQueryUI Slider Fixes #790: added visible for Nav and Dropdown finished rule generation for model generator. bug fix of form generator. minor fixes of debugger. Added SafeValidator. fix dataProvider getSort() cleanup MemCache timeout API after #804 Added failureCallback, reduced timeouts to 1s Mentioning that timeoutms is available in memcache only. set default format for gridview to text Removed extra line Added timeoutms parameter in MemCache ... Conflicts: tests/unit/data/config.phptags/2.0.0-beta
Carsten Brandt
11 years ago
227 changed files with 14549 additions and 7361 deletions
@ -1,5 +1,4 @@ |
|||||||
<?php |
<?php |
||||||
|
|
||||||
return array( |
return array( |
||||||
'adminEmail' => 'admin@example.com', |
'adminEmail' => 'admin@example.com', |
||||||
); |
); |
||||||
|
@ -1,78 +1,19 @@ |
|||||||
body { |
body { |
||||||
padding-top: 20px; |
padding-top: 70px; |
||||||
padding-bottom: 60px; |
|
||||||
} |
} |
||||||
|
|
||||||
/* Custom container */ |
.footer { |
||||||
.container { |
border-top: 1px solid #ddd; |
||||||
margin: 0 auto; |
margin-top: 30px; |
||||||
max-width: 1000px; |
padding-top: 15px; |
||||||
|
padding-bottom: 30px; |
||||||
} |
} |
||||||
|
|
||||||
.container > hr { |
|
||||||
margin: 60px 0; |
|
||||||
} |
|
||||||
|
|
||||||
/* Main marketing message and sign up button */ |
|
||||||
.jumbotron { |
.jumbotron { |
||||||
margin: 80px 0; |
text-align: center; |
||||||
text-align: center; |
background-color: transparent; |
||||||
} |
|
||||||
|
|
||||||
.jumbotron h1 { |
|
||||||
font-size: 100px; |
|
||||||
line-height: 1; |
|
||||||
} |
|
||||||
|
|
||||||
.jumbotron .lead { |
|
||||||
font-size: 24px; |
|
||||||
line-height: 1.25; |
|
||||||
} |
} |
||||||
|
|
||||||
.jumbotron .btn { |
.jumbotron .btn { |
||||||
font-size: 21px; |
font-size: 21px; |
||||||
padding: 14px 24px; |
padding: 14px 24px; |
||||||
} |
|
||||||
|
|
||||||
/* Supporting marketing content */ |
|
||||||
.marketing { |
|
||||||
margin: 60px 0; |
|
||||||
} |
|
||||||
|
|
||||||
.marketing p + h4 { |
|
||||||
margin-top: 28px; |
|
||||||
} |
|
||||||
|
|
||||||
/* Customize the navbar links to be fill the entire space of the .navbar */ |
|
||||||
.navbar.fullwidth .navbar-inner { |
|
||||||
padding: 0; |
|
||||||
} |
|
||||||
|
|
||||||
.navbar.fullwidth .nav { |
|
||||||
margin: 0; |
|
||||||
display: table; |
|
||||||
width: 100%; |
|
||||||
} |
|
||||||
|
|
||||||
.navbar.fullwidth .nav li { |
|
||||||
display: table-cell; |
|
||||||
width: 1%; |
|
||||||
float: none; |
|
||||||
} |
|
||||||
|
|
||||||
.navbar.fullwidth .nav li a { |
|
||||||
font-weight: bold; |
|
||||||
text-align: center; |
|
||||||
border-left: 1px solid rgba(255, 255, 255, .75); |
|
||||||
border-right: 1px solid rgba(0, 0, 0, .1); |
|
||||||
} |
|
||||||
|
|
||||||
.navbar.fullwidth .nav li:first-child a { |
|
||||||
border-left: 0; |
|
||||||
border-radius: 3px 0 0 3px; |
|
||||||
} |
|
||||||
|
|
||||||
.navbar.fullwidth .nav li:last-child a { |
|
||||||
border-right: 0; |
|
||||||
border-radius: 0 3px 3px 0; |
|
||||||
} |
} |
||||||
|
@ -1,5 +1,4 @@ |
|||||||
<?php |
<?php |
||||||
|
|
||||||
return array( |
return array( |
||||||
'adminEmail' => 'admin@example.com', |
'adminEmail' => 'admin@example.com', |
||||||
); |
); |
||||||
|
@ -1,3 +1,3 @@ |
|||||||
<?php |
<?php |
||||||
return array( |
return array( |
||||||
); |
); |
||||||
|
@ -1,3 +1,3 @@ |
|||||||
<?php |
<?php |
||||||
return array( |
return array( |
||||||
); |
); |
||||||
|
@ -1,3 +1,3 @@ |
|||||||
<?php |
<?php |
||||||
return array( |
return array( |
||||||
); |
); |
||||||
|
@ -1,3 +1,3 @@ |
|||||||
<?php |
<?php |
||||||
return array( |
return array( |
||||||
); |
); |
||||||
|
@ -1,3 +1,3 @@ |
|||||||
<?php |
<?php |
||||||
return array( |
return array( |
||||||
); |
); |
||||||
|
@ -1,3 +1,3 @@ |
|||||||
<?php |
<?php |
||||||
return array( |
return array( |
||||||
); |
); |
||||||
|
@ -1,3 +1,3 @@ |
|||||||
<?php |
<?php |
||||||
return array( |
return array( |
||||||
); |
); |
||||||
|
@ -1,3 +1,3 @@ |
|||||||
<?php |
<?php |
||||||
return array( |
return array( |
||||||
); |
); |
||||||
|
@ -1,5 +1,4 @@ |
|||||||
<?php |
<?php |
||||||
|
|
||||||
return array( |
return array( |
||||||
'adminEmail' => 'admin@example.com', |
'adminEmail' => 'admin@example.com', |
||||||
); |
); |
||||||
|
@ -1,16 +1,16 @@ |
|||||||
<?php |
<?php |
||||||
use yii\helpers\Html; |
use yii\helpers\Html; |
||||||
|
|
||||||
/** |
/** |
||||||
* @var yii\base\View $this |
* @var yii\base\View $this |
||||||
*/ |
*/ |
||||||
$this->title = 'About'; |
$this->title = 'About'; |
||||||
$this->params['breadcrumbs'][] = $this->title; |
$this->params['breadcrumbs'][] = $this->title; |
||||||
?> |
?> |
||||||
<h1><?php echo Html::encode($this->title); ?></h1>
|
<div class="site-about"> |
||||||
|
<h1><?php echo Html::encode($this->title); ?></h1>
|
||||||
<p> |
|
||||||
This is the About page. You may modify the following file to customize its content: |
|
||||||
</p> |
|
||||||
|
|
||||||
<code><?php echo __FILE__; ?></code>
|
<p>This is the About page. You may modify the following file to customize its content:</p> |
||||||
|
|
||||||
|
<code><?php echo __FILE__; ?></code>
|
||||||
|
</div> |
||||||
|
@ -1,78 +1,19 @@ |
|||||||
body { |
body { |
||||||
padding-top: 20px; |
padding-top: 70px; |
||||||
padding-bottom: 60px; |
|
||||||
} |
} |
||||||
|
|
||||||
/* Custom container */ |
.footer { |
||||||
.container { |
border-top: 1px solid #ddd; |
||||||
margin: 0 auto; |
margin-top: 30px; |
||||||
max-width: 1000px; |
padding-top: 15px; |
||||||
|
padding-bottom: 30px; |
||||||
} |
} |
||||||
|
|
||||||
.container > hr { |
|
||||||
margin: 60px 0; |
|
||||||
} |
|
||||||
|
|
||||||
/* Main marketing message and sign up button */ |
|
||||||
.jumbotron { |
.jumbotron { |
||||||
margin: 80px 0; |
text-align: center; |
||||||
text-align: center; |
background-color: transparent; |
||||||
} |
|
||||||
|
|
||||||
.jumbotron h1 { |
|
||||||
font-size: 100px; |
|
||||||
line-height: 1; |
|
||||||
} |
|
||||||
|
|
||||||
.jumbotron .lead { |
|
||||||
font-size: 24px; |
|
||||||
line-height: 1.25; |
|
||||||
} |
} |
||||||
|
|
||||||
.jumbotron .btn { |
.jumbotron .btn { |
||||||
font-size: 21px; |
font-size: 21px; |
||||||
padding: 14px 24px; |
padding: 14px 24px; |
||||||
} |
|
||||||
|
|
||||||
/* Supporting marketing content */ |
|
||||||
.marketing { |
|
||||||
margin: 60px 0; |
|
||||||
} |
|
||||||
|
|
||||||
.marketing p + h4 { |
|
||||||
margin-top: 28px; |
|
||||||
} |
|
||||||
|
|
||||||
/* Customize the navbar links to be fill the entire space of the .navbar */ |
|
||||||
.navbar.fullwidth .navbar-inner { |
|
||||||
padding: 0; |
|
||||||
} |
|
||||||
|
|
||||||
.navbar.fullwidth .nav { |
|
||||||
margin: 0; |
|
||||||
display: table; |
|
||||||
width: 100%; |
|
||||||
} |
|
||||||
|
|
||||||
.navbar.fullwidth .nav li { |
|
||||||
display: table-cell; |
|
||||||
width: 1%; |
|
||||||
float: none; |
|
||||||
} |
|
||||||
|
|
||||||
.navbar.fullwidth .nav li a { |
|
||||||
font-weight: bold; |
|
||||||
text-align: center; |
|
||||||
border-left: 1px solid rgba(255, 255, 255, .75); |
|
||||||
border-right: 1px solid rgba(0, 0, 0, .1); |
|
||||||
} |
|
||||||
|
|
||||||
.navbar.fullwidth .nav li:first-child a { |
|
||||||
border-left: 0; |
|
||||||
border-radius: 3px 0 0 3px; |
|
||||||
} |
|
||||||
|
|
||||||
.navbar.fullwidth .nav li:last-child a { |
|
||||||
border-right: 0; |
|
||||||
border-radius: 0 3px 3px 0; |
|
||||||
} |
} |
||||||
|
@ -1,19 +1,20 @@ |
|||||||
body { |
body { |
||||||
padding-top: 70px; |
padding-top: 70px; |
||||||
} |
} |
||||||
|
|
||||||
.footer { |
.footer { |
||||||
border-top: 1px solid #ddd; |
border-top: 1px solid #ddd; |
||||||
margin-top: 30px; |
margin-top: 30px; |
||||||
padding-top: 15px; |
padding-top: 15px; |
||||||
padding-bottom: 30px; |
padding-bottom: 30px; |
||||||
} |
} |
||||||
|
|
||||||
.jumbotron { |
.jumbotron { |
||||||
text-align: center; |
text-align: center; |
||||||
background-color: transparent; |
background-color: transparent; |
||||||
} |
} |
||||||
|
|
||||||
.jumbotron .btn { |
.jumbotron .btn { |
||||||
font-size: 21px; |
font-size: 21px; |
||||||
padding: 14px 24px; |
padding: 14px 24px; |
||||||
} |
} |
||||||
|
@ -0,0 +1,174 @@ |
|||||||
|
Advanced application template |
||||||
|
============================= |
||||||
|
|
||||||
|
This template is for large projects developed in teams where backend is divided from frontend, application is deployed |
||||||
|
to multiple servers etc. This application template also goes a bit further regarding features and provides essential |
||||||
|
database, signup and password restore out of the box. |
||||||
|
|
||||||
|
Installation |
||||||
|
------------ |
||||||
|
|
||||||
|
### Install via Composer |
||||||
|
|
||||||
|
If you do not have [Composer](http://getcomposer.org/), you may download it from |
||||||
|
[http://getcomposer.org/](http://getcomposer.org/) or run the following command on Linux/Unix/MacOS: |
||||||
|
|
||||||
|
~~~ |
||||||
|
curl -s http://getcomposer.org/installer | php |
||||||
|
~~~ |
||||||
|
|
||||||
|
You can then install the application using the following command: |
||||||
|
|
||||||
|
~~~ |
||||||
|
php composer.phar create-project --stability=dev yiisoft/yii2-app-advanced /path/to/yii-application |
||||||
|
~~~ |
||||||
|
|
||||||
|
Getting started |
||||||
|
--------------- |
||||||
|
|
||||||
|
After you install the application, you have to conduct the following steps to initialize |
||||||
|
the installed application. You only need to do these once for all. |
||||||
|
|
||||||
|
1. Execute the `init` command and select `dev` as environment. |
||||||
|
--- |
||||||
|
php /path/to/yii-application/init |
||||||
|
--- |
||||||
|
2. Create a new database. It is assumed that MySQL InnoDB is used. If not, adjust `console/migrations/m130524_201442_init.php`. |
||||||
|
3. In `common/config/params.php` set your database details in `components.db` values. |
||||||
|
|
||||||
|
4. Set document roots of your Web server: |
||||||
|
|
||||||
|
- for frontend `/path/to/yii-application/frontend/web/` and using the URL `http://frontend/` |
||||||
|
- for backend `/path/to/yii-application/backend/web/` and using the URL `http://backend/` |
||||||
|
|
||||||
|
Directory structure |
||||||
|
------------------- |
||||||
|
|
||||||
|
The root directory contains the following subdirectories: |
||||||
|
|
||||||
|
- `backend` - backend web application. |
||||||
|
- `common` - files common to all applications. |
||||||
|
- `console` - console application. |
||||||
|
- `environments` - environment configs. |
||||||
|
- `frontend` - frontend web application. |
||||||
|
|
||||||
|
Root directory contains a set of files. |
||||||
|
|
||||||
|
- `.gitignore` contains a list of directories ignored by git version system. If you need something never get to your source |
||||||
|
code repository, add it there. |
||||||
|
- `composer.json` - Composer config described in detail below. |
||||||
|
- `init` - initialization script described in "Composer config described in detail below". |
||||||
|
- `init.bat` - same for Windows. |
||||||
|
- `LICENSE.md` - license info. Put your project license there. Especially when opensourcing. |
||||||
|
- `README.md` - basic info about installing template. Consider replacing it with information about your project and its |
||||||
|
installation. |
||||||
|
- `requirements.php` - Yii requirements checker. |
||||||
|
- `yii` - console application bootstrap. |
||||||
|
- `yii.bat` - same for Windows. |
||||||
|
|
||||||
|
Applications |
||||||
|
------------ |
||||||
|
|
||||||
|
There are three applications in advanced template: frontend, backend and console. Frontend is typically what is presented |
||||||
|
to end user, the project itself. Backend is admin panel, analytics and such functionality. Console is typically used for |
||||||
|
cron jobs and low-level server management. Also it's used during application deployment and handles migrations and assets. |
||||||
|
|
||||||
|
There's also a `common` directory that contains files used by more than one application. For example, `User` model. |
||||||
|
|
||||||
|
frontend and backend are both web applications and both contain `web` directory. That's the webroot you should point your |
||||||
|
webserver to. |
||||||
|
|
||||||
|
Each application has its own namespace and alias corresponding to its name. Same applies to common directory. |
||||||
|
|
||||||
|
Configuration and environments |
||||||
|
------------------------------ |
||||||
|
|
||||||
|
There are multiple problems with straightforward approach to configuration: |
||||||
|
|
||||||
|
- Each team member has its own configuration options. Committing such config will affect other team members. |
||||||
|
- Production database password and API keys should not end up in repository. |
||||||
|
- There are multiple servers: development, testing, production. Each should have its own configuration. |
||||||
|
- Defining all configuration options for each case is very repetitive and takes too much time to maintain. |
||||||
|
|
||||||
|
In order to solve these issues Yii introduces environments concept that is very simple. Each environment is represented |
||||||
|
by a set of files under `environments` directory. `init` command is used to switch between these. What is really does is |
||||||
|
just copying everything from environment directory over the root directory where all applications are. |
||||||
|
|
||||||
|
Typically environment contains application bootstrap files such as `index.php` and config files suffixed with |
||||||
|
`-local.php`. These are added to `.gitignore` and never added to source code repository. |
||||||
|
|
||||||
|
In order to avoid duplication configurations are overriding each other. For example, frontend reads configuration in the |
||||||
|
following order: |
||||||
|
|
||||||
|
- `frontend/config/main.php` |
||||||
|
- `frontend/config/main-local.php` |
||||||
|
|
||||||
|
Parameters are read in the following order: |
||||||
|
|
||||||
|
- `common/config/params.php` |
||||||
|
- `common/config/params-local.php` |
||||||
|
- `frontend/config/params.php` |
||||||
|
- `frontend/config/params-local.php` |
||||||
|
|
||||||
|
The later config file overrides the former. |
||||||
|
|
||||||
|
Another difference is that most application component configurations are moved to params. Since params are read from |
||||||
|
`common` as well it allows you to specify database connection in one file and it will be then used for all applications. |
||||||
|
|
||||||
|
Configuring Composer |
||||||
|
-------------------- |
||||||
|
|
||||||
|
After application template is installed it's a good idea to adjust default `composer.json` that can be found in the root |
||||||
|
directory: |
||||||
|
|
||||||
|
```javascript |
||||||
|
{ |
||||||
|
"name": "yiisoft/yii2-app-advanced", |
||||||
|
"description": "Yii 2 Advanced Application Template", |
||||||
|
"keywords": ["yii", "framework", "advanced", "application template"], |
||||||
|
"homepage": "http://www.yiiframework.com/", |
||||||
|
"type": "project", |
||||||
|
"license": "BSD-3-Clause", |
||||||
|
"support": { |
||||||
|
"issues": "https://github.com/yiisoft/yii2/issues?state=open", |
||||||
|
"forum": "http://www.yiiframework.com/forum/", |
||||||
|
"wiki": "http://www.yiiframework.com/wiki/", |
||||||
|
"irc": "irc://irc.freenode.net/yii", |
||||||
|
"source": "https://github.com/yiisoft/yii2" |
||||||
|
}, |
||||||
|
"minimum-stability": "dev", |
||||||
|
"require": { |
||||||
|
"php": ">=5.3.0", |
||||||
|
"yiisoft/yii2": "dev-master", |
||||||
|
"yiisoft/yii2-composer": "dev-master" |
||||||
|
}, |
||||||
|
"scripts": { |
||||||
|
"post-create-project-cmd": [ |
||||||
|
"yii\\composer\\InstallHandler::setPermissions" |
||||||
|
] |
||||||
|
}, |
||||||
|
"extra": { |
||||||
|
"yii-install-writable": [ |
||||||
|
"backend/runtime", |
||||||
|
"backend/web/assets", |
||||||
|
|
||||||
|
"console/runtime", |
||||||
|
"console/migrations", |
||||||
|
|
||||||
|
"frontend/runtime", |
||||||
|
"frontend/web/assets" |
||||||
|
] |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
``` |
||||||
|
|
||||||
|
First we're updating basic information. Change `name`, `description`, `keywords`, `homepage` and `support` to match |
||||||
|
your project. |
||||||
|
|
||||||
|
Now the interesting part. You can add more packages your application needs to `require` section. |
||||||
|
For example, to use markdown helper you need to add `michelf/php-markdown`. All these packages are coming from |
||||||
|
[packagist.org](https://packagist.org/) so feel free to browse the website for useful code. |
||||||
|
|
||||||
|
After your `composer.json` is changed you can run `php composer.phar update`, wait till packages are downloaded and |
||||||
|
installed and then just use them. Autoloading of classes will be handled automatically. |
@ -0,0 +1,160 @@ |
|||||||
|
Basic application template |
||||||
|
========================== |
||||||
|
|
||||||
|
This template is a perfect fit for small projects or learning Yii2. |
||||||
|
|
||||||
|
The application has four pages: the homepage, the about page, the contact page and the login page. |
||||||
|
The contact page displays a contact form that users can fill in to submit their inquiries to the webmaster, |
||||||
|
and the login page allows users to be authenticated before accessing privileged contents. |
||||||
|
|
||||||
|
Installation |
||||||
|
------------ |
||||||
|
|
||||||
|
If you do not have [Composer](http://getcomposer.org/), you may download it from |
||||||
|
[http://getcomposer.org/](http://getcomposer.org/) or run the following command on Linux/Unix/MacOS: |
||||||
|
|
||||||
|
~~~ |
||||||
|
curl -s http://getcomposer.org/installer | php |
||||||
|
~~~ |
||||||
|
|
||||||
|
You can then install the Bootstrap Application using the following command: |
||||||
|
|
||||||
|
~~~ |
||||||
|
php composer.phar create-project --stability=dev yiisoft/yii2-app-basic /path/to/yii-application |
||||||
|
~~~ |
||||||
|
|
||||||
|
Now set document root directory of your Web server to /path/to/yii-application/web and you should be able to access the application using the URL `http://localhost/`. |
||||||
|
|
||||||
|
Directory structure |
||||||
|
------------------- |
||||||
|
|
||||||
|
The basic application does not divide application directories much. Here's the basic structure: |
||||||
|
|
||||||
|
- `commands` - console controllers. |
||||||
|
- `config` - configuration. |
||||||
|
- `controllers` - web controllers. |
||||||
|
- `models` - application models. |
||||||
|
- `runtime` - logs, states, file cache. |
||||||
|
- `views` - view templates. |
||||||
|
- `web` - webroot. |
||||||
|
|
||||||
|
Root directory contains a set of files. |
||||||
|
|
||||||
|
- `.gitignore` contains a list of directories ignored by git version system. If you need something never get to your source |
||||||
|
code repository, add it there. |
||||||
|
- `codeception.yml` - Codeception config. |
||||||
|
- `composer.json` - Composer config described in detail below. |
||||||
|
- `LICENSE.md` - license info. Put your project license there. Especially when opensourcing. |
||||||
|
- `README.md` - basic info about installing template. Consider replacing it with information about your project and its |
||||||
|
installation. |
||||||
|
- `requirements.php` - Yii requirements checker. |
||||||
|
- `yii` - console application bootstrap. |
||||||
|
- `yii.bat` - same for Windows. |
||||||
|
|
||||||
|
|
||||||
|
### config |
||||||
|
|
||||||
|
This directory contains configuration files: |
||||||
|
|
||||||
|
- `AppAsset.php` - definition of application assets such as CSS, JavaScript etc. Check [Managing assets](assets.md) for |
||||||
|
details. |
||||||
|
- `console.php` - console application configuration. |
||||||
|
- `params.php` - common application parameters. |
||||||
|
- `web.php` - web application configuration. |
||||||
|
- `web-test.php` - web application configuration used when running functional tests. |
||||||
|
|
||||||
|
All these files except `AppAsset.php` are returning arrays used to configure corresponding application properties. Check |
||||||
|
[Configuration](configuration.md) guide section for details. |
||||||
|
|
||||||
|
### views |
||||||
|
|
||||||
|
Views directory contains templates your application is using. In the basic template there are: |
||||||
|
|
||||||
|
``` |
||||||
|
layouts |
||||||
|
main.php |
||||||
|
site |
||||||
|
about.php |
||||||
|
contact.php |
||||||
|
error.php |
||||||
|
index.php |
||||||
|
login.php |
||||||
|
``` |
||||||
|
|
||||||
|
`layouts` contains HTML layouts i.e. page markup except content: doctype, head section, main menu, footer etc. |
||||||
|
The rest are typically controller views. By convention these are located in subdirectories matching controller id. For |
||||||
|
`SiteController` views are under `site`. Names of the views themselves are typically match controller action names. |
||||||
|
Partials are often named starting with underscore. |
||||||
|
|
||||||
|
### web |
||||||
|
|
||||||
|
Directory is a webroot. Typically a webserver is pointed into it. |
||||||
|
|
||||||
|
``` |
||||||
|
assets |
||||||
|
css |
||||||
|
index.php |
||||||
|
index-test.php |
||||||
|
``` |
||||||
|
|
||||||
|
`assets` contains published asset files such as CSS, JavaScript etc. Publishing process is automatic so you don't need |
||||||
|
to do anything with this directory other than making sure Yii has enough permissions to write to it. |
||||||
|
|
||||||
|
`css` contains plain CSS files and is useful for global CSS that isn't going to be compressed or merged by assets manager. |
||||||
|
|
||||||
|
`index.php` is the main web application bootstrap and is the central entry point for it. `index-test.php` is the entry |
||||||
|
point for functional testing. |
||||||
|
|
||||||
|
Configuring Composer |
||||||
|
-------------------- |
||||||
|
|
||||||
|
After application template is installed it's a good idea to adjust default `composer.json` that can be found in the root |
||||||
|
directory: |
||||||
|
|
||||||
|
```javascript |
||||||
|
{ |
||||||
|
"name": "yiisoft/yii2-app-basic", |
||||||
|
"description": "Yii 2 Basic Application Template", |
||||||
|
"keywords": ["yii", "framework", "basic", "application template"], |
||||||
|
"homepage": "http://www.yiiframework.com/", |
||||||
|
"type": "project", |
||||||
|
"license": "BSD-3-Clause", |
||||||
|
"support": { |
||||||
|
"issues": "https://github.com/yiisoft/yii2/issues?state=open", |
||||||
|
"forum": "http://www.yiiframework.com/forum/", |
||||||
|
"wiki": "http://www.yiiframework.com/wiki/", |
||||||
|
"irc": "irc://irc.freenode.net/yii", |
||||||
|
"source": "https://github.com/yiisoft/yii2" |
||||||
|
}, |
||||||
|
"minimum-stability": "dev", |
||||||
|
"require": { |
||||||
|
"php": ">=5.3.0", |
||||||
|
"yiisoft/yii2": "dev-master", |
||||||
|
"yiisoft/yii2-composer": "dev-master" |
||||||
|
}, |
||||||
|
"scripts": { |
||||||
|
"post-create-project-cmd": [ |
||||||
|
"yii\\composer\\InstallHandler::setPermissions" |
||||||
|
] |
||||||
|
}, |
||||||
|
"extra": { |
||||||
|
"yii-install-writable": [ |
||||||
|
"runtime", |
||||||
|
"web/assets" |
||||||
|
], |
||||||
|
"yii-install-executable": [ |
||||||
|
"yii" |
||||||
|
] |
||||||
|
} |
||||||
|
} |
||||||
|
``` |
||||||
|
|
||||||
|
First we're updating basic information. Change `name`, `description`, `keywords`, `homepage` and `support` to match |
||||||
|
your project. |
||||||
|
|
||||||
|
Now the interesting part. You can add more packages your application needs to `require` section. |
||||||
|
For example, to use markdown helper you need to add `michelf/php-markdown`. All these packages are coming from |
||||||
|
[packagist.org](https://packagist.org/) so feel free to browse the website for useful code. |
||||||
|
|
||||||
|
After your `composer.json` is changed you can run `php composer.phar update`, wait till packages are downloaded and |
||||||
|
installed and then just use them. Autoloading of classes will be handled automatically. |
@ -0,0 +1,48 @@ |
|||||||
|
Bootstrap widgets |
||||||
|
================= |
||||||
|
|
||||||
|
Yii includes support of [Bootstrap 3](http://getbootstrap.com/) markup and components framework out of the box. It is an |
||||||
|
excellent framework that allows you to speed up development a lot. |
||||||
|
|
||||||
|
Bootstrap is generally about two parts: |
||||||
|
|
||||||
|
- Basics such as grid system, typography, helper classes and responsive utilities. |
||||||
|
- Ready to use components such as menus, pagination, modal boxes, tabs etc. |
||||||
|
|
||||||
|
Basics |
||||||
|
------ |
||||||
|
|
||||||
|
Yii doesn't wrap bootstrap basics into PHP code since HTML is very simple by itself in this case. You can find details |
||||||
|
about using the basics at [bootstrap documentation website](http://getbootstrap.com/css/). Still Yii provides a |
||||||
|
convenient way to include bootstrap assets in your pages with a single line added to `AppAsset.php` located in your |
||||||
|
`config` directory: |
||||||
|
|
||||||
|
```php |
||||||
|
public $depends = array( |
||||||
|
'yii\web\YiiAsset', |
||||||
|
'yii\bootstrap\BootstrapAsset', // this line |
||||||
|
// 'yii\bootstrap\BootstrapThemeAsset' // uncomment to apply bootstrap 2 style to bootstrap 3 |
||||||
|
); |
||||||
|
``` |
||||||
|
|
||||||
|
Using bootstrap through Yii asset manager allows you to minimize its resources and combine with your own resources when |
||||||
|
needed. |
||||||
|
|
||||||
|
Yii widgets |
||||||
|
----------- |
||||||
|
|
||||||
|
Most complex bootstrap components are wrapped into Yii widgets to allow more robust syntax and integrate with |
||||||
|
framework features. All widgets belong to `\yii\bootstrap` namespace: |
||||||
|
|
||||||
|
- Alert |
||||||
|
- Button |
||||||
|
- ButtonDropdown |
||||||
|
- ButtonGroup |
||||||
|
- Carousel |
||||||
|
- Collapse |
||||||
|
- Dropdown |
||||||
|
- Modal |
||||||
|
- Nav |
||||||
|
- NavBar |
||||||
|
- Progress |
||||||
|
- Tabs |
@ -1,69 +0,0 @@ |
|||||||
Bootstrap with Yii |
|
||||||
================== |
|
||||||
|
|
||||||
Yii provides a few ready-to-use application templates. Based on your needs, you may |
|
||||||
choose one of them to bootstrap your project. |
|
||||||
|
|
||||||
In the following, we describe how to get started with the "Yii 2 Basic Application Template". |
|
||||||
|
|
||||||
|
|
||||||
### Install via Composer |
|
||||||
|
|
||||||
If you do not have [Composer](http://getcomposer.org/), you may download it from |
|
||||||
[http://getcomposer.org/](http://getcomposer.org/) or run the following command on Linux/Unix/MacOS: |
|
||||||
|
|
||||||
~~~ |
|
||||||
curl -s http://getcomposer.org/installer | php |
|
||||||
~~~ |
|
||||||
|
|
||||||
You can then install the Bootstrap Application using the following command: |
|
||||||
|
|
||||||
~~~ |
|
||||||
php composer.phar create-project --stability=dev yiisoft/yii2-app-basic yii-basic |
|
||||||
~~~ |
|
||||||
|
|
||||||
Now you should be able to access the Bootstrap Application using the URL `http://localhost/yii-basic/web/`, |
|
||||||
assuming `yii-basic` is directly under the document root of your Web server. |
|
||||||
|
|
||||||
|
|
||||||
As you can see, the application has four pages: the homepage, the about page, |
|
||||||
the contact page and the login page. The contact page displays a contact |
|
||||||
form that users can fill in to submit their inquiries to the webmaster, |
|
||||||
and the login page allows users to be authenticated before accessing privileged contents. |
|
||||||
|
|
||||||
|
|
||||||
The following diagram shows the directory structure of this application. |
|
||||||
|
|
||||||
~~~ |
|
||||||
yii-basic/ |
|
||||||
yii yii command line script for Unix/Linux |
|
||||||
yii.bat yii command line script for Windows |
|
||||||
requirements.php the requirement checker script |
|
||||||
commands/ containing customized yii console commands |
|
||||||
config/ containing configuration files |
|
||||||
console.php the console application configuration |
|
||||||
main.php the Web application configuration |
|
||||||
controllers/ containing controller class files |
|
||||||
SiteController.php the default controller class |
|
||||||
vendor/ containing third-party extensions and libraries |
|
||||||
models/ containing model class files |
|
||||||
User.php the User model |
|
||||||
LoginForm.php the form model for 'login' action |
|
||||||
ContactForm.php the form model for 'contact' action |
|
||||||
runtime/ containing temporarily generated files |
|
||||||
views/ containing controller view and layout files |
|
||||||
layouts/ containing layout view files |
|
||||||
main.php the base layout shared by all pages |
|
||||||
site/ containing view files for the 'site' controller |
|
||||||
about.php the view for the 'about' action |
|
||||||
contact.php the view for the 'contact' action |
|
||||||
index.php the view for the 'index' action |
|
||||||
login.php the view for the 'login' action |
|
||||||
web/ containing Web-accessible resources |
|
||||||
index.php Web application entry script file |
|
||||||
assets/ containing published resource files |
|
||||||
css/ containing CSS files |
|
||||||
~~~ |
|
||||||
|
|
||||||
|
|
||||||
TBD |
|
@ -0,0 +1,98 @@ |
|||||||
|
Configuration |
||||||
|
============= |
||||||
|
|
||||||
|
In Yii application and majority of components have sensible defaults so it's unlikely you spend lots of time configuring |
||||||
|
it. Still there are some mandatory options such as database connection you should set up. |
||||||
|
|
||||||
|
How application is configured depends on application template but there are some general principles applying in any case. |
||||||
|
|
||||||
|
Configuring options in bootstrap file |
||||||
|
------------------------------------- |
||||||
|
|
||||||
|
For each application in Yii there is at least one bootstrap file. For web applications it's typically `index.php`, for |
||||||
|
console applications it's `yii`. Both are doing nearly the same job: |
||||||
|
|
||||||
|
1. Setting common constants. |
||||||
|
2. Including Yii itself. |
||||||
|
3. Including Composer autoloader. |
||||||
|
4. Reading config file into `$config`. |
||||||
|
5. Creating new application instance using `$config` and running it. |
||||||
|
|
||||||
|
Bootstrap file is not the part of framework but your application so it's OK to adjust it to fit your application. Typical |
||||||
|
adjustments are the value of `YII_DEBUG` that should never be `true` on production and the way config is read. |
||||||
|
|
||||||
|
Configuring application instance |
||||||
|
-------------------------------- |
||||||
|
|
||||||
|
It was mentioned above that application is configured in bootstrap file when its instance is created. Config is typically |
||||||
|
stored in a PHP file in `/config` directory of the application and looks like the following: |
||||||
|
|
||||||
|
```php |
||||||
|
<?php |
||||||
|
return array( |
||||||
|
'id' => 'applicationId', |
||||||
|
'basePath' => dirname(__DIR__), |
||||||
|
'components' => array( |
||||||
|
// ... |
||||||
|
), |
||||||
|
'params' => require(__DIR__ . '/params.php'), |
||||||
|
); |
||||||
|
``` |
||||||
|
|
||||||
|
In the above array keys are names of application properties. Depending on application type you can check properties of |
||||||
|
either `\yii\web\Application` or `\yii\console\Application`. Both are extended from `\yii\base\Application`. |
||||||
|
|
||||||
|
> Note that you can configure not only public class properties but anything accessible via setter. For example, to |
||||||
|
configure runtime path you can use key named `runtimePath`. There's no such property in the application class but |
||||||
|
since there's a corresponding setter named `setRuntimePath` it will be properly configured. |
||||||
|
|
||||||
|
Configuring application components |
||||||
|
---------------------------------- |
||||||
|
|
||||||
|
Majority of Yii functionality are application components. These are attached to application via its `components` property: |
||||||
|
|
||||||
|
```php |
||||||
|
<?php |
||||||
|
return array( |
||||||
|
'id' => 'applicationId', |
||||||
|
'basePath' => dirname(__DIR__), |
||||||
|
'components' => array( |
||||||
|
'cache' => array( |
||||||
|
'class' => 'yii\caching\FileCache', |
||||||
|
), |
||||||
|
'user' => array( |
||||||
|
'identityClass' => 'app\models\User', |
||||||
|
), |
||||||
|
'errorHandler' => array( |
||||||
|
'errorAction' => 'site/error', |
||||||
|
), |
||||||
|
'log' => array( |
||||||
|
'traceLevel' => YII_DEBUG ? 3 : 0, |
||||||
|
'targets' => array( |
||||||
|
array( |
||||||
|
'class' => 'yii\log\FileTarget', |
||||||
|
'levels' => array('error', 'warning'), |
||||||
|
), |
||||||
|
), |
||||||
|
), |
||||||
|
), |
||||||
|
// ... |
||||||
|
); |
||||||
|
``` |
||||||
|
|
||||||
|
In the above four components are configured: `cache`, `user`, `errorHandler`, `log`. Each entry key is a component ID |
||||||
|
and the value is the configuration array. ID is used to access the component like `\Yii::$app->myComponent`. |
||||||
|
Configuration array has one special key named `class` that sets component class. The rest of the keys and values are used |
||||||
|
to configure component properties in the same way as top-level keys are used to configure application properties. |
||||||
|
|
||||||
|
Each application has predefined set of the components. In case of configuring one of these `class` key is omitted and |
||||||
|
application default class is used instead. You can check `registerCoreComponents` method of the application you are using |
||||||
|
to get a list of component IDs and corresponding classes. |
||||||
|
|
||||||
|
Note that Yii is smart enough to configure the component when it's actually used i.e. if `cache` is never used it will |
||||||
|
not be instantiated and configured at all. |
||||||
|
|
||||||
|
Setting component defaults classwide |
||||||
|
------------------------------------ |
||||||
|
|
||||||
|
TBD |
@ -0,0 +1,15 @@ |
|||||||
|
Debug toolbar and debugger |
||||||
|
========================== |
||||||
|
|
||||||
|
Yii2 includes a handy toolbar to aid faster development and debugging as well as debugger. Toolbar displays information |
||||||
|
about currently opened page while using debugger you can analyze data collected before. |
||||||
|
|
||||||
|
Installing and configuring |
||||||
|
-------------------------- |
||||||
|
|
||||||
|
How to use it |
||||||
|
------------- |
||||||
|
|
||||||
|
Creating your own panels |
||||||
|
------------------------ |
||||||
|
|
@ -1,3 +1,7 @@ |
|||||||
Error Handling |
Error Handling |
||||||
============== |
============== |
||||||
|
|
||||||
|
Error handling in Yii is different from plain PHP. First of all, all non-fatal errors are converted to exceptions so |
||||||
|
you can use `try`-`catch` to work with these. Second, even fatal errors are rendered in a nice way. In debug mode that |
||||||
|
means you have a trace and a piece of code where it happened so it takes less time to analyze and fix it. |
||||||
|
|
||||||
|
@ -0,0 +1,358 @@ |
|||||||
|
View |
||||||
|
==== |
||||||
|
|
||||||
|
View is an important part of MVC and is responsible for how data is presented to the end user. |
||||||
|
|
||||||
|
Basics |
||||||
|
------ |
||||||
|
|
||||||
|
Yii uses PHP in view templates by default so in a web application a view typically contains some HTML, `echo`, `foreach` |
||||||
|
and such basic constructs. It may also contain widget calls. Using complex code in views is considered a bad practice. |
||||||
|
Such code should be moved to controller or widgets. |
||||||
|
|
||||||
|
View is typically called from controller action like the following: |
||||||
|
|
||||||
|
```php |
||||||
|
public function actionIndex() |
||||||
|
{ |
||||||
|
return $this->render('index', array( |
||||||
|
'username' => 'samdark', |
||||||
|
)); |
||||||
|
} |
||||||
|
``` |
||||||
|
|
||||||
|
First argument is the view name. In context of the controller Yii will search for its views in `views/site/` where `site` |
||||||
|
is controller ID. For details on how view name is resolved please refer to [yii\base\Controller::render] method. |
||||||
|
Second argument is data array that contains key-value pairs. Value is available in the view as a variable named the same |
||||||
|
as the corresponding key. |
||||||
|
|
||||||
|
So the view for the action above should be in `views/site/index.php` and can be something like: |
||||||
|
|
||||||
|
```php |
||||||
|
<p>Hello, <?php echo $username?>!</p> |
||||||
|
``` |
||||||
|
|
||||||
|
Instead of just scalar values you can pass anything else such as arrays or objects. |
||||||
|
|
||||||
|
Widgets |
||||||
|
------- |
||||||
|
|
||||||
|
Widgets are a self-contained building blocks for your views. A widget may contain advanced logic, typically takes some |
||||||
|
configuration and data and returns HTML. There is a good number of widgets bundled with Yii such as [active form](form.md), |
||||||
|
breadcrumbs, menu or [wrappers around bootstrap component framework](boostrap-widgets.md). Additionally there are |
||||||
|
extensions providing additional widgets such as official one for jQueryUI components. |
||||||
|
|
||||||
|
In order to use widget you need to do the following: |
||||||
|
|
||||||
|
```php |
||||||
|
// Note that you have to "echo" the result to display it |
||||||
|
echo \yii\widgets\Menu::widget(array('items' => $items)); |
||||||
|
|
||||||
|
// Passing an array to initialize the object properties |
||||||
|
$form = \yii\widgets\ActiveForm::begin(array( |
||||||
|
'options' => array('class' => 'form-horizontal'), |
||||||
|
'fieldConfig' => array('inputOptions' => array('class' => 'input-xlarge')), |
||||||
|
)); |
||||||
|
... form inputs here ... |
||||||
|
\yii\widgets\ActiveForm::end(); |
||||||
|
``` |
||||||
|
|
||||||
|
In the code above `widget` method is used for a widget that just outputs content while `begin` and `end` are used for a |
||||||
|
widget that wraps content between method calls with its own output. In case of the form this output is the `<form>` tag |
||||||
|
with some properties set. |
||||||
|
|
||||||
|
Security |
||||||
|
-------- |
||||||
|
|
||||||
|
One of the main security principles is to always escape output. If violated it leads to script execution and, |
||||||
|
most probably, to cross-site scripting known as XSS leading to leaking of admin passwords, making a user to automatically |
||||||
|
perform actions etc. |
||||||
|
|
||||||
|
Yii provides a good toolset in order help you escaping your output. The very basic thing to escape is a text without any |
||||||
|
markup. You can deal with it like the following: |
||||||
|
|
||||||
|
```php |
||||||
|
<?php |
||||||
|
use yii\helpers\Html; |
||||||
|
?> |
||||||
|
|
||||||
|
<div class="username"> |
||||||
|
<?php echo Html::encode($user->name); ?> |
||||||
|
</div> |
||||||
|
``` |
||||||
|
|
||||||
|
When you want to render HTML it becomes complex so we're delegating the task to excellent |
||||||
|
[HTMLPurifier](http://htmlpurifier.org/) library. In order to use it you need to modify your `composer.json` first by |
||||||
|
adding the following to `require`: |
||||||
|
|
||||||
|
```javascript |
||||||
|
"ezyang/htmlpurifier": "v4.5.0" |
||||||
|
``` |
||||||
|
|
||||||
|
After it's done run `php composer.phar install` and wait till package is downloaded. Now everything is prepared to use |
||||||
|
Yii's HtmlPurifier helper: |
||||||
|
|
||||||
|
```php |
||||||
|
<?php |
||||||
|
use yii\helpers\HtmlPurifier; |
||||||
|
?> |
||||||
|
|
||||||
|
<div class="post"> |
||||||
|
<?php echo HtmlPurifier::process($post->text); ?> |
||||||
|
</div> |
||||||
|
``` |
||||||
|
|
||||||
|
Note that besides HTMLPurifier does excellent job making output safe it's not very fast so consider |
||||||
|
[caching result](caching.md). |
||||||
|
|
||||||
|
Alternative template languages |
||||||
|
------------------------------ |
||||||
|
|
||||||
|
There are official extensions for [Smarty](http://www.smarty.net/) and [Twig](http://twig.sensiolabs.org/). In order |
||||||
|
to learn more refer to [Using template engines](template.md) section of the guide. |
||||||
|
|
||||||
|
Using View object in templates |
||||||
|
------------------------------ |
||||||
|
|
||||||
|
An instance of `yii\base\View` component is available in view templates as `$this` variable. Using it in templates you |
||||||
|
can do many useful things including setting page title and meta, registering scripts and accessing the context. |
||||||
|
|
||||||
|
### Setting page title |
||||||
|
|
||||||
|
A common place to set page title are view templates. Since we can access view object with `$this`, setting a title |
||||||
|
becomes as easy as: |
||||||
|
|
||||||
|
```php |
||||||
|
$this->title = 'My page title'; |
||||||
|
``` |
||||||
|
|
||||||
|
### Adding meta tags |
||||||
|
|
||||||
|
Adding meta tags such as encoding, description, keywords is easy with view object as well: |
||||||
|
|
||||||
|
```php |
||||||
|
$this->registerMetaTag(array('encoding' => 'utf-8')); |
||||||
|
``` |
||||||
|
|
||||||
|
The first argument is an map of `<meta>` tag option names and values. The code above will produce: |
||||||
|
|
||||||
|
```html |
||||||
|
<meta encoding="utf-8"> |
||||||
|
``` |
||||||
|
|
||||||
|
Sometimes there's a need to have only a single tag of a type. In this case you need to specify the second argument: |
||||||
|
|
||||||
|
```html |
||||||
|
$this->registerMetaTag(array('description' => 'This is my cool website made with Yii!'), 'meta-description'); |
||||||
|
$this->registerMetaTag(array('description' => 'This website is about funny raccoons.'), 'meta-description'); |
||||||
|
``` |
||||||
|
|
||||||
|
If there are multiple calls with the same value of the second argument (`meta-description` in this case), the latter will |
||||||
|
override the former and only a single tag will be rendered: |
||||||
|
|
||||||
|
```html |
||||||
|
<meta description="This website is about funny raccoons."> |
||||||
|
``` |
||||||
|
|
||||||
|
### Registering link tags |
||||||
|
|
||||||
|
`<link>` tag is useful in many cases such as customizing favicon, pointing to RSS feed or delegating OpenID to another |
||||||
|
server. Yii view object has a method to work with these: |
||||||
|
|
||||||
|
```php |
||||||
|
$this->registerLinkTag(array( |
||||||
|
'title' => 'Lives News for Yii Framework', |
||||||
|
'rel' => 'alternate', |
||||||
|
'type' => 'application/rss+xml', |
||||||
|
'href' => 'http://www.yiiframework.com/rss.xml/', |
||||||
|
)); |
||||||
|
``` |
||||||
|
|
||||||
|
The code above will result in |
||||||
|
|
||||||
|
```html |
||||||
|
<link title="Lives News for Yii Framework" rel="alternate" type="application/rss+xml" href="http://www.yiiframework.com/rss.xml/" /> |
||||||
|
``` |
||||||
|
|
||||||
|
Same as with meta tags you can specify additional argument to make sure there's only one link of a type registered. |
||||||
|
|
||||||
|
### Registering CSS |
||||||
|
|
||||||
|
You can register CSS using `registerCss` or `registerCssFile`. Former is for outputting code in `<style>` tags directly |
||||||
|
to the page which is not recommended in most cases (but still valid). Latter is for registering CSS file. In Yii it's |
||||||
|
much better to [use asset manager](assets.md) to deal with these since it provides extra features so `registerCssFile` |
||||||
|
is manly useful for external CSS files. |
||||||
|
|
||||||
|
```php |
||||||
|
$this->registerCss("body { background: #f00; }"); |
||||||
|
``` |
||||||
|
|
||||||
|
The code above will result in adding the following to the head section of the page: |
||||||
|
|
||||||
|
```html |
||||||
|
<style> |
||||||
|
body { background: #f00; } |
||||||
|
</style> |
||||||
|
``` |
||||||
|
|
||||||
|
If you want to specify additional properties of the style tag, pass array of name-values to the second argument. If you |
||||||
|
need to make sure there's only a single style tag use third argument as was mentioned in meta tags description. |
||||||
|
|
||||||
|
```php |
||||||
|
$this->registerCssFile("http://example.com/css/themes/black-and-white.css", array('media' => 'print'), 'css-print-theme'); |
||||||
|
``` |
||||||
|
|
||||||
|
The code above will add a link to CSS file to the head section of the page. The CSS will be used only when printing the |
||||||
|
page. We're using third argument so one of the views could override it. |
||||||
|
|
||||||
|
### Registering scripts |
||||||
|
|
||||||
|
With View object you can register scripts. There are two dedicated methods for it: `registerJs` for inline scripts |
||||||
|
and `registerJsFile` for external scripts. Inline scripts are useful for configuration and dynamically generated code. |
||||||
|
The method for adding these can be used as follows: |
||||||
|
|
||||||
|
```php |
||||||
|
$this->registerJs("var options = ".json_encode($options).";", View::POS_END, 'my-options'); |
||||||
|
``` |
||||||
|
|
||||||
|
First argument is the actual code where we're converting a PHP array of options to JavaScript one. Second argument |
||||||
|
determines where script should be in the page. Possible values are: |
||||||
|
|
||||||
|
- `View::POS_HEAD` for head section. |
||||||
|
- `View::POS_BEGIN` for right after opening `<body>`. |
||||||
|
- `View::POS_END` for right before closing `</body>`. |
||||||
|
- `View::POS_READY` for executing code on document `ready` event. This one registers jQuery automatically. |
||||||
|
|
||||||
|
The last argument is unique script ID that is used to identify code block and replace existing one with the same ID |
||||||
|
instead of adding a new one. |
||||||
|
|
||||||
|
External script can be added like the following: |
||||||
|
|
||||||
|
```php |
||||||
|
$this->registerJsFile('http://example.com/js/main.js'); |
||||||
|
``` |
||||||
|
|
||||||
|
Same as with external CSS it's preferred to use asset bundles for external scripts. |
||||||
|
|
||||||
|
### Registering asset bundles |
||||||
|
|
||||||
|
As was mentioned earlier it's preferred to use asset bundles instead of using CSS and JavaScript directly. You can get |
||||||
|
details on how to define asset bundles in [asset manager](assets.md) section of the guide. As for using already defined |
||||||
|
asset bundle, it's very straightforward: |
||||||
|
|
||||||
|
```php |
||||||
|
frontend\config\AppAsset::register($this); |
||||||
|
``` |
||||||
|
|
||||||
|
### Layout |
||||||
|
|
||||||
|
A layout is a very convenient way to represent the part of the page that is common for all or at least for most pages |
||||||
|
generated by your application. Typically it includes `<head>` section, footer, main menu and alike elements. |
||||||
|
You can fine a fine example of the layout in a [basic application template](apps-basic.md). Here we'll review the very |
||||||
|
basic one without any widgets or extra markup. |
||||||
|
|
||||||
|
```php |
||||||
|
<?php |
||||||
|
use yii\helpers\Html; |
||||||
|
?> |
||||||
|
<?php $this->beginPage(); ?> |
||||||
|
<!DOCTYPE html> |
||||||
|
<html lang="<?php echo Yii::$app->charset; ?>"> |
||||||
|
<head> |
||||||
|
<meta charset="<?php echo Yii::$app->charset; ?>"/> |
||||||
|
<title><?php echo Html::encode($this->title); ?></title> |
||||||
|
<?php $this->head(); ?> |
||||||
|
</head> |
||||||
|
<body> |
||||||
|
<?php $this->beginBody(); ?> |
||||||
|
<div class="container"> |
||||||
|
<?php echo $content; ?> |
||||||
|
</div> |
||||||
|
<footer class="footer">© 2013 me :)</footer> |
||||||
|
<?php $this->endBody(); ?> |
||||||
|
</body> |
||||||
|
</html> |
||||||
|
<?php $this->endPage(); ?> |
||||||
|
``` |
||||||
|
|
||||||
|
In the markup above there's some code. First of all, `$content` is a variable that will contain result of views rendered |
||||||
|
with controller's `$this->render()` method. |
||||||
|
|
||||||
|
TBD |
||||||
|
|
||||||
|
### Partials |
||||||
|
|
||||||
|
Often you need to reuse some HTML markup in many views and often it's too simple to create a full-featured widget for it. |
||||||
|
In this case you may use partials. |
||||||
|
|
||||||
|
Partial is a view as well. It resides in one of directories under `views` and by convention is often started with `_`. |
||||||
|
For example, we need to render a list of user profiles and, at the same time, display individual profile elsewhere. |
||||||
|
|
||||||
|
First we need to define a partial for user profile in `_profile.php`: |
||||||
|
|
||||||
|
```php |
||||||
|
<?php |
||||||
|
use yii\helpers\Html; |
||||||
|
?> |
||||||
|
|
||||||
|
<div class="profile"> |
||||||
|
<h2><?php echo Html::encode($username); ?></h2> |
||||||
|
<p><?php echo Html::encode($tagline); ?></p> |
||||||
|
</div> |
||||||
|
``` |
||||||
|
|
||||||
|
Then we're using it in `index.php` view where we display a list of users: |
||||||
|
|
||||||
|
```php |
||||||
|
<div class="user-index"> |
||||||
|
<?php |
||||||
|
foreach($users as $user) { |
||||||
|
echo $this->render('_profile', array( |
||||||
|
'username' => $user->name, |
||||||
|
'tagline' => $user->tagline, |
||||||
|
)); |
||||||
|
} |
||||||
|
?> |
||||||
|
</div> |
||||||
|
``` |
||||||
|
|
||||||
|
Same way we can reuse it in another view displaying a single user profile: |
||||||
|
|
||||||
|
```php |
||||||
|
echo $this->render('_profile', array( |
||||||
|
'username' => $user->name, |
||||||
|
'tagline' => $user->tagline, |
||||||
|
)); |
||||||
|
``` |
||||||
|
|
||||||
|
### Accessing context |
||||||
|
|
||||||
|
Views are generally used either by controller or by widget. In both cases the object that called view rendering is |
||||||
|
available in the view as `$this->context`. For example if we need to print out the current internal request route in a |
||||||
|
view rendered by controller we can use the following: |
||||||
|
|
||||||
|
```php |
||||||
|
echo $this->context->getRoute(); |
||||||
|
``` |
||||||
|
|
||||||
|
### Caching blocks |
||||||
|
|
||||||
|
To learn about caching of view fragments please refer to [caching](caching.md) section of the guide. |
||||||
|
|
||||||
|
Customizing View component |
||||||
|
-------------------------- |
||||||
|
|
||||||
|
Since view is also an application component named `view` you can replace it with your own component that extends |
||||||
|
from `yii\base\View`. It can be done via application configuration file such as `config/web.php`: |
||||||
|
|
||||||
|
```php |
||||||
|
return array( |
||||||
|
// ... |
||||||
|
'components' => array( |
||||||
|
'view' => array( |
||||||
|
'class' => 'app\components\View', |
||||||
|
), |
||||||
|
// ... |
||||||
|
), |
||||||
|
); |
||||||
|
``` |
@ -0,0 +1,68 @@ |
|||||||
|
<?php |
||||||
|
/** |
||||||
|
* @link http://www.yiiframework.com/ |
||||||
|
* @copyright Copyright (c) 2008 Yii Software LLC |
||||||
|
* @license http://www.yiiframework.com/license/ |
||||||
|
*/ |
||||||
|
|
||||||
|
namespace yii\jui; |
||||||
|
|
||||||
|
use Yii; |
||||||
|
use yii\helpers\Html; |
||||||
|
|
||||||
|
/** |
||||||
|
* Slider renders a slider jQuery UI widget. |
||||||
|
* |
||||||
|
* For example: |
||||||
|
* |
||||||
|
* ```php |
||||||
|
* echo Slider::widget(array( |
||||||
|
* 'model' => $model, |
||||||
|
* 'attribute' => 'amount', |
||||||
|
* 'clientOptions' => array( |
||||||
|
* 'min' => 1, |
||||||
|
* 'max' => 10, |
||||||
|
* ), |
||||||
|
* )); |
||||||
|
* ``` |
||||||
|
* |
||||||
|
* The following example will use the name property instead: |
||||||
|
* |
||||||
|
* ```php |
||||||
|
* echo Slider::widget(array( |
||||||
|
* 'name' => 'amount', |
||||||
|
* 'clientOptions' => array( |
||||||
|
* 'min' => 1, |
||||||
|
* 'max' => 10, |
||||||
|
* ), |
||||||
|
* )); |
||||||
|
*``` |
||||||
|
* |
||||||
|
* @see http://api.jqueryui.com/slider/ |
||||||
|
* @author Alexander Makarov <sam@rmcreative.ru> |
||||||
|
* @since 2.0 |
||||||
|
*/ |
||||||
|
class Slider extends InputWidget |
||||||
|
{ |
||||||
|
/** |
||||||
|
* Renders the widget. |
||||||
|
*/ |
||||||
|
public function run() |
||||||
|
{ |
||||||
|
echo $this->renderWidget(); |
||||||
|
$this->registerWidget('slider', SliderAsset::className()); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Renders the Slider widget. |
||||||
|
* @return string the rendering result. |
||||||
|
*/ |
||||||
|
public function renderWidget() |
||||||
|
{ |
||||||
|
if ($this->hasModel()) { |
||||||
|
return Html::activeTextInput($this->model, $this->attribute, $this->options); |
||||||
|
} else { |
||||||
|
return Html::textInput($this->name, $this->value, $this->options); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,27 @@ |
|||||||
|
<?php |
||||||
|
/** |
||||||
|
* @link http://www.yiiframework.com/ |
||||||
|
* @copyright Copyright (c) 2008 Yii Software LLC |
||||||
|
* @license http://www.yiiframework.com/license/ |
||||||
|
*/ |
||||||
|
|
||||||
|
namespace yii\bootstrap; |
||||||
|
|
||||||
|
use yii\web\AssetBundle; |
||||||
|
|
||||||
|
/** |
||||||
|
* Bootstrap 2 theme for Bootstrap 3 |
||||||
|
* |
||||||
|
* @author Alexander Makarov <sam@rmcreative.ru> |
||||||
|
* @since 2.0 |
||||||
|
*/ |
||||||
|
class BootstrapThemeAsset extends AssetBundle |
||||||
|
{ |
||||||
|
public $sourcePath = '@yii/bootstrap/assets'; |
||||||
|
public $css = array( |
||||||
|
'css/bootstrap-theme.css', |
||||||
|
); |
||||||
|
public $depends = array( |
||||||
|
'yii\bootstrap\BootstrapAsset', |
||||||
|
); |
||||||
|
} |
@ -1,92 +0,0 @@ |
|||||||
<?php |
|
||||||
/** |
|
||||||
* @link http://www.yiiframework.com/ |
|
||||||
* @copyright Copyright (c) 2008 Yii Software LLC |
|
||||||
* @license http://www.yiiframework.com/license/ |
|
||||||
*/ |
|
||||||
|
|
||||||
namespace yii\bootstrap; |
|
||||||
|
|
||||||
use Yii; |
|
||||||
use yii\base\InvalidConfigException; |
|
||||||
use yii\base\Model; |
|
||||||
use yii\helpers\Html; |
|
||||||
|
|
||||||
/** |
|
||||||
* Typeahead renders a typehead bootstrap javascript component. |
|
||||||
* |
|
||||||
* For example, |
|
||||||
* |
|
||||||
* ```php |
|
||||||
* echo TypeAhead::widget(array( |
|
||||||
* 'model' => $model, |
|
||||||
* 'attribute' => 'country', |
|
||||||
* 'clientOptions' => array( |
|
||||||
* 'source' => array('USA', 'ESP'), |
|
||||||
* ), |
|
||||||
* )); |
|
||||||
* ``` |
|
||||||
* |
|
||||||
* The following example will use the name property instead |
|
||||||
* |
|
||||||
* ```php |
|
||||||
* echo TypeAhead::widget(array( |
|
||||||
* 'name' => 'country', |
|
||||||
* 'clientOptions' => array( |
|
||||||
* 'source' => array('USA', 'ESP'), |
|
||||||
* ), |
|
||||||
* )); |
|
||||||
*``` |
|
||||||
* |
|
||||||
* @see http://twitter.github.io/bootstrap/javascript.html#typeahead |
|
||||||
* @author Antonio Ramirez <amigo.cobos@gmail.com> |
|
||||||
* @since 2.0 |
|
||||||
*/ |
|
||||||
class Typeahead extends Widget |
|
||||||
{ |
|
||||||
/** |
|
||||||
* @var \yii\base\Model the data model that this widget is associated with |
|
||||||
*/ |
|
||||||
public $model; |
|
||||||
/** |
|
||||||
* @var string the model attribute that this widget is associated with |
|
||||||
*/ |
|
||||||
public $attribute; |
|
||||||
/** |
|
||||||
* @var string the input name. This must be set if [[model]] and [[attribute]] are not set. |
|
||||||
*/ |
|
||||||
public $name; |
|
||||||
/** |
|
||||||
* @var string the input value. |
|
||||||
*/ |
|
||||||
public $value; |
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* Renders the widget |
|
||||||
*/ |
|
||||||
public function run() |
|
||||||
{ |
|
||||||
echo $this->renderField(); |
|
||||||
$this->registerPlugin('typeahead'); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Renders the TypeAhead field. If [[model]] has been specified then it will render an active field. |
|
||||||
* If [[model]] is null or not from an [[Model]] instance, then the field will be rendered according to |
|
||||||
* the [[name]] attribute. |
|
||||||
* @return string the rendering result |
|
||||||
* @throws InvalidConfigException when none of the required attributes are set to render the textInput. |
|
||||||
* That is, if [[model]] and [[attribute]] are not set, then [[name]] is required. |
|
||||||
*/ |
|
||||||
public function renderField() |
|
||||||
{ |
|
||||||
if ($this->model instanceof Model && $this->attribute !== null) { |
|
||||||
return Html::activeTextInput($this->model, $this->attribute, $this->options); |
|
||||||
} elseif ($this->name !== null) { |
|
||||||
return Html::textInput($this->name, $this->value, $this->options); |
|
||||||
} else { |
|
||||||
throw new InvalidConfigException("Either 'name' or 'model' and 'attribute' properties must be specified."); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,384 @@ |
|||||||
|
.btn-default, |
||||||
|
.btn-primary, |
||||||
|
.btn-success, |
||||||
|
.btn-info, |
||||||
|
.btn-warning, |
||||||
|
.btn-danger { |
||||||
|
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2); |
||||||
|
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 1px rgba(0, 0, 0, 0.075); |
||||||
|
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 1px rgba(0, 0, 0, 0.075); |
||||||
|
} |
||||||
|
|
||||||
|
.btn-default:active, |
||||||
|
.btn-primary:active, |
||||||
|
.btn-success:active, |
||||||
|
.btn-info:active, |
||||||
|
.btn-warning:active, |
||||||
|
.btn-danger:active, |
||||||
|
.btn-default.active, |
||||||
|
.btn-primary.active, |
||||||
|
.btn-success.active, |
||||||
|
.btn-info.active, |
||||||
|
.btn-warning.active, |
||||||
|
.btn-danger.active { |
||||||
|
-webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); |
||||||
|
box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); |
||||||
|
} |
||||||
|
|
||||||
|
.btn:active, |
||||||
|
.btn.active { |
||||||
|
background-image: none; |
||||||
|
} |
||||||
|
|
||||||
|
.btn-default { |
||||||
|
text-shadow: 0 1px 0 #fff; |
||||||
|
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#ffffff), to(#e6e6e6)); |
||||||
|
background-image: -webkit-linear-gradient(top, #ffffff, 0%, #e6e6e6, 100%); |
||||||
|
background-image: -moz-linear-gradient(top, #ffffff 0%, #e6e6e6 100%); |
||||||
|
background-image: linear-gradient(to bottom, #ffffff 0%, #e6e6e6 100%); |
||||||
|
background-repeat: repeat-x; |
||||||
|
border-color: #e0e0e0; |
||||||
|
border-color: #ccc; |
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe6e6e6', GradientType=0); |
||||||
|
} |
||||||
|
|
||||||
|
.btn-default:active, |
||||||
|
.btn-default.active { |
||||||
|
background-color: #e6e6e6; |
||||||
|
border-color: #e0e0e0; |
||||||
|
} |
||||||
|
|
||||||
|
.btn-primary { |
||||||
|
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#428bca), to(#3071a9)); |
||||||
|
background-image: -webkit-linear-gradient(top, #428bca, 0%, #3071a9, 100%); |
||||||
|
background-image: -moz-linear-gradient(top, #428bca 0%, #3071a9 100%); |
||||||
|
background-image: linear-gradient(to bottom, #428bca 0%, #3071a9 100%); |
||||||
|
background-repeat: repeat-x; |
||||||
|
border-color: #2d6ca2; |
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3071a9', GradientType=0); |
||||||
|
} |
||||||
|
|
||||||
|
.btn-primary:active, |
||||||
|
.btn-primary.active { |
||||||
|
background-color: #3071a9; |
||||||
|
border-color: #2d6ca2; |
||||||
|
} |
||||||
|
|
||||||
|
.btn-success { |
||||||
|
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#5cb85c), to(#449d44)); |
||||||
|
background-image: -webkit-linear-gradient(top, #5cb85c, 0%, #449d44, 100%); |
||||||
|
background-image: -moz-linear-gradient(top, #5cb85c 0%, #449d44 100%); |
||||||
|
background-image: linear-gradient(to bottom, #5cb85c 0%, #449d44 100%); |
||||||
|
background-repeat: repeat-x; |
||||||
|
border-color: #419641; |
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0); |
||||||
|
} |
||||||
|
|
||||||
|
.btn-success:active, |
||||||
|
.btn-success.active { |
||||||
|
background-color: #449d44; |
||||||
|
border-color: #419641; |
||||||
|
} |
||||||
|
|
||||||
|
.btn-warning { |
||||||
|
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#f0ad4e), to(#ec971f)); |
||||||
|
background-image: -webkit-linear-gradient(top, #f0ad4e, 0%, #ec971f, 100%); |
||||||
|
background-image: -moz-linear-gradient(top, #f0ad4e 0%, #ec971f 100%); |
||||||
|
background-image: linear-gradient(to bottom, #f0ad4e 0%, #ec971f 100%); |
||||||
|
background-repeat: repeat-x; |
||||||
|
border-color: #eb9316; |
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0); |
||||||
|
} |
||||||
|
|
||||||
|
.btn-warning:active, |
||||||
|
.btn-warning.active { |
||||||
|
background-color: #ec971f; |
||||||
|
border-color: #eb9316; |
||||||
|
} |
||||||
|
|
||||||
|
.btn-danger { |
||||||
|
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#d9534f), to(#c9302c)); |
||||||
|
background-image: -webkit-linear-gradient(top, #d9534f, 0%, #c9302c, 100%); |
||||||
|
background-image: -moz-linear-gradient(top, #d9534f 0%, #c9302c 100%); |
||||||
|
background-image: linear-gradient(to bottom, #d9534f 0%, #c9302c 100%); |
||||||
|
background-repeat: repeat-x; |
||||||
|
border-color: #c12e2a; |
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0); |
||||||
|
} |
||||||
|
|
||||||
|
.btn-danger:active, |
||||||
|
.btn-danger.active { |
||||||
|
background-color: #c9302c; |
||||||
|
border-color: #c12e2a; |
||||||
|
} |
||||||
|
|
||||||
|
.btn-info { |
||||||
|
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#5bc0de), to(#31b0d5)); |
||||||
|
background-image: -webkit-linear-gradient(top, #5bc0de, 0%, #31b0d5, 100%); |
||||||
|
background-image: -moz-linear-gradient(top, #5bc0de 0%, #31b0d5 100%); |
||||||
|
background-image: linear-gradient(to bottom, #5bc0de 0%, #31b0d5 100%); |
||||||
|
background-repeat: repeat-x; |
||||||
|
border-color: #2aabd2; |
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0); |
||||||
|
} |
||||||
|
|
||||||
|
.btn-info:active, |
||||||
|
.btn-info.active { |
||||||
|
background-color: #31b0d5; |
||||||
|
border-color: #2aabd2; |
||||||
|
} |
||||||
|
|
||||||
|
.thumbnail, |
||||||
|
.img-thumbnail { |
||||||
|
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075); |
||||||
|
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075); |
||||||
|
} |
||||||
|
|
||||||
|
.dropdown-menu > li > a:hover, |
||||||
|
.dropdown-menu > li > a:focus, |
||||||
|
.dropdown-menu > .active > a, |
||||||
|
.dropdown-menu > .active > a:hover, |
||||||
|
.dropdown-menu > .active > a:focus { |
||||||
|
background-color: #357ebd; |
||||||
|
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#428bca), to(#357ebd)); |
||||||
|
background-image: -webkit-linear-gradient(top, #428bca, 0%, #357ebd, 100%); |
||||||
|
background-image: -moz-linear-gradient(top, #428bca 0%, #357ebd 100%); |
||||||
|
background-image: linear-gradient(to bottom, #428bca 0%, #357ebd 100%); |
||||||
|
background-repeat: repeat-x; |
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff357ebd', GradientType=0); |
||||||
|
} |
||||||
|
|
||||||
|
.navbar { |
||||||
|
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#ffffff), to(#f8f8f8)); |
||||||
|
background-image: -webkit-linear-gradient(top, #ffffff, 0%, #f8f8f8, 100%); |
||||||
|
background-image: -moz-linear-gradient(top, #ffffff 0%, #f8f8f8 100%); |
||||||
|
background-image: linear-gradient(to bottom, #ffffff 0%, #f8f8f8 100%); |
||||||
|
background-repeat: repeat-x; |
||||||
|
border-radius: 4px; |
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0); |
||||||
|
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 5px rgba(0, 0, 0, 0.075); |
||||||
|
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 5px rgba(0, 0, 0, 0.075); |
||||||
|
} |
||||||
|
|
||||||
|
.navbar .navbar-nav > .active > a { |
||||||
|
background-color: #f8f8f8; |
||||||
|
} |
||||||
|
|
||||||
|
.navbar-brand, |
||||||
|
.navbar-nav > li > a { |
||||||
|
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25); |
||||||
|
} |
||||||
|
|
||||||
|
.navbar-inverse { |
||||||
|
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#3c3c3c), to(#222222)); |
||||||
|
background-image: -webkit-linear-gradient(top, #3c3c3c, 0%, #222222, 100%); |
||||||
|
background-image: -moz-linear-gradient(top, #3c3c3c 0%, #222222 100%); |
||||||
|
background-image: linear-gradient(to bottom, #3c3c3c 0%, #222222 100%); |
||||||
|
background-repeat: repeat-x; |
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0); |
||||||
|
} |
||||||
|
|
||||||
|
.navbar-inverse .navbar-nav > .active > a { |
||||||
|
background-color: #222222; |
||||||
|
} |
||||||
|
|
||||||
|
.navbar-inverse .navbar-brand, |
||||||
|
.navbar-inverse .navbar-nav > li > a { |
||||||
|
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); |
||||||
|
} |
||||||
|
|
||||||
|
.navbar-static-top, |
||||||
|
.navbar-fixed-top, |
||||||
|
.navbar-fixed-bottom { |
||||||
|
border-radius: 0; |
||||||
|
} |
||||||
|
|
||||||
|
.alert { |
||||||
|
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2); |
||||||
|
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05); |
||||||
|
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05); |
||||||
|
} |
||||||
|
|
||||||
|
.alert-success { |
||||||
|
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#dff0d8), to(#c8e5bc)); |
||||||
|
background-image: -webkit-linear-gradient(top, #dff0d8, 0%, #c8e5bc, 100%); |
||||||
|
background-image: -moz-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%); |
||||||
|
background-image: linear-gradient(to bottom, #dff0d8 0%, #c8e5bc 100%); |
||||||
|
background-repeat: repeat-x; |
||||||
|
border-color: #b2dba1; |
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0); |
||||||
|
} |
||||||
|
|
||||||
|
.alert-info { |
||||||
|
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#d9edf7), to(#b9def0)); |
||||||
|
background-image: -webkit-linear-gradient(top, #d9edf7, 0%, #b9def0, 100%); |
||||||
|
background-image: -moz-linear-gradient(top, #d9edf7 0%, #b9def0 100%); |
||||||
|
background-image: linear-gradient(to bottom, #d9edf7 0%, #b9def0 100%); |
||||||
|
background-repeat: repeat-x; |
||||||
|
border-color: #9acfea; |
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0); |
||||||
|
} |
||||||
|
|
||||||
|
.alert-warning { |
||||||
|
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#fcf8e3), to(#f8efc0)); |
||||||
|
background-image: -webkit-linear-gradient(top, #fcf8e3, 0%, #f8efc0, 100%); |
||||||
|
background-image: -moz-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%); |
||||||
|
background-image: linear-gradient(to bottom, #fcf8e3 0%, #f8efc0 100%); |
||||||
|
background-repeat: repeat-x; |
||||||
|
border-color: #f5e79e; |
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0); |
||||||
|
} |
||||||
|
|
||||||
|
.alert-danger { |
||||||
|
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#f2dede), to(#e7c3c3)); |
||||||
|
background-image: -webkit-linear-gradient(top, #f2dede, 0%, #e7c3c3, 100%); |
||||||
|
background-image: -moz-linear-gradient(top, #f2dede 0%, #e7c3c3 100%); |
||||||
|
background-image: linear-gradient(to bottom, #f2dede 0%, #e7c3c3 100%); |
||||||
|
background-repeat: repeat-x; |
||||||
|
border-color: #dca7a7; |
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0); |
||||||
|
} |
||||||
|
|
||||||
|
.progress { |
||||||
|
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#ebebeb), to(#f5f5f5)); |
||||||
|
background-image: -webkit-linear-gradient(top, #ebebeb, 0%, #f5f5f5, 100%); |
||||||
|
background-image: -moz-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%); |
||||||
|
background-image: linear-gradient(to bottom, #ebebeb 0%, #f5f5f5 100%); |
||||||
|
background-repeat: repeat-x; |
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0); |
||||||
|
} |
||||||
|
|
||||||
|
.progress-bar { |
||||||
|
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#428bca), to(#3071a9)); |
||||||
|
background-image: -webkit-linear-gradient(top, #428bca, 0%, #3071a9, 100%); |
||||||
|
background-image: -moz-linear-gradient(top, #428bca 0%, #3071a9 100%); |
||||||
|
background-image: linear-gradient(to bottom, #428bca 0%, #3071a9 100%); |
||||||
|
background-repeat: repeat-x; |
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3071a9', GradientType=0); |
||||||
|
} |
||||||
|
|
||||||
|
.progress-bar-success { |
||||||
|
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#5cb85c), to(#449d44)); |
||||||
|
background-image: -webkit-linear-gradient(top, #5cb85c, 0%, #449d44, 100%); |
||||||
|
background-image: -moz-linear-gradient(top, #5cb85c 0%, #449d44 100%); |
||||||
|
background-image: linear-gradient(to bottom, #5cb85c 0%, #449d44 100%); |
||||||
|
background-repeat: repeat-x; |
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0); |
||||||
|
} |
||||||
|
|
||||||
|
.progress-bar-info { |
||||||
|
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#5bc0de), to(#31b0d5)); |
||||||
|
background-image: -webkit-linear-gradient(top, #5bc0de, 0%, #31b0d5, 100%); |
||||||
|
background-image: -moz-linear-gradient(top, #5bc0de 0%, #31b0d5 100%); |
||||||
|
background-image: linear-gradient(to bottom, #5bc0de 0%, #31b0d5 100%); |
||||||
|
background-repeat: repeat-x; |
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0); |
||||||
|
} |
||||||
|
|
||||||
|
.progress-bar-warning { |
||||||
|
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#f0ad4e), to(#ec971f)); |
||||||
|
background-image: -webkit-linear-gradient(top, #f0ad4e, 0%, #ec971f, 100%); |
||||||
|
background-image: -moz-linear-gradient(top, #f0ad4e 0%, #ec971f 100%); |
||||||
|
background-image: linear-gradient(to bottom, #f0ad4e 0%, #ec971f 100%); |
||||||
|
background-repeat: repeat-x; |
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0); |
||||||
|
} |
||||||
|
|
||||||
|
.progress-bar-danger { |
||||||
|
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#d9534f), to(#c9302c)); |
||||||
|
background-image: -webkit-linear-gradient(top, #d9534f, 0%, #c9302c, 100%); |
||||||
|
background-image: -moz-linear-gradient(top, #d9534f 0%, #c9302c 100%); |
||||||
|
background-image: linear-gradient(to bottom, #d9534f 0%, #c9302c 100%); |
||||||
|
background-repeat: repeat-x; |
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0); |
||||||
|
} |
||||||
|
|
||||||
|
.list-group { |
||||||
|
border-radius: 4px; |
||||||
|
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075); |
||||||
|
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075); |
||||||
|
} |
||||||
|
|
||||||
|
.list-group-item.active, |
||||||
|
.list-group-item.active:hover, |
||||||
|
.list-group-item.active:focus { |
||||||
|
text-shadow: 0 -1px 0 #3071a9; |
||||||
|
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#428bca), to(#3278b3)); |
||||||
|
background-image: -webkit-linear-gradient(top, #428bca, 0%, #3278b3, 100%); |
||||||
|
background-image: -moz-linear-gradient(top, #428bca 0%, #3278b3 100%); |
||||||
|
background-image: linear-gradient(to bottom, #428bca 0%, #3278b3 100%); |
||||||
|
background-repeat: repeat-x; |
||||||
|
border-color: #3278b3; |
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3278b3', GradientType=0); |
||||||
|
} |
||||||
|
|
||||||
|
.panel { |
||||||
|
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); |
||||||
|
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); |
||||||
|
} |
||||||
|
|
||||||
|
.panel-default > .panel-heading { |
||||||
|
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#f5f5f5), to(#e8e8e8)); |
||||||
|
background-image: -webkit-linear-gradient(top, #f5f5f5, 0%, #e8e8e8, 100%); |
||||||
|
background-image: -moz-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%); |
||||||
|
background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%); |
||||||
|
background-repeat: repeat-x; |
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0); |
||||||
|
} |
||||||
|
|
||||||
|
.panel-primary > .panel-heading { |
||||||
|
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#428bca), to(#357ebd)); |
||||||
|
background-image: -webkit-linear-gradient(top, #428bca, 0%, #357ebd, 100%); |
||||||
|
background-image: -moz-linear-gradient(top, #428bca 0%, #357ebd 100%); |
||||||
|
background-image: linear-gradient(to bottom, #428bca 0%, #357ebd 100%); |
||||||
|
background-repeat: repeat-x; |
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff357ebd', GradientType=0); |
||||||
|
} |
||||||
|
|
||||||
|
.panel-success > .panel-heading { |
||||||
|
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#dff0d8), to(#d0e9c6)); |
||||||
|
background-image: -webkit-linear-gradient(top, #dff0d8, 0%, #d0e9c6, 100%); |
||||||
|
background-image: -moz-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%); |
||||||
|
background-image: linear-gradient(to bottom, #dff0d8 0%, #d0e9c6 100%); |
||||||
|
background-repeat: repeat-x; |
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0); |
||||||
|
} |
||||||
|
|
||||||
|
.panel-info > .panel-heading { |
||||||
|
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#d9edf7), to(#c4e3f3)); |
||||||
|
background-image: -webkit-linear-gradient(top, #d9edf7, 0%, #c4e3f3, 100%); |
||||||
|
background-image: -moz-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%); |
||||||
|
background-image: linear-gradient(to bottom, #d9edf7 0%, #c4e3f3 100%); |
||||||
|
background-repeat: repeat-x; |
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0); |
||||||
|
} |
||||||
|
|
||||||
|
.panel-warning > .panel-heading { |
||||||
|
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#fcf8e3), to(#faf2cc)); |
||||||
|
background-image: -webkit-linear-gradient(top, #fcf8e3, 0%, #faf2cc, 100%); |
||||||
|
background-image: -moz-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%); |
||||||
|
background-image: linear-gradient(to bottom, #fcf8e3 0%, #faf2cc 100%); |
||||||
|
background-repeat: repeat-x; |
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0); |
||||||
|
} |
||||||
|
|
||||||
|
.panel-danger > .panel-heading { |
||||||
|
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#f2dede), to(#ebcccc)); |
||||||
|
background-image: -webkit-linear-gradient(top, #f2dede, 0%, #ebcccc, 100%); |
||||||
|
background-image: -moz-linear-gradient(top, #f2dede 0%, #ebcccc 100%); |
||||||
|
background-image: linear-gradient(to bottom, #f2dede 0%, #ebcccc 100%); |
||||||
|
background-repeat: repeat-x; |
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0); |
||||||
|
} |
||||||
|
|
||||||
|
.well { |
||||||
|
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#e8e8e8), to(#f5f5f5)); |
||||||
|
background-image: -webkit-linear-gradient(top, #e8e8e8, 0%, #f5f5f5, 100%); |
||||||
|
background-image: -moz-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%); |
||||||
|
background-image: linear-gradient(to bottom, #e8e8e8 0%, #f5f5f5 100%); |
||||||
|
background-repeat: repeat-x; |
||||||
|
border-color: #dcdcdc; |
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0); |
||||||
|
-webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 0 rgba(255, 255, 255, 0.1); |
||||||
|
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 0 rgba(255, 255, 255, 0.1); |
||||||
|
} |
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Binary file not shown.
After Width: | Height: | Size: 62 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 50 KiB |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue