From fac86ef65ec001e2d1a7339a60477717f9e08951 Mon Sep 17 00:00:00 2001 From: D058266 Date: Tue, 12 Nov 2024 14:09:19 +0100 Subject: [PATCH] hide links section if documentation feature is set --- app/controllers/dashboard_controller.rb | 16 +++++++++------- app/views/application/_help_text.html.haml | 16 ++++++++++------ 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index ea885002de..129bd2d1ae 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -324,11 +324,14 @@ def load_help_text help_file = File.join(plugin.path, "plugin_help.md") end - # try to find the links file, check first for service specific links file, - # next for general plugin links file - help_links = File.join(plugin.path, "plugin_#{service_name}_help_links.md") - unless File.exist?(help_links) - help_links = File.join(plugin.path, "plugin_help_links.md") + help_links = "" + unless @domain_config.feature_hidden?("documentation") + # try to find the links file, check first for service specific links file, + # next for general plugin links file + help_links = File.join(plugin.path, "plugin_#{service_name}_help_links.md") + unless File.exist?(help_links) + help_links = File.join(plugin.path, "plugin_help_links.md") + end end # load plugin specific help text @@ -336,7 +339,6 @@ def load_help_text return unless File.exist?(help_links) # load plugin specific help links @plugin_help_links = File.new(help_links, "r").read - @plugin_help_links = - @plugin_help_links.gsub('#{@sap_docu_url}', sap_url_for("documentation")) + @plugin_help_links = @plugin_help_links.gsub('#{@sap_docu_url}', sap_url_for("documentation")) end end diff --git a/app/views/application/_help_text.html.haml b/app/views/application/_help_text.html.haml index c038d04a10..5d349c38bf 100644 --- a/app/views/application/_help_text.html.haml +++ b/app/views/application/_help_text.html.haml @@ -4,11 +4,15 @@ %a.close-button{href: "#{}", data: {toggle: "help"}} x - .row - .plugin-help-text + - unless @plugin_help_links.nil? + .row + .plugin-help-text + :markdown + #{@plugin_help_text} + .plugin-help-links + :markdown + #{@plugin_help_links} + - else + .row{style: "margin: 10px;"} :markdown #{@plugin_help_text} - - .plugin-help-links - :markdown - #{@plugin_help_links}