Skip to content

Commit

Permalink
hide links section if documentation feature is set
Browse files Browse the repository at this point in the history
  • Loading branch information
hgw77 committed Nov 12, 2024
1 parent a1889e9 commit fac86ef
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
16 changes: 9 additions & 7 deletions app/controllers/dashboard_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -324,19 +324,21 @@ def load_help_text
help_file = File.join(plugin.path, "plugin_help.md")
end

# try to find the links file, check first for service specific links file,
# next for general plugin links file
help_links = File.join(plugin.path, "plugin_#{service_name}_help_links.md")
unless File.exist?(help_links)
help_links = File.join(plugin.path, "plugin_help_links.md")
help_links = ""
unless @domain_config.feature_hidden?("documentation")
# try to find the links file, check first for service specific links file,
# next for general plugin links file
help_links = File.join(plugin.path, "plugin_#{service_name}_help_links.md")
unless File.exist?(help_links)
help_links = File.join(plugin.path, "plugin_help_links.md")
end
end

# load plugin specific help text
@plugin_help_text = File.new(help_file, "r").read if File.exist?(help_file)
return unless File.exist?(help_links)
# load plugin specific help links
@plugin_help_links = File.new(help_links, "r").read
@plugin_help_links =
@plugin_help_links.gsub('#{@sap_docu_url}', sap_url_for("documentation"))
@plugin_help_links = @plugin_help_links.gsub('#{@sap_docu_url}', sap_url_for("documentation"))
end
end
16 changes: 10 additions & 6 deletions app/views/application/_help_text.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@
%a.close-button{href: "#{}", data: {toggle: "help"}}
x

.row
.plugin-help-text
- unless @plugin_help_links.nil?
.row
.plugin-help-text
:markdown
#{@plugin_help_text}
.plugin-help-links
:markdown
#{@plugin_help_links}
- else
.row{style: "margin: 10px;"}
:markdown
#{@plugin_help_text}

.plugin-help-links
:markdown
#{@plugin_help_links}

0 comments on commit fac86ef

Please sign in to comment.