Skip to content

Commit

Permalink
Updates to release v1.7.9
Browse files Browse the repository at this point in the history
  • Loading branch information
kartik-v committed Sep 26, 2018
1 parent 443949e commit 65b32b0
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 29 deletions.
6 changes: 6 additions & 0 deletions CHANGE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Change Log: `yii2-detail-view`
==============================

## Version 1.7.9

**Date:** 26-Sep-2018

- Enhancements in parsing Bootstrap CSS classes (ref: kartik-v/yii2-krajee-base#100).

## Version 1.7.8

**Date:** 23-Sep-2018
Expand Down
49 changes: 25 additions & 24 deletions src/DetailView.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @package yii2-detail-view
* @author Kartik Visweswaran <[email protected]>
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2018
* @version 1.7.8
* @version 1.7.9
*/

namespace kartik\detail;
Expand Down Expand Up @@ -112,8 +112,8 @@ class DetailView extends YiiDetailView implements BootstrapInterface
* @var string horizontal **right** alignment for grid cells
*/
const ALIGN_RIGHT = 'right';
/**

/**
* @var string horizontal **center** alignment for grid cells
*/
const ALIGN_CENTER = 'center';
Expand Down Expand Up @@ -531,7 +531,7 @@ class DetailView extends YiiDetailView implements BootstrapInterface
* - inputType: string|Closure, the HTML 5 input type if `type` is set to [[DetailView::::INPUT_HTML 5]].
* - inputContainer: array|Closure, HTML attributes for the input container
* - inputWidth: string|Closure, the width of the container holding the input, should be appended along with the
* width unit (`px` or `%`) - this property is deprecated since v1.7.8
* width unit (`px` or `%`) - this property is deprecated since v1.7.9
* - fieldConfig: array|Closure, optional, the Active field configuration.
* - options: array|Closure, optional, the HTML attributes for the input.
* - updateAttr: string|Closure, optional, the name of the attribute to be updated, when in edit mode. This will
Expand Down Expand Up @@ -821,9 +821,6 @@ protected function initWidget()
$this->_msgCat = 'kvdetail';
$this->pluginName = 'kvDetailView';
$isBs4 = $this->isBs4();
if (!isset($this->panelCssPrefix)) {
$this->panelCssPrefix = $isBs4 ? 'card border-' : 'panel panel-';
}
if ($isBs4) {
Html::addCssClass($this->container, 'kv-container-bs4');
}
Expand Down Expand Up @@ -851,7 +848,7 @@ protected function initWidget()
Html::addCssClass($this->options, 'table-bordered');
}
if ($this->condensed) {
Html::addCssClass($this->options, $isBs4 ? 'table-sm' : 'table-condensed');
$this->addCssClass($this->options, self::BS_TABLE_CONDENSED);
}
$this->_childTableOptions = $this->options;
if ($this->striped) {
Expand All @@ -874,15 +871,16 @@ protected function runWidget()
$this->container['id'] = $this->getId();
}
$this->initI18N(__DIR__);
Html::addCssClass($this->alertContainerOptions, [$this->isBs4() ? 'card-body' : 'panel-body', 'kv-alert-container']);
Html::addCssClass($this->alertContainerOptions,
[$this->getCssClass(self::BS_PANEL_BODY), 'kv-alert-container']);
foreach ($this->alertMessageSettings as $key => $setting) {
$this->alertMessageSettings[$key] = (array) $setting;
$this->alertMessageSettings[$key] = (array)$setting;
}
$this->alertMessageSettings += [
'kv-detail-error' => ['alert', 'alert-danger'],
'kv-detail-success' => ['alert', 'alert-success'],
'kv-detail-info' => ['alert', 'alert-info'],
'kv-detail-warning' => ['alert', 'alert-warning'],
'kv-detail-info' => ['alert', 'alert-info'],
'kv-detail-warning' => ['alert', 'alert-warning'],
];

