Skip to content

Commit

Permalink
Prepare for next release.
Browse files Browse the repository at this point in the history
- Refactoring code.
- Maybe BC break.
  • Loading branch information
mdmunir committed Mar 9, 2016
1 parent 99f828c commit 5aef422
Show file tree
Hide file tree
Showing 43 changed files with 1,720 additions and 1,736 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
Yii2 Admin Change Log
==========================

2.0 Under Development
2.3
-----



2.0
---------------------

- Chg: Remove dependenci to `yiisoft/yii2-jui` (mdmunir).
Expand Down
675 changes: 675 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

24 changes: 22 additions & 2 deletions Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ public function init()
['label' => Yii::t('rbac-admin', 'Application'), 'url' => Yii::$app->homeUrl]
];
}
if (class_exists('yii\jui\JuiAsset')) {
Yii::$container->set('mdm\admin\AutocompleteAsset', 'yii\jui\JuiAsset');
}
}

/**
Expand Down Expand Up @@ -132,7 +135,8 @@ public function getMenus()
'label' => $value,
];
}
$this->_normalizeMenus[$id] = isset($this->_normalizeMenus[$id]) ? array_merge($this->_normalizeMenus[$id], $value) : $value;
$this->_normalizeMenus[$id] = isset($this->_normalizeMenus[$id]) ? array_merge($this->_normalizeMenus[$id], $value)
: $value;
if (!isset($this->_normalizeMenus[$id]['url'])) {
$this->_normalizeMenus[$id]['url'] = [$mid . $id];
}
Expand All @@ -151,4 +155,20 @@ public function setMenus($menus)
$this->_menus = array_merge($this->_menus, $menus);
$this->_normalizeMenus = null;
}
}

/**
* @inheritdoc
*/
public function beforeAction($action)
{
if (parent::beforeAction($action)) {
/* @var $action \yii\base\Action */
$action->controller->getView()->params['breadcrumbs'][] = [
'label' => Yii::t('rbac-admin', 'Admin'),
'url' => ['/' . $this->uniqueId]
];
return true;
}
return false;
}
}
21 changes: 21 additions & 0 deletions assets/animate.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.glyphicon-refresh-animate {
-animation: spin .7s infinite linear;
-ms-animation: spin .7s infinite linear;
-webkit-animation: spinw .7s infinite linear;
-moz-animation: spinm .7s infinite linear;
}

@keyframes spin {
from { transform: scale(1) rotate(0deg);}
to { transform: scale(1) rotate(360deg);}
}

@-webkit-keyframes spinw {
from { -webkit-transform: rotate(0deg);}
to { -webkit-transform: rotate(360deg);}
}

@-moz-keyframes spinm {
from { -moz-transform: rotate(0deg);}
to { -moz-transform: rotate(360deg);}
}
58 changes: 55 additions & 3 deletions components/Configs.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
*/
class Configs extends \yii\base\Object
{
const CACHE_TAG = 'mdm.admin';
/**
* @var Connection Database connection.
*/
Expand All @@ -46,15 +47,20 @@ class Configs extends \yii\base\Object
public $cache = 'cache';

/**
* @var integer Cache duration. Default to a month.
* @var integer Cache duration. Default to a hour.
*/
public $cacheDuration = 2592000;
public $cacheDuration = 3600;

/**
* @var string Menu table name.
*/
public $menuTable = '{{%menu}}';


/**
* @var array
*/
public $options;

/**
* @var self Instance of self
*/
Expand Down Expand Up @@ -99,4 +105,50 @@ public static function instance()

return self::$_instance;
}

public static function __callStatic($name, $arguments)
{
$instance = static::instance();
if ($instance->hasProperty($name)) {
return $instance->$name;
} else {
if (count($arguments)) {
$instance->options[$name] = reset($arguments);
} else {
return array_key_exists($name, $instance->options) ? $instance->options[$name] : null;
}
}
}

/**
* @return Connection
*/
public static function db()
{
return static::instance()->db;
}

/**
* @return Cache
*/
public static function cache()
{
return static::instance()->cache;
}

/**
* @return integer
*/
public static function cacheDuration()
{
return static::instance()->cacheDuration;
}

/**
* @return string
*/
public static function menuTable()
{
return static::instance()->menuTable;
}
}
Loading

0 comments on commit 5aef422

Please sign in to comment.