From 7fe1afb34809a1c22083ab38b55a1910edaca0df Mon Sep 17 00:00:00 2001 From: Vivek Santayana Date: Sat, 18 Jun 2022 09:39:31 +0100 Subject: [PATCH 1/8] Create editor files --- ref-test/app/editor/__init__.py | 0 ref-test/app/editor/static/editor.js | 0 ref-test/app/editor/static/js/editor.js | 0 ref-test/app/editor/templates/editor/index.html | 0 ref-test/app/editor/views.py | 12 ++++++++++++ ref-test/config.py | 2 +- ref-test/main.py | 4 +++- 7 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 ref-test/app/editor/__init__.py create mode 100644 ref-test/app/editor/static/editor.js create mode 100644 ref-test/app/editor/static/js/editor.js create mode 100644 ref-test/app/editor/templates/editor/index.html create mode 100644 ref-test/app/editor/views.py diff --git a/ref-test/app/editor/__init__.py b/ref-test/app/editor/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/ref-test/app/editor/static/editor.js b/ref-test/app/editor/static/editor.js new file mode 100644 index 0000000..e69de29 diff --git a/ref-test/app/editor/static/js/editor.js b/ref-test/app/editor/static/js/editor.js new file mode 100644 index 0000000..e69de29 diff --git a/ref-test/app/editor/templates/editor/index.html b/ref-test/app/editor/templates/editor/index.html new file mode 100644 index 0000000..e69de29 diff --git a/ref-test/app/editor/views.py b/ref-test/app/editor/views.py new file mode 100644 index 0000000..fd729c4 --- /dev/null +++ b/ref-test/app/editor/views.py @@ -0,0 +1,12 @@ +from flask import Blueprint, render_template + +editor = Blueprint( + name='editor', + import_name=__name__, + template_folder='templates', + static_folder='static' +) + +@editor.route('/') +def _editor(): + return render_template('/editor/index.html') \ No newline at end of file diff --git a/ref-test/config.py b/ref-test/config.py index beea69e..38a499a 100644 --- a/ref-test/config.py +++ b/ref-test/config.py @@ -1 +1 @@ -from app.config import ProductionConfig as Config \ No newline at end of file +from app.config import DevelopmentConfig as Config \ No newline at end of file diff --git a/ref-test/main.py b/ref-test/main.py index aa270a9..e97c9e1 100644 --- a/ref-test/main.py +++ b/ref-test/main.py @@ -36,7 +36,7 @@ def create_app(): def _check_cookie_consent(): if request.cookies.get('cookie_consent'): return - if any([ request.path.startswith(x) for x in [ '/admin/static/', '/static/', '/cookies/' ] ]): + if any([ request.path.startswith(x) for x in [ '/admin/static/', '/root/', '/quiz/static', '/admin/editor/static/', '/cookies/' ] ]): return flash(f'Cookie Consent: This web site only stores minimal, functional cookies. It does not store any tracking information. By using this site, you consent to this use of cookies. For more information, see our privacy policy.', 'cookie_alert') @@ -51,11 +51,13 @@ def create_app(): from app.api.views import api from app.quiz.views import quiz from app.views import views + from app.editor.views import editor app.register_blueprint(admin, url_prefix='/admin') app.register_blueprint(api, url_prefix='/api') app.register_blueprint(views) app.register_blueprint(quiz) + app.register_blueprint(editor, url_prefix='/admin/editor') if not path.isdir(f'./{data}'): mkdir(f'./{data}') if not path.isdir(f'./{data}/questions'): mkdir(f'./{data}/questions') From e1e279e939d852de377427cc9c4c365ac6e597f2 Mon Sep 17 00:00:00 2001 From: Vivek Santayana Date: Sat, 18 Jun 2022 09:43:07 +0100 Subject: [PATCH 2/8] Base editor template --- ref-test/app/editor/templates/editor/index.html | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ref-test/app/editor/templates/editor/index.html b/ref-test/app/editor/templates/editor/index.html index e69de29..9c81408 100644 --- a/ref-test/app/editor/templates/editor/index.html +++ b/ref-test/app/editor/templates/editor/index.html @@ -0,0 +1,12 @@ + + + + + + + Document + + + Editor + + \ No newline at end of file From 418dfe7a70489a403300b98af9de7cc292eca33a Mon Sep 17 00:00:00 2001 From: Vivek Santayana Date: Sat, 18 Jun 2022 09:53:36 +0100 Subject: [PATCH 3/8] Added templates and static files for editor --- ref-test/app/editor/static/css/style.css | 260 ++++++++++++++++++ ref-test/app/editor/static/favicon.ico | Bin 0 -> 15086 bytes ref-test/app/editor/static/favicon.png | Bin 0 -> 85851 bytes .../app/editor/static/js/jquery-3.6.0.min.js | 2 + ref-test/app/editor/static/js/script.js | 233 ++++++++++++++++ .../templates/editor/components/base.html | 82 ++++++ .../editor/components/client-alerts.html | 1 + .../editor/components/datatable.html | 28 ++ .../templates/editor/components/footer.html | 2 + .../editor/components/input-forms.html | 4 + .../templates/editor/components/navbar.html | 111 ++++++++ .../templates/editor/components/og-meta.html | 18 ++ .../components/secondary-navs/tests.html | 23 ++ .../editor/components/server-alerts.html | 43 +++ .../app/editor/templates/editor/index.html | 160 ++++++++++- 15 files changed, 955 insertions(+), 12 deletions(-) create mode 100644 ref-test/app/editor/static/css/style.css create mode 100644 ref-test/app/editor/static/favicon.ico create mode 100644 ref-test/app/editor/static/favicon.png create mode 100644 ref-test/app/editor/static/js/jquery-3.6.0.min.js create mode 100644 ref-test/app/editor/static/js/script.js create mode 100644 ref-test/app/editor/templates/editor/components/base.html create mode 100644 ref-test/app/editor/templates/editor/components/client-alerts.html create mode 100644 ref-test/app/editor/templates/editor/components/datatable.html create mode 100644 ref-test/app/editor/templates/editor/components/footer.html create mode 100644 ref-test/app/editor/templates/editor/components/input-forms.html create mode 100644 ref-test/app/editor/templates/editor/components/navbar.html create mode 100644 ref-test/app/editor/templates/editor/components/og-meta.html create mode 100644 ref-test/app/editor/templates/editor/components/secondary-navs/tests.html create mode 100644 ref-test/app/editor/templates/editor/components/server-alerts.html diff --git a/ref-test/app/editor/static/css/style.css b/ref-test/app/editor/static/css/style.css new file mode 100644 index 0000000..7a22f31 --- /dev/null +++ b/ref-test/app/editor/static/css/style.css @@ -0,0 +1,260 @@ +body { + padding: 80px 0; +} + +.site-footer { + background-color: lightgray; + font-size: small; +} + +.site-footer p { + margin: 0; +} + +.form-container { + display: -ms-flexbox; + display: flex; + -ms-flex-align: center; + align-items: center; + padding-top: 40px; + padding-bottom: 40px; +} + +.form-display { + 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 `