From c9b038c02460562d9eef56d4928019e4ae6244d2 Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Mon, 1 Nov 2021 23:35:13 +0100 Subject: [PATCH] better menu --- index.php | 28 +++++++++++++++++++--------- js/index.js | 7 +++++++ 2 files changed, 26 insertions(+), 9 deletions(-) create mode 100644 js/index.js diff --git a/index.php b/index.php index 6f5c4c6..fe981b7 100644 --- a/index.php +++ b/index.php @@ -101,21 +101,31 @@ if (!empty($_POST['fix'])) { $breadcrumb = []; if (!empty($_REQUEST['config'])) { $breadcrumb = [ - ($type == 'plugin' ? __('Plugins') : __('Themes')) => $core->adminurl->get('admin.plugin.improve', ['type' => ($type == 'plugin' ? 'plugin' : 'theme')]), - '' . __('Configure module') . '' => '' - ]; -} else { - $breadcrumb = [ - '' . ($type == 'plugin' ? __('Plugins') : __('Themes')) . '' => '', - ($type == 'theme' ? __('Plugins') : __('Themes')) => $core->adminurl->get('admin.plugin.improve', ['type' => ($type == 'theme' ? 'plugin' : 'theme')]) + __('Configure module') => '' ]; } # display header -echo '' . __('improve') . '' . -dcPage::breadcrumb(array_merge([__('improve') => ''], $breadcrumb), ['hl' => false]) . +echo '' . __('improve') . '' . +dcPage::jsLoad(dcPage::getPF('improve/js/index.js')) . +'' . +dcPage::breadcrumb(array_merge([ + __('Plugins') => '', + __('improve') => '' +], $breadcrumb)) . dcPage::notices(); +# Menu list +if (empty($_REQUEST['config'])) { + echo + '
' . + '

' . + form::combo('type', [__('Plugins') => 'plugin', __('Themes') => 'theme'], $type) . ' ' . + '' . + form::hidden('p', 'improve') . '

' . + '
'; +} + if (!empty($_REQUEST['config'])) { $back_url = $_REQUEST['redir'] ?? $core->adminurl->get('admin.plugin.improve', ['type' => $type]); diff --git a/js/index.js b/js/index.js new file mode 100644 index 0000000..800f7ec --- /dev/null +++ b/js/index.js @@ -0,0 +1,7 @@ +/*global $, dotclear */ +'use strict'; + +$(function () { + $('#improve_menu input[type=submit]').hide(); + $('#improve_menu #type').on('change', function () {this.form.submit();}); +}); \ No newline at end of file