Browse Source

Enhanced `handleAction()` in `yii.js`

Closes #12737
tags/2.0.11
SilverFire - Dmitry Naumenko 8 years ago
parent
commit
7b5efe5161
No known key found for this signature in database
GPG Key ID: 39DD917A92B270A
  1. 2
      framework/CHANGELOG.md
  2. 9
      framework/assets/yii.js

2
framework/CHANGELOG.md

@ -31,7 +31,7 @@ Yii Framework 2 Change Log
- Bug #13071: Help option for commands was not working in modules (arogachev, haimanman)
- Bug #13089: Fixed `yii\console\controllers\AssetController::adjustCssUrl()` breaks URL reference specification (`url(#id)`) (vitalyzhakov)
- Bug #13105: Fixed `validate()` method in `yii.activeForm.js` to prevent unexpected form submit when `forceValidate` set to `true` (silverfire)
- Bug #13118: Fixed `handleAction()` function in `yii.js` to handle attribute `data-pjax=0` as disabled PJAX (silverfire)
- Bug #13118: Fixed `handleAction()` function in `yii.js` to handle attribute `data-pjax=0` as disabled PJAX (silverfire, arisk)
- Bug #13128: Fixed incorrect position of {pos} string in ColumnSchemaBuilder `__toString` (df2)
- Bug #13159: Fixed `destroy` method in `yii.captcha.js` which did not work as expected (arogachev)
- Bug #13198: Fixed order of checks in `yii\validators\IpValidator` that sometimes caused wrong error message (silverfire)

9
framework/assets/yii.js

@ -154,6 +154,7 @@ window.yii = (function ($) {
action = $e.attr('href'),
params = $e.data('params'),
pjax = $e.data('pjax') || 0,
usePjax = pjax !== 0 && $.support.pjax,
pjaxPushState = !!$e.data('pjax-push-state'),
pjaxReplaceState = !!$e.data('pjax-replace-state'),
pjaxTimeout = $e.data('pjax-timeout'),
@ -164,7 +165,7 @@ window.yii = (function ($) {
pjaxContainer,
pjaxOptions = {};
if (pjax !== 0 && $.support.pjax) {
if (usePjax) {
if ($e.data('pjax-container')) {
pjaxContainer = $e.data('pjax-container');
} else {
@ -190,13 +191,13 @@ window.yii = (function ($) {
if (method === undefined) {
if (action && action != '#') {
if (pjax !== 0 && $.support.pjax) {
if (usePjax) {
$.pjax.click(event, pjaxOptions);
} else {
window.location = action;
}
} else if ($e.is(':submit') && $form.length) {
if (pjax !== 0 && $.support.pjax) {
if (usePjax) {
$form.on('submit',function(e){
$.pjax.submit(e, pjaxOptions);
})
@ -249,7 +250,7 @@ window.yii = (function ($) {
oldAction = $form.attr('action');
$form.attr('action', action);
}
if (pjax !== 0 && $.support.pjax) {
if (usePjax) {
$form.on('submit',function(e){
$.pjax.submit(e, pjaxOptions);
})

Loading…
Cancel
Save