From 6a57dcdf9101d35c4674629d26c07688e47ac65d Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Sun, 12 Jul 2020 12:12:47 +0200 Subject: [PATCH] Promote some views to wms-core and update dependencies --- package.json | 19 +++-- views/errors/400.njk | 2 - views/errors/401.njk | 2 - views/errors/403.njk | 2 - views/errors/404.njk | 2 - views/errors/429.njk | 2 - views/errors/500.njk | 2 - views/errors/503.njk | 2 - views/errors/error.njk | 36 ---------- views/layouts/barebone.njk | 37 ---------- views/layouts/base.njk | 2 +- views/macros.njk | 142 ------------------------------------- 12 files changed, 13 insertions(+), 237 deletions(-) delete mode 100644 views/errors/400.njk delete mode 100644 views/errors/401.njk delete mode 100644 views/errors/403.njk delete mode 100644 views/errors/404.njk delete mode 100644 views/errors/429.njk delete mode 100644 views/errors/500.njk delete mode 100644 views/errors/503.njk delete mode 100644 views/errors/error.njk delete mode 100644 views/layouts/barebone.njk delete mode 100644 views/macros.njk diff --git a/package.json b/package.json index f9bf4df..beda726 100644 --- a/package.json +++ b/package.json @@ -18,9 +18,14 @@ "@babel/preset-env": "^7.9.5", "@types/config": "^0.0.36", "@types/express": "^4.17.6", + "@types/express-session": "^1.17.0", "@types/formidable": "^1.0.31", - "@types/jest": "^25.2.1", + "@types/jest": "^26.0.4", + "@types/mysql": "^2.15.15", "@types/node": "^13.13.2", + "@types/nodemailer": "^6.4.0", + "@types/nunjucks": "^3.1.3", + "@types/ws": "^7.2.6", "babel-loader": "^8.1.0", "concurrently": "^5.1.0", "css-loader": "^3.5.2", @@ -28,16 +33,16 @@ "file-loader": "^6.0.0", "imagemin": "^7.0.1", "imagemin-gifsicle": "^7.0.0", - "imagemin-mozjpeg": "^8.0.0", - "imagemin-pngquant": "^8.0.0", - "imagemin-svgo": "^7.1.0", + "imagemin-mozjpeg": "^9.0.0", + "imagemin-pngquant": "^9.0.0", + "imagemin-svgo": "^8.0.0", "img-loader": "^3.0.1", - "jest": "^25.4.0", + "jest": "^26.1.0", "mini-css-extract-plugin": "^0.9.0", "node-sass": "^4.14.0", "nodemon": "^2.0.3", - "sass-loader": "^8.0.2", - "ts-jest": "^25.4.0", + "sass-loader": "^9.0.2", + "ts-jest": "^26.1.1", "typescript": "^3.8.3", "uglifyjs-webpack-plugin": "^2.2.0", "webpack": "^4.43.0", diff --git a/views/errors/400.njk b/views/errors/400.njk deleted file mode 100644 index a5bc022..0000000 --- a/views/errors/400.njk +++ /dev/null @@ -1,2 +0,0 @@ -{% extends './error.njk' %} -{% import 'macros.njk' as macros %} diff --git a/views/errors/401.njk b/views/errors/401.njk deleted file mode 100644 index a5bc022..0000000 --- a/views/errors/401.njk +++ /dev/null @@ -1,2 +0,0 @@ -{% extends './error.njk' %} -{% import 'macros.njk' as macros %} diff --git a/views/errors/403.njk b/views/errors/403.njk deleted file mode 100644 index a5bc022..0000000 --- a/views/errors/403.njk +++ /dev/null @@ -1,2 +0,0 @@ -{% extends './error.njk' %} -{% import 'macros.njk' as macros %} diff --git a/views/errors/404.njk b/views/errors/404.njk deleted file mode 100644 index a5bc022..0000000 --- a/views/errors/404.njk +++ /dev/null @@ -1,2 +0,0 @@ -{% extends './error.njk' %} -{% import 'macros.njk' as macros %} diff --git a/views/errors/429.njk b/views/errors/429.njk deleted file mode 100644 index a5bc022..0000000 --- a/views/errors/429.njk +++ /dev/null @@ -1,2 +0,0 @@ -{% extends './error.njk' %} -{% import 'macros.njk' as macros %} diff --git a/views/errors/500.njk b/views/errors/500.njk deleted file mode 100644 index a5bc022..0000000 --- a/views/errors/500.njk +++ /dev/null @@ -1,2 +0,0 @@ -{% extends './error.njk' %} -{% import 'macros.njk' as macros %} diff --git a/views/errors/503.njk b/views/errors/503.njk deleted file mode 100644 index a5bc022..0000000 --- a/views/errors/503.njk +++ /dev/null @@ -1,2 +0,0 @@ -{% extends './error.njk' %} -{% import 'macros.njk' as macros %} diff --git a/views/errors/error.njk b/views/errors/error.njk deleted file mode 100644 index 3d05ea9..0000000 --- a/views/errors/error.njk +++ /dev/null @@ -1,36 +0,0 @@ -{% extends '../layouts/barebone.njk' %} - -{% set title = error_code + ' - ' + error_message %} - -{% block _stylesheets %} - -{% endblock %} - -{% block _body %} - - -
- {% if flash %} - {{ macros.messages(flash) }} - {% endif %} - -
{{ error_code }}
-
{{ error_message }}
-
{{ error_instructions|safe }}
- - -
- -
- Error ID: {{ error_id }} -
- If you think this isn't right, please contact us with the above error ID at - {{ app.contact_email }}. -
-{% endblock %} \ No newline at end of file diff --git a/views/layouts/barebone.njk b/views/layouts/barebone.njk deleted file mode 100644 index 3a82d94..0000000 --- a/views/layouts/barebone.njk +++ /dev/null @@ -1,37 +0,0 @@ - - - - - {{ title }} - - - - - - - - {% if description %} - - {% endif %} - - {% if refresh_after %} - - {% endif %} - - {% block _stylesheets %}{% endblock %} - {% block _scripts %} - - {% endblock %} - - - -
- {% block header %}{% endblock %} -
- -{% block _body %}{% endblock %} - - - - - \ No newline at end of file diff --git a/views/layouts/base.njk b/views/layouts/base.njk index f87c6aa..cb76570 100644 --- a/views/layouts/base.njk +++ b/views/layouts/base.njk @@ -1,4 +1,4 @@ -{% extends './barebone.njk' %} +{% extends 'layouts/barebone.njk' %} {% import 'macros.njk' as macros %} {% block _stylesheets %} diff --git a/views/macros.njk b/views/macros.njk deleted file mode 100644 index 789700a..0000000 --- a/views/macros.njk +++ /dev/null @@ -1,142 +0,0 @@ -{% macro message(type, content, raw=false, discreet=false) %} -
- - - {{ content|safe if raw else content }} - -
-{% endmacro %} - -{% macro messages(flash) %} - {% set flashed = flash() %} - {% set display = 0 %} - - {% for type, bag in flashed %} - {% if bag|length %} - {% set display = 1 %} - {% endif %} - {% endfor %} - - {% if display %} -
- {% for type, bag in flashed %} - {% for content in bag %} - {{ message(type, content) }} - {% endfor %} - {% endfor %} -
- {% endif %} -{% endmacro %} - -{% macro csrf(getCSRFToken) %} - -{% endmacro %} - -{% macro field(_locals, type, name, value, placeholder, hint, validation_attributes='', extraData='') %} - {% set validation = _locals.validation() %} - {% set validation = validation[name] if validation[name] or null %} - {% set previousFormData = _locals.previousFormData() %} - {% set value = previousFormData[name] or value or validation.value or '' %} - - {% if type == 'hidden' %} - {% if validation %} - {{ message('error', validation.message) }} - {% endif %} - - {% else %} -
- {% if type == 'duration' %} -
- {% for f in extraData %} -
- {% if previousFormData[name] %} - {% set v = value[f] %} - {% else %} - {% set v = (value % 60) if f == 's' else (((value - value % 60) / 60 % 60) if f == 'm' else ((value - value % 3600) / 3600 if f == 'h')) %} - {% endif %} - - -
- {% endfor %} -
- {% elseif type == 'select' %} - - - {% else %} - - {% endif %} - - - {{ fieldError(_locals, name) }} - {% if hint %} -
{{ hint }}
- {% endif %} -
- {% endif %} -{% endmacro %} - -{% macro fieldError(_locals, name) %} - {% set validation = _locals.validation() %} - {% set validation = validation[name] if validation[name] or null %} - {% if validation %} -
{{ validation.message }}
- {% endif %} -{% endmacro %} - -{% macro websocket(websocketUrl, listener, reconnectOnClose = 1, checkFunction = 0) %} - -{% endmacro %} - -{% macro paginate(pagination, routeName) %} - {% if pagination.hasPrevious() or pagination.hasNext() %} - - {% endif %} -{% endmacro %} \ No newline at end of file