knowledge_base.html.erb 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <!DOCTYPE HTML>
  2. <html lang="<%= system_locale_via_uri.locale %>"
  3. dir="<%= system_locale_via_uri.dir %>"
  4. adir="ltr"
  5. data-id='<%= @knowledge_base.id %>'
  6. data-iconset='<%= @knowledge_base.iconset %>'
  7. data-available-locales='<%= all_locales.map(&:locale).join(',') %>'
  8. data-base-path='<%= custom_path_if_needed help_root_path(locale: '{locale}'), @knowledge_base %>'
  9. data-primary-locale="<%= (filter_primary_kb_locale || all_locales.first)&.locale %>"
  10. data-icons-url="<%= icons_url %>"
  11. >
  12. <meta charset="utf-8">
  13. <title><%= kb_public_page_title(@knowledge_base, @object, @page_title_error) %></title>
  14. <meta name="viewport" content="width=device-width,initial-scale=1.0,viewport-fit=cover">
  15. <%= render partial: 'knowledge_base/public/feeds_header' if @knowledge_base.show_feed_icon %>
  16. <%= stylesheet_link_tag "knowledge_base.css", :media => 'all' %>
  17. <%= render 'knowledge_base/public/inline_stylesheet', knowledge_base: @knowledge_base, locale: system_locale_via_uri %>
  18. <%= canonical_link_tag @knowledge_base, @category, @object %>
  19. <div class="wrapper js-wrapper">
  20. <%= render_top_bar_if_needed @object, @knowledge_base %>
  21. <header class="header js-header">
  22. <div class="container">
  23. <span class="logo">
  24. <%= link_to custom_path_if_needed(help_root_path(locale: params[:locale]), @knowledge_base) do %>
  25. <img src="/api/v1/system_assets/product_logo/<%= Setting.get('product_logo') %>">
  26. <% end %>
  27. </span>
  28. <nav class="menu">
  29. <% menu_items.location_header.each do |menu_item| %>
  30. <%= link_to menu_item.title, menu_item.url, class: 'menu-item', target: menu_item.new_tab ? '_blank' : nil %>
  31. <% end %>
  32. </nav>
  33. </div>
  34. <div class="container">
  35. <div class="search">
  36. <div class="search-field">
  37. <%= icon 'magnifier' %>
  38. <input class="js-search-input" type="search" placeholder="<%= zt('How can we help you? Search for an answer or a topic…') %>">
  39. </div>
  40. <ul class="search-results js-search-results" data-empty-placeholder="<%= zt('No results were found.') %>"></ul>
  41. </div>
  42. </div>
  43. </header>
  44. <%= render_breadcrumb_if_needed(@knowledge_base, @object, @alternative) %>
  45. <%= yield %>
  46. <footer class="footer">
  47. <div class="container">
  48. <div class="footer-menu">
  49. <div class="copyright">
  50. <%= @knowledge_base.translation.footer_note %>
  51. </div>
  52. <nav class="menu">
  53. <% menu_items.location_footer.each do |menu_item| %>
  54. <%= link_to menu_item.title, menu_item.url, class: 'menu-item', target: menu_item.new_tab ? '_blank' : nil %>
  55. <% end %>
  56. </nav>
  57. <% if @knowledge_base.show_feed_icon %>
  58. <div class="dropdown-picker feed-picker">
  59. <a href="#" data-toggle="dropdown" aria-expanded="false">
  60. <%= icon('rss') %>
  61. </a>
  62. <ul class="dropdown-menu dropdown-menu-<%= dropdown_menu_direction %> dropdown-menu-up" role="menu">
  63. <% feeds_available(@knowledge_base, @category, @object).each do |feed| %>
  64. <li>
  65. <%= link_to feed[:title], feed[:url] %>
  66. </li>
  67. <% end %>
  68. </ul>
  69. </div>
  70. <% end %>
  71. <div class="dropdown-picker language-picker">
  72. <a class="btn btn--action" href="#" data-toggle="dropdown" aria-expanded="false">
  73. <%= system_locale_via_uri.name %>
  74. <%= icon 'arrow-down' %>
  75. </a>
  76. <ul class="dropdown-menu dropdown-menu-<%= dropdown_menu_direction %> dropdown-menu-up" role="menu">
  77. <% @object_locales&.each do |locale| %>
  78. <li class="<%= 'is-selected' if locale.name == system_locale_via_uri.name %>">
  79. <%= link_to custom_path_if_needed(url_for(locale: locale.locale), @knowledge_base), hreflang: locale.locale do %>
  80. <%= icon 'checkmark' %>
  81. <%= locale.name %>
  82. <% end %>
  83. </li>
  84. <% end %>
  85. </ul>
  86. </div>
  87. </div>
  88. </div>
  89. </footer>
  90. </div>
  91. <%= javascript_tag nonce: true do -%>
  92. if(window.fetch === undefined || window.Promise === undefined || Element.prototype.prepend === undefined){
  93. var polyfillScriptTag = document.createElement('script');
  94. polyfillScriptTag.setAttribute('src', '<%= path_to_javascript('knowledge_base_public_polyfills') %>');
  95. polyfillScriptTag.setAttribute('nonce', '<%= content_security_policy_nonce %>');
  96. document.body.appendChild(polyfillScriptTag);
  97. }
  98. <% end -%>
  99. <%= javascript_include_tag 'knowledge_base_public', nonce: true %>