From 5e8bda5e4f254a92e1cf571570d72755652ce3a9 Mon Sep 17 00:00:00 2001 From: Jacek Lebioda <jacek.lebioda.001@student.uni.lu> Date: Wed, 16 Nov 2016 14:03:00 +0100 Subject: [PATCH] Navigation to top-level pages --- readme.md | 2 +- smash/web/templates/_base.html | 28 +++++++++++----- smash/web/templates/assignments/index.html | 5 +++ smash/web/templates/doctors/index.html | 5 +++ .../templates/equipment_and_rooms/index.html | 5 +++ smash/web/templates/index.html | 6 ++-- smash/web/templates/mail_templates/index.html | 5 +++ smash/web/templates/subjects/index.html | 5 +++ smash/web/urls.py | 7 +++- smash/web/views.py | 33 +++++++++++++++++-- 10 files changed, 84 insertions(+), 17 deletions(-) create mode 100644 smash/web/templates/assignments/index.html create mode 100644 smash/web/templates/doctors/index.html create mode 100644 smash/web/templates/equipment_and_rooms/index.html create mode 100644 smash/web/templates/mail_templates/index.html create mode 100644 smash/web/templates/subjects/index.html diff --git a/readme.md b/readme.md index ba904092..01d8a786 100644 --- a/readme.md +++ b/readme.md @@ -14,7 +14,7 @@ - `virtualenv env` to create new virtualenv (contains clean python working environment) - `. env/bin/activate` (to start using virtualenv) - `pip install -r requirements.txt` to install project's dependencies - - Create `local_settings.py` file in `/scheduling-system/smash/web` directory, containing: + - Create `local_settings.py` file in `/scheduling-system/smash/smash` directory (see template below), and change your connection data: ``` # SECURITY WARNING: keep the secret key used in production secret! diff --git a/smash/web/templates/_base.html b/smash/web/templates/_base.html index 83515719..d495471a 100644 --- a/smash/web/templates/_base.html +++ b/smash/web/templates/_base.html @@ -246,35 +246,35 @@ desired effect <li class="header">Pages</li> <li data-desc="subjects"> - <a href="#"> + <a href="{% url 'web.views.subjects' %}"> <i class="fa fa-users"></i> <span>Subjects</span> </a> </li> <li data-desc="assignments"> - <a href="#"> + <a href="{% url 'web.views.assignments' %}"> <i class="fa fa-calendar"></i> <span>Assignments</span> </a> </li> <li data-desc="doctors"> - <a href="#"> + <a href="{% url 'web.views.doctors' %}"> <i class="fa fa-user-md"></i> <span>Doctors</span> </a> </li> - <li data-desc="equipment-and-rooms"> - <a href="#"> + <li data-desc="equipment_and_rooms"> + <a href="{% url 'web.views.equipment_and_rooms' %}"> <i class="fa fa-building-o"></i> <span>Equipment&rooms</span> </a> </li> - <li data-desc="mail-templates"> - <a href="#"> + <li data-desc="mail_templates"> + <a href="{% url 'web.views.mail_templates' %}"> <i class="fa fa-envelope-o"></i> <span>Mail templates</span> </a> @@ -304,8 +304,8 @@ desired effect <!-- Content Header (Page header) --> <section class="content-header"> <h1> - {{ page_header }} - <small>{{ page_description }}</small> + {% block page_header %}{% endblock page_header %} + <small>{% block page_description %}{% endblock page_description %}</small> </h1> <ol class="breadcrumb"> @@ -431,6 +431,16 @@ desired effect <!-- AdminLTE App --> <script src="{% static 'AdminLTE/js/app.min.js' %}"></script> + <script> + var activate = function(page_to_activate) { + var $e = $(".sidebar-menu > li[data-desc='" + page_to_activate + "']"); + $e.addClass("active"); + }; + + activate({% block page_title %}{% endblock page_title %}); + + </script> + {% comment "TODO: Check, and add if works %} <!-- Optionally, you can add Slimscroll and FastClick plugins. Both of these plugins are recommended to enhance the diff --git a/smash/web/templates/assignments/index.html b/smash/web/templates/assignments/index.html new file mode 100644 index 00000000..3cd45b54 --- /dev/null +++ b/smash/web/templates/assignments/index.html @@ -0,0 +1,5 @@ +{% extends "_base.html" %} + +{% block page_title %}'assignments'{% endblock page_title %} +{% block page_header %}Assignments{% endblock page_header %} +{% block page_description %}{% endblock page_description %} diff --git a/smash/web/templates/doctors/index.html b/smash/web/templates/doctors/index.html new file mode 100644 index 00000000..0cd98ef3 --- /dev/null +++ b/smash/web/templates/doctors/index.html @@ -0,0 +1,5 @@ +{% extends "_base.html" %} + +{% block page_title %}'doctors'{% endblock page_title %} +{% block page_header %}Doctors'{% endblock page_header %} +{% block page_description %}information{% endblock page_description %} diff --git a/smash/web/templates/equipment_and_rooms/index.html b/smash/web/templates/equipment_and_rooms/index.html new file mode 100644 index 00000000..730be748 --- /dev/null +++ b/smash/web/templates/equipment_and_rooms/index.html @@ -0,0 +1,5 @@ +{% extends "_base.html" %} + +{% block page_title %}'equipment_and_rooms'{% endblock page_title %} +{% block page_header %}Equipment and rooms{% endblock page_header %} +{% block page_description %}{% endblock page_description %} diff --git a/smash/web/templates/index.html b/smash/web/templates/index.html index 5e1abb2c..5c824cd3 100644 --- a/smash/web/templates/index.html +++ b/smash/web/templates/index.html @@ -1,5 +1,5 @@ {% extends "_base.html" %} -{% block content %} - <h3>Smart scheduling</h3> -{% endblock content %} +{% block page_title %}'subjects'{% endblock page_title %} +{% block page_header %}Welcome page{% endblock page_header %} +{% block page_description %}Short description{% endblock page_description %} diff --git a/smash/web/templates/mail_templates/index.html b/smash/web/templates/mail_templates/index.html new file mode 100644 index 00000000..69bb5c01 --- /dev/null +++ b/smash/web/templates/mail_templates/index.html @@ -0,0 +1,5 @@ +{% extends "_base.html" %} + +{% block page_title %}'mail_templates'{% endblock page_title %} +{% block page_header %}Mail templates{% endblock page_header %} +{% block page_description %}{% endblock page_description %} diff --git a/smash/web/templates/subjects/index.html b/smash/web/templates/subjects/index.html new file mode 100644 index 00000000..16a2be3f --- /dev/null +++ b/smash/web/templates/subjects/index.html @@ -0,0 +1,5 @@ +{% extends "_base.html" %} + +{% block page_title %}'subjects'{% endblock page_title %} +{% block page_header %}Subjects{% endblock page_header %} +{% block page_description %}{% endblock page_description %} diff --git a/smash/web/urls.py b/smash/web/urls.py index 7cad1d27..44816932 100644 --- a/smash/web/urls.py +++ b/smash/web/urls.py @@ -17,5 +17,10 @@ from django.conf.urls import url from web import views urlpatterns = [ - url(r'$', views.index, name='web.views.index') + url(r'assignments$', views.assignments, name='web.views.assignments'), + url(r'subjects$', views.subjects, name='web.views.subjects'), + url(r'doctors$', views.doctors, name='web.views.doctors'), + url(r'equipment_and_rooms$', views.equipment_and_rooms, name='web.views.equipment_and_rooms'), + url(r'mail_templates$', views.mail_templates, name='web.views.mail_templates'), + url(r'$', views.index, name='web.views.index') ] diff --git a/smash/web/views.py b/smash/web/views.py index 47ea6b7e..48a6c3c7 100644 --- a/smash/web/views.py +++ b/smash/web/views.py @@ -6,8 +6,35 @@ from django.template import loader # Create your views here. def index(request): template = loader.get_template("index.html") - return HttpResponse(template.render({ - 'page_header': 'Header', - 'page_description': 'Test' + return HttpResponse(template.render({ }), request) + +def assignments(request): + template = loader.get_template("assignments/index.html") + return HttpResponse(template.render({ + }), request) + + +def subjects(request): + template = loader.get_template("subjects/index.html") + return HttpResponse(template.render({ + }), request) + + +def doctors(request): + template = loader.get_template("doctors/index.html") + return HttpResponse(template.render({ + }), request) + + +def equipment_and_rooms(request): + template = loader.get_template("equipment_and_rooms/index.html") + return HttpResponse(template.render({ + }), request) + + +def mail_templates(request): + template = loader.get_template("mail_templates/index.html") + return HttpResponse(template.render({ + }), request) -- GitLab