Module: DocumentationControllerBranding

Extended by:
ActiveSupport::Concern
Defined in:
app/controllers/concerns/documentation_controller_branding.rb

Instance Method Summary collapse

Instance Method Details

#docs_url(guide:, flavor:, chapter: nil) ⇒ Object

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



39
40
41
42
# File 'app/controllers/concerns/documentation_controller_branding.rb', line 39

def docs_url(guide:, flavor:, chapter: nil)
  url = ForemanThemeSatellite::Documentation::DOCS_GUIDES_LINKS.dig(guide, chapter)
  url || "#{ForemanThemeSatellite.documentation_root}/#{guide.downcase}/#{chapter}"
end

#documentation_url(section = nil, options = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/concerns/documentation_controller_branding.rb', line 6

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

#plugin_documentation_urlObject



24
25
26
# File 'app/controllers/concerns/documentation_controller_branding.rb', line 24

def plugin_documentation_url
  ForemanThemeSatellite::Documentation::PLUGINS_DOCUMENTATION[plugin_documentation_params[:name]] || super
end

#support_urlObject



32
33
34
# File 'app/controllers/concerns/documentation_controller_branding.rb', line 32

def support_url
  'https://access.redhat.com/products/red-hat-satellite#get-support'
end

#upgrade_url(section) ⇒ Object



44
45
46
47
48
49
50
51
# File 'app/controllers/concerns/documentation_controller_branding.rb', line 44

def upgrade_url(section)
  case section
  when 'documentation'
    "#{ForemanThemeSatellite.unversioned_documentation_root}#Upgrade"
  when 'helper'
    'https://access.redhat.com/labs/satelliteupgradehelper'
  end
end

#wiki_url(section: '') ⇒ Object



28
29
30
# File 'app/controllers/concerns/documentation_controller_branding.rb', line 28

def wiki_url(section: '')
  documentation_url(section)
end