Skip to content

Commit

Permalink
Upgrade to release v2.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kartik-v committed Jul 17, 2014
1 parent d20293b commit c8e6184
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
15 changes: 15 additions & 0 deletions CHANGE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
version 2.7.0
=============
**Date:** 18-Jul-2014

1. enh #96: Enhanced DatePicker, DateTimePicker, and TimePicker to work along with the new `autoWidgetSettings` for DateControl module .
2. enh #98: Added `language` configuration property for DatePicker, DateTimePicker, and TimePicker.
3. bug #99: Fix DateControl to work for date time formatting with DateTimePicker.
4. enh #104: Add more information to documentation for Select2 widget and explain placeholder setting when `allowClear` is `true`.
5. enh #106: Added Turkish translations for FileInput widget.
6. bug #110: Allow use of Select2 with tags, when tags are empty.
7. enh #111: Allow configuring of template for each item in SideNav.
8. Added `iconPrefix` property in SideNav to easily configure with more icon frameworks (other than glyphicon).

version 2.6.0
=============
**Date:** 01-Jul-2014

1. Issue Fixes from #73 to #95.
2. Added `language` property to `InputWidget` along with `initLanguage` method for automatic language setting in `pluginOptions`.
The `language` property will be auto defaulted to `Yii::$app->language` if not set.
Expand Down
16 changes: 11 additions & 5 deletions widgets/SideNav.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* @copyright Copyright © Kartik Visweswaran, Krajee.com, 2013
* @package yii2-widgets
* @version 1.0.0
* @version 1.1.0
*/

namespace kartik\widgets;
Expand Down Expand Up @@ -62,6 +62,13 @@ class SideNav extends \yii\widgets\Menu
*/
public $type = self::TYPE_DEFAULT;

/**
* @var string prefix for the icon in [[items]]. This string will be prepended
* before the icon name to get the icon CSS class. This defaults to `glyphicon glyphicon-`
* for usage with glyphicons available with Bootstrap.
*/
public $iconPrefix = 'glyphicon glyphicon-';

/**
* @var array string/boolean the sidenav heading. This is not HTML encoded
* When set to false or null, no heading container will be displayed.
Expand Down Expand Up @@ -101,7 +108,6 @@ class SideNav extends \yii\widgets\Menu
* - icon: string, optional, specifies the glyphicon name to be placed before label.
* - url: string or array, optional, specifies the URL of the menu item. It will be processed by [[Url::to]].
* When this is set, the actual menu item content will be generated using [[linkTemplate]];
* otherwise, [[labelTemplate]] will be used.
* - visible: boolean, optional, whether this menu item is visible. Defaults to true.
* - items: array, optional, specifies the sub-menu items. Its format is the same as the parent items.
* - active: boolean, optional, whether this menu item is in active state (currently selected).
Expand All @@ -111,7 +117,7 @@ class SideNav extends \yii\widgets\Menu
* - template: string, optional, the template used to render the content of this menu item.
* The token `{url}` will be replaced by the URL associated with this menu item,
* and the token `{label}` will be replaced by the label of the menu item.
* If this option is not set, [[linkTemplate]] or [[labelTemplate]] will be used instead.
* If this option is not set, [[linkTemplate]] will be used instead.
* - options: array, optional, the HTML attributes for the menu item tag.
*
*/
Expand Down Expand Up @@ -201,8 +207,8 @@ protected function markTopItems()
protected function renderItem($item)
{
$this->validateItems($item);
$template = ArrayHelper::getValue($item, 'template', $this->linkTemplate);
$url = Url::to(ArrayHelper::getValue($item, 'url', '#'));
$template = $this->linkTemplate;
if (empty($item['top'])) {
if (empty($item['items'])) {
$template = str_replace('{icon}', $this->indItem . '{icon}', $template);
Expand All @@ -214,7 +220,7 @@ protected function renderItem($item)
$template = str_replace('{icon}', $indicator . '{icon}', $template);
}
}
$icon = empty($item['icon']) ? '' : '<i class="glyphicon glyphicon-' . $item['icon'] . '"></i> &nbsp;';
$icon = empty($item['icon']) ? '' : '<span class="' . $this->iconPrefix . $item['icon'] . '"></span> &nbsp;';
unset($item['icon'], $item['top']);
return strtr($template, [
'{url}' => $url,
Expand Down

0 comments on commit c8e6184

Please sign in to comment.