Skip to content

Commit 4acf90d

Browse files
committed
Consistent version in documentation URLs
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.
1 parent 2b10ad9 commit 4acf90d

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

app/helpers/remote_execution_helper.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,7 @@ def time_in_words_span(time)
203203
end
204204

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

@@ -276,4 +275,8 @@ def targeting_hosts(job_invocation, hosts)
276275
actions: template_invocation_actions(task, host, job_invocation, template_invocation) }
277276
end
278277
end
278+
279+
def rex_doc_version
280+
ForemanRemoteExecution::VERSION.split('.').take(2).join('.')
281+
end
279282
end

app/views/job_invocations/welcome.html.erb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
<%= _("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>
88
</p>
99
<p><%= link_to _('Learn more about this in the documentation.'),
10-
documentation_url('1.ForemanRemoteExecution1.3Manual', :root_url => 'https://www.theforeman.org/plugins/foreman_remote_execution/1.3/index.html#'), :rel => 'external' %></p>
10+
external_link_path(type: 'plugin_manual', name: 'foreman_remote_execution', version: rex_doc_version, section: "#1.ForemanRemoteExecution#{rex_doc_version}Manual"),
11+
rel: 'external' %></p>
1112
<div class="blank-slate-pf-main-action">
1213
<%= display_link_if_authorized(_("Run Job"), { :action => :create }, { :class => "btn btn-primary btn-lg" }) %>
1314
</div>

0 commit comments

Comments
 (0)