Skip to content

Commit

Permalink
Update dependencies, port to bootstrap-flask/bootstrap 5
Browse files Browse the repository at this point in the history
  • Loading branch information
manisandro committed Dec 11, 2023
1 parent ea39b6e commit 5117100
Show file tree
Hide file tree
Showing 106 changed files with 1,047 additions and 1,026 deletions.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM sourcepole/qwc-uwsgi-base:alpine-v2023.10.26

ADD . /srv/qwc_service
ADD requirements.txt /srv/qwc_service/requirements.txt

# git: Required for pip with git repos
# postgresql-dev g++ python3-dev: Required for psycopg2
Expand All @@ -10,4 +10,6 @@ RUN \
pip3 install --no-cache-dir -r /srv/qwc_service/requirements.txt && \
apk del build-deps

ADD src /srv/qwc_service/

ENV SERVICE_MOUNTPOINT=/qwc_admin
37 changes: 0 additions & 37 deletions plugins/themes/templates/index.html

This file was deleted.

27 changes: 0 additions & 27 deletions plugins/themes/templates/xyzlayer.html

This file was deleted.

23 changes: 11 additions & 12 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
Flask==2.3.2
Flask-Bootstrap==3.3.7.1
Flask-JWT-Extended==4.4.4
Flask-Mail==0.9.1
Flask-WTF==1.1.1
flask_login==0.6.2
python-dotenv==1.0.0
psycopg2==2.9.6
Flask==3.0.0
Bootstrap-Flask==2.3.3
Flask-JWT-Extended==4.5.3
Flask-Mail2==1.0.2
Flask-WTF==1.2.1
flask_login==0.6.3
psycopg2==2.9.9
requests==2.31.0
SQLAlchemy==1.4.48
Werkzeug==2.3.4
email_validator==2.0.0.post2
qwc-services-core==1.3.20
SQLAlchemy==2.0.23
Werkzeug==3.0.1
email_validator==2.1.0.post1
qwc-services-core==1.3.21
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion controllers/controller.py → src/controllers/controller.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from datetime import datetime
import math

from flask import abort, flash, redirect, render_template, request, url_for, Markup
from flask import abort, flash, redirect, render_template, request, url_for
from markupsafe import Markup
from sqlalchemy.exc import IntegrityError, InternalError
from wtforms import ValidationError

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from collections import OrderedDict
import math

from flask import flash, Markup, render_template, request, session as flask_session
from flask import flash, render_template, request, session as flask_session
from markupsafe import Markup
from sqlalchemy.orm import joinedload

from .controller import Controller
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from .controller import Controller
from forms import RoleForm
from flask import flash, Markup
from flask import flash
from markupsafe import Markup
from wtforms import ValidationError


Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% import "bootstrap/wtf.html" as wtf %}
{% import "bootstrap5/form.html" as wtf %}
{% extends "templates/base.html" %}
{% block title %}{{ title }}{% endblock %}
{% block scripts %}
Expand Down Expand Up @@ -35,11 +35,11 @@
<h1>{{ title }}</h1>
<form id="form" class="form form-horizontal" action="{{ action }}" method="post" style="padding-bottom: 25px;">
{{ form.csrf_token }}
{{ wtf.form_field(form.pgservice, form_type="horizontal", horizontal_columns=('sm', 2, 5)) }}
{{ wtf.form_field(form.name, form_type="horizontal", horizontal_columns=('sm', 2, 5)) }}
{{ wtf.form_field(form.enable_alkis, form_type="horizontal", horizontal_columns=('sm', 2, 5)) }}
{{ wtf.form_field(form.enable_owner, form_type="horizontal", horizontal_columns=('sm', 2, 5)) }}
{{ wtf.form_field(form.header_template, form_type="horizontal", horizontal_columns=('sm', 2, 5)) }}
{{ wtf.form_field(form.submit, class="btn btn-primary") }}
{{ wtf.render_field(form.pgservice, form_type="horizontal", horizontal_columns=('sm', 2, 5)) }}
{{ wtf.render_field(form.name, form_type="horizontal", horizontal_columns=('sm', 2, 5)) }}
{{ wtf.render_field(form.enable_alkis, form_type="horizontal", horizontal_columns=('sm', 2, 5)) }}
{{ wtf.render_field(form.enable_owner, form_type="horizontal", horizontal_columns=('sm', 2, 5)) }}
{{ wtf.render_field(form.header_template, form_type="horizontal", horizontal_columns=('sm', 2, 5)) }}
{{ wtf.render_field(form.submit, class="btn btn-primary") }}
</form>
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{% block container %}
<h1>{{ title }}</h1>
<a href="{{ url_for('new_alkis') }}" class="btn btn-success" role="button">
{{ utils.icon('plus') }} {% block new_resource_label %}Neu{% endblock %}
{{ utils.render_icon('plus-lg') }} {% block new_resource_label %}Neu{% endblock %}
</a>
<table class="table table-striped">
<thead>
Expand All @@ -24,13 +24,13 @@ <h1>{{ title }}</h1>
{% endblock %}
<td>
<a href="{{ url_for('edit_alkis', index=resource.id) }}" class="btn btn-primary" role="button">
{{ utils.icon('pencil') }} Bearbeiten
{{ utils.render_icon('pencil') }} Bearbeiten
</a>
<form action="{{ url_for('delete_alkis', index=resource.id) }}" method="post" style="display: inline;">
<input type="hidden" name="_method" value="DELETE" />
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
<button type="submit" class="btn btn-danger" onclick="return confirm('{% block delete_resource_confirmation %}Wirklich entfernen?{% endblock %}');">
{{ utils.icon('remove') }} Entfernen
{{ utils.render_icon('x') }} Entfernen
</button>
</form>
</td>
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import os
from shutil import copyfile

