From e765a999c69829b9b156175c66f01e703aa431fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Ho=CC=88rler?= Date: Sun, 14 Jan 2018 19:57:22 +0100 Subject: [PATCH] divided the navigation to separate file. --- .../webshop/templates/webshop/base.html | 39 +++---------------- .../webshop/templates/webshop/index.html | 2 + .../webshop/templates/webshop/nav.html | 35 +++++++++++++++++ 3 files changed, 42 insertions(+), 34 deletions(-) create mode 100644 django/didgeridoo/webshop/templates/webshop/nav.html diff --git a/django/didgeridoo/webshop/templates/webshop/base.html b/django/didgeridoo/webshop/templates/webshop/base.html index 661fbae..34177de 100644 --- a/django/didgeridoo/webshop/templates/webshop/base.html +++ b/django/didgeridoo/webshop/templates/webshop/base.html @@ -7,7 +7,7 @@ - {% load static %} + {% load staticfiles %} {% block title %} @@ -28,39 +28,7 @@ </div> </div> </div> - <nav class="navbar navbar-default"> - <div class="container-fluid"> - <div class="navbar-header"> - <a class="navbar-brand" href="{% url 'index' %}"> - HOME - </a> - <ul class="nav navbar-nav"> - <li><a href="#">CART</a></li> - {% if user.is_authenticated %} - <li> - <a href="{% url 'profile' %}">PROFILE</a> - </li> - <li> - <a href="{% url 'logout' %}">LOGOUT</a> - </li> - {% else %} - <li> - <a href="{% url 'login' %}">LOGIN</a> - </li> - {% endif %} - </ul> - <form action="" method="POST" novalidate> - {% csrf_token %} - <select name="CurrencyUpdate" id="CurrencyUpdate" onchange="this.form.submit()"> - <option value="CHF">CHF</option> - <option value="USD">USD</option> - <option value="GBP">GBP</option> - <option value="JPY">JPY</option> - </select> - </form> - </div> - </div> - </nav> + {% block nav %}{% include "webshop/nav.html" %}{% endblock %} <div class="container-fluid"> <div class="row"> <div class="col-md-2"> @@ -127,5 +95,8 @@ </div> </div> </footer> + <script src="https://code.jquery.com/jquery-3.1.0.min.js"></script> + <script src="{% static 'js/app.js' %}"></script> + <script>{% block javascript %}{% endblock %}</script> </body> </html> diff --git a/django/didgeridoo/webshop/templates/webshop/index.html b/django/didgeridoo/webshop/templates/webshop/index.html index 7eff913..71484e3 100644 --- a/django/didgeridoo/webshop/templates/webshop/index.html +++ b/django/didgeridoo/webshop/templates/webshop/index.html @@ -1,5 +1,7 @@ {% extends "webshop/base.html" %} + {% block section_title %}Articles{% endblock %} + {% block content %} {% if articles_list %} <table class="table"> diff --git a/django/didgeridoo/webshop/templates/webshop/nav.html b/django/didgeridoo/webshop/templates/webshop/nav.html new file mode 100644 index 0000000..aa45224 --- /dev/null +++ b/django/didgeridoo/webshop/templates/webshop/nav.html @@ -0,0 +1,35 @@ +{% block nav %} +<nav class="navbar navbar-default"> + <div class="container-fluid"> + <div class="navbar-header"> + <a class="navbar-brand" href="{% url 'index' %}"> + HOME + </a> + <ul class="nav navbar-nav"> + <li><a href="#">CART</a></li> + {% if user.is_authenticated %} + <li> + <a href="{% url 'profile' %}">PROFILE</a> + </li> + <li> + <a href="{% url 'logout' %}">LOGOUT</a> + </li> + {% else %} + <li> + <a href="{% url 'login' %}">LOGIN</a> + </li> + {% endif %} + </ul> + <form action="" method="POST" novalidate> + {% csrf_token %} + <select name="CurrencyUpdate" id="CurrencyUpdate" onchange="this.form.submit()"> + <option value="CHF">CHF</option> + <option value="USD">USD</option> + <option value="GBP">GBP</option> + <option value="JPY">JPY</option> + </select> + </form> + </div> + </div> +</nav> +{% endblock %}