Merge branch 'pjax' of https://github.com/Alex-Code/yii2 into Alex-Code-pjax

This commit is contained in:
SilverFire - Dmitry Naumenko
2015-12-06 21:50:33 +02:00
parent 762307f2f5
commit e8aa60e411
2 changed files with 14 additions and 8 deletions

View File

@ -43,10 +43,11 @@ Yii Framework 2 Change Log
- Bug #10302: Fixed JS function `yii.getQueryParams`, which parsed array variables incorrectly (servocoder, silverfire)
- Bug: Fixed generation of canonical URLs for `ViewAction` pages (samdark)
- Bug: Fixed `mb_*` functions calls to use `UTF-8` or `Yii::$app->charset` (silverfire)
- Enh #3506: Added `\yii\validators\IpValidator` to perform validation of IP addresses and subnets (SilverFire, samdark)
- Enh #5146: Added `\yii\i18n\Formatter::asDuration()` method (nineinchnick, SilverFire)
- Enh #3506: Added `yii\validators\IpValidator` to perform validation of IP addresses and subnets (SilverFire, samdark)
- Enh #4104: Added `yii\filters\auth\AuthMethod::optional` for optional authentification in all child classes (SilverFire)
- Enh #5146: Added `yii\i18n\Formatter::asDuration()` method (nineinchnick, SilverFire)
- Enh #5902: `yii\widgets\Pjax::options` now support special option `tag` to specify tag of container (Alex-Code)
- Enh #7341: Client validation now skips disabled inputs (SamMousa)
- Enh #4104: Added `yii\filters\auth\AuthMetod::optional` for optional authentification in all child classes (SilverFire)
- Enh #7566: Improved `\yii\validators\CompareValidator` default messages (slinstj)
- Enh #7581: Added ability to specify range using anonymous function in `RangeValidator` (RomeroMsk)
- Enh #8284: Added `\yii\captcha\CaptchaAction::$imageLibrary` property allowing to set image rendering library (AnatolyRugalev)

View File

@ -9,6 +9,7 @@ namespace yii\widgets;
use Yii;
use yii\base\Widget;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\helpers\Json;
use yii\web\Response;
@ -44,7 +45,10 @@ use yii\web\Response;
class Pjax extends Widget
{
/**
* @var array the HTML attributes for the widget container tag.
* @var array the HTML attributes for the widget container tag. The following special options are recognized:
*
* - `tag`: string, the tag name for the container. Defaults to `div`
*
* @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
*/
public $options = [];
@ -87,7 +91,6 @@ class Pjax extends Widget
*/
public $clientOptions;
/**
* @inheritdoc
*/
@ -109,13 +112,15 @@ class Pjax extends Widget
echo Html::tag('title', Html::encode($view->title));
}
} else {
echo Html::beginTag('div', array_merge([
$options = $this->options;
$tag = ArrayHelper::remove($options, 'tag', 'div');
echo Html::beginTag($tag, array_merge([
'data-pjax-container' => '',
'data-pjax-push-state' => $this->enablePushState,
'data-pjax-replace-state' => $this->enableReplaceState,
'data-pjax-timeout' => $this->timeout,
'data-pjax-scrollto' => $this->scrollTo,
], $this->options));
], $options));
}
}
@ -125,7 +130,7 @@ class Pjax extends Widget
public function run()
{
if (!$this->requiresPjax()) {
echo Html::endTag('div');
echo Html::endTag(ArrayHelper::remove($this->options, 'tag', 'div'));
$this->registerClientScript();
return;