Initial commit

This commit is contained in:
Joshua Rubingh 2020-11-13 15:31:14 +01:00
parent 2af942da5a
commit 10e2a34143
103 changed files with 3609 additions and 0 deletions

9
.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
venv/*
.vscode/*
static/*
__pycache__
db.sqlite3
doc/_build/
doc/output/
api_test.py
log/*

9
.gitmodules vendored Normal file
View File

@ -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

7
requirements.txt Normal file
View File

@ -0,0 +1,7 @@
Django
dj-database-url
django_js_reverse
python-decouple
django-cryptography
djangorestframework
pandas

1
synthea Submodule

@ -0,0 +1 @@
Subproject commit 16129ad4fbef18e5c89b941e1b14a8fcf04abf07

1
synthea-international Submodule

@ -0,0 +1 @@
Subproject commit da67258b54ee83e3d4ad11b5f0dfcbc5bb053e34

1
synthea-modules Submodule

@ -0,0 +1 @@
Subproject commit 824b4d3182434bd20ef644a21a8bc4a828f399dc

View File

@ -0,0 +1 @@
default_app_config = 'apps.RUG_template.apps.RugTemplateConfig'

View File

@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

View File

@ -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')

View File

@ -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 <EMAIL@ADDRESS>, 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 <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\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 <a href="
"\"%(login_url)s\">log in page</a>."
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 ""

View File

@ -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 <EMAIL@ADDRESS>, 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 <j.g.rubingh@rug.nl>\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 <a href="
"\"%(login_url)s\">log in page</a>."
msgstr ""
"Je nieuwe wachtwoord is ingesteld. Je kunt nu inloggen via de <a href="
"\"%(login_url)s\">inlog pagina</a>."
#: 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"

View File

@ -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

View File

@ -0,0 +1,3 @@
from django.db import models
# Create your models here.

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 967 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,64 @@
function csrfSafeMethod(method) {
// these HTTP methods do not require CSRF protection
return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
}
function init_password_toggles() {
jQuery('input[type="password"]').each(function(counter,value){
jQuery('<button type="button" class="password_toggle password_hidden icon" title="Toggle password" />').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('<span class="required">*</span>');
});
/*
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('<span class="required">*</span>');
});
*/
}
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();
});

View File

