Skip to content

Commit

Permalink
Update to release v1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
kartik-v committed May 3, 2015
1 parent 00de3b0 commit 890e305
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 57 deletions.
11 changes: 5 additions & 6 deletions CHANGE.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
version 1.1.0
version 1.0.1
=============
**Date:** 03-May-2015

**Date:** 04-Feb-2015

- Fix #2, #3: Register assets based availability of locale files.
- Fix #13: Add ability to hide search control and use as normal select.
- (enh #2, #3): Register assets based on availability of locale files.
- (enh #13): Add ability to hide search control and use as normal select.
- (enh kartik-v/yii2-krajee-base#34, kartik-v/yii2-krajee-base#35): Enhance i18n translation locales.

version 1.0.0
=============

**Date:** 08-Nov-2014

- Initial release
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2014, Kartik Visweswaran
Copyright (c) 2014 - 2015, Kartik Visweswaran
Krajee.com
All rights reserved.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ to the ```require``` section of your `composer.json` file.

## Latest Release

> NOTE: The latest version of the module is v1.1.0 released on 03-Jan-2015. Refer the [CHANGE LOG](https://github.com/kartik-v/yii2-widget-select2/blob/master/CHANGE.md) for details.
> NOTE: The latest version of the module is v1.0.1. Refer the [CHANGE LOG](https://github.com/kartik-v/yii2-widget-select2/blob/master/CHANGE.md) for details.
## Demo

Expand Down
85 changes: 38 additions & 47 deletions Select2.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

/**
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2015
* @package yii2-widgets
* @subpackage yii2-widget-select2
* @version 1.0.0
* @version 1.0.1
*/

namespace kartik\select2;
Expand All @@ -13,7 +13,6 @@
use yii\helpers\Html;
use yii\helpers\ArrayHelper;
use yii\base\InvalidConfigException;
use kartik\base\Config;

/**
* Select2 widget is a Yii2 wrapper for the Select2 jQuery plugin. This
Expand Down Expand Up @@ -118,42 +117,45 @@ public function init()

/**
* Embeds the input group addon
*
* @param string $input
*
* @return string
*/
protected function embedAddon($input)
{
if (!empty($this->addon)) {
$addon = $this->addon;
$prepend = ArrayHelper::getValue($addon, 'prepend', '');
$append = ArrayHelper::getValue($addon, 'append', '');
$group = ArrayHelper::getValue($addon, 'groupOptions', []);
$size = isset($this->size) ? ' input-group-' . $this->size : '';
if ($this->pluginLoading) {
Html::addCssClass($group, 'kv-hide group-' . $this->options['id']);
}
if (is_array($prepend)) {
$content = ArrayHelper::getValue($prepend, 'content', '');
if (isset($prepend['asButton']) && $prepend['asButton'] == true) {
$prepend = Html::tag('div', $content, ['class' => 'input-group-btn']);
} else {
$prepend = Html::tag('span', $content, ['class' => 'input-group-addon']);
}
Html::addCssClass($group, 'input-group' . $size . ' select2-bootstrap-prepend');
if (empty($this->addon)) {
return $input;
}
$prepend = ArrayHelper::getValue($this->addon, 'prepend', '');
$append = ArrayHelper::getValue($this->addon, 'append', '');
$group = ArrayHelper::getValue($this->addon, 'groupOptions', []);
$size = isset($this->size) ? ' input-group-' . $this->size : '';
if ($this->pluginLoading) {
Html::addCssClass($group, 'kv-hide group-' . $this->options['id']);
}
if (is_array($prepend)) {
$content = ArrayHelper::getValue($prepend, 'content', '');
if (isset($prepend['asButton']) && $prepend['asButton'] == true) {
$prepend = Html::tag('div', $content, ['class' => 'input-group-btn']);
} else {
$prepend = Html::tag('span', $content, ['class' => 'input-group-addon']);
}
if (is_array($append)) {
$content = ArrayHelper::getValue($append, 'content', '');
if (isset($append['asButton']) && $append['asButton'] == true) {
$append = Html::tag('div', $content, ['class' => 'input-group-btn']);
} else {
$append = Html::tag('span', $content, ['class' => 'input-group-addon']);
}
Html::addCssClass($group, 'input-group' . $size . ' select2-bootstrap-append');
Html::addCssClass($group, 'input-group' . $size . ' select2-bootstrap-prepend');
}
if (is_array($append)) {
$content = ArrayHelper::getValue($append, 'content', '');
if (isset($append['asButton']) && $append['asButton'] == true) {
$append = Html::tag('div', $content, ['class' => 'input-group-btn']);
} else {
$append = Html::tag('span', $content, ['class' => 'input-group-addon']);
}
$addonText = $prepend . $input . $append;
$contentBefore = ArrayHelper::getValue($addon, 'contentBefore', '');
$contentAfter = ArrayHelper::getValue($addon, 'contentAfter', '');
return Html::tag('div', $contentBefore . $addonText . $contentAfter, $group);
Html::addCssClass($group, 'input-group' . $size . ' select2-bootstrap-append');
}
return $input;
$addonText = $prepend . $input . $append;
$contentBefore = ArrayHelper::getValue($this->addon, 'contentBefore', '');
$contentAfter = ArrayHelper::getValue($this->addon, 'contentAfter', '');
return Html::tag('div', $contentBefore . $addonText . $contentAfter, $group);
}

/**
Expand All @@ -180,23 +182,12 @@ protected function renderInput()
echo $this->_loadIndicator . $this->embedAddon($input);
}

/**
/**
* Registers the asset bundle and locale
*/
protected function registerAssetBundle() {
public function registerAssetBundle() {
$view = $this->getView();
if (!empty($this->language) && substr($this->language, 0, 2) != 'en') {
$path = __DIR__ . '/lib';
$file = "select2_locale_{$this->language}.js";
if (!Config::fileExists("{$path}/{$file}")) {
$file = "select2_locale_{$this->_lang}.js";
}
if (Config::fileExists("{$path}/{$file}")) {
Select2Asset::register($view)->js[] = $file;
return;
}
}
Select2Asset::register($view);
Select2Asset::register($view)->addLanguage($this->language, 'select2_locale_', '/');
}

/**
Expand Down
4 changes: 2 additions & 2 deletions Select2Asset.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

/**
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2015
* @package yii2-widgets
* @subpackage yii2-widget-select2
* @version 1.0.0
* @version 1.0.1
*/

namespace kartik\select2;
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"homepage": "https://github.com/kartik-v/yii2-widget-select2",
"type": "yii2-extension",
"license": "BSD 3-Clause",
"minimum-stability": "stable",
"authors": [
{
"name": "Kartik Visweswaran",
Expand Down

0 comments on commit 890e305

Please sign in to comment.