-
Notifications
You must be signed in to change notification settings - Fork 112
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
Fixes #37342 - Update foreman docs and fix specify matcher documentation #711
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the proper APIs. Since theforeman/foreman@b566ea8 it's no longer needed to override the root URL isn't because it's creating broken links.
You should be able to use type: 'docs'
and get the right base URL (including version) and filename.
major_version = ::ForemanAnsible::VERSION.split('.')[0] | ||
'https://theforeman.org/plugins/foreman_ansible/'\ | ||
"#{major_version}.x/index.html" | ||
'https://docs.theforeman.org/nightly/Managing_Configurations_Ansible/index-foreman-el.html' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never hardcode versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ack
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use documentation_button
and documentation_url
helpers directly, or wrap them with ansible-specific wrapper to make the code a bit more DRY.
The documentation_url
helper calls the links_controller
under the hood. In our case we want the docs
type of link with its relevant parameters. This will also enable proper branding down the line.
@@ -1,7 +1,8 @@ | |||
<% title _("Ansible Roles") %> | |||
|
|||
<% title_actions ansible_proxy_import(hash_for_import_ansible_roles_path), | |||
documentation_button('#4.1ImportingRoles', :root_url => ansible_doc_url) %> | |||
documentation_button('#Importing_Ansible_Roles_and_Variables_ansible', :root_url => ansible_doc_url) %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
documentation_button('#Importing_Ansible_Roles_and_Variables_ansible', :root_url => ansible_doc_url) %> | |
documentation_button(type: 'docs', 'Managing_Configurations_Ansible', chapter: 'Importing_Ansible_Roles_and_Variables_ansible') %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure you can pass a position argument in the middle. It's probably
documentation_button('#Importing_Ansible_Roles_and_Variables_ansible', :root_url => ansible_doc_url) %> | |
documentation_button('Managing_Configurations_Ansible', type: 'docs', chapter: 'Importing_Ansible_Roles_and_Variables_ansible') %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, makes sense. Hope it wasn't too confusing
@@ -7,7 +7,7 @@ | |||
<p><%= _('No Ansible Roles were found in Foreman. If you want to assign roles to your hosts, | |||
you have to import them first.').html_safe %> | |||
</p> | |||
<p><%= link_to(_('Learn more about this in the documentation.'), documentation_url('#4.1ImportingRoles', :root_url => ansible_doc_url), target: '_blank') %></p> | |||
<p><%= link_to(_('Learn more about this in the documentation.'), documentation_url('#Importing_Ansible_Roles_and_Variables_ansible', :root_url => ansible_doc_url), target: '_blank') %></p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<p><%= link_to(_('Learn more about this in the documentation.'), documentation_url('#Importing_Ansible_Roles_and_Variables_ansible', :root_url => ansible_doc_url), target: '_blank') %></p> | |
<p><%= link_to(_('Learn more about this in the documentation.'), documentation_url(type: 'docs', 'Managing_Configurations_Ansible', chapter: 'Importing_Ansible_Roles_and_Variables_ansible'), target: '_blank') %></p> |
@@ -65,7 +65,7 @@ | |||
</fieldset> | |||
</br> | |||
<fieldset> | |||
<h2><%= _("Specify Matchers") %> <%= documentation_button('4.2.6SmartMatchers') %></h2> | |||
<h2><%= _("Specify Matchers") %> <%= documentation_button('#Overriding_Ansible_Variables_in_foreman_ansible', :root_url => ansible_doc_url) %></h2> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<h2><%= _("Specify Matchers") %> <%= documentation_button('#Overriding_Ansible_Variables_in_foreman_ansible', :root_url => ansible_doc_url) %></h2> | |
<h2><%= _("Specify Matchers") %> <%= documentation_button(type: 'docs', 'Managing_Configurations_Ansible', chapter: 'Overriding_Ansible_Variables_in_foreman_ansible') %></h2> |
@@ -2,7 +2,7 @@ | |||
<%= stylesheet 'foreman_ansible/foreman-ansible' %> | |||
|
|||
<%= title_actions display_link_if_authorized(_('New Ansible Variable'), hash_for_new_ansible_variable_path, :class => "btn btn-default no-float"), | |||
documentation_button('#4.3Variables', :root_url => ansible_doc_url) | |||
documentation_button('#Importing_Ansible_Roles_and_Variables_ansible', :root_url => ansible_doc_url) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
documentation_button('#Importing_Ansible_Roles_and_Variables_ansible', :root_url => ansible_doc_url) | |
documentation_button(type: 'docs', 'Managing_Configurations_Ansible', chapter: 'Importing_Ansible_Roles_and_Variables_ansible') |
@girijaasoni any update on this? |
almost done, confused about this comment , should I update it in accordance with 6.15? It will fail for the other versions |
@@ -65,7 +65,7 @@ | |||
</fieldset> | |||
</br> | |||
<fieldset> | |||
<h2><%= _("Specify Matchers") %> <%= documentation_button('4.2.6SmartMatchers') %></h2> | |||
<h2><%= _("Specify Matchers") %> <%= documentation_button('Managing_Configurations_Ansible', type: 'docs', chapter: 'Overriding_Ansible_Variables_in_foreman_ansible') %></h2> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<h2><%= _("Specify Matchers") %> <%= documentation_button('Managing_Configurations_Ansible', type: 'docs', chapter: 'Overriding_Ansible_Variables_in_foreman_ansible') %></h2> | |
<h2><%= _("Specify Matchers") %> <%= documentation_button('Managing_Configurations_Ansible', type: 'docs', chapter: 'Overriding_Ansible_Variables_in_foreman_ansible') %></h2> |
@@ -7,7 +7,7 @@ | |||
<p><%= _('No Ansible Roles were found in Foreman. If you want to assign roles to your hosts, | |||
you have to import them first.').html_safe %> | |||
</p> | |||
<p><%= link_to(_('Learn more about this in the documentation.'), documentation_url('#4.1ImportingRoles', :root_url => ansible_doc_url), target: '_blank') %></p> | |||
<p><%= link_to(_('Learn more about this in the documentation.'), documentation_url('Managing_Configurations_Ansible', type: 'docs', chapter: 'Importing_Ansible_Roles_and_Variables_ansible'), target: '_blank') %></p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<p><%= link_to(_('Learn more about this in the documentation.'), documentation_url('Managing_Configurations_Ansible', type: 'docs', chapter: 'Importing_Ansible_Roles_and_Variables_ansible'), target: '_blank') %></p> | |
<p><%= link_to(_('Learn more about this in the documentation.'), documentation_url('Managing_Configurations_Ansible', type: 'docs', chapter: 'Importing_Ansible_Roles_and_Variables_ansible'), target: '_blank') %></p> |
LGTM Works as expected. |
Thanks @girijaasoni @ekohl |
@stejskalleos can we get this cherrypick 13.0.z? |
Foreman documentation was outdated and using theforeman.org. This PR updates the doc links according to 'https://docs.theforeman.org/nightly/Managing_Configurations_Ansible/index-foreman-el.html'
It also fixes the misdirected redirect for SpecifyMatchers as reported in https://issues.redhat.com/browse/SAT-24111
Note: This Pr is blocked by RedHatSatellite/foreman_theme_satellite#45