navbar.html 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. {% load menu_tags staticfiles i18n %}
  2. <nav class="navbar navbar-default navbar-fixed-top">
  3. <div class="container">
  4. <div class="navbar-header">
  5. <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse-1">
  6. <span class="sr-only">{% trans 'toggle_navigation' %}</span>
  7. <span class="icon-bar"></span>
  8. <span class="icon-bar"></span>
  9. <span class="icon-bar"></span>
  10. </button>
  11. <a href="/"><img class="navbar-logo" alt="Freedomvote" src="{% static 'images/logo.png' %}"></a>
  12. </div>
  13. <div id="navbar-collapse-1" class="collapse navbar-collapse">
  14. <ul class="nav navbar-nav">
  15. {% for child in children %}
  16. <li><a href="{{ child.attr.redirect_url|default:child.get_absolute_url }}">{{ child.get_menu_title }}</a></li>
  17. {% endfor %}
  18. </ul>
  19. {% if user.is_authenticated %}
  20. <ul class="nav navbar-nav navbar-right">
  21. <li class="dropdown">
  22. <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{{user.username}} <span class="caret"></span></a>
  23. <ul class="dropdown-menu">
  24. <li>
  25. <a href="{% url 'party_dashboard' user.username %}"><i class="fa fa-dashboard"></i>
  26. {% trans 'dashboard' %}
  27. </a>
  28. </li>
  29. <li role="separator" class="divider"></li>
  30. <li>
  31. <a href="{% url 'party_logout' user.username %}"><i class="fa fa-power-off"></i>
  32. {% trans 'logout' %}
  33. </a>
  34. </li>
  35. </ul>
  36. </li>
  37. </ul>
  38. {% endif %}
  39. <form action="{% url 'set_language' %}" class="navbar-right navbar-form language" method="post">
  40. {% csrf_token %}
  41. {% get_current_language as LANGUAGE_CODE %}
  42. {% get_available_languages as LANGUAGES %}
  43. {% get_language_info_list for LANGUAGES as languages %}
  44. <input name="next" type="hidden" value="{{ request.path }}" />
  45. <input name="language" type="hidden" value="{{ language.code }}" />
  46. <ul class="navbar-nav nav">
  47. {% for language in languages %}
  48. <li><a href="#" data-lang="{{language.code}}">
  49. {% if language.code == LANGUAGE_CODE %}<strong>{% endif %}
  50. {{language.code}}
  51. {% if language.code == LANGUAGE_CODE %}</strong>{% endif %}
  52. </a></li>
  53. {% endfor %}
  54. </ul>
  55. </form>
  56. </div>
  57. </div>
  58. </nav>