diff --git a/Controller/Admin.php b/Controller/Admin.php index f522375..963d778 100644 --- a/Controller/Admin.php +++ b/Controller/Admin.php @@ -2,6 +2,9 @@ namespace EmailOnSave\Controller; +/** + * Admin class. + */ class Admin extends \Cockpit\AuthController { public function index() { diff --git a/actions.php b/actions.php index 6f98940..a99beaa 100644 --- a/actions.php +++ b/actions.php @@ -1,7 +1,7 @@ on('collections.save.after', function($name, $data) use($app) { +$app->on('collections.save.after', function ($name, $data) use ($app) { $settings = $app->storage->getKey('cockpit/options', 'emailonsave.settings', []); @@ -45,4 +45,4 @@ ); } -}); \ No newline at end of file +}); diff --git a/admin.php b/admin.php index 3476eb1..4386500 100644 --- a/admin.php +++ b/admin.php @@ -1,19 +1,18 @@ addResource('EmailOnSave', ['manage.emailonsave']); -$app->on('admin.init', function() { +/* + * add menu entry if the user has access to group stuff + */ +$this->on('cockpit.view.settings.item', function () { + if ($this->module('cockpit')->hasaccess('EmailOnSave', 'manage.emailonsave')) { + $this->renderView("emailonsave:views/partials/settings.php"); + } +}); - // bind admin routes /emailonsave - $this->bindClass('EmailOnSave\\Controller\\Admin', 'emailonsave'); - - // add to modules menu - $this('admin')->addMenuItem('modules', [ - 'label' => 'Email On Save', - 'icon' => 'assets:app/media/icons/email.svg', - 'route' => '/emailonsave', - 'active' => strpos($this['route'], '/emailonsave') === 0 - ]); - -}); \ No newline at end of file +$app->on('admin.init', function () use ($app) { + // Bind admin routes /settings/email-on-save. + $this->bindClass('EmailOnSave\\Controller\\Admin', 'settings/email-on-save'); +}); diff --git a/bootstrap.php b/bootstrap.php index 6c7691c..433376c 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -1,9 +1,9 @@ + +
+
+ + @lang('Email on Save') + +
+ @lang('Email on Save') +
+ +
+
diff --git a/views/settings/index.php b/views/settings/index.php index fce15ae..60133ab 100644 --- a/views/settings/index.php +++ b/views/settings/index.php @@ -52,7 +52,7 @@
- @lang('Cancel') + @lang('Cancel')