Skip to content

Commit

Permalink
Updates to release v1.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
kartik-v committed May 22, 2016
1 parent 36f9f49 commit efe81b3
Show file tree
Hide file tree
Showing 8 changed files with 152 additions and 6 deletions.
8 changes: 8 additions & 0 deletions CHANGE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Change Log: `yii2-widget-fileinput`
===================================

## Version 1.0.5

**Date:** 22-May-2016

- (enh #70): Add Estonian Translations.
- (enh #71): Enhancements for plugin v4.3.2.
- Add branch alias for dev-master latest release.

## Version 1.0.4

**Date:** 10-Jan-2016
Expand Down
4 changes: 2 additions & 2 deletions CanvasBlobAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
* @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2016
* @package yii2-widgets
* @subpackage yii2-widget-fileinput
* @version 1.0.4
* @version 1.0.5
*/

namespace kartik\file;

use kartik\base\AssetBundle;

/**
* Asset bundle for FileInput Widget
* CanvasToBlob Asset bundle for FileInput Widget
*
* @author Kartik Visweswaran <kartikv2@gmail.com>
* @since 1.0
Expand Down
31 changes: 31 additions & 0 deletions DomPurifyAsset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

/**
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2016
* @package yii2-widgets
* @subpackage yii2-widget-rating
* @version 1.0.5
*/

namespace kartik\file;

use kartik\base\AssetBundle;

/**
* DomPurify asset bundle for FileInput Widget
*
* @author Kartik Visweswaran <kartikv2@gmail.com>
* @since 1.0
*/
class DomPurifyAsset extends AssetBundle
{
/**
* @inheritdoc
*/
public function init()
{
$this->setSourcePath('@vendor/kartik-v/bootstrap-fileinput');
$this->setupAssets('js', ['js/plugins/purify']);
parent::init();
}
}
32 changes: 29 additions & 3 deletions FileInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2016
* @package yii2-widgets
* @subpackage yii2-widget-fileinput
* @version 1.0.4
* @version 1.0.5
*/

namespace kartik\file;

use Yii;
use yii\helpers\Html;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use kartik\base\InputWidget;
use kartik\base\TranslationTrait;

Expand All @@ -37,6 +37,16 @@ class FileInput extends InputWidget
*/
public $resizeImages = false;

/**
* @var bool whether to load sortable plugin to rearrange initial preview images on client side
*/
public $sortThumbs = true;

/**
* @var bool whether to load dom purify plugin to purify HTML content in purfiy
*/
public $purifyHtml = true;

/**
* @var bool whether to show 'plugin unsupported' message for IE browser versions 9 & below
*/
Expand All @@ -58,6 +68,11 @@ class FileInput extends InputWidget
*/
public $pluginName = 'fileinput';

/**
* @var array the list of inbuilt themes
*/
private static $_themes = ['fa', 'gly'];

/**
* @var array initialize the FileInput widget
*/
Expand Down Expand Up @@ -112,7 +127,18 @@ public function registerAssetBundle()
CanvasBlobAsset::register($view);
$this->pluginOptions['resizeImage'] = true;
}
FileInputAsset::register($view)->addLanguage($this->language, 'fileinput_locale_');
$theme = ArrayHelper::getValue($this->pluginOptions, 'theme');
if (!empty($theme) && in_array($theme, self::$_themes)) {
FileInputThemeAsset::register($view)->addTheme($theme);
}
if ($this->sortThumbs) {
SortableAsset::register($view);
}
if ($this->purifyHtml) {
DomPurifyAsset::register($view);
$this->pluginOptions['purifyHtml'] = true;
}
FileInputAsset::register($view)->addLanguage($this->language, '');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion FileInputAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2016
* @package yii2-widgets
* @subpackage yii2-widget-fileinput
* @version 1.0.4
* @version 1.0.5
*/

namespace kartik\file;
Expand Down
45 changes: 45 additions & 0 deletions FileInputThemeAsset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

/**
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2016
* @package yii2-widgets
* @subpackage yii2-widget-rating
* @version 1.0.5
*/

namespace kartik\file;

use kartik\base\AssetBundle;

/**
* Theme Asset bundle for StarRating Widget
*
* @author Kartik Visweswaran <kartikv2@gmail.com>
* @since 1.0
*/
class FileInputThemeAsset extends AssetBundle
{
/**
* @inheritdoc
*/
public $sourcePath = '@vendor/kartik-v/bootstrap-fileinput';

/**
* @inheritdoc
*/
public function init()
{
$this->depends = array_merge($this->depends, ['kartik\rating\FileInputAsset']);
parent::init();
}

/**
* Add star rating theme file
*
* @param string $theme the theme file name
*/
public function addTheme($theme)
{
$this->css[] = "css/theme-{$theme}.css";
}
}
31 changes: 31 additions & 0 deletions SortableAsset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

/**
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2016
* @package yii2-widgets
* @subpackage yii2-widget-rating
* @version 1.0.5
*/

namespace kartik\file;

use kartik\base\AssetBundle;

/**
* Sortable asset bundle for FileInput Widget
*
* @author Kartik Visweswaran <kartikv2@gmail.com>
* @since 1.0
*/
class SortableAsset extends AssetBundle
{
/**
* @inheritdoc
*/
public function init()
{
$this->setSourcePath('@vendor/kartik-v/bootstrap-fileinput');
$this->setupAssets('js', ['js/plugins/sortable']);
parent::init();
}
}
5 changes: 5 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,10 @@
"psr-4": {
"kartik\\file\\": ""
}
},
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
}
}

0 comments on commit efe81b3

Please sign in to comment.