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_url(section = nil, options = {}) ⇒ Object
- #plugin_documentation_url ⇒ 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
37 38 39 40 |
# File 'app/controllers/concerns/documentation_controller_branding.rb', line 37 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 23 24 |
# 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 = dictionary[matched_key] if matched_key end if url.empty? upstream_url = super(section, ) 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 |
#plugin_documentation_url ⇒ Object
26 27 28 |
# File 'app/controllers/concerns/documentation_controller_branding.rb', line 26 def plugin_documentation_url ForemanThemeSatellite::Documentation::PLUGINS_DOCUMENTATION[plugin_documentation_params[:name]] || super end |
#wiki_url(section: '') ⇒ Object
30 31 32 |
# File 'app/controllers/concerns/documentation_controller_branding.rb', line 30 def wiki_url(section: '') documentation_url(section) end |