Integrating Swagger UI to my a slate generated web

2020-08-05 10:23发布

问题:

I want to integrate swagger UI into my ruby based slate generated API docs , for that I looked up here

and did the directed changes to the layout.erb file adding the required head and body sections but upon building the webpage nothing shows up , these are the modified head and body section.

<head>
<meta charset="utf-8">
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title><%= current_page.data.title || "API Documentation" %></title>

<link rel="stylesheet" type="text/css" href="swagger-ui.css">

<style>
  <%= Rouge::Themes::MonokaiSublime.render(:scope => '.highlight') %>
</style>
<%= stylesheet_link_tag :screen, media: :screen %>
<%= stylesheet_link_tag :print, media: :print %>
<% if current_page.data.search %>
  <%= javascript_include_tag  "all" %>
<% else %>
  <%= javascript_include_tag  "all_nosearch" %>
<% end %>
<body class="<%= page_classes %>" data-languages="<%=h language_tabs.map{ |lang| lang.is_a?(Hash) ? lang.keys.first : lang }.to_json %>">




<div id="swagger-ui"></div>

<script src="swagger-ui-bundle.js"></script>
<script src="swagger-ui-standalone-preset.js"></script>

<script>
  window.onload = function() {
    const ui = SwaggerUIBundle({
      url: "https://qa-refapp.openmrs.org/openmrs/module/webservices/rest/swagger.json",
      dom_id: '#swagger-ui',
      presets: [
        SwaggerUIBundle.presets.apis,
        SwaggerUIStandalonePreset
      ]
    })

    window.ui = ui
   }
</script>

I added the complete layout.erb file here