Skip to content

Commit

Permalink
Enhanced handleAction() in yii.js
Browse files Browse the repository at this point in the history
  • Loading branch information
SilverFire committed Dec 17, 2016
1 parent 0f6b69a commit 7b5efe5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion framework/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 5 additions & 4 deletions framework/assets/yii.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand All @@ -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 {
Expand All @@ -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);
})
Expand Down Expand Up @@ -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);
})
Expand Down

0 comments on commit 7b5efe5

Please sign in to comment.