knowledge_base.html.erb 4.5 KB

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