From 0ab7f1e0aed4e8b710c43725c1be0b2e5e31eb31 Mon Sep 17 00:00:00 2001 From: Christophe BOULAIN Date: Thu, 6 Mar 2014 11:04:03 +0100 Subject: [PATCH 1/2] Add size attribute to Modal --- extensions/bootstrap/CHANGELOG.md | 1 + extensions/bootstrap/Modal.php | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/extensions/bootstrap/CHANGELOG.md b/extensions/bootstrap/CHANGELOG.md index 5fced15e10..720f5fe04b 100644 --- a/extensions/bootstrap/CHANGELOG.md +++ b/extensions/bootstrap/CHANGELOG.md @@ -14,6 +14,7 @@ Yii Framework 2 bootstrap extension Change Log - Enh #2425: Tabs widget now selects first tab if no active tab is specified (samdark) - Chg #1459: Update Collapse to use bootstrap 3 classes (tonydspaniard) - Chg #1820: Update Progress to use bootstrap 3 markup (samdark) +- Enh #2643: Add size attribute to Modal (tof06) 2.0.0 alpha, December 1, 2013 ----------------------------- diff --git a/extensions/bootstrap/Modal.php b/extensions/bootstrap/Modal.php index 276b57c4ae..cdf6eb3ae4 100644 --- a/extensions/bootstrap/Modal.php +++ b/extensions/bootstrap/Modal.php @@ -35,6 +35,10 @@ use yii\helpers\Html; */ class Modal extends Widget { + const SIZE_LARGE="modal-lg"; + const SIZE_SMALL="modal-sm"; + const SIZE_DEFAULT=""; + /** * @var string the header content in the modal window. */ @@ -43,6 +47,10 @@ class Modal extends Widget * @var string the footer content in the modal window. */ public $footer; + /** + * @var string the modal size. Can be MODAL_LG or MODAL_SM, or empty for default. + */ + public $size; /** * @var array the options for rendering the close button tag. * The close button is displayed in the header of the modal window. Clicking @@ -86,7 +94,7 @@ class Modal extends Widget echo $this->renderToggleButton() . "\n"; echo Html::beginTag('div', $this->options) . "\n"; - echo Html::beginTag('div', ['class' => 'modal-dialog']) . "\n"; + echo Html::beginTag('div', ['class' => 'modal-dialog '.$this->size]) . "\n"; echo Html::beginTag('div', ['class' => 'modal-content']) . "\n"; echo $this->renderHeader() . "\n"; echo $this->renderBodyBegin() . "\n"; From 6f49e466091d81dc0b298f9e43093b0953f347f6 Mon Sep 17 00:00:00 2001 From: Christophe BOULAIN Date: Thu, 6 Mar 2014 12:18:32 +0100 Subject: [PATCH 2/2] CS fix --- extensions/bootstrap/CHANGELOG.md | 3 ++- extensions/bootstrap/Modal.php | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/extensions/bootstrap/CHANGELOG.md b/extensions/bootstrap/CHANGELOG.md index 720f5fe04b..464c959706 100644 --- a/extensions/bootstrap/CHANGELOG.md +++ b/extensions/bootstrap/CHANGELOG.md @@ -12,9 +12,10 @@ Yii Framework 2 bootstrap extension Change Log - Enh #1601: Added support for tagName and encodeLabel parameters in ButtonDropdown (omnilight) - Enh #1881: Improved `yii\bootstrap\NavBar` with `containerOptions`, `innerContainerOptions` and `renderInnerContainer` (creocoder) - Enh #2425: Tabs widget now selects first tab if no active tab is specified (samdark) +- Enh #2643: Add size attribute to Modal (tof06) - Chg #1459: Update Collapse to use bootstrap 3 classes (tonydspaniard) - Chg #1820: Update Progress to use bootstrap 3 markup (samdark) -- Enh #2643: Add size attribute to Modal (tof06) + 2.0.0 alpha, December 1, 2013 ----------------------------- diff --git a/extensions/bootstrap/Modal.php b/extensions/bootstrap/Modal.php index cdf6eb3ae4..e498f49233 100644 --- a/extensions/bootstrap/Modal.php +++ b/extensions/bootstrap/Modal.php @@ -35,9 +35,9 @@ use yii\helpers\Html; */ class Modal extends Widget { - const SIZE_LARGE="modal-lg"; - const SIZE_SMALL="modal-sm"; - const SIZE_DEFAULT=""; + const SIZE_LARGE = "modal-lg"; + const SIZE_SMALL = "modal-sm"; + const SIZE_DEFAULT = ""; /** * @var string the header content in the modal window. @@ -94,7 +94,7 @@ class Modal extends Widget echo $this->renderToggleButton() . "\n"; echo Html::beginTag('div', $this->options) . "\n"; - echo Html::beginTag('div', ['class' => 'modal-dialog '.$this->size]) . "\n"; + echo Html::beginTag('div', ['class' => 'modal-dialog ' . $this->size]) . "\n"; echo Html::beginTag('div', ['class' => 'modal-content']) . "\n"; echo $this->renderHeader() . "\n"; echo $this->renderBodyBegin() . "\n";