index.html.erb 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <main class="main main--categories"
  2. <% if @object %>
  3. data-base-path='<%= custom_path_if_needed help_category_path(@object, locale: '{locale}'), @knowledge_base %>'
  4. data-available-locales='<%= @object_locales.map(&:locale).join(',') %>'
  5. <% end %>>
  6. <div class="container">
  7. <% if @object %>
  8. <h1>
  9. <%= @object.translation.title %>
  10. </h1>
  11. <% end %>
  12. <% if !@categories.present? && !@answers&.present? %>
  13. <div class="sections-empty">
  14. <%= zt('No content to show') %>
  15. <br>
  16. <%= zt('Please add categories and/or answers') %>
  17. </div>
  18. <% else %>
  19. <% if @categories&.present? %>
  20. <ul class="sections sections--<%= effective_layout_name(@knowledge_base, @object) %>" data-less-than-four="<%= @categories.length < 4 %>">
  21. <% @categories.each do |category| %>
  22. <%= render 'category', { category: category, knowledge_base: @knowledge_base } %>
  23. <% end %>
  24. </ul>
  25. <% end %>
  26. <% if @categories&.present? && @answers&.present? %>
  27. <hr>
  28. <% end %>
  29. <% if @answers&.present? %>
  30. <ul class="sections sections--list" data-less-than-four="<%= @answers.length < 4 %>">
  31. <% @answers.each do |translation| %>
  32. <%= render 'answer', { answer: translation } %>
  33. <% end %>
  34. </ul>
  35. <% end %>
  36. <% end %>
  37. </div>
  38. </main>