Fix: Modal options backdrop and keyboard deactivation has no effect

This commit is contained in:
buddh4 2019-03-05 23:00:19 +01:00
parent 294215560e
commit e36b00ac94
3 changed files with 11 additions and 14 deletions

View File

@ -15,7 +15,7 @@ HumHub Change Log
- Fix: WallEntry of global content throws error
- Fix: `ActivityAsset` does not depend on `StreamAsset`
- Fix: Uploaded png preview files lose transparency
- Fix: Modal options `backdrop` and `keyboard` deactivation has no effect
1.3.10 (February 22, 2019)
---------------------------

View File

@ -37,17 +37,12 @@ class ModalDialog extends Modal
}
//The x close button is rendered by default either if forced by showClose or a headertext is given
$showClose = ($this->showClose != null) ? $this->showClose : ($this->header != null);
$showClose = $this->showClose ?: ($this->header !== null);
$bodyClass = 'modal-body';
$bodyClass .= ($this->centerText) ? ' text-center' : '';
$bodyClass .= $this->centerText ? ' text-center' : '';
$this->initialLoader = ($this->initialLoader ==! null) ? $this->initialLoader : ($this->body === null);
$modalData = '';
$modalData .= !$this->closable || !$this->backdrop ? 'data-backdrop="static"' : '';
$modalData .= !$this->closable || !$this->keyboard ? 'data-keyboard="false"' : '';
$modalData .= $this->show ? 'data-show="true"' : '';
return $this->render('modalDialog', [
'header' => $this->header,
@ -64,8 +59,9 @@ class ModalDialog extends Modal
public function getAttributes()
{
$dialogClass = 'modal-dialog';
$dialogClass .= ($this->size != null) ? ' modal-dialog-'.$this->size : '';
$dialogClass .= ($this->animation != null) ? ' animated '.$this->animation : '';
$dialogClass .= $this->size ? ' modal-dialog-'.$this->size : '';
$dialogClass .= $this->animation ? ' animated '.$this->animation : '';
$dialogClass .= ' '.$this->dialogClass;
return [
'class' => $dialogClass
@ -74,8 +70,8 @@ class ModalDialog extends Modal
public function getData()
{
return [
'backdrop' => (!$this->closable || $this->backdrop === false) ? "static" : $this->backdrop,
'keyboard' => (!$this->closable || !$this->keyboard) ? "false" : 'true',
'backdrop' => (!$this->closable || $this->backdrop === false) ? 'static' : $this->backdrop,
'keyboard' => (!$this->closable || !$this->keyboard) ? 'false' : 'true',
];
}

View File

@ -294,6 +294,7 @@ humhub.module('ui.modal', function (module, require, $) {
if (!this.$.data('bs.modal')) {
this.$.modal(this.options);
} else {
this.set(this.options);
this.$.modal('show');
}
this.focus();
@ -392,8 +393,8 @@ humhub.module('ui.modal', function (module, require, $) {
this.getDialog().addClass('modal-dialog-'+this.options.size);
}
this.options.backdrop = options.backdrop || true;
this.options.keyboard = options.keyboard || true;
this.options.backdrop = object.defaultValue(options.backdrop, true);
this.options.keyboard = object.defaultValue(options.keyboard, true);
if (this.$.data('bs.modal')) {
this.$.data('bs.modal').options = this.options;