From f7ab1d641f981cd3f6cd3d92351bd1adf701e297 Mon Sep 17 00:00:00 2001 From: Francesco Boccacci Date: Thu, 1 Feb 2024 09:28:28 +0100 Subject: [PATCH] Add shortcut links within catalog layers context menu (layers and project settings) (#392) * Create CatalogProjectContextMenu.vue and use common directive click-outside-context-menu.js * Add CatalogProjectContextMenu.vue and use common showContextMenu on CatalogTristateTree.vue * Set common css/less rules from catalog-context-menu * extract event listeners from `components/Catalog.vue`) * sort attributes make it more clear that is a for..loop * vertical indentation * missing yoda * Update CatalogLayerContextMenu.vue * exctract predicates * Update CatalogProjectContextMenu.vue * Update CatalogTristateTree.vue * remove tautology * shorten directive name (ref: `v-click-outside`) * function name * qgis icon * fix duplicate const variable * missing file * update since tags * add `edit_url` and `layers_url` links * hide context menu items on empty config --------- Co-authored-by: Raruto --- src/assets/style/less/g3w-catalog.less | 4 +- .../less/g3w-skins/blue/g3w-catalog.less | 2 +- .../less/g3w-skins/green/g3w-catalog.less | 3 +- .../less/g3w-skins/purple/g3w-catalog.less | 3 +- .../style/less/g3w-skins/red/g3w-catalog.less | 3 +- .../less/g3w-skins/yellow/g3w-catalog.less | 3 +- src/components/Catalog.vue | 201 +++++++----- src/components/CatalogLayerContextMenu.vue | 286 ++++++++++-------- src/components/CatalogProjectContextMenu.vue | 143 +++++++++ src/components/CatalogTristateTree.vue | 188 +++++++----- src/components/index.js | 5 + src/directives/v-click-outside.js | 21 ++ src/index.prod.js | 2 + 13 files changed, 580 insertions(+), 284 deletions(-) create mode 100644 src/components/CatalogProjectContextMenu.vue create mode 100644 src/directives/v-click-outside.js diff --git a/src/assets/style/less/g3w-catalog.less b/src/assets/style/less/g3w-catalog.less index e42ea68d5..aa1cfb43f 100644 --- a/src/assets/style/less/g3w-catalog.less +++ b/src/assets/style/less/g3w-catalog.less @@ -294,7 +294,7 @@ Licensed under MIT } } -#layer-menu { +.catalog-context-menu { background: #FAFAFA; border: 1px solid #BDBDBD; border-radius: 3px; @@ -392,7 +392,7 @@ Licensed under MIT border:0; } } - #layer-menu { + .catalog-context-menu { .wms-url-tooltip { .tooltip-inner { min-width: 200px; diff --git a/src/assets/style/less/g3w-skins/blue/g3w-catalog.less b/src/assets/style/less/g3w-skins/blue/g3w-catalog.less index 991e4f375..367f2cf11 100644 --- a/src/assets/style/less/g3w-skins/blue/g3w-catalog.less +++ b/src/assets/style/less/g3w-skins/blue/g3w-catalog.less @@ -22,7 +22,7 @@ } } - #layer-menu { + .catalog-context-menu { li { &.title { border-bottom-color: @light-blue !important; diff --git a/src/assets/style/less/g3w-skins/green/g3w-catalog.less b/src/assets/style/less/g3w-skins/green/g3w-catalog.less index f81d52781..5e3da8915 100644 --- a/src/assets/style/less/g3w-skins/green/g3w-catalog.less +++ b/src/assets/style/less/g3w-skins/green/g3w-catalog.less @@ -22,8 +22,7 @@ } } - - #layer-menu { + .catalog-context-menu { li { &.title { border-bottom-color: @green !important; diff --git a/src/assets/style/less/g3w-skins/purple/g3w-catalog.less b/src/assets/style/less/g3w-skins/purple/g3w-catalog.less index 858433b94..452dc2888 100644 --- a/src/assets/style/less/g3w-skins/purple/g3w-catalog.less +++ b/src/assets/style/less/g3w-skins/purple/g3w-catalog.less @@ -22,8 +22,7 @@ } } - - #layer-menu { + .catalog-context-menu { li { &.title { border-bottom-color: @purple !important; diff --git a/src/assets/style/less/g3w-skins/red/g3w-catalog.less b/src/assets/style/less/g3w-skins/red/g3w-catalog.less index 6dfacaf04..755ee99c4 100644 --- a/src/assets/style/less/g3w-skins/red/g3w-catalog.less +++ b/src/assets/style/less/g3w-skins/red/g3w-catalog.less @@ -22,8 +22,7 @@ } } - - #layer-menu { + .catalog-context-menu { li { &.title { border-bottom-color: @red !important; diff --git a/src/assets/style/less/g3w-skins/yellow/g3w-catalog.less b/src/assets/style/less/g3w-skins/yellow/g3w-catalog.less index aa530bdca..8919d6c6d 100644 --- a/src/assets/style/less/g3w-skins/yellow/g3w-catalog.less +++ b/src/assets/style/less/g3w-skins/yellow/g3w-catalog.less @@ -22,8 +22,7 @@ } } - - #layer-menu { + .catalog-context-menu { li { &.title { border-bottom-color: @yellow !important; diff --git a/src/components/Catalog.vue b/src/components/Catalog.vue index 57f71567e..d507ec8dd 100644 --- a/src/components/Catalog.vue +++ b/src/components/Catalog.vue @@ -9,39 +9,49 @@
+ +
-
+
+ +
-
-
    + +
    +
    +
+
-
-
    -
  • + +
    +
      +
    • {{ baselayer.title }}
    • @@ -96,29 +118,33 @@
    + +
- + -
+ + +
+ diff --git a/src/components/CatalogTristateTree.vue b/src/components/CatalogTristateTree.vue index 80445796c..9c96de450 100644 --- a/src/components/CatalogTristateTree.vue +++ b/src/components/CatalogTristateTree.vue @@ -7,7 +7,7 @@