diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..df4b189 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +venv/* +.vscode/* +static/* +__pycache__ +db.sqlite3 +doc/_build/ +doc/output/ +api_test.py +log/* diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..37bf3ce --- /dev/null +++ b/.gitmodules @@ -0,0 +1,9 @@ +[submodule "synthea"] + path = synthea + url = https://github.com/dHealthNL/synthea.git +[submodule "synthea-international"] + path = synthea-international + url = https://github.com/dHealthNL/synthea-international.git +[submodule "synthea-modules"] + path = synthea-modules + url = https://github.com/dHealthNL/synthea-modules.git diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..044be4c --- /dev/null +++ b/requirements.txt @@ -0,0 +1,7 @@ +Django +dj-database-url +django_js_reverse +python-decouple +django-cryptography +djangorestframework +pandas diff --git a/synthea b/synthea new file mode 160000 index 0000000..16129ad --- /dev/null +++ b/synthea @@ -0,0 +1 @@ +Subproject commit 16129ad4fbef18e5c89b941e1b14a8fcf04abf07 diff --git a/synthea-international b/synthea-international new file mode 160000 index 0000000..da67258 --- /dev/null +++ b/synthea-international @@ -0,0 +1 @@ +Subproject commit da67258b54ee83e3d4ad11b5f0dfcbc5bb053e34 diff --git a/synthea-modules b/synthea-modules new file mode 160000 index 0000000..824b4d3 --- /dev/null +++ b/synthea-modules @@ -0,0 +1 @@ +Subproject commit 824b4d3182434bd20ef644a21a8bc4a828f399dc diff --git a/webservice/apps/RUG_template/__init__.py b/webservice/apps/RUG_template/__init__.py new file mode 100644 index 0000000..4d348bc --- /dev/null +++ b/webservice/apps/RUG_template/__init__.py @@ -0,0 +1 @@ +default_app_config = 'apps.RUG_template.apps.RugTemplateConfig' \ No newline at end of file diff --git a/webservice/apps/RUG_template/admin.py b/webservice/apps/RUG_template/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/webservice/apps/RUG_template/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/webservice/apps/RUG_template/apps.py b/webservice/apps/RUG_template/apps.py new file mode 100644 index 0000000..71c96ae --- /dev/null +++ b/webservice/apps/RUG_template/apps.py @@ -0,0 +1,8 @@ +from django.apps import AppConfig +from django.utils.translation import ugettext_lazy as _ + +class RugTemplateConfig(AppConfig): + name = 'apps.RUG_template' + label = 'RUG_template' + verbose_name = _('RUG Template') + verbose_name_plural = _('RUG Template') diff --git a/webservice/apps/RUG_template/locale/en/LC_MESSAGES/django.mo b/webservice/apps/RUG_template/locale/en/LC_MESSAGES/django.mo new file mode 100644 index 0000000..71cbdf3 Binary files /dev/null and b/webservice/apps/RUG_template/locale/en/LC_MESSAGES/django.mo differ diff --git a/webservice/apps/RUG_template/locale/en/LC_MESSAGES/django.po b/webservice/apps/RUG_template/locale/en/LC_MESSAGES/django.po new file mode 100644 index 0000000..04a7191 --- /dev/null +++ b/webservice/apps/RUG_template/locale/en/LC_MESSAGES/django.po @@ -0,0 +1,213 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-07-30 15:42+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: apps/RUG_template/apps.py:7 apps/RUG_template/apps.py:8 +msgid "RUG Template" +msgstr "" + +#: apps/RUG_template/templates/400.html:4 +#: apps/RUG_template/templates/400.html:5 +msgid "Oops, sorry, bad request (400)" +msgstr "" + +#: apps/RUG_template/templates/400.html:7 +#: apps/RUG_template/templates/404.html:7 +msgid "" +"Unfortunately, the link to this page does not work, the page (temporarily) " +"does not exist or it has been moved." +msgstr "" + +#: apps/RUG_template/templates/403.html:4 +#: apps/RUG_template/templates/403.html:5 +msgid "Oops, sorry, forbidden access (403)" +msgstr "" + +#: apps/RUG_template/templates/403.html:7 +msgid "Unfortunately, you do not have rights to access this url." +msgstr "" + +#: apps/RUG_template/templates/404.html:4 +#: apps/RUG_template/templates/404.html:5 +msgid "Oops, sorry, page not found (404)" +msgstr "" + +#: apps/RUG_template/templates/500.html:4 +#: apps/RUG_template/templates/500.html:5 +msgid "Oops, sorry, server error (500)" +msgstr "" + +#: apps/RUG_template/templates/500.html:7 +msgid "Unfortunately, something went wrong on the server." +msgstr "" + +#: apps/RUG_template/templates/admin/base_site.html:24 +msgid "Language" +msgstr "" + +#: apps/RUG_template/templates/admin/base_site.html:32 +msgid "Documentation" +msgstr "" + +#: apps/RUG_template/templates/admin/base_site.html:36 +msgid "Change password" +msgstr "" + +#: apps/RUG_template/templates/admin/base_site.html:38 +msgid "Log out" +msgstr "" + +#: apps/RUG_template/templates/base.html:7 +msgid "Welcome at RUG" +msgstr "" + +#: apps/RUG_template/templates/base.html:113 +msgid "Language selection" +msgstr "" + +#: apps/RUG_template/templates/index.html:4 +#: apps/RUG_template/templates/index.html:5 +msgid "Welcome to the RUG Template page" +msgstr "" + +#: apps/RUG_template/templates/index.html:7 +msgid "Simple RUG Template" +msgstr "" + +#: apps/RUG_template/templates/index.html:8 +msgid "Some more text" +msgstr "" + +#: apps/RUG_template/templates/menu.html:4 +msgid "Section" +msgstr "" + +#: apps/RUG_template/templates/menu.html:7 +msgid "Menu item" +msgstr "" + +#: apps/RUG_template/templates/pager.html:13 +msgid "previous" +msgstr "" + +#: apps/RUG_template/templates/pager.html:21 +msgid "next" +msgstr "" + +#: apps/RUG_template/templates/registration/login.html:4 +#: apps/RUG_template/templates/registration/login.html:5 +#: apps/RUG_template/templates/registration/login.html:8 +#: apps/RUG_template/templates/registration/login.html:18 +msgid "Login" +msgstr "" + +#: apps/RUG_template/templates/registration/login.html:10 +msgid "" +"You can login here to create your schedules. If you do not have a login, " +"please contact: some_one@rug.nl" +msgstr "" + +#: apps/RUG_template/templates/registration/login.html:24 +msgid "Lost password?" +msgstr "" + +#: apps/RUG_template/templates/registration/password_reset_complete.html:4 +#: apps/RUG_template/templates/registration/password_reset_complete.html:5 +#: apps/RUG_template/templates/registration/password_reset_complete.html:7 +msgid "Password reset complete" +msgstr "" + +#: apps/RUG_template/templates/registration/password_reset_complete.html:9 +#, python-format +msgid "" +"Your new password has been set. You can log in now on the log in page." +msgstr "" + +#: apps/RUG_template/templates/registration/password_reset_confirm.html:4 +#: apps/RUG_template/templates/registration/password_reset_confirm.html:5 +#: apps/RUG_template/templates/registration/password_reset_confirm.html:7 +msgid "Set a new password!" +msgstr "" + +#: apps/RUG_template/templates/registration/password_reset_confirm.html:9 +msgid "Here you can set a new password." +msgstr "" + +#: apps/RUG_template/templates/registration/password_reset_confirm.html:17 +msgid "Change my password" +msgstr "" + +#: apps/RUG_template/templates/registration/password_reset_confirm.html:23 +msgid "" +"The password reset link was invalid, possibly because it has already been " +"used. Please request a new password reset." +msgstr "" + +#: apps/RUG_template/templates/registration/password_reset_done.html:4 +#: apps/RUG_template/templates/registration/password_reset_done.html:5 +#: apps/RUG_template/templates/registration/password_reset_done.html:8 +msgid "Reset password, email sent" +msgstr "" + +#: apps/RUG_template/templates/registration/password_reset_done.html:11 +msgid "" +"We've emailed you instructions for setting your password. You should receive " +"the email shortly!" +msgstr "" + +#: apps/RUG_template/templates/registration/password_reset_email.html:2 +#, python-format +msgid "" +"You're receiving this email because you requested a password reset for your " +"user account at %(site_name)s.\n" +"\n" +"Please go to the following page and choose a new password:\n" +"\n" +"%(protocol)s://%(domain)s%(reset_url)s\n" +"\n" +"Your username, in case you've forgotten: %(user)s\n" +"\n" +"Thanks for using our site!\n" +"\n" +"The %(site_name)s team" +msgstr "" + +#: apps/RUG_template/templates/registration/password_reset_form.html:4 +#: apps/RUG_template/templates/registration/password_reset_form.html:5 +#: apps/RUG_template/templates/registration/password_reset_form.html:8 +msgid "Reset password" +msgstr "" + +#: apps/RUG_template/templates/registration/password_reset_form.html:10 +msgid "" +"Here you can request a password reset. Please enter your email address that " +"is used for registration." +msgstr "" + +#: apps/RUG_template/templates/registration/password_reset_form.html:17 +msgid "Reset my password" +msgstr "" + +#: apps/RUG_template/templates/singup.html:4 +#: apps/RUG_template/templates/singup.html:5 +#: apps/RUG_template/templates/singup.html:7 +#: apps/RUG_template/templates/singup.html:14 +msgid "Singup" +msgstr "" diff --git a/webservice/apps/RUG_template/locale/nl/LC_MESSAGES/django.mo b/webservice/apps/RUG_template/locale/nl/LC_MESSAGES/django.mo new file mode 100644 index 0000000..6a1957d Binary files /dev/null and b/webservice/apps/RUG_template/locale/nl/LC_MESSAGES/django.mo differ diff --git a/webservice/apps/RUG_template/locale/nl/LC_MESSAGES/django.po b/webservice/apps/RUG_template/locale/nl/LC_MESSAGES/django.po new file mode 100644 index 0000000..24389c3 --- /dev/null +++ b/webservice/apps/RUG_template/locale/nl/LC_MESSAGES/django.po @@ -0,0 +1,240 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-07-30 15:42+0200\n" +"PO-Revision-Date: 2020-05-27 15:59+0200\n" +"Last-Translator: Joshua Rubingh \n" +"Language-Team: \n" +"Language: nl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 2.0.6\n" + +#: apps/RUG_template/apps.py:7 apps/RUG_template/apps.py:8 +msgid "RUG Template" +msgstr "RUG Template" + +#: apps/RUG_template/templates/400.html:4 +#: apps/RUG_template/templates/400.html:5 +msgid "Oops, sorry, bad request (400)" +msgstr "Oeps, sorry, pagina niet gevonden (404)" + +#: apps/RUG_template/templates/400.html:7 +#: apps/RUG_template/templates/404.html:7 +msgid "" +"Unfortunately, the link to this page does not work, the page (temporarily) " +"does not exist or it has been moved." +msgstr "" +"Helaas werkt de link naar deze pagina niet, de pagina bestaat (tijdelijk) " +"niet of is verplaatst." + +#: apps/RUG_template/templates/403.html:4 +#: apps/RUG_template/templates/403.html:5 +msgid "Oops, sorry, forbidden access (403)" +msgstr "Oeps, sorry, geen toegang (403)" + +#: apps/RUG_template/templates/403.html:7 +msgid "Unfortunately, you do not have rights to access this url." +msgstr "Helaas heb je geen rechten om toegang te krijgen tot deze URL." + +#: apps/RUG_template/templates/404.html:4 +#: apps/RUG_template/templates/404.html:5 +msgid "Oops, sorry, page not found (404)" +msgstr "Oeps, sorry, pagina niet gevonden (404)" + +#: apps/RUG_template/templates/500.html:4 +#: apps/RUG_template/templates/500.html:5 +msgid "Oops, sorry, server error (500)" +msgstr "Oeps, sorry, server error (500)" + +#: apps/RUG_template/templates/500.html:7 +msgid "Unfortunately, something went wrong on the server." +msgstr "Helaas is er iets misgegaan op de server." + +#: apps/RUG_template/templates/admin/base_site.html:24 +msgid "Language" +msgstr "Taal" + +#: apps/RUG_template/templates/admin/base_site.html:32 +msgid "Documentation" +msgstr "Documentatie" + +#: apps/RUG_template/templates/admin/base_site.html:36 +msgid "Change password" +msgstr "Verander wachtwoord" + +#: apps/RUG_template/templates/admin/base_site.html:38 +msgid "Log out" +msgstr "Logouit" + +#: apps/RUG_template/templates/base.html:7 +msgid "Welcome at RUG" +msgstr "Welkom bij de RUG" + +#: apps/RUG_template/templates/base.html:113 +msgid "Language selection" +msgstr "Taal keuze" + +#: apps/RUG_template/templates/index.html:4 +#: apps/RUG_template/templates/index.html:5 +msgid "Welcome to the RUG Template page" +msgstr "Welkom bij de RUG Template pagina" + +#: apps/RUG_template/templates/index.html:7 +msgid "Simple RUG Template" +msgstr "Simpel RUG Template" + +#: apps/RUG_template/templates/index.html:8 +msgid "Some more text" +msgstr "Nog wat tekst" + +#: apps/RUG_template/templates/menu.html:4 +msgid "Section" +msgstr "Sectie" + +#: apps/RUG_template/templates/menu.html:7 +msgid "Menu item" +msgstr "Menu item" + +#: apps/RUG_template/templates/pager.html:13 +msgid "previous" +msgstr "vorige" + +#: apps/RUG_template/templates/pager.html:21 +msgid "next" +msgstr "volgende" + +#: apps/RUG_template/templates/registration/login.html:4 +#: apps/RUG_template/templates/registration/login.html:5 +#: apps/RUG_template/templates/registration/login.html:8 +#: apps/RUG_template/templates/registration/login.html:18 +msgid "Login" +msgstr "Login" + +#: apps/RUG_template/templates/registration/login.html:10 +msgid "" +"You can login here to create your schedules. If you do not have a login, " +"please contact: some_one@rug.nl" +msgstr "" +"Hier kunt u inloggen om nieuwe roosters te maken. Als je geen login hebt " +"neem dan contact op met iemand@rug.nl" + +#: apps/RUG_template/templates/registration/login.html:24 +msgid "Lost password?" +msgstr "Wachtwoord kwijt?" + +#: apps/RUG_template/templates/registration/password_reset_complete.html:4 +#: apps/RUG_template/templates/registration/password_reset_complete.html:5 +#: apps/RUG_template/templates/registration/password_reset_complete.html:7 +msgid "Password reset complete" +msgstr "Wachtwoord reset is kompleet" + +#: apps/RUG_template/templates/registration/password_reset_complete.html:9 +#, python-format +msgid "" +"Your new password has been set. You can log in now on the log in page." +msgstr "" +"Je nieuwe wachtwoord is ingesteld. Je kunt nu inloggen via de inlog pagina." + +#: apps/RUG_template/templates/registration/password_reset_confirm.html:4 +#: apps/RUG_template/templates/registration/password_reset_confirm.html:5 +#: apps/RUG_template/templates/registration/password_reset_confirm.html:7 +msgid "Set a new password!" +msgstr "Stel een nieuw wachtwoord in!" + +#: apps/RUG_template/templates/registration/password_reset_confirm.html:9 +msgid "Here you can set a new password." +msgstr "Hier kun je een nieuw wachtwoord instellen." + +#: apps/RUG_template/templates/registration/password_reset_confirm.html:17 +msgid "Change my password" +msgstr "Verander mijn wachtwoord" + +#: apps/RUG_template/templates/registration/password_reset_confirm.html:23 +msgid "" +"The password reset link was invalid, possibly because it has already been " +"used. Please request a new password reset." +msgstr "" +"De link voor het opnieuw instellen van het wachtwoord was ongeldig, mogelijk " +"omdat deze al is gebruikt. Vraag een nieuwe reset van het wachtwoord aan." + +#: apps/RUG_template/templates/registration/password_reset_done.html:4 +#: apps/RUG_template/templates/registration/password_reset_done.html:5 +#: apps/RUG_template/templates/registration/password_reset_done.html:8 +msgid "Reset password, email sent" +msgstr "Wachtwoord is gereset, email is verstuurd" + +#: apps/RUG_template/templates/registration/password_reset_done.html:11 +msgid "" +"We've emailed you instructions for setting your password. You should receive " +"the email shortly!" +msgstr "" +"We hebben u een e-mail gestuurd met instructies voor het instellen van uw " +"wachtwoord. U ontvangt de e-mail binnenkort!" + +#: apps/RUG_template/templates/registration/password_reset_email.html:2 +#, python-format +msgid "" +"You're receiving this email because you requested a password reset for your " +"user account at %(site_name)s.\n" +"\n" +"Please go to the following page and choose a new password:\n" +"\n" +"%(protocol)s://%(domain)s%(reset_url)s\n" +"\n" +"Your username, in case you've forgotten: %(user)s\n" +"\n" +"Thanks for using our site!\n" +"\n" +"The %(site_name)s team" +msgstr "" +"Je ontvangt deze e-mail omdat je een wachtwoord reset hebt aangevraagd voor " +"je gebruikersaccount op%(site_name)s.\n" +"\n" +"Ga naar de volgende pagina en kies een nieuw wachtwoord:\n" +"\n" +"%(protocol)s://%(domain)s%(reset_url)s\n" +"\n" +"Uw gebruikersnaam, voor het geval u het bent vergeten: %(user)s\n" +"\n" +"Bedankt voor het gebruiken van onze site!\n" +"\n" +"Het team van %(site_name)s" + +#: apps/RUG_template/templates/registration/password_reset_form.html:4 +#: apps/RUG_template/templates/registration/password_reset_form.html:5 +#: apps/RUG_template/templates/registration/password_reset_form.html:8 +msgid "Reset password" +msgstr "Reset wachtwoord" + +#: apps/RUG_template/templates/registration/password_reset_form.html:10 +msgid "" +"Here you can request a password reset. Please enter your email address that " +"is used for registration." +msgstr "" +"Hier kunt u een wachtwoord reset aanvragen. Voer uw e-mailadres in dat wordt " +"gebruikt voor registratie." + +#: apps/RUG_template/templates/registration/password_reset_form.html:17 +msgid "Reset my password" +msgstr "Reset mijn wachtwoord" + +#: apps/RUG_template/templates/singup.html:4 +#: apps/RUG_template/templates/singup.html:5 +#: apps/RUG_template/templates/singup.html:7 +#: apps/RUG_template/templates/singup.html:14 +msgid "Singup" +msgstr "Opgeven" + +#~ msgid "Password reset" +#~ msgstr "Wachtwoord reset" diff --git a/webservice/apps/RUG_template/middleware.py b/webservice/apps/RUG_template/middleware.py new file mode 100644 index 0000000..cf9f7d3 --- /dev/null +++ b/webservice/apps/RUG_template/middleware.py @@ -0,0 +1,38 @@ +import pytz +import requests + +from ipware import get_client_ip +from django.utils import timezone + +# make sure you add `TimezoneMiddleware` appropriately in settings.py: 'apps.RUG_template.middleware.TimezoneMiddleware' +class TimezoneMiddleware: + """ Middleware to check user timezone. """ + def __init__(self, get_response): + self.get_response = get_response + # One-time configuration and initialization. + + def __call__(self, request): + # Code to be executed for each request before + # the view (and later middleware) are called. + client_ip, is_routable = get_client_ip(request) + user_time_zone = request.session.get('user_time_zone', None) + try: + if user_time_zone is None and is_routable and client_ip is not None: + # Here we use an online service to get visitor info. Maybe not the nicest way to do it, but it is a way + # Also we only check when we get a public IP address. Local networks will not be checked online + # https://freegeoip.app + freegeoip_response = requests.get('https://freegeoip.app/json/{0}'.format(client_ip)) + freegeoip_response_json = freegeoip_response.json() + user_time_zone = freegeoip_response_json['time_zone'] + if user_time_zone: + request.session['user_time_zone'] = user_time_zone + timezone.activate(pytz.timezone(user_time_zone)) + except: + pass + + response = self.get_response(request) + + # Code to be executed for each request/response after + # the view is called. + + return response \ No newline at end of file diff --git a/webservice/apps/RUG_template/migrations/__init__.py b/webservice/apps/RUG_template/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/webservice/apps/RUG_template/models.py b/webservice/apps/RUG_template/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/webservice/apps/RUG_template/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/webservice/apps/RUG_template/static/RUG_template/images/RUG_Logo.jpg b/webservice/apps/RUG_template/static/RUG_template/images/RUG_Logo.jpg new file mode 100644 index 0000000..da3037b Binary files /dev/null and b/webservice/apps/RUG_template/static/RUG_template/images/RUG_Logo.jpg differ diff --git a/webservice/apps/RUG_template/static/RUG_template/images/add-icon.png b/webservice/apps/RUG_template/static/RUG_template/images/add-icon.png new file mode 100644 index 0000000..81295f3 Binary files /dev/null and b/webservice/apps/RUG_template/static/RUG_template/images/add-icon.png differ diff --git a/webservice/apps/RUG_template/static/RUG_template/images/edit-icon.png b/webservice/apps/RUG_template/static/RUG_template/images/edit-icon.png new file mode 100644 index 0000000..2873781 Binary files /dev/null and b/webservice/apps/RUG_template/static/RUG_template/images/edit-icon.png differ diff --git a/webservice/apps/RUG_template/static/RUG_template/images/encrypted_document.png b/webservice/apps/RUG_template/static/RUG_template/images/encrypted_document.png new file mode 100644 index 0000000..f28e7f0 Binary files /dev/null and b/webservice/apps/RUG_template/static/RUG_template/images/encrypted_document.png differ diff --git a/webservice/apps/RUG_template/static/RUG_template/images/eye-closed.png b/webservice/apps/RUG_template/static/RUG_template/images/eye-closed.png new file mode 100644 index 0000000..a4e0b3c Binary files /dev/null and b/webservice/apps/RUG_template/static/RUG_template/images/eye-closed.png differ diff --git a/webservice/apps/RUG_template/static/RUG_template/images/eye-open.png b/webservice/apps/RUG_template/static/RUG_template/images/eye-open.png new file mode 100644 index 0000000..f977f19 Binary files /dev/null and b/webservice/apps/RUG_template/static/RUG_template/images/eye-open.png differ diff --git a/webservice/apps/RUG_template/static/RUG_template/images/favicon.ico b/webservice/apps/RUG_template/static/RUG_template/images/favicon.ico new file mode 100644 index 0000000..bc12218 Binary files /dev/null and b/webservice/apps/RUG_template/static/RUG_template/images/favicon.ico differ diff --git a/webservice/apps/RUG_template/static/RUG_template/images/flag-en.png b/webservice/apps/RUG_template/static/RUG_template/images/flag-en.png new file mode 100644 index 0000000..9ab58e1 Binary files /dev/null and b/webservice/apps/RUG_template/static/RUG_template/images/flag-en.png differ diff --git a/webservice/apps/RUG_template/static/RUG_template/images/flag-nl.png b/webservice/apps/RUG_template/static/RUG_template/images/flag-nl.png new file mode 100644 index 0000000..bafed87 Binary files /dev/null and b/webservice/apps/RUG_template/static/RUG_template/images/flag-nl.png differ diff --git a/webservice/apps/RUG_template/static/RUG_template/images/minus-icon.png b/webservice/apps/RUG_template/static/RUG_template/images/minus-icon.png new file mode 100644 index 0000000..a94d7dd Binary files /dev/null and b/webservice/apps/RUG_template/static/RUG_template/images/minus-icon.png differ diff --git a/webservice/apps/RUG_template/static/RUG_template/images/plus-icon.png b/webservice/apps/RUG_template/static/RUG_template/images/plus-icon.png new file mode 100644 index 0000000..6b90d3b Binary files /dev/null and b/webservice/apps/RUG_template/static/RUG_template/images/plus-icon.png differ diff --git a/webservice/apps/RUG_template/static/RUG_template/images/send_email.png b/webservice/apps/RUG_template/static/RUG_template/images/send_email.png new file mode 100644 index 0000000..4134f6f Binary files /dev/null and b/webservice/apps/RUG_template/static/RUG_template/images/send_email.png differ diff --git a/webservice/apps/RUG_template/static/RUG_template/javascript/humanize-duration.min.js b/webservice/apps/RUG_template/static/RUG_template/javascript/humanize-duration.min.js new file mode 100644 index 0000000..8caa889 --- /dev/null +++ b/webservice/apps/RUG_template/static/RUG_template/javascript/humanize-duration.min.js @@ -0,0 +1 @@ +!function(){var n={y:function(n){return 1===n?"χρόνος":"χρόνια"},mo:function(n){return 1===n?"μήνας":"μήνες"},w:function(n){return 1===n?"εβδομάδα":"εβδομάδες"},d:function(n){return 1===n?"μέρα":"μέρες"},h:function(n){return 1===n?"ώρα":"ώρες"},m:function(n){return 1===n?"λεπτό":"λεπτά"},s:function(n){return 1===n?"δευτερόλεπτο":"δευτερόλεπτα"},ms:function(n){return 1===n?"χιλιοστό του δευτερολέπτου":"χιλιοστά του δευτερολέπτου"},decimal:","},y={ar:{y:function(n){return 1===n?"سنة":"سنوات"},mo:function(n){return 1===n?"شهر":"أشهر"},w:function(n){return 1===n?"أسبوع":"أسابيع"},d:function(n){return 1===n?"يوم":"أيام"},h:function(n){return 1===n?"ساعة":"ساعات"},m:function(n){return 2').text('Toggle password').insertAfter(value); + }); + + jQuery('button.password_toggle').on('click',function(event){ + event.preventDefault(); + toggle_password(this); + }); +} + +function toggle_password(button) { + button = jQuery(button); + let password_field = button.prev('input'); + let show = password_field.attr('type') == 'password'; + + password_field.attr('type',( show ? 'text' : 'password' )); + button.removeClass('password_hidden password_shown').addClass(( show ? 'password_shown' : 'password_hidden' )) +} + +function human_sizes(value) { + const units = ['B','KB','MB','GB','TB','HB']; + const unit_value = 1000; + + let counter = 0; + while (value / unit_value > 1) { + value /= unit_value; + counter++; + } + return value + '' + units[counter]; +} + +function label_required_fields() { + jQuery('input,textarea,select').filter('[required]:visible').each(function(counter,value){ + let field = jQuery(value); + jQuery('label[for="' + field.attr('id') + '"]').append('*'); + }); + + /* + jQuery('select').each(function(counter,value){ + let field = jQuery(value); + console.log(jQuery('label[for="' + field.attr('id') + '"]')); + jQuery('label[for="' + field.attr('id') + '"]').append('*'); + }); + */ +} + +jQuery(function(){ + jQuery.ajaxSetup({ + beforeSend: function(xhr, settings) { + if (!csrfSafeMethod(settings.type) && !this.crossDomain) { + xhr.setRequestHeader("X-CSRFToken", Cookies.get('csrftoken')); + } + } + }); + + init_password_toggles(); + label_required_fields(); +}); \ No newline at end of file diff --git a/webservice/apps/RUG_template/static/RUG_template/javascript/jquery.formset.js b/webservice/apps/RUG_template/static/RUG_template/javascript/jquery.formset.js new file mode 100644 index 0000000..e352fe8 --- /dev/null +++ b/webservice/apps/RUG_template/static/RUG_template/javascript/jquery.formset.js @@ -0,0 +1,252 @@ +/** + * https://raw.githubusercontent.com/elo80ka/django-dynamic-formset/master/src/jquery.formset.js + * jQuery Formset 1.5-pre + * @author Stanislaus Madueke (stan DOT madueke AT gmail DOT com) + * @requires jQuery 1.2.6 or later + * + * Copyright (c) 2009, Stanislaus Madueke + * All rights reserved. + * + * Licensed under the New BSD License + * See: http://www.opensource.org/licenses/bsd-license.php + */ +;(function($) { + $.fn.formset = function(opts) + { + var options = $.extend({}, $.fn.formset.defaults, opts), + flatExtraClasses = options.extraClasses.join(' '), + totalForms = $('#id_' + options.prefix + '-TOTAL_FORMS'), + maxForms = $('#id_' + options.prefix + '-MAX_NUM_FORMS'), + minForms = $('#id_' + options.prefix + '-MIN_NUM_FORMS'), + childElementSelector = 'input,select,textarea,label,div', + $$ = $(this), + + applyExtraClasses = function(row, ndx) { + if (options.extraClasses) { + row.removeClass(flatExtraClasses); + row.addClass(options.extraClasses[ndx % options.extraClasses.length]); + } + }, + + updateElementIndex = function(elem, prefix, ndx) { + var idRegex = new RegExp(prefix + '-(\\d+|__prefix__)-'), + replacement = prefix + '-' + ndx + '-'; + if (elem.attr("for")) elem.attr("for", elem.attr("for").replace(idRegex, replacement)); + if (elem.attr('id')) elem.attr('id', elem.attr('id').replace(idRegex, replacement)); + if (elem.attr('name')) elem.attr('name', elem.attr('name').replace(idRegex, replacement)); + }, + + hasChildElements = function(row) { + return row.find(childElementSelector).length > 0; + }, + + showAddButton = function() { + return maxForms.length == 0 || // For Django versions pre 1.2 + (maxForms.val() == '' || (maxForms.val() - totalForms.val() > 0)); + }, + + /** + * Indicates whether delete link(s) can be displayed - when total forms > min forms + */ + showDeleteLinks = function() { + return minForms.length == 0 || // For Django versions pre 1.7 + (minForms.val() == '' || (totalForms.val() - minForms.val() > 0)); + }, + + insertDeleteLink = function(row) { + var delCssSelector = $.trim(options.deleteCssClass).replace(/\s+/g, '.'), + addCssSelector = $.trim(options.addCssClass).replace(/\s+/g, '.'); + + var delButtonHTML = '' + options.deleteText +''; + if (options.deleteContainerClass) { + // If we have a specific container for the remove button, + // place it as the last child of that container: + row.find('[class*="' + options.deleteContainerClass + '"]').append(delButtonHTML); + } else if (row.is('TR')) { + // If the forms are laid out in table rows, insert + // the remove button into the last table cell: + row.children(':last').append(delButtonHTML); + } else if (row.is('UL') || row.is('OL')) { + // If they're laid out as an ordered/unordered list, + // insert an
  • after the last list item: + row.append('
  • ' + delButtonHTML + '
  • '); + } else { + // Otherwise, just insert the remove button as the + // last child element of the form's container: + row.append(delButtonHTML); + } + + // Check if we're under the minimum number of forms - not to display delete link at rendering + if (!showDeleteLinks()){ + row.find('a.' + delCssSelector).hide(); + } + + row.find('a.' + delCssSelector).click(function() { + var row = $(this).parents('.' + options.formCssClass), + del = row.find('input:hidden[id $= "-DELETE"]'), + buttonRow = row.siblings("a." + addCssSelector + ', .' + options.formCssClass + '-add'), + forms; + if (del.length) { + // We're dealing with an inline formset. + // Rather than remove this form from the DOM, we'll mark it as deleted + // and hide it, then let Django handle the deleting: + del.val('on'); + row.hide(); + forms = $('.' + options.formCssClass).not(':hidden'); + totalForms.val(forms.length); + } else { + row.remove(); + // Update the TOTAL_FORMS count: + forms = $('.' + options.formCssClass).not('.formset-custom-template'); + totalForms.val(forms.length); + } + for (var i=0, formCount=forms.length; i