Skip to content

Commit

Permalink
Consistent version in documentation URLs
Browse files Browse the repository at this point in the history
This now uses the plugin manual helper to redirect users. It
consistently uses the same version as the REX documentation buttons.

Ideally it would also use the plugin_manual type in documentation_url,
but that doesn't work in Foreman itself.
  • Loading branch information
ekohl committed Nov 27, 2023
1 parent acd3f7c commit 54dc5ed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions app/helpers/remote_execution_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,7 @@ def time_in_words_span(time)
end

def documentation_button_rex(section = '')
url = 'http://theforeman.org/plugins/foreman_remote_execution/' +
"#{ForemanRemoteExecution::VERSION.split('.').take(2).join('.')}/index.html#"
url = "https://theforeman.org/plugins/foreman_remote_execution/#{rex_doc_version}/index.html#"
documentation_button section, :root_url => url
end

Expand Down Expand Up @@ -276,4 +275,8 @@ def targeting_hosts(job_invocation, hosts)
actions: template_invocation_actions(task, host, job_invocation, template_invocation) }
end
end

def rex_doc_version
ForemanRemoteExecution::VERSION.split('.').take(2).join('.')
end
end
3 changes: 2 additions & 1 deletion app/views/job_invocations/welcome.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
<%= _("Foreman can run arbitrary commands on remote hosts using different providers, such as SSH or Ansible. Communication goes through the Smart Proxy so Foreman does not have to have direct access to the target hosts and can scale to control many hosts.") %></br>
</p>
<p><%= link_to _('Learn more about this in the documentation.'),
documentation_url('1.ForemanRemoteExecution1.3Manual', :root_url => 'https://www.theforeman.org/plugins/foreman_remote_execution/1.3/index.html#'), :rel => 'external' %></p>
external_link_path(type: 'plugin_manual', name: 'foreman_remote_execution', version: rex_doc_version, section: "#1.ForemanRemoteExecution#{rex_doc_version}Manual"),
rel: 'external' %></p>
<div class="blank-slate-pf-main-action">
<%= display_link_if_authorized(_("Run Job"), { :action => :create }, { :class => "btn btn-primary btn-lg" }) %>
</div>
Expand Down

0 comments on commit 54dc5ed

Please sign in to comment.