From 830ebef522ee082cc6dfa6e109dc6951d477c478 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Fri, 26 Jul 2024 16:02:36 +0200 Subject: [PATCH] Use documentation URL helper from core Foreman 3.9.1+ has built in support to link to docs. This simplifies the code in this module. --- app/helpers/foreman_openscap_helper.rb | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/app/helpers/foreman_openscap_helper.rb b/app/helpers/foreman_openscap_helper.rb index cf67e505..5dd5f0ba 100644 --- a/app/helpers/foreman_openscap_helper.rb +++ b/app/helpers/foreman_openscap_helper.rb @@ -2,26 +2,10 @@ module ForemanOpenscapHelper def scap_doc_button(section) - documentation_button(section, root_url: scap_doc_url) + documentation_button('Managing_Security_Compliance', type: 'docs', chapter: section) end def scap_doc_url(section = '') - return scap_root_url if section.empty? - - documentation_url(section, root_url: scap_root_url) - end - - private - - def doc_flavor - ForemanOpenscap.with_katello? ? 'katello' : 'foreman-el' - end - - def scap_root_url - @scap_root_url ||= begin - version = SETTINGS[:version] - version = version.tag == 'develop' ? 'nightly' : version.short - "https://docs.theforeman.org/#{version}/Managing_Security_Compliance/index-#{doc_flavor}.html#" - end + documentation_url('Managing_Security_Compliance', type: 'docs', chapter: section) end end