Sha256: 3db8e5897c8fe09d2ec80eb9b2637b34803c8272e54bade855fbdaf8193e311e
Contents?: true
Size: 1.57 KB
Versions: 4
Compression:
Stored size: 1.57 KB
Contents
require_relative '../../../lib/foreman_theme_satellite/documentation' module DocumentationControllerBranding extend ActiveSupport::Concern def documentation_url(section = nil, options = {}) url = '' unless section.nil? dictionary = ForemanThemeSatellite::Documentation::USER_GUIDE_DICTIONARY matched_key = dictionary.keys.sort_by(&:length).reverse.find {|key| section.include? key} url = dictionary[matched_key] if matched_key end if url.empty? upstream_url = super(section, options) if (upstream_url =~ /redhat.com/) url = upstream_url else special_links_pair = ForemanThemeSatellite::Documentation::SPECIAL_LINKS.find { |regex, _val| regex.match(upstream_url) } url = special_links_pair[1] if special_links_pair url = "#{ForemanThemeSatellite.documentation_root}/administering_red_hat_satellite" if url.empty? end end url end def plugin_documentation_url ForemanThemeSatellite::Documentation::PLUGINS_DOCUMENTATION[plugin_documentation_params[:name]] || super end def wiki_url(section: '') documentation_url(section) end # For new documentation at docs.theforeman.org # We do not use flavor downstream, but keeping it here for the same method signature # rubocop:disable Lint/UnusedMethodArgument def docs_url(guide:, flavor:, chapter: nil) url = ForemanThemeSatellite::Documentation::DOCS_GUIDES_LINKS.dig(guide, chapter) url || "#{ForemanThemeSatellite.documentation_root}/#{guide.downcase}/#{chapter}" end # rubocop:enable Lint/UnusedMethodArgument end
Version data entries
4 entries across 4 versions & 1 rubygems