Skip to content

Commit

Permalink
Merge pull request #20 from eluhr/feature/refurbish
Browse files Browse the repository at this point in the history
Feature/refurbish
  • Loading branch information
eluhr authored Jun 9, 2020
2 parents 6090f9b + f166f16 commit c5056e9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 12 deletions.
22 changes: 19 additions & 3 deletions src/controllers/DefaultController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@

namespace dmstr\modules\backend\controllers;

use dmstr\helpers\Metadata;
use dmstr\modules\backend\Module;
use dmstr\widgets\Menu;
use insolita\wgadminlte\InfoBox;
use Yii;
use yii\data\ArrayDataProvider;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\helpers\Url;
use yii\web\Controller;

/**
Expand Down Expand Up @@ -77,4 +74,23 @@ public function renderDashboardMenu($item = [])

return $menuItems;
}

/**
* flush cache
*
* if APCu is used as cache we cannot flush cache from cli command
* see: https://github.com/yiisoft/yii2/issues/8647
*
* @return \yii\web\Response
*/
public function actionCacheFlush()
{
if (Yii::$app->cache->flush()) {
Yii::$app->session->addFlash('success', Yii::t('backend-module','Cache cleared'));
} else {
Yii::$app->session->addFlash('error', Yii::t('backend-module','Cannot clear cache'));
}
return $this->goBack(['index']);
}

}
17 changes: 8 additions & 9 deletions src/views/default/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
$this->title = Yii::t('backend-module', 'Dashboard');
?>

<h1>Backend</h1>
<h1><?=Yii::t('backend-module', 'Backend')?></h1>

<div class="row">

Expand Down Expand Up @@ -111,11 +111,10 @@
<div class="small-box bg-olive">
<div class="inner">
<h3>
Diagram
<?=Yii::t('backend-module', 'Diagram')?>
</h3>
RBAC Hierarchy
<p>

<?=Yii::t('backend-module', 'RBAC Hierarchy')?>
</p>
</div>
<div class="icon">
Expand All @@ -133,11 +132,11 @@
<div class="small-box bg-olive">
<div class="inner">
<h3>
Auth
<?=Yii::t('backend-module', 'Auth')?>
</h3>

<p>
Roles & Permissions
<?=Yii::t('backend-module', 'Roles & Permissions')?>
</p>
</div>
<div class="icon">
Expand All @@ -155,17 +154,17 @@
<div class="small-box bg-gray">
<div class="inner">
<h3>
Cache
<?=Yii::t('backend-module', 'Cache')?>
</h3>

<p>
Flush
<?=Yii::t('backend-module', 'Flush')?>
</p>
</div>
<div class="icon">
<i class="ion ion-grid"></i>
</div>
<a onclick="return confirm('Are you sure?')" href="<?= \yii\helpers\Url::to(['cache/flush']) ?>" class="small-box-footer">
<a data-confirm="<?=Yii::t('backend-module', 'Are you sure?')?>" href="<?= \yii\helpers\Url::to(['default/cache-flush']) ?>" class="small-box-footer">
<?=Yii::t('backend-module', 'Flush')?> <i class="fa fa-arrow-circle-right"></i>
</a>
</div>
Expand Down

0 comments on commit c5056e9

Please sign in to comment.