diff --git a/Plugin.php b/Plugin.php index 63280ec..d266c07 100644 --- a/Plugin.php +++ b/Plugin.php @@ -36,36 +36,6 @@ public function boot() $this->app->register(ServiceProvider::class); } - /** - * @return array - */ - public function registerNavigation() - { - return [ - 'dynamicpdf' => [ - 'label' => 'renatio.dynamicpdf::lang.menu.label', - 'url' => Backend::url('renatio/dynamicpdf/templates'), - 'icon' => 'icon-file-pdf-o', - 'permissions' => ['renatio.dynamicpdf.*'], - 'order' => 500, - 'sideMenu' => [ - 'templates' => [ - 'label' => 'renatio.dynamicpdf::lang.templates.templates', - 'icon' => 'icon-file-text-o', - 'url' => Backend::url('renatio/dynamicpdf/templates'), - 'permissions' => ['renatio.dynamicpdf.manage_templates'], - ], - 'layouts' => [ - 'label' => 'renatio.dynamicpdf::lang.templates.layouts', - 'icon' => 'icon-th-large', - 'url' => Backend::url('renatio/dynamicpdf/layouts'), - 'permissions' => ['renatio.dynamicpdf.manage_layouts'], - ] - ] - ] - ]; - } - /** * @return array */ @@ -105,7 +75,16 @@ public function registerMarkupTags() */ public function registerSettings() { - return []; + return [ + 'templates' => [ + 'category' => 'renatio.dynamicpdf::lang.menu.label', + 'label' => 'renatio.dynamicpdf::lang.templates.templates', + 'icon' => 'icon-file-text-o', + 'url' => Backend::url('renatio/dynamicpdf/templates'), + 'description' => '', + 'permissions' => ['renatio.dynamicpdf.manage_templates'], + ], + ]; } } \ No newline at end of file diff --git a/controllers/Layouts.php b/controllers/Layouts.php index e27437a..817304a 100644 --- a/controllers/Layouts.php +++ b/controllers/Layouts.php @@ -6,6 +6,7 @@ use Backend\Facades\BackendMenu; use October\Rain\Exception\ApplicationException; use Renatio\DynamicPDF\Classes\PDF; +use System\Classes\SettingsManager; /** * Class Layouts @@ -46,7 +47,8 @@ public function __construct() { parent::__construct(); - BackendMenu::setContext('Renatio.DynamicPDF', 'dynamicpdf', 'layouts'); + BackendMenu::setContext('October.System', 'system', 'settings'); + SettingsManager::setContext('Renatio.DynamicPDF', 'layouts'); } /** diff --git a/controllers/Templates.php b/controllers/Templates.php index fdcad65..cd0f1f0 100644 --- a/controllers/Templates.php +++ b/controllers/Templates.php @@ -6,6 +6,7 @@ use Backend\Facades\BackendMenu; use October\Rain\Exception\ApplicationException; use Renatio\DynamicPDF\Classes\PDF; +use System\Classes\SettingsManager; /** * Class Templates @@ -35,13 +36,26 @@ class Templates extends Controller /** * @var string */ - public $listConfig = 'config_list.yaml'; + //public $listConfig = 'config_list.yaml'; + + public $listConfig = [ + 'templates' => 'config_list.yaml', + 'layouts' => '$/renatio/dynamicpdf/controllers/layouts/config_list.yaml', + ]; public function __construct() { parent::__construct(); - BackendMenu::setContext('Renatio.DynamicPDF', 'dynamicpdf', 'templates'); + BackendMenu::setContext('October.System', 'system', 'settings'); + SettingsManager::setContext('Renatio.DynamicPDF', 'templates'); + } + + public function index($tab = null) + { + $this->asExtension('ListController')->index(); + $this->bodyClass = 'compact-container'; + $this->vars['activeTab'] = $tab ?: 'templates'; } /** diff --git a/controllers/layouts/config_form.yaml b/controllers/layouts/config_form.yaml index 8b0f086..0e3c07e 100644 --- a/controllers/layouts/config_form.yaml +++ b/controllers/layouts/config_form.yaml @@ -12,19 +12,19 @@ form: $/renatio/dynamicpdf/models/layout/fields.yaml modelClass: Renatio\DynamicPDF\Models\Layout # Default redirect location -defaultRedirect: renatio/dynamicpdf/layouts +defaultRedirect: renatio/dynamicpdf/index/layouts # Create page create: title: renatio.dynamicpdf::lang.layout.create_layout redirect: renatio/dynamicpdf/layouts/update/:id - redirectClose: renatio/dynamicpdf/layouts + redirectClose: renatio/dynamicpdf/index/layouts # Update page update: title: renatio.dynamicpdf::lang.layout.edit_layout - redirect: renatio/dynamicpdf/layouts - redirectClose: renatio/dynamicpdf/layouts + redirect: renatio/dynamicpdf/index/layouts + redirectClose: renatio/dynamicpdf/index/layouts # Preview page preview: diff --git a/controllers/layouts/update.htm b/controllers/layouts/update.htm index 96f284d..9dfbf09 100644 --- a/controllers/layouts/update.htm +++ b/controllers/layouts/update.htm @@ -2,7 +2,7 @@