from flask import flash, json, Markup, redirect, render_template, request, \
url_for
from flask import flash, json, redirect, render_template, request, url_for
from markupsafe import Markup
from json.decoder import JSONDecodeError


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,6 @@ <h1>{{ title }}</h1>
<div id="annotations" class="alert alert-danger" role="alert" style="display: none"></div>

<input class="btn btn-primary" id="submit" name="submit" type="submit" value="Save">
<button class="col-sm-offset-2 btn btn-danger" onclick="history.back()">Cancel</button>
</form>
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ <h1>{{ title }}</h1>
<br><br>

<a href="{{ url_for('config_editor_edit_tenant_config') }}" class="btn btn-primary" role="button">
{{ utils.icon('pencil') }} tenantConfig.json
{{ utils.render_icon('pencil') }} tenantConfig.json
</a>

<a href="{{ url_for('config_editor_edit_qwc2_config') }}" class="btn btn-primary" role="button">
{{ utils.icon('pencil') }} config.json
{{ utils.render_icon('pencil') }} config.json
</a>
{% endblock %}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class WMSLayerForm(FlaskForm):
title = StringField("Title", validators=[DataRequired()])
attribution = StringField("Attribution")
thumbnail = SelectField("Thumbnail", coerce=str, choices=[("", "")])
tiled = BooleanField("tiled")
tiled = BooleanField("Tiled")
submit = SubmitField("Save")


Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ class ThemeForm(FlaskForm):
message="Please enter a comma separted list of names.")]
)
collapseLayerGroupsBelowLevel = IntegerField(
"collapse layer groups below level",
description="Optional, layer tree level below which to initially \n collapse groups. By default the tree is completely expanded.",
"Collapse layer groups below level",
description="Optional, layer tree level below which to initially collapse groups. By default the tree is completely expanded.",
validators=[Optional()]
)
default = BooleanField(
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
{% block themes_container %}
<h1>{{ title }}</h1>
<a href="{{ url_for('new_backgroundlayer', type='wms') }}" class="btn btn-success" role="button" title="New WMS layer">
{{ utils.icon('plus') }} WMS
{{ utils.render_icon('plus-lg') }} WMS
</a>
<a href="{{ url_for('new_backgroundlayer', type='wmts') }}" class="btn btn-success" role="button" title="New WMTS layer">
{{ utils.icon('plus') }} WMTS
{{ utils.render_icon('plus-lg') }} WMTS
</a>
<a href="{{ url_for('new_backgroundlayer', type='xyz') }}" class="btn btn-success" role="button" title="New XYZ layer">
{{ utils.icon('plus') }} XYZ
{{ utils.render_icon('plus-lg') }} XYZ
</a>
<div style="padding-top: 1em;"/>
<div clas="panel-body">
Expand All @@ -29,14 +29,16 @@ <h1>{{ title }}</h1>
<td>{{ layer.name }}</td>
<td>{{ layer.title }}</td>
<td style="text-align: right">
{% if layer.type == "wms" %}
<a href="{{ url_for('edit_backgroundlayer', index=loop.index0) }}" class="btn btn-primary" role="button" title="Edit layer">
{{ utils.icon('pencil') }}
<div class="btn-group" role="group">
{% if layer.type == "wms" %}
<a href="{{ url_for('edit_backgroundlayer', index=loop.index0) }}" class="btn btn-primary" role="button" title="Edit layer">
{{ utils.render_icon('pencil') }}
</a>
{% endif %}
<a href="{{ url_for('delete_backgroundlayer', index=loop.index0) }}" class="btn btn-danger" role="button" title="Delete layer" onclick="return confirm('Really delete layer {{ layer.title }}?');">
{{ utils.render_icon('trash') }}
</a>
{% endif %}
<a href="{{ url_for('delete_backgroundlayer', index=loop.index0) }}" class="btn btn-danger" role="button" title="Delete layer" onclick="return confirm('Really delete layer {{ layer.title }}?');">
{{ utils.icon('trash') }}
</a>
</div>
</td>
</tr>
{% endfor %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% import "bootstrap/wtf.html" as wtf %}
{% import "bootstrap5/form.html" as wtf %}
{% extends "plugins/themes/templates/index.html" %}
{% block title %}{{ title }}{% endblock %}
{% block themes_container %}
Expand All @@ -7,8 +7,8 @@ <h1>{{ title }}</h1>
<form id="form_project" class="form" action="{{ url_for('upload_project') }}" method="post" style="padding-bottom: 25px;" enctype="multipart/form-data">
<div class="well form-group">
{{ form_project.csrf_token }}
{{ wtf.form_field(form_project.upload, horizontal_columns=('lg', 2, 10), class="btn btn-default") }}
{{ wtf.form_field(form_project.submit, horizontal_columns=('lg', 2, 10), class="btn btn-primary") }}
{{ wtf.render_field(form_project.upload, form_type="horizontal") }}
{{ wtf.render_field(form_project.submit, class="btn btn-primary") }}
</div>
</form>
<div class="panel panel-default">
Expand All @@ -28,7 +28,7 @@ <h1>{{ title }}</h1>
<td style="text-align: right">
<div class="btn-group">
<a href="{{ url_for('delete_project', projectname=project[1]) }}" class="btn btn-danger" role="button" title="Delete project" onclick="return confirm('Really delete {{ project[1] }}?');">
{{ utils.icon('trash') }}
{{ utils.render_icon('trash') }}
</a>
</div>
</td>
Expand All @@ -41,8 +41,8 @@ <h1>{{ title }}</h1>
<form id="form_layer" class="form" action="{{ url_for('upload_layer') }}" method="post" style="padding-bottom: 25px;" enctype="multipart/form-data">
<div class="well form-group">
{{ form_layer.csrf_token }}
{{ wtf.form_field(form_layer.upload, horizontal_columns=('lg', 2, 10), class="btn btn-default") }}
{{ wtf.form_field(form_layer.submit, horizontal_columns=('lg', 2, 10), class="btn btn-primary") }}
{{ wtf.render_field(form_layer.upload, horizontal_columns=('lg', 2, 10), class="btn btn-default") }}
{{ wtf.render_field(form_layer.submit, horizontal_columns=('lg', 2, 10), class="btn btn-primary") }}
</div>
</form>
<div class="panel panel-default">
Expand All @@ -62,7 +62,7 @@ <h1>{{ title }}</h1>
<td style="text-align: right">
<div class="btn-group">
<a href="{{ url_for('delete_layer', layername=layer) }}" class="btn btn-danger" role="button" title="Delete layer" onclick="return confirm('Really delete {{ layer }}?');">
{{ utils.icon('trash') }}
{{ utils.render_icon('trash') }}
</a>
</div>
</td>
Expand All @@ -75,8 +75,8 @@ <h1>{{ title }}</h1>
<form id="form_template" class="form" action="{{ url_for('upload_template') }}" method="post" style="padding-bottom: 25px;" enctype="multipart/form-data">
<div class="well form-group">
{{ form_template.csrf_token }}
{{ wtf.form_field(form_template.upload, horizontal_columns=('lg', 2, 10), class="btn btn-default") }}
{{ wtf.form_field(form_template.submit, horizontal_columns=('lg', 2, 10), class="btn btn-primary") }}
{{ wtf.render_field(form_template.upload, horizontal_columns=('lg', 2, 10), class="btn btn-default") }}
{{ wtf.render_field(form_template.submit, horizontal_columns=('lg', 2, 10), class="btn btn-primary") }}
</div>
</form>
<div class="panel panel-default">
Expand All @@ -96,7 +96,7 @@ <h1>{{ title }}</h1>
<td style="text-align: right">
<div class="btn-group">
<a href="{{ url_for('delete_template', templatename=template) }}" class="btn btn-danger" role="button" title="Delete template" onclick="return confirm('Really delete {{ template }}?');">
{{ utils.icon('trash') }}
{{ utils.render_icon('trash') }}
</a>
</div>
</td>
Expand Down
38 changes: 38 additions & 0 deletions src/plugins/themes/templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{% extends "templates/base.html" %}
{% block title %}{{ title }}{% endblock %}
{% block container %}
<ul class="nav nav-tabs mb-2" id="tabbar">
<li class="nav-item">
<a class="nav-link" aria-current="page" href="{{ url_for('themes') }}">Theme configuration</a>
</li>
<li class="nav-item">
<a class="nav-link" aria-current="page" href="{{ url_for('backgroundlayers') }}">Background layers</a>
</li>
<li class="nav-item">
<a class="nav-link" aria-current="page" href="{{ url_for('mapthumbs') }}">Mapthumbs</a>
</li>
<li class="nav-item">
<a class="nav-link" aria-current="page" href="{{ url_for('info_templates') }}">Info templates</a>
</li>
<li class="nav-item">
<a class="nav-link" aria-current="page" href="{{ url_for('files') }}">Upload files</a>
</li>
</ul>

<div class="container pb-4">
{% block themes_container %}
{% endblock %}
</div>
{% endblock %}

{% block scripts %}
{{ super() }}
<script type="text/javascript">
$('#tabbar a').each(function() {
$(this).removeClass('active');
if($(this).attr('href') === location.pathname) {
$(this).addClass('active');
}
});
</script>
{% endblock %}
Loading

0 comments on commit 5117100

Please sign in to comment.