From 08a140a73be90e5b13c04ad905beb3e0f67c49bc Mon Sep 17 00:00:00 2001 From: viveksantayana Date: Thu, 16 Jun 2022 15:19:26 +0100 Subject: [PATCH] Finished common section of app --- ref-test/app/install.py | 32 --- ref-test/app/quiz/templates/quiz/privacy.html | 26 --- ref-test/app/root/css/style.css | 218 ++++++++++++++++++ ref-test/app/root/favicon.ico | Bin 0 -> 15086 bytes ref-test/app/root/favicon.png | Bin 0 -> 85851 bytes ref-test/app/root/js/jquery-3.6.0.min.js | 2 + ref-test/app/root/js/script.js | 86 +++++++ .../templates/quiz => templates}/404.html | 2 +- ref-test/app/templates/components/base.html | 78 +++++++ ref-test/app/templates/components/footer.html | 3 + ref-test/app/templates/components/navbar.html | 14 ++ .../app/templates/components/og-meta.html | 17 ++ .../templates/components/server-alerts.html | 43 ++++ ref-test/app/templates/privacy.html | 27 ++- ref-test/app/views.py | 2 +- ref-test/config.py | 2 +- ref-test/main.py | 33 ++- ref-test/wsgi.py | 2 - 18 files changed, 518 insertions(+), 69 deletions(-) delete mode 100644 ref-test/app/install.py delete mode 100644 ref-test/app/quiz/templates/quiz/privacy.html create mode 100644 ref-test/app/root/css/style.css create mode 100644 ref-test/app/root/favicon.ico create mode 100644 ref-test/app/root/favicon.png create mode 100644 ref-test/app/root/js/jquery-3.6.0.min.js create mode 100644 ref-test/app/root/js/script.js rename ref-test/app/{quiz/templates/quiz => templates}/404.html (82%) create mode 100644 ref-test/app/templates/components/base.html create mode 100644 ref-test/app/templates/components/footer.html create mode 100644 ref-test/app/templates/components/navbar.html create mode 100644 ref-test/app/templates/components/og-meta.html create mode 100644 ref-test/app/templates/components/server-alerts.html diff --git a/ref-test/app/install.py b/ref-test/app/install.py deleted file mode 100644 index 843259b..0000000 --- a/ref-test/app/install.py +++ /dev/null @@ -1,32 +0,0 @@ -from main import app, Config -from .data import data -from .modules import db -from .tools.data import save -from .tools.logs import write - -from os import mkdir, path, system -from cryptography.fernet import Fernet - -from sqlalchemy_utils import database_exists, create_database - -def install_scripts(): - if not path.isdir(f'./{data}'): mkdir(f'./{data}') - if not path.isdir(f'./{data}/questions'): mkdir(f'./{data}/questions') - if not path.isfile(f'./{data}/.gitignore'): - with open(f'./{data}/.gitignore', 'a+') as file: file.write(f'*') - if not path.isfile(f'./{data}/config.json'): save({}, 'config.json') - if not path.isdir(f'./{data}/logs'): mkdir(f'./{data}/logs') - if not path.isfile(f'./{data}/logs/users.log'): write('users.log', 'Log file created.') - if not path.isfile(f'./{data}/logs/system.log'): write('system.log', 'Log file created.') - if not path.isfile(f'./{data}/logs/tests.log'): write('tests.log', 'Log file created.') - if not database_exists(Config.SQLALCHEMY_DATABASE_URI): - create_database(Config.SQLALCHEMY_DATABASE_URI) - write('system.log', 'No database found. Creating a new database.') - from .models import Entry, Test, User - with app.app_context(): db.create_all() - write('system.log', 'Creating database schema.') - if not path.isfile(f'./{data}/.encryption.key'): - write('system.log', 'No encryption key found. Generating new encryption key.') - with open(f'./{data}/.encryption.key', 'wb') as key_file: - key = Fernet.generate_key() - key_file.write(key) \ No newline at end of file diff --git a/ref-test/app/quiz/templates/quiz/privacy.html b/ref-test/app/quiz/templates/quiz/privacy.html deleted file mode 100644 index 6e02e89..0000000 --- a/ref-test/app/quiz/templates/quiz/privacy.html +++ /dev/null @@ -1,26 +0,0 @@ -{% extends "quiz/components/base.html" %} - -{% block content %} -

Privacy Policy

- - This web app stores data using cookies. The web site only stores the minimum information it needs to function. -
Site Administrators
- - - -
Test Candidates
- - -
Requests to Delete Data
- -{% endblock %} \ No newline at end of file diff --git a/ref-test/app/root/css/style.css b/ref-test/app/root/css/style.css new file mode 100644 index 0000000..802ade7 --- /dev/null +++ b/ref-test/app/root/css/style.css @@ -0,0 +1,218 @@ +body { + padding: 80px 0; + line-height: 1.5; + font-size: 14pt; +} + +#cookie-alert { + padding-right: 16px; +} + +#dismiss-cookie-alert { + margin-top: 16px; + width: fit-content; +} + +.button-container { + margin: 2rem auto; + width: fit-content; +} + +.instruction-container { + margin: 2rem auto; +} + +.site-footer { + background-color: lightgray; + font-size: small; +} + +.site-footer p { + margin: 0; +} + +.quiz-container { + max-width: 720px; +} + +.form-container { + display: -ms-flexbox; + display: flex; + -ms-flex-align: center; + align-items: center; + padding-top: 40px; + padding-bottom: 40px; +} + +.form-quiz-start { + width: 100%; + max-width: 420px; + padding: 15px; + margin: auto; +} + +.form-heading { + margin-bottom: 2rem; +} + +.form-label-group { + position: relative; + margin-bottom: 2rem; +} + +.form-label-group input, +.form-label-group label { + padding: var(--input-padding-y) var(--input-padding-x); + font-size: 16pt; +} + +.form-label-group label { + position: absolute; + top: 0; + left: 0; + display: block; + width: 100%; + margin-bottom: 0; /* Override default `