Module: DocumentationControllerBranding
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/controllers/concerns/documentation_controller_branding.rb
Instance Method Summary collapse
-
#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.
- #documentation_root ⇒ Object
- #documentation_root_url ⇒ Object
- #documentation_url(section = nil, options = {}) ⇒ Object
- #plugin_documentation_url ⇒ Object
- #support_url ⇒ Object
- #unversioned_documentation_root ⇒ Object
- #upgrade_url(section) ⇒ Object
- #wiki_url(section: '') ⇒ Object
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
40 41 42 43 |
# File 'app/controllers/concerns/documentation_controller_branding.rb', line 40 def docs_url(guide:, flavor:, chapter: nil) url = ForemanThemeSatellite::Documentation::DOCS_GUIDES_LINKS.dig(guide, chapter) url ? "#{documentation_root}/#{url}" : "#{documentation_root}/#{guide.downcase}/#{chapter}" end |
#documentation_root ⇒ Object
58 59 60 |
# File 'app/controllers/concerns/documentation_controller_branding.rb', line 58 def documentation_root "#{unversioned_documentation_root}/#{ForemanThemeSatellite.documentation_version}/html-single" end |
#documentation_root_url ⇒ Object
54 55 56 |
# File 'app/controllers/concerns/documentation_controller_branding.rb', line 54 def documentation_root_url "#{unversioned_documentation_root}/#{ForemanThemeSatellite.documentation_version}" 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, = {}) url = '' unless section.nil? dictionary = ForemanThemeSatellite::Documentation::USER_GUIDE_DICTIONARY matched_key = dictionary.keys.sort_by(&:length).reverse.find {|key| section.include? key} url = "#{documentation_root}/#{dictionary[matched_key]}" if matched_key end if url.empty? upstream_url = super(section, ) url = if (upstream_url =~ /redhat.com/) redirect_root_url(upstream_url) else documentation_root_url end end url end |
#plugin_documentation_url ⇒ Object
24 25 26 27 |
# File 'app/controllers/concerns/documentation_controller_branding.rb', line 24 def plugin_documentation_url branded_url = ForemanThemeSatellite::Documentation::PLUGINS_DOCUMENTATION[plugin_documentation_params[:name]] branded_url ? "#{documentation_root}/#{branded_url}" : super end |
#support_url ⇒ Object
33 34 35 |
# File 'app/controllers/concerns/documentation_controller_branding.rb', line 33 def support_url 'https://access.redhat.com/products/red-hat-satellite#get-support' # This is not included in RHOKP end |
#unversioned_documentation_root ⇒ Object
62 63 64 |
# File 'app/controllers/concerns/documentation_controller_branding.rb', line 62 def unversioned_documentation_root "#{Setting[:satellite_documentation_url]}/documentation/en-us/red_hat_satellite" end |
#upgrade_url(section) ⇒ Object
45 46 47 48 49 50 51 52 |
# File 'app/controllers/concerns/documentation_controller_branding.rb', line 45 def upgrade_url(section) case section when 'documentation' "#{unversioned_documentation_root}#Upgrade" when 'helper' 'https://access.redhat.com/labs/satelliteupgradehelper' # This is not included in RHOKP end end |
#wiki_url(section: '') ⇒ Object
29 30 31 |
# File 'app/controllers/concerns/documentation_controller_branding.rb', line 29 def wiki_url(section: '') documentation_url(section) end |