$this->registerAssets();
Expand Down Expand Up @@ -1136,7 +1134,7 @@ protected function renderFormAttribute($config)
$inputWidth = ArrayHelper::getValue($config, 'inputWidth', '');
$container = ArrayHelper::getValue($config, 'inputContainer', []);
if ($inputWidth != '') {
Html::addCssStyle($container, "width: {$inputWidth}"); // deprecated since v1.7.8
Html::addCssStyle($container, "width: {$inputWidth}"); // deprecated since v1.7.9
}
$template = ArrayHelper::getValue($fieldConfig, 'template', "{input}\n{error}\n{hint}");
$row = Html::tag('div', $template, $container);
Expand Down Expand Up @@ -1223,21 +1221,24 @@ protected function renderPanel($items)
$panelAfter = '';
$panelFooter = '';
$isBs4 = $this->isBs4();
static::initCss($options, $this->panelCssPrefix . $type);
if (isset($this->panelCssPrefix)) {
static::initCss($options, $this->panelCssPrefix . $type);
} else {
$this->addCssClass($options, self::BS_PANEL);
Html::addCssClass($options, $isBs4 ? "border-{$type}" : "panel-{$type}");
}
if ($after === false && $footer === false) {
Html::addCssClass($this->container, 'kv-flat-b');
}
$titleTag = ArrayHelper::remove($titleOptions, 'tag', ($isBs4 ? 'span' : 'h3'));
if (!$isBs4) {
static::initCss($titleOptions, 'panel-title');
}
$titleTag = ArrayHelper::remove($titleOptions, 'tag', ($isBs4 ? 'h5' : 'h3'));
static::initCss($titleOptions, $isBs4 ? 'm-0' : $this->getCssClass(self::BS_PANEL_TITLE));
if ($heading !== false) {
$color = $type === 'default' ? 'bg-light' : 'text-white bg-' . $type;
static::initCss($headingOptions, $isBs4 ? 'card-header ' . $color : 'panel-heading');
$color = $isBs4 ? ($type === 'default' ? ' bg-light' : " text-white bg-{$type}") : '';
static::initCss($headingOptions, $this->getCssClass(self::BS_PANEL_HEADING) . $color);
$panelHeading = Html::tag('div', $this->panelHeadingTemplate, $headingOptions);
}
if ($footer !== false) {
static::initCss($footerOptions, $isBs4 ? 'card-footer border-top-0' : 'panel-footer');
static::initCss($footerOptions, $this->getCssClass(self::BS_PANEL_FOOTER));
$panelFooter = Html::tag('div', $footer, $footerOptions);
}
if ($before !== false) {
Expand All @@ -1255,7 +1256,7 @@ protected function renderPanel($items)
'{items}' => $items,
'{panelFooter}' => $panelFooter,
'{panelBefore}' => $panelBefore,
'{panelAfter}' => $panelAfter
'{panelAfter}' => $panelAfter,
]);

return Html::tag('div', strtr($out, [
Expand Down Expand Up @@ -1331,7 +1332,7 @@ protected function getDefaultButton($type, $iconBs3, $iconBs4, $title)
$buttonOptions = $type . 'Options';
$options = $this->$buttonOptions;
$css = $this->getDefaultIconPrefix() . ($this->isBs4() ? $iconBs4 : $iconBs3);
$label = ArrayHelper::remove($options, 'label', '<i class="' . $css . '"></i>');
$label = ArrayHelper::remove($options, 'label', '<i class="' . $css . '"></i>');
if (empty($options['class'])) {
$options['class'] = 'kv-action-btn';
}
Expand Down Expand Up @@ -1375,7 +1376,7 @@ protected function registerAssets()
$button = Html::tag($tag, $label, $opts);
}
$opts = ArrayHelper::getValue($this->alertWidgetOptions, 'options', []);
$css = '{class} fade ' . ($this->isBs4() ? 'show' : 'in');
$css = '{class} fade ' . $this->getCssClass(self::BS_SHOW);
if (!empty($opts['class'])) {
$opts['class'] .= ' ' . $css;
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/DetailViewAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @package yii2-detail-view
* @author Kartik Visweswaran <[email protected]>
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2018
* @version 1.7.8
* @version 1.7.9
*/

namespace kartik\detail;
Expand Down
2 changes: 1 addition & 1 deletion src/assets/css/kv-detail-view.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @package yii2-detail-view
* @author Kartik Visweswaran <[email protected]>
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2018
* @version 1.7.7
* @version 1.7.9
*
* Styles for yii2-detail-view extension
*
Expand Down
2 changes: 1 addition & 1 deletion src/assets/css/kv-detail-view.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/assets/js/kv-detail-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @package yii2-detail-view
* @author Kartik Visweswaran <[email protected]>
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2018
* @version 1.7.7
* @version 1.7.9
*
* Client extension for the yii2-detail-view extension
*
Expand Down
2 changes: 1 addition & 1 deletion src/assets/js/kv-detail-view.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 65b32b0

Please sign in to comment.