navbar.html 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. {% load wagtailcore_tags wagtailsettings_tags wagtailimages_tags wagtailcrx_tags i18n %}
  2. {% load wagtailcore_tags wagtailsettings_tags wagtailimages_tags wagtailcrx_tags i18n %}
  3. {% if not settings.wagtailcrx.LayoutSettings.navbar_wrapper_fluid %}
  4. <div class="container">
  5. {% endif %}
  6. <nav class="navbar navbar-header bg-cherry">
  7. {% if not settings.wagtailcrx.LayoutSettings.navbar_content_fluid %}
  8. <div class="container">
  9. {% endif %}
  10. <div>
  11. <a class="navbar-brand" href="/">
  12. {% if settings.wagtailcrx.LayoutSettings.logo %}
  13. {% image settings.wagtailcrx.LayoutSettings.logo original as logo %}
  14. <img class="img-fluid" src="{{logo.url}}" alt="{{site.site_name}}" />
  15. {% else %}
  16. {{site.site_name}}
  17. {% endif %}
  18. </a>
  19. </div>
  20. {% if not settings.wagtailcrx.LayoutSettings.navbar_content_fluid %}
  21. </div><!-- /.container -->
  22. {% endif %}
  23. </nav>
  24. <nav class="navbar {% get_navbar_css %}">
  25. {% if not settings.wagtailcrx.LayoutSettings.navbar_content_fluid %}
  26. <div class="container">
  27. {% endif %}
  28. <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
  29. <span class="navbar-toggler-icon"></span>
  30. </button>
  31. <div class="collapse navbar-collapse" id="navbar">
  32. {% get_navbars as navbars %}
  33. {% for navbar in navbars %}
  34. <ul class="navbar-nav {{navbar.custom_css_class}}"
  35. {% if navbar.custom_id %}id="{{navbar.custom_id}}"{% endif %} >
  36. {% for item in navbar.menu_items %}
  37. {% include_block item with liclass="nav-item" aclass="nav-link" ga_event_category="Navbar" %}
  38. {% endfor %}
  39. </ul>
  40. {% endfor %}
  41. {% if settings.wagtailcrx.LayoutSettings.navbar_search %}
  42. <form class="ml-auto form-inline" action="{% url 'codered_search' %}" method="GET">
  43. {% load bootstrap4 %}
  44. {% get_searchform request as form %}
  45. {% bootstrap_form form layout='inline' %}
  46. <div class="form-group">
  47. <button class="btn btn-outline-primary ml-2" type="submit">{% trans 'Search' %}</button>
  48. </div>
  49. </form>
  50. {% endif %}
  51. </div>
  52. {% if not settings.wagtailcrx.LayoutSettings.navbar_content_fluid %}
  53. </div><!-- /.container -->
  54. {% endif %}
  55. </nav>
  56. {% if not settings.wagtailcrx.LayoutSettings.navbar_wrapper_fluid %}
  57. </div><!-- /.container -->
  58. {% endif %}
  59. {# Navbar offset #}
  60. {% if settings.wagtailcrx.LayoutSettings.navbar_fixed %}
  61. {% if settings.wagtailcrx.LayoutSettings.logo %}
  62. <div class="{{settings.wagtailcrx.LayoutSettings.navbar_format}}-fixed-img-offset {{settings.wagtailcrx.LayoutSettings.navbar_collapse_mode}}"></div>
  63. {% else %}
  64. <div class="{{settings.wagtailcrx.LayoutSettings.navbar_format}}-fixed-offset {{settings.wagtailcrx.LayoutSettings.navbar_collapse_mode}}"></div>
  65. {% endif %}
  66. {% endif %}