Sha256: 721ccf6812606b758bc72591ab011e65aa76b6304f040a6da42b4d1733c29e63

Contents?: true

Size: 1.12 KB

Versions: 3

Compression:

Stored size: 1.12 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
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
foreman_theme_satellite-13.2.1 app/controllers/concerns/documentation_controller_branding.rb
foreman_theme_satellite-13.2.0 app/controllers/concerns/documentation_controller_branding.rb
foreman_theme_satellite-13.1.0 app/controllers/concerns/documentation_controller_branding.rb