Browse Source

Implemented data-form support.

batch-query-test
Sam Mousa 9 years ago
parent
commit
25b1178515
  1. 1
      framework/CHANGELOG.md
  2. 9
      framework/assets/yii.js

1
framework/CHANGELOG.md

@ -56,6 +56,7 @@ Yii Framework 2 Change Log
- Enh #10061: `yii\helpers\BaseInflector::transliterate()` is now public. Introduced different levels of transliteration strictness (silverfire) - Enh #10061: `yii\helpers\BaseInflector::transliterate()` is now public. Introduced different levels of transliteration strictness (silverfire)
- Enh #10118: Allow easy extension of slug generation in `yii\behaviors\SluggableBehavior` (cebe, hesna) - Enh #10118: Allow easy extension of slug generation in `yii\behaviors\SluggableBehavior` (cebe, hesna)
- Enh: Added last resort measure for `FileHelper::removeDirectory()` fail to unlink symlinks under Windows (samdark) - Enh: Added last resort measure for `FileHelper::removeDirectory()` fail to unlink symlinks under Windows (samdark)
- Enh: #9893: Added support for data-form attribute so links can target specific forms (SamMousa)
- Chg #9369: `Yii::$app->user->can()` now returns `false` instead of erroring in case `authManager` component is not configured (creocoder) - Chg #9369: `Yii::$app->user->can()` now returns `false` instead of erroring in case `authManager` component is not configured (creocoder)
- Chg #9411: `DetailView` now automatically sets container tag ID in case it's not specified (samdark) - Chg #9411: `DetailView` now automatically sets container tag ID in case it's not specified (samdark)
- Chg #9953: `TimestampBehavior::getValue()` changed to make value processing consistent with `AttributeBehavior::getValue()` (silverfire) - Chg #9953: `TimestampBehavior::getValue()` changed to make value processing consistent with `AttributeBehavior::getValue()` (silverfire)

9
framework/assets/yii.js

@ -144,8 +144,8 @@ yii = (function ($) {
* @param $e the jQuery representation of the element * @param $e the jQuery representation of the element
*/ */
handleAction: function ($e, event) { handleAction: function ($e, event) {
var method = $e.data('method'), var $form = $e.attr('data-form') ? $('#' + $e.attr('data-form')) : $e.closest('form'),
$form = $e.closest('form'), method = !$e.data('method') && $form ? $form.attr('method') : $e.data('method'),
action = $e.attr('href'), action = $e.attr('href'),
params = $e.data('params'), params = $e.data('params'),
pjax = $e.data('pjax'), pjax = $e.data('pjax'),
@ -322,9 +322,10 @@ yii = (function ($) {
var handler = function (event) { var handler = function (event) {
var $this = $(this), var $this = $(this),
method = $this.data('method'), method = $this.data('method'),
message = $this.data('confirm'); message = $this.data('confirm'),
form = $this.data('form');
if (method === undefined && message === undefined) { if (method === undefined && message === undefined && form === undefined) {
return true; return true;
} }

Loading…
Cancel
Save