Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BZ #1991964 - Show upgrade links under Administer > Upgrade #38

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions app/controllers/concerns/documentation_controller_branding.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
module DocumentationControllerBranding
extend ActiveSupport::Concern

def external_url(type:, options: {})
return super unless type == 'upgrade'

case options[:section]
when 'documentation'
ForemanThemeSatellite.unversioned_documentation_root
when 'helper'
"#{ForemanThemeSatellite.documentation_server}/labsinfo/satelliteupgradehelper"
end
end

def documentation_url(section = nil, options = {})
url = ''
unless section.nil?
Expand Down
20 changes: 19 additions & 1 deletion lib/foreman_theme_satellite/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class Engine < ::Rails::Engine
SettingRegistry.prepend SettingRegistryBranding
end

# rubocop:disable Metrics/BlockLength
initializer 'foreman_theme_satellite.register_plugin', :before=> :finisher_hook do |app|
Foreman::Plugin.register :foreman_theme_satellite do
requires_foreman '>= 3.7.0'
Expand Down Expand Up @@ -53,8 +54,19 @@ class Engine < ::Rails::Engine

extend_rabl_template 'api/v2/home/status', 'api/v2/home/status_extensions'
extend_template_helpers ForemanThemeSatellite::RendererMethods

divider :admin_menu, caption: N_('Upgrade'), parent: :administer_menu
menu :admin_menu, :general_documentation,
url_hash: { controller: :links, action: :show, type: :upgrade, section: :documentation },
caption: N_('Documentation'),
parent: :administer_menu
menu :admin_menu, :upgrade_helper,
url_hash: { controller: :links, action: :show, type: :upgrade, section: :helper },
caption: N_('Upgrade helper'),
parent: :administer_menu
end
end
# rubocop:enable Metrics/BlockLength

initializer 'foreman_theme_satellite.load_app_instance_data' do |app|
ForemanThemeSatellite::Engine.paths['db/migrate'].existent.each do |path|
Expand Down Expand Up @@ -148,7 +160,13 @@ def self.documentation_version

def self.documentation_root
@documentation_root ||= begin
"#{documentation_server}/documentation/en-us/red_hat_satellite/#{documentation_version}/html"
"#{unversioned_documentation_root}/#{documentation_version}/html"
end
end

def self.unversioned_documentation_root
@unversioned_documentation_root ||= begin
"#{documentation_server}/documentation/en-us/red_hat_satellite"
end
end

Expand Down
Loading