@ -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 = '<a class="' + options.deleteCssClass + '" href="javascript:void(0)">' + options.deleteText +'</a>';
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 <li> after the last list item:
row.append('<li>' + delButtonHTML + '</li>');
} 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<formCount; i++) {
// Apply `extraClasses` to form rows so they're nicely alternating:
applyExtraClasses(forms.eq(i), i);
if (!del.length) {
// Also update names and IDs for all child controls (if this isn't
// a delete-able inline formset) so they remain in sequence:
forms.eq(i).find(childElementSelector).each(function() {
updateElementIndex($(this), options.prefix, i);
});
}
}
// Check if we've reached the minimum number of forms - hide all delete link(s)
if (!showDeleteLinks()){
$('a.' + delCssSelector).each(function(){$(this).hide();});
}
// Check if we need to show the add button:
if (buttonRow.is(':hidden') && showAddButton()) buttonRow.show();
// If a post-delete callback was provided, call it with the deleted form:
if (options.removed) options.removed(row);
return false;
});
};
$$.each(function(i) {
var row = $(this),
del = row.find('input:checkbox[id $= "-DELETE"]');
if (del.length) {
// If you specify "can_delete = True" when creating an inline formset,
// Django adds a checkbox to each form in the formset.
// Replace the default checkbox with a hidden field:
if (del.is(':checked')) {
// If an inline formset containing deleted forms fails validation, make sure
// we keep the forms hidden (thanks for the bug report and suggested fix Mike)
del.before('<input type="hidden" name="' + del.attr('name') +'" id="' + del.attr('id') +'" value="on" />');
row.hide();
} else {
del.before('<input type="hidden" name="' + del.attr('name') +'" id="' + del.attr('id') +'" />');
}
// Hide any labels associated with the DELETE checkbox:
$('label[for="' + del.attr('id') + '"]').hide();
del.remove();
}
if (hasChildElements(row)) {
row.addClass(options.formCssClass);
if (row.is(':visible')) {
insertDeleteLink(row);
applyExtraClasses(row, i);
}
}
});
if ($$.length) {
var hideAddButton = !showAddButton(),
addButton, template;
if (options.formTemplate) {
// If a form template was specified, we'll clone it to generate new form instances:
template = (options.formTemplate instanceof $) ? options.formTemplate : $(options.formTemplate);
template.removeAttr('id').addClass(options.formCssClass + ' formset-custom-template');
template.find(childElementSelector).each(function() {
updateElementIndex($(this), options.prefix, '__prefix__');
});
insertDeleteLink(template);
} else {
// Otherwise, use the last form in the formset; this works much better if you've got
// extra (>= 1) forms (thnaks to justhamade for pointing this out):
if (options.hideLastAddForm) $('.' + options.formCssClass + ':last').hide();
template = $('.' + options.formCssClass + ':last').clone(true).removeAttr('id');
template.find('input:hidden[id $= "-DELETE"]').remove();
// Clear all cloned fields, except those the user wants to keep (thanks to brunogola for the suggestion):
template.find(childElementSelector).not(options.keepFieldValues).each(function() {
var elem = $(this);
// If this is a checkbox or radiobutton, uncheck it.
// This fixes Issue 1, reported by Wilson.Andrew.J:
if (elem.is('input:checkbox') || elem.is('input:radio')) {
elem.attr('checked', false);
} else {
elem.val('');
}
});
}
// FIXME: Perhaps using $.data would be a better idea?
options.formTemplate = template;
var addButtonHTML = '<a class="' + options.addCssClass + '" href="javascript:void(0)">' + options.addText + '</a>';
if (options.addContainerClass) {
// If we have a specific container for the "add" button,
// place it as the last child of that container:
var addContainer = $('[class*="' + options.addContainerClass + '"');
addContainer.append(addButtonHTML);
addButton = addContainer.find('[class="' + options.addCssClass + '"]');
} else if ($$.is('TR')) {
// If forms are laid out as table rows, insert the
// "add" button in a new table row:
var numCols = $$.eq(0).children().length, // This is a bit of an assumption :|
buttonRow = $('<tr><td colspan="' + numCols + '">' + addButtonHTML + '</tr>').addClass(options.formCssClass + '-add');
$$.parent().append(buttonRow);
addButton = buttonRow.find('a');
} else {
// Otherwise, insert it immediately after the last form:
$$.filter(':last').after(addButtonHTML);
addButton = $$.filter(':last').next();
}
if (hideAddButton) addButton.hide();
addButton.click(function() {
var formCount = parseInt(totalForms.val()),
row = options.formTemplate.clone(true).removeClass('formset-custom-template'),
buttonRow = $($(this).parents('tr.' + options.formCssClass + '-add').get(0) || this),
delCssSelector = $.trim(options.deleteCssClass).replace(/\s+/g, '.');
applyExtraClasses(row, formCount);
row.insertBefore(buttonRow).show();
row.find(childElementSelector).each(function() {
updateElementIndex($(this), options.prefix, formCount);
});
totalForms.val(formCount + 1);
// Check if we're above the minimum allowed number of forms -> show all delete link(s)
if (showDeleteLinks()){
$('a.' + delCssSelector).each(function(){$(this).show();});
}
// Check if we've exceeded the maximum allowed number of forms:
if (!showAddButton()) buttonRow.hide();
// If a post-add callback was supplied, call it with the added form:
if (options.added) options.added(row);
return false;
});
}
return $$;
};
/* Setup plugin defaults */
$.fn.formset.defaults = {
prefix: 'form', // The form prefix for your django formset
formTemplate: null, // The jQuery selection cloned to generate new form instances
addText: 'add another', // Text for the add link
deleteText: 'remove', // Text for the delete link
addContainerClass: null, // Container CSS class for the add link
deleteContainerClass: null, // Container CSS class for the delete link
addCssClass: 'add-row', // CSS class applied to the add link
deleteCssClass: 'delete-row', // CSS class applied to the delete link
formCssClass: 'dynamic-form', // CSS class applied to each form in a formset
extraClasses: [], // Additional CSS classes, which will be applied to each form in turn
keepFieldValues: '', // jQuery selector for fields whose values should be kept when the form is cloned
added: null, // Function called each time a new form is added
removed: null, // Function called each time a form is deleted
hideLastAddForm: false // When set to true, hide last empty add form (becomes visible when clicking on add button)
};
})(jQuery);

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,151 @@
/*
* Konami-JS ~
* :: Now with support for touch events and multiple instances for
* :: those situations that call for multiple easter eggs!
* Code: https://github.com/snaptortoise/konami-js
* Copyright (c) 2009 George Mandis (georgemandis.com, snaptortoise.com)
* Version: 1.6.2 (7/17/2018)
* Licensed under the MIT License (http://opensource.org/licenses/MIT)
* Tested in: Safari 4+, Google Chrome 4+, Firefox 3+, IE7+, Mobile Safari 2.2.1+ and Android
*/
var Konami = function (callback) {
var konami = {
addEvent: function (obj, type, fn, ref_obj) {
if (obj.addEventListener)
obj.addEventListener(type, fn, false);
else if (obj.attachEvent) {
// IE
obj["e" + type + fn] = fn;
obj[type + fn] = function () {
obj["e" + type + fn](window.event, ref_obj);
}
obj.attachEvent("on" + type, obj[type + fn]);
}
},
removeEvent: function (obj, eventName, eventCallback) {
if (obj.removeEventListener) {
obj.removeEventListener(eventName, eventCallback);
} else if (obj.attachEvent) {
obj.detachEvent(eventName);
}
},
input: "",
pattern: "38384040373937396665",
keydownHandler: function (e, ref_obj) {
if (ref_obj) {
konami = ref_obj;
} // IE
konami.input += e ? e.keyCode : event.keyCode;
if (konami.input.length > konami.pattern.length) {
konami.input = konami.input.substr((konami.input.length - konami.pattern.length));
}
if (konami.input === konami.pattern) {
konami.code(konami._currentLink);
konami.input = '';
e.preventDefault();
return false;
}
},
load: function (link) {
this._currentLink = link;
this.addEvent(document, "keydown", this.keydownHandler, this);
this.iphone.load(link);
},
unload: function () {
this.removeEvent(document, 'keydown', this.keydownHandler);
this.iphone.unload();
},
code: function (link) {
window.location = link
},
iphone: {
start_x: 0,
start_y: 0,
stop_x: 0,
stop_y: 0,
tap: false,
capture: false,
orig_keys: "",
keys: ["UP", "UP", "DOWN", "DOWN", "LEFT", "RIGHT", "LEFT", "RIGHT", "TAP", "TAP"],
input: [],
code: function (link) {
konami.code(link);
},
touchmoveHandler: function (e) {
if (e.touches.length === 1 && konami.iphone.capture === true) {
var touch = e.touches[0];
konami.iphone.stop_x = touch.pageX;
konami.iphone.stop_y = touch.pageY;
konami.iphone.tap = false;
konami.iphone.capture = false;
konami.iphone.check_direction();
}
},
touchendHandler: function () {
konami.iphone.input.push(konami.iphone.check_direction());
if (konami.iphone.input.length > konami.iphone.keys.length) konami.iphone.input.shift();
if (konami.iphone.input.length === konami.iphone.keys.length) {
var match = true;
for (var i = 0; i < konami.iphone.keys.length; i++) {
if (konami.iphone.input[i] !== konami.iphone.keys[i]) {
match = false;
}
}
if (match) {
konami.iphone.code(konami._currentLink);
}
}
},
touchstartHandler: function (e) {
konami.iphone.start_x = e.changedTouches[0].pageX;
konami.iphone.start_y = e.changedTouches[0].pageY;
konami.iphone.tap = true;
konami.iphone.capture = true;
},
load: function (link) {
this.orig_keys = this.keys;
konami.addEvent(document, "touchmove", this.touchmoveHandler);
konami.addEvent(document, "touchend", this.touchendHandler, false);
konami.addEvent(document, "touchstart", this.touchstartHandler);
},
unload: function () {
konami.removeEvent(document, 'touchmove', this.touchmoveHandler);
konami.removeEvent(document, 'touchend', this.touchendHandler);
konami.removeEvent(document, 'touchstart', this.touchstartHandler);
},
check_direction: function () {
x_magnitude = Math.abs(this.start_x - this.stop_x);
y_magnitude = Math.abs(this.start_y - this.stop_y);
x = ((this.start_x - this.stop_x) < 0) ? "RIGHT" : "LEFT";
y = ((this.start_y - this.stop_y) < 0) ? "DOWN" : "UP";
result = (x_magnitude > y_magnitude) ? x : y;
result = (this.tap === true) ? "TAP" : result;
return result;
}
}
}
typeof callback === "string" && konami.load(callback);
if (typeof callback === "function") {
konami.code = callback;
konami.load();
}
return konami;
};
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
module.exports = Konami;
} else {
if (typeof define === 'function' && define.amd) {
define([], function() {
return Konami;
});
} else {
window.Konami = Konami;
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,155 @@
.rug-wrapper {
max-width: 80% !important;
}
.rug-width-m-8-24 {
width: 25%;
}
.rug-panel--content {
max-width: none;
}
.rug-nav--main__item {
display: none;
}
.rug-nav--main__item:first-of-type,
.rug-nav--main__item:last-of-type {
display: block;
}
.rug-breadcrumbs {
display: none;
}
p {
max-width: none;
}
table {
width: 100%;
}
table.stripe tr:nth-child(even) {
background-color: #f2f2f2;
}
table.stripe td {
white-space: nowrap;
overflow: hidden;
}
table.stripe td.empty {
text-align: center;
}
.pointer {
cursor: pointer;
}
form#new_schedule_form input:not([type=checkbox]) {
width: 100%
}
.text-danger {
color: #721c24;
}
.required {
color: red;
}
span.required {
margin-left: 0.2rem;
}
.alert-warning {
color: #856404;
background-color: #fff3cd;
border-color: #ffeeba;
}
.alert-success {
color: #155724;
background-color: #d4edda;
border-color: #c3e6cb;
}
.alert-danger {
color: #721c24;
background-color: #f8d7da;
border-color: #f5c6cb;
}
.form-control {
display: block;
width: 100%;
height: calc(1.5em + .75rem + 2px);
padding: .375rem .75rem;
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
color: #495057;
background-color: #fff;
background-clip: padding-box;
border: 1px solid #ced4da;
border-radius: .25rem;
transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
}
.icon {
height: 1rem;
width: auto;
}
h1 .icon {
height: 1.5rem;
}
/* Password toggles */
input[readonly] {
border: none;
background-color: transparent;
/* width: 75px;*/
}
button.password_toggle {
width: 1.8rem;
overflow: hidden;
text-indent: -999%;
white-space: nowrap;
cursor: pointer;
background-color: transparent;
background-repeat: no-repeat;
background-size: auto 100%;
background-position: center;
margin-left: 0.2rem;
border: none;
}
button.password_toggle.password_hidden {
background-image: url('../images/eye-open.png');
}
button.password_toggle.password_shown {
background-image: url('../images/eye-closed.png');
}
/* End Password toggles */
.add-row {
margin: 6px 0 0 0;
padding-left: 24px;
background: url('../images/plus-icon.png') no-repeat left center;
background-size: auto 80%;
}
.delete-row {
display:block;
margin: 6px 0 0 0;
padding-left: 20px;
background: url('../images/minus-icon.png') no-repeat left center;
background-size: auto 80%;
}

View File

@ -0,0 +1,8 @@
img.i18n_flag {
width: 16px;
vertical-align: text-top;
}
form#language_form {
display: inline;
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,17 @@
{% extends 'base.html' %} <!-- Add this for inheritance -->
{% load i18n %}
{% block title %}{% trans "Oops, sorry, bad request (400)" %}{% endblock %}
{% block pagetitle %}<span style="color:red">{% trans "Oops, sorry, bad request (400)" %}</span>{% endblock %}
{% block content %}
<p>{% trans "Unfortunately, the link to this page does not work, the page (temporarily) does not exist or it has been moved." %}</p>
<style>
.rug-breadcrumbs {
display:none
}
.rug-layout__item.rug-width-m-8-24 {
display:none
}
</style>
{% endblock %}

View File

@ -0,0 +1,17 @@
{% extends 'base.html' %} <!-- Add this for inheritance -->
{% load i18n %}
{% block title %}{% trans "Oops, sorry, forbidden access (403)" %}{% endblock %}
{% block pagetitle %}<span style="color:red">{% trans "Oops, sorry, forbidden access (403)" %}</span>{% endblock %}
{% block content %}
<p>{% trans "Unfortunately, you do not have rights to access this url." %}</p>
<style>
.rug-breadcrumbs {
display:none
}
.rug-layout__item.rug-width-m-8-24 {
display:none
}
</style>
{% endblock %}

View File

@ -0,0 +1,17 @@
{% extends 'base.html' %} <!-- Add this for inheritance -->
{% load i18n %}
{% block title %}{% trans "Oops, sorry, page not found (404)" %}{% endblock %}
{% block pagetitle %}<span style="color:red">{% trans "Oops, sorry, page not found (404)" %}</span>{% endblock %}
{% block content %}
<p>{% trans "Unfortunately, the link to this page does not work, the page (temporarily) does not exist or it has been moved." %}</p>
<style>
.rug-breadcrumbs {
display:none
}
.rug-layout__item.rug-width-m-8-24 {
display:none
}
</style>
{% endblock %}

View File

@ -0,0 +1,17 @@
{% extends 'base.html' %} <!-- Add this for inheritance -->
{% load i18n %}
{% block title %}{% trans "Oops, sorry, server error (500)" %}{% endblock %}
{% block pagetitle %}<span style="color:red">{% trans "Oops, sorry, server error (500)" %}</span>{% endblock %}
{% block content %}
<p>{% trans "Unfortunately, something went wrong on the server." %}</p>
<style>
.rug-breadcrumbs {
display:none
}
.rug-layout__item.rug-width-m-8-24 {
display:none
}
</style>
{% endblock %}

View File

@ -0,0 +1,38 @@
{% extends "admin/base_site.html" %}
{% load static %}
{% load i18n %}
{% block extrahead %}
<link rel="shortcut icon" href="{% static 'RUG_template/images/favicon.ico' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'RUG_template/style/custom_admin.css' %}"/>
{% endblock %}
{% block userlinks %}
{% comment %} Language choice. Should be put somewhere else when finale designs are done. {% endcomment %}
<form action="{% url 'set_language' %}" method="post" id="language_form" name="language_form">
{% csrf_token %}
{% get_current_language as LANGUAGE_CODE %}
{% get_available_languages as LANGUAGES %}
{% get_language_info_list for LANGUAGES as languages %}
<input name="next" type="hidden" value="{% if redirect_to %}{{ redirect_to }}{% endif %}">
<input type="hidden" name="language" id="language" value="{{LANGUAGE_CODE}}">
{% for language in languages %}
<a onclick="document.getElementById('language').value='{{ language.code }}'; document.forms['language_form'].submit(); return false;" href="#">
{% with 'RUG_template/images/flag-'|add:language.code|add:'.png' as image_static %}
<img class="i18n_flag" src="{% static image_static %}" title="{% trans 'Language' %} {{ language.name_translated }}"/>
{% endwith %}
</a> /
{% endfor %}
</form>
{% if user.is_active and user.is_staff %}
{% url 'django-admindocs-docroot' as docsroot %}
{% if docsroot %}
<a href="{{ docsroot }}">{% trans 'Documentation' %}</a> /
{% endif %}
{% endif %}
{% if user.has_usable_password %}
<a href="{% url 'admin:password_change' %}">{% trans 'Change password' %}</a> /
{% endif %}
<a href="{% url 'admin:logout' %}">{% trans 'Log out' %}</a>
{% endblock %}

View File

@ -0,0 +1,634 @@
{% load static %}
{% load i18n %}
<!DOCTYPE html>
<html prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article#" lang="nl">
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>{% block title %}{% trans "Welcome at RUG" %}{% endblock %}</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="https://www.rug.nl/_definition/shared/css/jquery-smoothness/jquery-ui.min.css?version=2019-12-12" rel="stylesheet">
<link href="https://www.rug.nl/_definition/shared/css/jquery-ui-timepicker-addon.css?version=2019-12-12" rel="stylesheet">
<link href="https://www.rug.nl/_definition/shared/css/styles_v2.css?version=2019-12-12" rel="stylesheet" type="text/css">
<link href="https://www.rug.nl/_definition/shared/css/fotorama.css?version=2019-12-12" rel="stylesheet" type="text/css">
<link href="https://www.rug.nl/apple-touch-icon-57x57.png" sizes="57x57" rel="apple-touch-icon">
<link href="https://www.rug.nl/apple-touch-icon-114x114.png" sizes="114x114" rel="apple-touch-icon">
<link href="https://www.rug.nl/apple-touch-icon-72x72.png" sizes="72x72" rel="apple-touch-icon">
<link href="https://www.rug.nl/apple-touch-icon-144x144.png" sizes="144x144" rel="apple-touch-icon">
<link href="https://www.rug.nl/apple-touch-icon-60x60.png" sizes="60x60" rel="apple-touch-icon">
</