From 3bb7deae36508a07f2a667ce829912a6793e4c5b Mon Sep 17 00:00:00 2001 From: Jacek Lebioda <jacek.lebioda.001@student.uni.lu> Date: Thu, 26 Jan 2017 13:17:19 +0100 Subject: [PATCH] Added visits stub + some improvements --- smash/web/models.py | 6 ++- smash/web/templates/_base.html | 16 +++++-- .../templates/equipment_and_rooms/index.html | 17 ++++++++ smash/web/templates/login.html | 28 ++++++------- smash/web/templates/mail_templates/index.html | 21 +++++++++- smash/web/templates/visits/breadcrumb.html | 4 ++ smash/web/templates/visits/index.html | 42 +++++++++++++++++++ smash/web/views.py | 7 ++++ 8 files changed, 120 insertions(+), 21 deletions(-) create mode 100644 smash/web/templates/visits/breadcrumb.html create mode 100644 smash/web/templates/visits/index.html diff --git a/smash/web/models.py b/smash/web/models.py index bd76a27e..9b33e4d8 100644 --- a/smash/web/models.py +++ b/smash/web/models.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.db import models from django.utils import timezone -from django.contrib.auth.models import User +from django.contrib.auth.models import User, AnonymousUser import datetime @@ -236,7 +236,11 @@ class Worker (models.Model): @staticmethod def get_details(the_user): + if the_user.is_authenticated == False: + return ('Guest', 'Test account') + person = Worker.objects.filter(user=the_user) + if len(person) == 0: return ('Guest', 'Test account') else: diff --git a/smash/web/templates/_base.html b/smash/web/templates/_base.html index b105fb84..17b58ca0 100644 --- a/smash/web/templates/_base.html +++ b/smash/web/templates/_base.html @@ -258,6 +258,13 @@ desired effect </a> </li> + <li data-desc="visits"> + <a href="{% url 'web.views.visits' %}"> + <i class="fa fa-id-card-o"></i> + <span>Visits</span> + </a> + </li> + <li data-desc="assignments"> <a href="{% url 'web.views.assignments' %}"> <i class="fa fa-calendar"></i> @@ -336,13 +343,14 @@ desired effect <footer class="main-footer"> {% block footer %} <!-- To the right --> - <div class="pull-right hidden-xs"> + <!--<div class="pull-right hidden-xs"> - - </div> + </div>--> + <!-- Default to the left --> - Footer text (eg. <small> + 2017, Parkinson Research Clinic <!--(eg. <small> <strong>Copyright © 2016 <a href="#">Company</a>.</strong> All rights reserved. - </small>) + </small>)--> {% endblock footer %} </footer> diff --git a/smash/web/templates/equipment_and_rooms/index.html b/smash/web/templates/equipment_and_rooms/index.html index df28518d..286d3775 100644 --- a/smash/web/templates/equipment_and_rooms/index.html +++ b/smash/web/templates/equipment_and_rooms/index.html @@ -10,6 +10,23 @@ {% endblock breadcrumb %} {% block maincontent %} +<div class="box box-danger box-solid"> + <div class="box-header with-border"> + <h3 class="box-title">Not yet implemented</h3> + + <div class="box-tools pull-right"> + <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button> + </div> + <!-- /.box-tools --> + </div> + <!-- /.box-header --> + <div class="box-body"> + This is only a static page to show, how the system would look like. + Any changes to the system (eg. adding new flying team, modifying list of visit types) can be made by the administrator in the administration panel. + </div> + <!-- /.box-body --> +</div> + <div class="row"> <div class="col-md-3"> <div class="bg-red-active small-box"> diff --git a/smash/web/templates/login.html b/smash/web/templates/login.html index b6f8aa22..1cdc90f5 100644 --- a/smash/web/templates/login.html +++ b/smash/web/templates/login.html @@ -6,21 +6,21 @@ <title>Scheduling System | Log in</title> <!-- Tell the browser to be responsive to screen width --> <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"> - {% block styles %} + {% block styles %} <!-- Bootstrap 3.3.6 --> <link rel="stylesheet" href="{% static 'AdminLTE/css/bootstrap.min.css' %}"> - + <!-- Font Awesome --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> - + <!-- Ionicons --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css"> - + <!-- Theme style --> <link rel="stylesheet" href="{% static 'AdminLTE/css/AdminLTE.min.css' %}"> - + <link rel="stylesheet" href="{% static 'AdminLTE/css/skins/skin-green.min.css' %}"> - + <!-- iCheck --> <link rel="stylesheet" href="{% static 'AdminLTE/plugins/iCheck/square/blue.css' %}"> @@ -29,7 +29,7 @@ <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> - + <style> .login-logo-h5 { margin-top: -10px; @@ -48,7 +48,7 @@ <h5 class="login-logo-h5">(Smart Scheduling)</h5> </div> <!-- /.login-logo --> - + {% if state == "logout" %} <div class="callout callout-info"> <h4>Success!</h4> @@ -70,14 +70,14 @@ {% else %} <hr /> {% endif %} - + <p class="login-box-msg">Please sign in</p> <form action="{% url 'web.views.login' %}" method="post"> {% csrf_token %} - + <div class="form-group has-feedback"> - <input type="text" name="username" class="form-control" placeholder="E-mail"> + <input type="text" name="username" class="form-control" placeholder="Login"> <span class="glyphicon glyphicon-envelope form-control-feedback"></span> </div> <div class="form-group has-feedback"> @@ -99,7 +99,7 @@ <!-- /.col --> </div> </form> - + <hr /> <a href="#">I forgot my password</a><br> @@ -114,8 +114,8 @@ <!-- jQuery 2.2.3 --> <script src="{% static 'AdminLTE/plugins/jQuery/jquery-2.2.3.min.js' %}"></script> <!-- Bootstrap 3.3.6 --> - <script src="{% static 'AdminLTE/js/bootstrap.min.js' %}"></script> - + <script src="{% static 'AdminLTE/js/bootstrap.min.js' %}"></script> + <!-- iCheck --> <script src="{% static 'AdminLTE/plugins/iCheck/icheck.min.js' %}"></script> <script> diff --git a/smash/web/templates/mail_templates/index.html b/smash/web/templates/mail_templates/index.html index 453afb8d..57d5de7f 100644 --- a/smash/web/templates/mail_templates/index.html +++ b/smash/web/templates/mail_templates/index.html @@ -16,6 +16,23 @@ {% endblock breadcrumb %} {% block maincontent %} +<div class="box box-danger box-solid"> + <div class="box-header with-border"> + <h3 class="box-title">Not yet implemented</h3> + + <div class="box-tools pull-right"> + <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button> + </div> + <!-- /.box-tools --> + </div> + <!-- /.box-header --> + <div class="box-body"> + This is only a static page to show, how the system would look like. + A comprehensive system for template editing and generation has to be developed. + </div> + <!-- /.box-body --> +</div> + <div> <a class="btn btn-app"> <i class="fa fa-plus"></i> Add new letter @@ -74,10 +91,10 @@ {% block scripts %} {{ block.super }} - + <script src="{% static 'AdminLTE/plugins/datatables/jquery.dataTables.min.js' %}"></script> <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script> - + <script> $(function () { $('#table').DataTable({ diff --git a/smash/web/templates/visits/breadcrumb.html b/smash/web/templates/visits/breadcrumb.html new file mode 100644 index 00000000..e2222c98 --- /dev/null +++ b/smash/web/templates/visits/breadcrumb.html @@ -0,0 +1,4 @@ +<li><a href="{% url 'web.views.assignments' %}"><i class="fa fa-dashboard"></i> Dashboard</a></li> +<li class="active"> + <a href="{% url 'web.views.visits' %}">Visits</a> +</li> diff --git a/smash/web/templates/visits/index.html b/smash/web/templates/visits/index.html new file mode 100644 index 00000000..db29aed4 --- /dev/null +++ b/smash/web/templates/visits/index.html @@ -0,0 +1,42 @@ +{% extends "_base.html" %} +{% load static %} + +{% block styles %} +{{ block.super }} + <!-- DataTables --> + <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}"> + + <!-- fullCalendar 2.2.5--> + <link rel="stylesheet" href="{% static 'AdminLTE/plugins/fullcalendar/fullcalendar.min.css' %}"> + <link rel="stylesheet" href="{% static 'AdminLTE/plugins/fullcalendar/fullcalendar.print.css' %}" media="print"> +{% endblock styles %} + +{% block page_title %}'visits'{% endblock page_title %} +{% block page_header %}Visits{% endblock page_header %} +{% block page_description %}{% endblock page_description %} + +{% block title %}{{ block.super }} - Visits{% endblock %} + +{% block breadcrumb %} +{% include "visits/breadcrumb.html" %} +{% endblock breadcrumb %} + +{% block maincontent %} +<div class="row"> + <div class="col-md-12"> + <h3>Planning</h3> + + None + </div> +</div> +{% endblock maincontent %} + +{% block scripts %} + {{ block.super }} + + <script src="{% static 'AdminLTE/plugins/datatables/jquery.dataTables.min.js' %}"></script> + <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script> + <script src="{% static 'AdminLTE/plugins/moment.js/moment.min.js' %}"></script> + <script src="{% static 'AdminLTE/plugins/fullcalendar/fullcalendar.min.js' %}"></script> + +{% endblock scripts %} diff --git a/smash/web/views.py b/smash/web/views.py index 8249c76a..1f8dfb6b 100644 --- a/smash/web/views.py +++ b/smash/web/views.py @@ -36,6 +36,9 @@ def login(request): Saturates response with information about logged user """ def wrap_response(request, template, params): + print request + print request.user + person, role = Worker.get_details(request.user) final_params = params.copy() @@ -56,6 +59,10 @@ def assignments(request): return wrap_response(request, 'assignments/index.html', {}) +def visits(request): + return wrap_response(request, 'visits/index.html', {}) + + def subjects(request): subjects_list = Subject.objects.order_by('-lastName') context = { -- GitLab