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

Fixes #36838 - Make doc links point to the new docs #547

Merged
merged 6 commits into from
Oct 31, 2023
Merged
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
19 changes: 11 additions & 8 deletions app/helpers/foreman_openscap_helper.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
require 'foreman_openscap/version'

module ForemanOpenscapHelper
def scap_doc_link(section = '', text = _('documentation'))
link_to(
text,
scap_doc_url(section),
:rel => 'external noopener noreferrer', :target => '_blank'
)
def scap_doc_button(section)
documentation_button(section, root_url: scap_doc_url)
end

def scap_doc_url(section = '')
Expand All @@ -15,10 +11,17 @@ def scap_doc_url(section = '')
documentation_url(section, root_url: scap_root_url)
end

private

def doc_flavor
ForemanOpenscap.with_katello? ? 'katello' : 'foreman-el'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My biggest concern is that the OpenSCAP guide is not published in stable branches as foreman-el:

https://github.com/theforeman/foreman-documentation/blob/5a811af4a30310b96a15e3bec708079e04256c31/guides/doc-Managing_Security_Compliance/master.adoc#L14-L18

This results in linking to https://docs.theforeman.org/3.8/Managing_Security_Compliance/index-foreman-el.html (for Foreman 3.8).

This is because it hasn't been properly reviewed. You can see examples such as https://docs.theforeman.org/nightly/Managing_Security_Compliance/index-foreman-el.html#Deploying_a_Policy_in_a_Host_Group_Using_Ansible_security-compliance

You have enabled and synced the operating system repositories to Foreman, and enabled them on the hosts:

Content syncing is not available without Foreman, so that needs to be addressed.

We do publish the nightly docs, just so you can at least review some of it, even if it's broken.

end

def scap_root_url
@scap_root_url ||= begin
version = ForemanOpenscap::VERSION.split('.')[0..-2].join('.')
"https://theforeman.org/plugins/foreman_openscap/#{version}/index.html"
version = SETTINGS[:version]
version = version.tag == 'develop' ? 'nightly' : version.short
"https://docs.theforeman.org/#{version}/Managing_Security_Compliance/index-#{doc_flavor}.html#"
end
end
end
2 changes: 1 addition & 1 deletion app/views/arf_reports/welcome.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
<%= _("You don't seem to have any ARF report. ARF report is a summary of a single scan occurrence on a particular host for a given Compliance Policy.") %></br>
</p>
<div class="blank-slate-pf-main-action">
<%= link_to _('Documentation'), documentation_url("4.4ARFReports", :root_url => "https://www.theforeman.org/plugins/foreman_openscap/0.8/index.html#"), :rel => 'external', :class => 'btn btn-primary btn-lg' %>
<%= link_to _('Documentation'), scap_doc_url("Monitoring_Compliance_security-compliance"), :rel => 'external', :class => 'btn btn-primary btn-lg' %>
</div>
</div>
2 changes: 1 addition & 1 deletion app/views/policies/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<% title_actions(
display_link_if_authorized(_("New Compliance Policy"), hash_for_new_policy_path, :class => "btn btn-primary"),
documentation_button('#4.2Creatingpolicywizard', :root_url => scap_doc_url)
scap_doc_button('Managing_Compliance_Policies_security-compliance')
) %>

<%= render :partial => 'list' %>
2 changes: 1 addition & 1 deletion app/views/policies/steps/_deployment_options_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class="alert alert-info" id="scap-deployment-options-info-banner">
<span class="pficon pficon-info"></span>
<strong><%= _('There are significant differences in deployment options.') %></strong>
<%= _('Please make sure you understand them by reading our') %> <%=scap_doc_link('#2.3Policydeploymentoptions') %>.
<%= _('Please make sure you understand them by reading our') %> <%= link_to(_('documentation'), scap_doc_url('deploying-compliance-policies_security-compliance'), :rel => 'external noopener noreferrer', :target => '_blank') %>.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Translation wise this isn't great. Other languages may put the word documentation at another place, but perhaps we should track it elsewhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

</div>

<%= deploy_by_radios f, @policy %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/scap_contents/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<% title _("SCAP Contents") %>

<% title_actions(display_link_if_authorized(_("Upload New SCAP Content"), hash_for_new_scap_content_path, :class => 'btn btn-primary'),
documentation_button('#4.1CreatingSCAPcontent', :root_url => scap_doc_url)) %>
scap_doc_button('Configuring_SCAP_Contents_security-compliance')) %>

<%= render :partial => 'list' %>
2 changes: 1 addition & 1 deletion app/views/tailoring_files/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% title _("Tailoring Files") %>
<% title_actions(display_link_if_authorized(_("Upload New Tailoring file"), hash_for_new_tailoring_file_path, :class => 'btn btn-primary'),
documentation_button('#4.5Tailoringfiles(foreman_openscap>=0.6.5)', :root_url => scap_doc_url)) %>
scap_doc_button('tailoring-xccdf-profiles_security-compliance')) %>
<%= render :partial => 'list' %>
Loading