Sha256: 77c4edbc46031472d250d3acf538e8b08617ccd3e40841a19c85d90f02271f8b

Contents?: true

Size: 1.39 KB

Versions: 8

Compression:

Stored size: 1.39 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)
      url = if (upstream_url =~ /redhat.com/)
              upstream_url
            else
              "#{ForemanThemeSatellite.documentation_root}/administering_red_hat_satellite"
            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

8 entries across 8 versions & 1 rubygems

Version Path
foreman_theme_satellite-14.2.0 app/controllers/concerns/documentation_controller_branding.rb
foreman_theme_satellite-13.3.3 app/controllers/concerns/documentation_controller_branding.rb
foreman_theme_satellite-14.1.0 app/controllers/concerns/documentation_controller_branding.rb
foreman_theme_satellite-13.3.2 app/controllers/concerns/documentation_controller_branding.rb
foreman_theme_satellite-13.3.1 app/controllers/concerns/documentation_controller_branding.rb
foreman_theme_satellite-14.0.1 app/controllers/concerns/documentation_controller_branding.rb
foreman_theme_satellite-14.0.0 app/controllers/concerns/documentation_controller_branding.rb
foreman_theme_satellite-13.3.0 app/controllers/concerns/documentation_controller_branding.rb