Enh #3771: Added humhub\modules\ui\form\widgets\ActiveForm:acknowledge flag

This commit is contained in:
buddh4 2019-12-03 15:08:08 +01:00
parent 2d3b9bbceb
commit a4f36adde8
3 changed files with 14 additions and 1 deletions

View File

@ -26,6 +26,7 @@ HumHub Change Log (DEVELOP)
- Enh: Added `data-ui-addition` way of definint ui additions
- Enh: Added `data-ui-addition` way of defining ui additions
- Enh #3771: Added `data-ui-addition="acknowledgeForm"` in order to prevent page changes without save/confirmation
- Enh #3771: Added `humhub\modules\ui\form\widgets\ActiveForm:acknowledge` flag
1.4
---

View File

@ -28,4 +28,15 @@ class ActiveForm extends \yii\bootstrap\ActiveForm
*/
public $fieldClass = 'humhub\modules\ui\form\widgets\ActiveField';
public $acknowledge = false;
public function init()
{
parent::init();
if($this->acknowledge) {
$this->options['data-ui-addition'] = 'acknowledgeForm';
}
}
}

View File

@ -353,7 +353,8 @@ humhub.module('client', function (module, require, $) {
$(document).on('pjax:beforeSend.humhub_client', function(evt) {
if ($form.serialize() !== state && !window.confirm(msg)) {
evt.preventDefault();
return;
} else {
offBeforeLoad();
}
})
};