From 9b4e46ed945e101ada0ba315d91a9cc6820eb56b Mon Sep 17 00:00:00 2001 From: Tobias Munk Date: Wed, 27 May 2020 17:10:25 +0200 Subject: [PATCH 01/10] added rbac diagram --- src/controllers/RbacController.php | 121 +++++++++++++++++++++++++++++ src/views/rbac/index.twig | 17 ++++ 2 files changed, 138 insertions(+) create mode 100644 src/controllers/RbacController.php create mode 100644 src/views/rbac/index.twig diff --git a/src/controllers/RbacController.php b/src/controllers/RbacController.php new file mode 100644 index 0000000..424dabf --- /dev/null +++ b/src/controllers/RbacController.php @@ -0,0 +1,121 @@ +_manager = \Yii::$app->authManager; + + } + + public function actionIndex() + { + $this->renderDiagram(); + + $mmd = file_get_contents(\Yii::getAlias($this->_mmdFile)); + return $this->render('index.twig', ['mmd' => $mmd]); + } + + + private function renderDiagram() + { + $manager = \Yii::$app->authManager; + $roles = $manager->getRoles(); + + $mermaid = 'flowchart LR' . PHP_EOL . PHP_EOL; + + $assignmentsMmd = ''; + $rolesMmd = ''; + $permissionMmd = ''; + + foreach ($this->_manager->getPermissions() as $permission) { + $permissionMmd .= $this->renderAssignments($permission); + } + + $permissionMmd .= $this->renderPermissions(); + + foreach ($roles as $role) { + if ($role->ruleName) { + $rolesMmd .= $this->renderItem($role) . PHP_EOL; + $arrow = '-.->'; + } else { + $rolesMmd .= $this->renderItem($role) . PHP_EOL; + $arrow = '-->'; + } + $assignmentsMmd .= $this->renderAssignments($role); + } + + #$mermaid .= $this->renderAsSubgraph('roles',$rolesMmd) . PHP_EOL; + $mermaid .= $rolesMmd . PHP_EOL; + $mermaid .= $permissionMmd . PHP_EOL; + $mermaid .= $assignmentsMmd . PHP_EOL; + + $filename = \Yii::getAlias($this->_mmdFile); + FileHelper::createDirectory(dirname($filename)); + file_put_contents($filename, $mermaid); + + } + + private function renderAssignments($item) + { + $assignmentsMmd = ''; + foreach ($this->_manager->getChildren($item->name) as $child) { + $arrow = ($item->ruleName) ? '-.->' : '-->'; + $assignmentsMmd .= $this->renderItem($item, true) . $arrow . $this->renderItem($child, true) . PHP_EOL; + } + return $assignmentsMmd; + } + + private function renderPermissions() + { + $permissionGroups = []; + $permissionMmd = '' . PHP_EOL; + foreach ($this->_manager->getPermissions() as $permission) { + $group = explode('_', $permission->name)[0]; + $group = explode('.', $group)[0]; + $permissionGroups[$group][] = $this->renderItem($permission) . PHP_EOL; + } + + foreach ($permissionGroups as $group => $items) { + $g = ''; + foreach ($items as $line) { + $g .= $line; + } + $permissionMmd .= $this->renderAsSubgraph("__$group", $g); + } + return $permissionMmd; + } + + private function renderAsSubgraph($name, $diagram) { + $subgraph = 'subgraph '.$name.PHP_EOL; + $subgraph .= $diagram.PHP_EOL; + $subgraph .= 'end'.PHP_EOL; + + return $subgraph; + } + + private function renderItem($item, $compact = false) + { + if ($compact) { + $node = md5($item->name); + } else { + $node = md5($item->name) . '["' . $item->name . '

' . $item->description . '"]'; + $node .= ';'.PHP_EOL; + $routePart = $item->type == 1 ? 'role' : 'permission'; + $node .= 'click '.md5($item->name).' "/user/'.$routePart.'/update?name='.$item->name.'" "TT";'; + } + return $node; + } +} diff --git a/src/views/rbac/index.twig b/src/views/rbac/index.twig new file mode 100644 index 0000000..a49047f --- /dev/null +++ b/src/views/rbac/index.twig @@ -0,0 +1,17 @@ +{# register_asset_bundle('dmstr/web/MermaidAsset') #} + + + +
+
+ Roles and Permissions +
+
+ {{ mmd }} +
+
+ +

Debug

+

+ {{ mmd }}
+
From ce4efb00bab5749f07a087d3e01bd91e7857a3d9 Mon Sep 17 00:00:00 2001 From: Tobias Munk Date: Thu, 28 May 2020 17:07:57 +0200 Subject: [PATCH 02/10] created separate controllers, updated Dashboard --- src/Module.php | 2 + src/controllers/DefaultController.php | 65 ----------- src/controllers/RbacController.php | 132 ++++++++++++++++++---- src/views/default/index.php | 77 ++++++++++++- src/views/rbac/index.twig | 2 + src/views/{default => rbac}/show-auth.php | 0 6 files changed, 184 insertions(+), 94 deletions(-) rename src/views/{default => rbac}/show-auth.php (100%) diff --git a/src/Module.php b/src/Module.php index af39541..89d5a6d 100644 --- a/src/Module.php +++ b/src/Module.php @@ -28,6 +28,8 @@ class Module extends \yii\base\Module */ public $modulesDashboardBlacklist = []; + public $rbacDiagramExcludeRoles = ['Master']; + /** * @param $label * diff --git a/src/controllers/DefaultController.php b/src/controllers/DefaultController.php index 1b4b857..101e676 100644 --- a/src/controllers/DefaultController.php +++ b/src/controllers/DefaultController.php @@ -65,71 +65,6 @@ public function actionViewConfig() ); } - /** - * @return string - */ - public function actionShowAuth() - { - $allPermissions = Yii::$app->authManager->getPermissions(); - $allRoles = Yii::$app->authManager->getRoles(); - $userPermissions = []; - $userRoles = []; - - foreach ($allPermissions AS $item) { - if (Yii::$app->user->can($item->name)) { - $userPermissions[] = [ - 'description' => $item->description, - 'name' => $item->name, - ]; - } - } - foreach ($allRoles AS $item) { - if (Yii::$app->user->can($item->name)) { - $userRoles[] = [ - 'description' => $item->description, - 'name' => $item->name, - ]; - } - } - - return $this->render('show-auth', - [ - 'permissions' => new ArrayDataProvider([ - 'allModels' => $userPermissions, - 'pagination' => [ - 'pageSize' => 100, - ], - ]), - 'roles' => new ArrayDataProvider([ - 'allModels' => $userRoles, - 'pagination' => [ - 'pageSize' => 100, - ], - ]), - ]); - } - - - - /** - * 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->redirect(!empty(Yii::$app->request->referrer) ? Yii::$app->request->referrer : Url::to(['index'])); - } - - /** * @param array $item \dmstr\modules\pages\models\Tree::getMenuItems() * diff --git a/src/controllers/RbacController.php b/src/controllers/RbacController.php index 424dabf..5910928 100644 --- a/src/controllers/RbacController.php +++ b/src/controllers/RbacController.php @@ -4,9 +4,10 @@ namespace dmstr\modules\backend\controllers; +use yii\data\ArrayDataProvider; use yii\helpers\FileHelper; -use yii\helpers\Inflector; use yii\web\Controller; +use Yii; class RbacController extends Controller { @@ -20,7 +21,51 @@ public function init() } - public function actionIndex() + /** + * @return string + */ + public function actionAssignments() + { + $allPermissions = Yii::$app->authManager->getPermissions(); + $allRoles = Yii::$app->authManager->getRoles(); + $userPermissions = []; + $userRoles = []; + + foreach ($allPermissions AS $item) { + if (Yii::$app->user->can($item->name)) { + $userPermissions[] = [ + 'description' => $item->description, + 'name' => $item->name, + ]; + } + } + foreach ($allRoles AS $item) { + if (Yii::$app->user->can($item->name)) { + $userRoles[] = [ + 'description' => $item->description, + 'name' => $item->name, + ]; + } + } + + return $this->render('show-auth', + [ + 'permissions' => new ArrayDataProvider([ + 'allModels' => $userPermissions, + 'pagination' => [ + 'pageSize' => 100, + ], + ]), + 'roles' => new ArrayDataProvider([ + 'allModels' => $userRoles, + 'pagination' => [ + 'pageSize' => 100, + ], + ]), + ]); + } + + public function actionDiagram() { $this->renderDiagram(); @@ -31,34 +76,26 @@ public function actionIndex() private function renderDiagram() { - $manager = \Yii::$app->authManager; - $roles = $manager->getRoles(); $mermaid = 'flowchart LR' . PHP_EOL . PHP_EOL; $assignmentsMmd = ''; - $rolesMmd = ''; $permissionMmd = ''; - foreach ($this->_manager->getPermissions() as $permission) { - $permissionMmd .= $this->renderAssignments($permission); - } - + $rolesMmd = $this->renderRoles(); $permissionMmd .= $this->renderPermissions(); - foreach ($roles as $role) { - if ($role->ruleName) { - $rolesMmd .= $this->renderItem($role) . PHP_EOL; - $arrow = '-.->'; - } else { - $rolesMmd .= $this->renderItem($role) . PHP_EOL; - $arrow = '-->'; - } + foreach ($this->_manager->getRoles() as $role) { $assignmentsMmd .= $this->renderAssignments($role); } + $assignmentsMmd .= PHP_EOL . PHP_EOL; + foreach ($this->_manager->getPermissions() as $permission) { + $assignmentsMmd .= $this->renderAssignments($permission); + } #$mermaid .= $this->renderAsSubgraph('roles',$rolesMmd) . PHP_EOL; $mermaid .= $rolesMmd . PHP_EOL; + #$mermaid .= $permissionMmd . PHP_EOL; $mermaid .= $permissionMmd . PHP_EOL; $mermaid .= $assignmentsMmd . PHP_EOL; @@ -68,8 +105,51 @@ private function renderDiagram() } + private function renderRoles() + { + $roles = $this->_manager->getRoles(); + $rolesMmd = ''; + $assignmentsMmd = ''; + + $_gs = []; + + foreach ($roles as $role) { + #var_dump($this->module->rbacDiagramExcludeRoles);exit; + if (in_array($role->name, $this->module->rbacDiagramExcludeRoles)) continue; + + $group = $role->ruleName ?? '__NONE__'; + $group = '__NONE__'; + + if ($role->ruleName) { + $_gs[$group][] = $this->renderItem($role) . PHP_EOL; + $arrow = '-.->'; + } else { + $_gs[$group][] = $this->renderItem($role) . PHP_EOL; + $arrow = '-->'; + } + + #$assignmentsMmd .= $this->renderAssignments($role); + + } + + foreach ($_gs as $groupName => $g) { + $groupMmd = implode("\n", $g); + if ($groupName != '__NONE__') { + $rolesMmd .= $this->renderAsSubgraph($groupName, $groupMmd); + } else { + $rolesMmd .= $groupMmd; + } + #$rolesMmd .= $groupMmd; + } + + + return $rolesMmd . $assignmentsMmd; + } + private function renderAssignments($item) { + if (in_array($item->name, $this->module->rbacDiagramExcludeRoles)) return; + $assignmentsMmd = ''; foreach ($this->_manager->getChildren($item->name) as $child) { $arrow = ($item->ruleName) ? '-.->' : '-->'; @@ -85,6 +165,7 @@ private function renderPermissions() foreach ($this->_manager->getPermissions() as $permission) { $group = explode('_', $permission->name)[0]; $group = explode('.', $group)[0]; + $group = explode('-', $group)[0]; $permissionGroups[$group][] = $this->renderItem($permission) . PHP_EOL; } @@ -98,10 +179,11 @@ private function renderPermissions() return $permissionMmd; } - private function renderAsSubgraph($name, $diagram) { - $subgraph = 'subgraph '.$name.PHP_EOL; - $subgraph .= $diagram.PHP_EOL; - $subgraph .= 'end'.PHP_EOL; + private function renderAsSubgraph($name, $diagram) + { + $subgraph = 'subgraph ' . $name . PHP_EOL; + $subgraph .= $diagram . PHP_EOL; + $subgraph .= 'end' . PHP_EOL; return $subgraph; } @@ -111,10 +193,12 @@ private function renderItem($item, $compact = false) if ($compact) { $node = md5($item->name); } else { - $node = md5($item->name) . '["' . $item->name . '

' . $item->description . '"]'; - $node .= ';'.PHP_EOL; + $symbols = ($item->type == 1) ? ["(",")"] : ["[","]"]; + $node = md5($item->name) . $symbols[0]. '"' . $item->name . '

' . $item->description . '"'.$symbols[1]; + + $node .= ';' . PHP_EOL; $routePart = $item->type == 1 ? 'role' : 'permission'; - $node .= 'click '.md5($item->name).' "/user/'.$routePart.'/update?name='.$item->name.'" "TT";'; + $node .= 'click ' . md5($item->name) . ' "/user/' . $routePart . '/update?name=' . $item->name . '" "TT";'; } return $node; } diff --git a/src/views/default/index.php b/src/views/default/index.php index 2059d8e..cd934e2 100644 --- a/src/views/default/index.php +++ b/src/views/default/index.php @@ -11,14 +11,15 @@
-
+

- +

- + +

@@ -33,7 +34,7 @@
-
+

-
+

getModules()) ?> @@ -103,6 +104,72 @@

+ + +
+ +
+
+

+ Diagram +

+ RBAC Hierarchy +

+ +

+
+
+ +
+ + + +
+
+ + +
+ +
+
+

+ Your Permissions +

+ +

+ RBAC +

+
+
+ +
+ + + +
+
+ + +
+ +
+
+

+ Cache +

+ +

+ Flush +

+
+
+ +
+ + + +
+
diff --git a/src/views/rbac/index.twig b/src/views/rbac/index.twig index a49047f..2fce36e 100644 --- a/src/views/rbac/index.twig +++ b/src/views/rbac/index.twig @@ -11,7 +11,9 @@

+{#

Debug


  {{ mmd }}
 
+#} diff --git a/src/views/default/show-auth.php b/src/views/rbac/show-auth.php similarity index 100% rename from src/views/default/show-auth.php rename to src/views/rbac/show-auth.php From 6090f9bea134b8945713c616c631803843989d8e Mon Sep 17 00:00:00 2001 From: Tobias Munk Date: Fri, 29 May 2020 16:35:10 +0200 Subject: [PATCH 03/10] created separate controllers, added ENV to config view --- src/controllers/ConfigController.php | 44 +++++++++++++++++++ src/controllers/DefaultController.php | 25 ----------- src/views/{default => config}/_controller.php | 0 src/views/{default => config}/_module.php | 0 .../view-config.php => config/view.php} | 12 +++++ src/views/default/index.php | 6 +-- 6 files changed, 59 insertions(+), 28 deletions(-) create mode 100644 src/controllers/ConfigController.php rename src/views/{default => config}/_controller.php (100%) rename src/views/{default => config}/_module.php (100%) rename src/views/{default/view-config.php => config/view.php} (91%) diff --git a/src/controllers/ConfigController.php b/src/controllers/ConfigController.php new file mode 100644 index 0000000..688a37e --- /dev/null +++ b/src/controllers/ConfigController.php @@ -0,0 +1,44 @@ + $loadedModules]); + $loadedModulesDataProvider->pagination->pageSize = 100; + + $components = Yii::$app->getComponents(); + ksort($components); + $modules = Yii::$app->getModules(); + ksort($modules); + $env = $_ENV; + ksort($env); + + + return $this->render( + 'view', + [ + 'params' => Yii::$app->params, + 'components' => $components, + 'modules' => $modules, + 'env' => $env, + 'loadedModulesDataProvider' => $loadedModulesDataProvider, + ] + ); + } +} diff --git a/src/controllers/DefaultController.php b/src/controllers/DefaultController.php index 101e676..cfcfbb4 100644 --- a/src/controllers/DefaultController.php +++ b/src/controllers/DefaultController.php @@ -38,32 +38,7 @@ public function actionIndex() return $this->render('index', ['items' => $items]); } - /** - * Application configuration. - * - * @return string - */ - public function actionViewConfig() - { - $loadedModules = Metadata::getModules(); - $loadedModulesDataProvider = new ArrayDataProvider(['allModels' => $loadedModules]); - $loadedModulesDataProvider->pagination->pageSize = 100; - - $components = Yii::$app->getComponents(); - ksort($components); - $modules = Yii::$app->getModules(); - ksort($modules); - return $this->render( - 'view-config', - [ - 'params' => Yii::$app->params, - 'components' => $components, - 'modules' => $modules, - 'loadedModulesDataProvider' => $loadedModulesDataProvider, - ] - ); - } /** * @param array $item \dmstr\modules\pages\models\Tree::getMenuItems() diff --git a/src/views/default/_controller.php b/src/views/config/_controller.php similarity index 100% rename from src/views/default/_controller.php rename to src/views/config/_controller.php diff --git a/src/views/default/_module.php b/src/views/config/_module.php similarity index 100% rename from src/views/default/_module.php rename to src/views/config/_module.php diff --git a/src/views/default/view-config.php b/src/views/config/view.php similarity index 91% rename from src/views/default/view-config.php rename to src/views/config/view.php index 7f91ba1..f503d52 100644 --- a/src/views/default/view-config.php +++ b/src/views/config/view.php @@ -89,6 +89,14 @@ endBlock('modules') ?> +beginBlock('env') ?> +
+
+
+endBlock('env') ?> + + + diff --git a/src/views/default/index.php b/src/views/default/index.php index cd934e2..4500181 100644 --- a/src/views/default/index.php +++ b/src/views/default/index.php @@ -76,7 +76,7 @@
- +
@@ -133,11 +133,11 @@

- Your Permissions + Auth

- RBAC + Roles & Permissions

From 55fbe6d7f5ed06e8299cdbda63b4e01fe24827f3 Mon Sep 17 00:00:00 2001 From: Elias Luhr Date: Tue, 9 Jun 2020 09:53:20 +0200 Subject: [PATCH 04/10] reimplemented cache flush --- src/controllers/DefaultController.php | 22 +++++++++++++++++++--- src/views/default/index.php | 2 +- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/controllers/DefaultController.php b/src/controllers/DefaultController.php index cfcfbb4..97102d9 100644 --- a/src/controllers/DefaultController.php +++ b/src/controllers/DefaultController.php @@ -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; /** @@ -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']); + } + } diff --git a/src/views/default/index.php b/src/views/default/index.php index 4500181..a99ff97 100644 --- a/src/views/default/index.php +++ b/src/views/default/index.php @@ -165,7 +165,7 @@
- +
From f166f16f717c7351fe7bcb6044eb02c3d6e9d1a6 Mon Sep 17 00:00:00 2001 From: Elias Luhr Date: Tue, 9 Jun 2020 09:53:32 +0200 Subject: [PATCH 05/10] i18n --- src/views/default/index.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/views/default/index.php b/src/views/default/index.php index a99ff97..90b40ec 100644 --- a/src/views/default/index.php +++ b/src/views/default/index.php @@ -3,7 +3,7 @@ $this->title = Yii::t('backend-module', 'Dashboard'); ?> -

Backend

+

@@ -111,11 +111,10 @@

- Diagram +

- RBAC Hierarchy

- +

@@ -133,11 +132,11 @@

- Auth +

- Roles & Permissions +

@@ -155,11 +154,11 @@

- Cache +

- Flush +

From 083523bcc34cedafc92174451b2fc25abb0291b6 Mon Sep 17 00:00:00 2001 From: Elias Luhr Date: Wed, 10 Jun 2020 08:19:04 +0200 Subject: [PATCH 06/10] moved cache flush functionality into separate controller --- src/controllers/CacheController.php | 35 +++++++++++++++++++++++++++ src/controllers/DefaultController.php | 18 -------------- src/views/default/index.php | 2 +- 3 files changed, 36 insertions(+), 19 deletions(-) create mode 100644 src/controllers/CacheController.php diff --git a/src/controllers/CacheController.php b/src/controllers/CacheController.php new file mode 100644 index 0000000..6e9224b --- /dev/null +++ b/src/controllers/CacheController.php @@ -0,0 +1,35 @@ +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->redirect(['default/index']); + } +} \ No newline at end of file diff --git a/src/controllers/DefaultController.php b/src/controllers/DefaultController.php index 97102d9..5a94263 100644 --- a/src/controllers/DefaultController.php +++ b/src/controllers/DefaultController.php @@ -75,22 +75,4 @@ 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']); - } - } diff --git a/src/views/default/index.php b/src/views/default/index.php index 90b40ec..69ee379 100644 --- a/src/views/default/index.php +++ b/src/views/default/index.php @@ -164,7 +164,7 @@
- +
From 864f858d10ce17fc2261b9e6eb96b4fa2976fde4 Mon Sep 17 00:00:00 2001 From: Elias Luhr Date: Thu, 16 Jul 2020 14:09:30 +0200 Subject: [PATCH 07/10] updated toolbar and modal --- composer.json | 3 ++- src/widgets/views/modal.twig | 10 ++++++++++ src/widgets/views/toolbar.twig | 10 ++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index a237129..ae1c546 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,8 @@ "suggest": { "codemix/yii2-localeurls": "Extended URL manager", "dmstr/yii2-pages-module": "Menu manager", - "dmstr/yii2-prototype-module": "Content prototyping" + "dmstr/yii2-prototype-module": "Content prototyping", + "dmstr/lajax-yii2-translate-manager-addons": "Translating" }, "autoload": { "psr-4": { diff --git a/src/widgets/views/modal.twig b/src/widgets/views/modal.twig index 3ef9bf9..363cca3 100644 --- a/src/widgets/views/modal.twig +++ b/src/widgets/views/modal.twig @@ -1,10 +1,12 @@ {{ use ('dmstr/cookiebutton') }} {{ use ('yii/widgets') }} {{ use ('rmrevin/yii/fontawesome/FA') }} +{{ use ('dmstr/lajax/translatemanager/widgets/ToggleTranslateLink') }} {% set backendItems = Tree.getMenuItems('backend', true, {'target': app.params['backend.iframe.name']} ) %} + {% if not app.user.isGuest %}
@@ -57,6 +59,14 @@ } ) | raw }} + {% if app.components['translatemanager'] is defined %} + {{ ToggleTranslateLink_widget({ + 'options': { + 'class': 'btn btn-xs btn-default', + 'title': 'Toggle translate' + } + }) }} + {% endif %}
diff --git a/src/widgets/views/toolbar.twig b/src/widgets/views/toolbar.twig index e727c8d..89246d8 100644 --- a/src/widgets/views/toolbar.twig +++ b/src/widgets/views/toolbar.twig @@ -4,6 +4,7 @@ {{ use ('dmstr/modules/prototype/widgets/TwigWidget') }} {{ use ('dmstr/cookiebutton/CookieButton') }} {{ use ('rmrevin/yii/fontawesome/FA') }} +{{ use ('dmstr/lajax/translatemanager/widgets/ToggleTranslateLink') }} {% if not app.user.isGuest %} {% set backendItems = Tree.getMenuItems('backend', true, {'target': app.params['backend.iframe.name']} ) %} @@ -83,6 +84,15 @@ } ) }} + {% if app.components['translatemanager'] is defined %} + {{ ToggleTranslateLink_widget({ + 'options': { + 'class': 'btn btn-xs btn-default', + 'title': 'Toggle translate' + } + }) }} + {% endif %} + {{ twig_widget_widget({ 'key': 'frontend.extra.menuItems', 'renderEmpty': false, From e502833c965abebb9098df6e3589ed6809330789 Mon Sep 17 00:00:00 2001 From: Jens Giessmann Date: Fri, 4 Sep 2020 11:49:46 +0200 Subject: [PATCH 08/10] add dmstr-backend css class to body tag in main layout --- src/views/layouts/main.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/layouts/main.php b/src/views/layouts/main.php index c4cb537..5968a05 100644 --- a/src/views/layouts/main.php +++ b/src/views/layouts/main.php @@ -59,7 +59,7 @@ head() ?> - request->cookies['dmstr-backend_pin-navigation'] ? '' : 'sidebar-collapse' ?> "> Date: Mon, 7 Sep 2020 11:33:59 +0200 Subject: [PATCH 09/10] fixed BS3 json-editor form-group --- src/assets/backend/less/json-editor.less | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/assets/backend/less/json-editor.less b/src/assets/backend/less/json-editor.less index bdf6bd1..af78658 100644 --- a/src/assets/backend/less/json-editor.less +++ b/src/assets/backend/less/json-editor.less @@ -1,3 +1,10 @@ +// json-editor well padding .well-small { .well-sm; -} \ No newline at end of file +} + +// json-editor Bootstrap 3 fix +div[id$="-container"] div[data-schemaid] .form-group { + margin-right: 0px; + margin-left: 0px; +} From 54ffce48446b2db537cc2ff884d1586ee746148c Mon Sep 17 00:00:00 2001 From: Tobias Munk Date: Mon, 7 Sep 2020 11:49:40 +0200 Subject: [PATCH 10/10] json-editor fixes (LESS) --- src/assets/backend/less/json-editor.less | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/assets/backend/less/json-editor.less b/src/assets/backend/less/json-editor.less index af78658..811ce80 100644 --- a/src/assets/backend/less/json-editor.less +++ b/src/assets/backend/less/json-editor.less @@ -4,7 +4,22 @@ } // json-editor Bootstrap 3 fix -div[id$="-container"] div[data-schemaid] .form-group { - margin-right: 0px; - margin-left: 0px; +div[id$="-container"] div[data-schemaid] { + .form-group { + margin-right: 0px; + margin-left: 0px; + } + + h3 { + font-size: 1em; + margin-top: 0.5em; + } +} + +div[data-schematype="object"] { + .well; + .well-small; } + + +