Skip to content

Commit

Permalink
Anpassung Darstellung Buttons; Anpassung OWS-Einbindung
Browse files Browse the repository at this point in the history
  • Loading branch information
gdmhrogut committed Apr 30, 2024
1 parent 5cb014e commit 2896b59
Show file tree
Hide file tree
Showing 14 changed files with 61 additions and 76 deletions.
2 changes: 1 addition & 1 deletion bemas/templates/bemas/codelist-delete.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ <h5>
Möchten Sie den Eintrag <strong><em>{{ object }}</em></strong> der Codeliste <strong>{{ codelist_verbose_name_plural }}</strong> wirklich löschen?
</small>
</h5>
<div class="d-grid mt-4 mb-3 gap-2 d-md-block">
<div class="d-grid mt-4 mb-3 gap-2">
<button class="btn btn-danger" type="submit"><i class="fas fa-{{ 'delete'|get_icon }}"></i> {% if not is_mobile %}Codelisteneintrag {% endif %}löschen</button>
<a class="btn btn-warning" role="button" href="{{ codelist_cancel_url }}"><i class="fas fa-{{ 'cancel'|get_icon }}"></i> abbrechen</a>
</div>
Expand Down
2 changes: 1 addition & 1 deletion bemas/templates/bemas/codelist-form.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ <h2><i class="fas fa-{{ 'codelist'|get_icon }}"></i> <em>{{ codelist_verbose_nam
</table>
</div>
<div id="buttons">
<div class="d-grid mt-5 mb-3 gap-2 d-md-block">
<div class="d-grid mt-5 mb-3 gap-2">
<button class="btn btn-success" type="submit"><i class="fas fa-{{ 'save'|get_icon }}"></i> {% if not is_mobile %}{% if object %}Änderungen{% else %}neuen Codelisteneintrag{% endif %} {% endif %}speichern</button>
{% if object %}
<a class="btn btn-danger" role="button" href="{{ codelist_deletion_url }}"><i class="fas fa-{{ 'delete'|get_icon }}"></i> {% if not is_mobile %}Codelisteneintrag {% endif %}löschen</a>
Expand Down
2 changes: 1 addition & 1 deletion bemas/templates/bemas/generic-objectclass-delete.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ <h5>
{% if deletion_hints %}
{% include "bemas/container-deletion-hints.html" %}
{% endif %}
<div class="d-grid mt-4 mb-3 gap-2 d-md-block">
<div class="d-grid mt-4 mb-3 gap-2">
<button class="btn btn-danger" type="submit"><i class="fas fa-{{ 'delete'|get_icon }}"></i> {% if not is_mobile %}{{ objectclass_verbose_name }} {% endif %}löschen</button>
<a class="btn btn-warning" role="button" href="{{ objectclass_cancel_url }}"><i class="fas fa-{{ 'cancel'|get_icon }}"></i> abbrechen</a>
</div>
Expand Down
23 changes: 16 additions & 7 deletions bemas/templates/bemas/generic-objectclass-form.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,15 @@ <h2><i class="fas fa-{{ objectclass_name|lower|get_icon }}"></i> <em>{{ objectcl
{% endif %}
{% endfor %}
</table>
{% if not is_mobile %}
<div class="d-grid mt-5 mb-3 gap-2">
<button class="btn btn-success" type="submit" onclick="setFinalArrayFields(); setFinalGeometry('#id_{{ objectclass_geometry_field }}');"><i class="fas fa-{{ 'save'|get_icon }}"></i> {% if object %}Änderungen{% else %}{{ objectclass_new }} {{ objectclass_verbose_name }}{% endif %} speichern</button>
{% if object %}
<a class="btn btn-danger" role="button" href="{{ objectclass_deletion_url }}"><i class="fas fa-{{ 'delete'|get_icon }}"></i> {{ objectclass_verbose_name }} löschen</a>
{% endif %}
<a class="btn btn-warning" role="button" href="{{ objectclass_cancel_url }}"><i class="fas fa-{{ 'cancel'|get_icon }}"></i> abbrechen</a>
</div>
{% endif %}
</div>
{% if objectclass_is_geometry_model %}
<div id="map-addresssearch-container-form">
Expand All @@ -87,9 +96,9 @@ <h2><i class="fas fa-{{ objectclass_name|lower|get_icon }}"></i> <em>{{ objectcl
<textarea hidden id="id_{{ objectclass_geometry_field }}" class="required django-leaflet-raw-textarea" name="{{ objectclass_geometry_field }}" cols="150" rows="4">{ "type": "Point", "coordinates": [] }</textarea>
{% endif %}
{% leaflet_map "leaflet-map" callback="window.mapCallbackFunction" %}
<div class="d-grid mt-3 gap-2 d-md-block">
<div class="d-grid mt-3 gap-2">
<button disabled id="addressToMap" class="btn btn-primary" type="button"><i class="fas fa-{{ 'address_to_map'|get_icon }}"></i> Marker auf aktuelle Adresse setzen</button>
<button disabled id="mapToAddress" class="btn btn-primary" type="button"><i class="fas fa-{{ 'address'|get_icon }}"></i> Adresse des aktuellen Markers übernehmen</button>
<button disabled id="mapToAddress" class="btn btn-primary" type="button"><i class="fas fa-{{ 'address'|get_icon }}"></i> Adresse aus Karte übernehmen</button>
</div>
<div class="mt-3">
<label for="id_address" class="form-label">Adresse</label>
Expand All @@ -101,15 +110,15 @@ <h2><i class="fas fa-{{ objectclass_name|lower|get_icon }}"></i> <em>{{ objectcl
</div>
</div>
{% endif %}
<div id="buttons">
<div class="d-grid mt-5 mb-3 gap-2 d-md-block">
<button class="btn btn-success" type="submit" onclick="setFinalArrayFields(); setFinalGeometry('#id_{{ objectclass_geometry_field }}');"><i class="fas fa-{{ 'save'|get_icon }}"></i> {% if not is_mobile %}{% if object %}Änderungen{% else %}{{ objectclass_new }} {{ objectclass_verbose_name }}{% endif %} {% endif %}speichern</button>
{% if is_mobile %}
<div class="d-grid mt-5 mb-3 gap-2">
<button class="btn btn-success" type="submit" onclick="setFinalArrayFields(); setFinalGeometry('#id_{{ objectclass_geometry_field }}');"><i class="fas fa-{{ 'save'|get_icon }}"></i> speichern</button>
{% if object %}
<a class="btn btn-danger" role="button" href="{{ objectclass_deletion_url }}"><i class="fas fa-{{ 'delete'|get_icon }}"></i> {% if not is_mobile %}{{ objectclass_verbose_name }} {% endif %}löschen</a>
<a class="btn btn-danger" role="button" href="{{ objectclass_deletion_url }}"><i class="fas fa-{{ 'delete'|get_icon }}"></i> löschen</a>
{% endif %}
<a class="btn btn-warning" role="button" href="{{ objectclass_cancel_url }}"><i class="fas fa-{{ 'cancel'|get_icon }}"></i> abbrechen</a>
</div>
</div>
{% endif %}
{% include "modal-error.html" %}
</form>
<script>
Expand Down
4 changes: 0 additions & 4 deletions datenmanagement/static/datenmanagement/css/form-desktop.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#buttons {
position: absolute;
}

#custom-form {
width: 49%;
float: left;
Expand Down
3 changes: 2 additions & 1 deletion datenmanagement/static/datenmanagement/css/map.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
display: none;
}

#filter-one-click {
#filter-one-click,
#filter-one-click-buttons {
width: 100%;
}

Expand Down
16 changes: 7 additions & 9 deletions datenmanagement/static/datenmanagement/js/cartographicHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,19 +210,17 @@ function configureMap(map, owsProxyUrl, additionalWmsLayers = {}) {
});

// define basemap.de
const basemapde = L.tileLayer.wms('https://sgx.geodatenzentrum.de/wms_basemapde', {
layers: 'de_basemapde_web_raster_farbe',
format: map._wmsFormat,
const basemapde = L.tileLayer('https://sgx.geodatenzentrum.de/wmts_basemapde/tile/1.0.0/de_basemapde_web_raster_farbe/default/GLOBAL_WEBMERCATOR/{z}/{y}/{x}.png', {
maxZoom: map._maxLayerZoom,
attribution: '© GeoBasis-DE/BKG'
});

// define Liegenschaftskarte
const liegenschaftskarte = L.tileLayer.wms(owsProxyUrl + '/liegenschaftskarte/wms', {
layers: 'hro.liegenschaftskarte',
const liegenschaftskarte = L.tileLayer.wms(owsProxyUrl + 'https://www.geodaten-mv.de/dienste/alkis_wms', {
layers: 'adv_alkis_tatsaechliche_nutzung,adv_alkis_weiteres,adv_alkis_gebaeude,adv_alkis_flurstuecke',
format: map._wmsFormat,
maxZoom: map._maxLayerZoom,
attribution: Hanse- und Universitätsstadt Rostock (MLV intern)'
attribution: GeoBasis-DE/M-V'
});

// define Luftbild
Expand All @@ -232,16 +230,16 @@ function configureMap(map, owsProxyUrl, additionalWmsLayers = {}) {
});

// define Luftbild 2021
const luftbild_2021 = L.tileLayer.wms(owsProxyUrl + '/luftbild_2021/wms', {
const luftbild_2021 = L.tileLayer.wms(owsProxyUrl + 'https://geo.sv.rostock.de/geodienste/luftbild_2021/wms', {
layers: 'hro.luftbild_2021.luftbild_2021',
format: map._wmsFormat,
maxZoom: map._maxLayerZoom,
attribution: '© Hanse- und Universitätsstadt Rostock (MLV intern)'
});

// define Luftbild 2022
const luftbild_2022 = L.tileLayer.wms(owsProxyUrl + '/luftbild_2022/wms', {
layers: 'hro.luftbild_2022.luftbild_2022',
const luftbild_2022 = L.tileLayer.wms(owsProxyUrl + 'https://www.geodaten-mv.de/dienste/adv_dop10rgb', {
layers: 'mv_dop10',
format: map._wmsFormat,
maxZoom: map._maxLayerZoom,
attribution: '© GeoBasis-DE/M-V'
Expand Down
19 changes: 1 addition & 18 deletions datenmanagement/static/datenmanagement/js/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ function addDeleteFieldButton(field) {
*
* @param {Object} field - single field
* @param {Object} fieldToInsertAfter - field after which the passed single field (i.e. its wrapper) shall be inserted
* @param {boolean} [buttonsPosition=false] - dynamically set vertical positions of buttons?
*
* inserts the passed single field into an array field complex
*/
function addField(field, fieldToInsertAfter, buttonsPosition = false) {
function addField(field, fieldToInsertAfter) {
// create wrapper
let wrapper = $('<div/>', { class: 'input-group', style: 'margin-top:0.5rem' });
// insert passed single field into created wrapper
Expand All @@ -42,9 +41,6 @@ function addField(field, fieldToInsertAfter, buttonsPosition = false) {
wrapper.insertAfter(fieldToInsertAfter.parent().is('.input-group') ? fieldToInsertAfter.parent() : fieldToInsertAfter);
// add a deletion button
addDeleteFieldButton(field);
// dynamically set vertical positions of buttons
if (buttonsPosition)
setButtonsPosition();
}

/**
Expand Down Expand Up @@ -201,19 +197,6 @@ function setAddressReference(addressType, layer) {
.catch(error => console.log(error))
}

/**
* @function
* @name setButtonsPosition
*
* dynamically set vertical positions of buttons by means of position and size of the form element (plus 20 pixels extra "buffer")
*/
function setButtonsPosition() {
let top = $('#custom-form').position().top + $('#custom-form').height() + 20;
$('#buttons').offset({
top: top
});
}

/**
* @function
* @name setFinalArrayFields
Expand Down
2 changes: 1 addition & 1 deletion datenmanagement/templates/datenmanagement/add_another.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ <h5>
Möchten Sie den soeben erfolgreich angelegten Datensatz <strong><em>{{ object }}</em></strong> nochmal bearbeiten oder ihn als Vorlage für einen weiteren Datensatz zum Datenthema <strong>{{ model_verbose_name_plural }}</strong> verwenden?
</small>
</h5>
<div class="d-grid mt-4 gap-2 d-md-block">
<div class="d-grid mt-4 gap-2">
<a class="btn btn-success" role="button" href="{{ url_yes }}"><i class="fas fa-clone"></i> ja</a>
<a class="btn btn-warning" role="button" href="{{ url_no }}"><i class="fas fa-hand"></i> nein</a>
</div>
Expand Down
2 changes: 1 addition & 1 deletion datenmanagement/templates/datenmanagement/delete.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ <h5>
Möchten Sie den Datensatz <strong><em>{{ object }}</em></strong> des Datenthemas <strong>{{ model_verbose_name_plural }}</strong> wirklich löschen?
</small>
</h5>
<div class="d-grid mt-4 gap-2 d-md-block">
<div class="d-grid mt-4 gap-2">
<button class="btn btn-danger" type="submit"><i class="fas fa-trash"></i> Datensatz löschen</button>
<a class="btn btn-warning" href="{{ url_back }}"><i class="fas fa-hand"></i> abbrechen</a>
</div>
Expand Down
50 changes: 27 additions & 23 deletions datenmanagement/templates/datenmanagement/form.html
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,20 @@ <h5 class="alert-heading">assoziierte Datensätze</h5>
</tr>
{% endif %}
</table>
{% if not forms_in_mobile_mode and not is_mobile %}
<div class="d-grid mt-5 mb-3 gap-2">
{% if not object and user|user_has_model_add_permission:model_name_lower or object and user|user_has_model_change_permission:model_name_lower %}
<button class="btn btn-primary" type="submit" onclick="setFinalArrayFields(); setFinalGeometry();"><i class="fas fa-floppy-disk"></i> {% if object %}Änderungen{% else %}neuen Datensatz{% endif %} speichern</button>
{% endif %}
{% if url_model_add %}
<button class="btn btn-primary" type="submit" onclick="cloneObject('{{ url_model_add }}'); setFinalArrayFields(); setFinalGeometry();"><i class="fas fa-clone"></i> als neuen Datensatz klonen</button>
{% endif %}
{% if url_model_delete_object %}
<a class="btn btn-danger" role="button" href="{{ url_model_delete_object }}"><i class="fas fa-trash"></i> Datensatz löschen</a>
{% endif %}
<a class="btn btn-warning" role="button" href="{{ url_back }}"><i class="fas fa-hand"></i> abbrechen</a>
</div>
{% endif %}
</div>
{% if model_geometry_type %}
<div id="map-addresssearch-container-form">
Expand All @@ -186,17 +200,17 @@ <h5 class="alert-heading">assoziierte Datensätze</h5>
{% leaflet_map "leaflet-map" callback="window.mapCallbackFunction" settings_overrides=leaflet_config_overrides %}
{% if not object and user|user_has_model_add_permission:model_name_lower or object and user|user_has_model_change_permission:model_name_lower %}
{% if model_geometry_type == 'Point' or address_type and not address_mandatory %}
<div class="d-grid mt-3 gap-2 d-md-block">
<div class="d-grid mt-3 gap-2">
{% if model_geometry_type == 'Point' %}
<button disabled id="addressToMap" class="btn btn-primary" type="button"><i class="fas fa-location-dot"></i> Marker setzen</button>
<button disabled id="addressToMap" class="btn btn-primary" type="button"><i class="fas fa-location-dot"></i> Marker auf aktuelle Adresse setzen</button>
{% endif %}
{% if not address_mandatory %}
{% if address_type == 'Adresse' %}
<button disabled id="mapToAddress" class="btn btn-primary" type="button"><i class="fas fa-house"></i> Adresse übernehmen</button>
<button disabled id="mapToAddress" class="btn btn-primary" type="button"><i class="fas fa-house"></i> Adresse aus Karte übernehmen</button>
{% elif address_type == 'Straße' %}
<button disabled id="mapToStreet" class="btn btn-primary" type="button"><i class="fas fa-road"></i> Straße übernehmen</button>
<button disabled id="mapToStreet" class="btn btn-primary" type="button"><i class="fas fa-road"></i> Straße aus Karte übernehmen</button>
{% elif address_type == 'Gemeindeteil' %}
<button disabled id="mapToDistrict" class="btn btn-primary" type="button"><i class="fas fa-circle-dot"></i> Gemeindeteil übernehmen</button>
<button disabled id="mapToDistrict" class="btn btn-primary" type="button"><i class="fas fa-circle-dot"></i> Gemeindeteil aus Karte übernehmen</button>
{% endif %}
{% endif %}
</div>
Expand All @@ -218,20 +232,20 @@ <h5 class="alert-heading">assoziierte Datensätze</h5>
</div>
</div>
{% endif %}
<div id="buttons">
<div class="d-grid mt-5 mb-3 gap-2 d-md-block">
{% if forms_in_mobile_mode or is_mobile %}
<div class="d-grid mt-5 mb-3 gap-2">
{% if not object and user|user_has_model_add_permission:model_name_lower or object and user|user_has_model_change_permission:model_name_lower %}
<button class="btn btn-primary" type="submit" onclick="setFinalArrayFields(); setFinalGeometry();"><i class="fas fa-floppy-disk"></i> {% if not forms_in_mobile_mode and not is_mobile %}{% if object %}Änderungen{% else %}neuen Datensatz{% endif %} {% endif %}speichern</button>
<button class="btn btn-primary" type="submit" onclick="setFinalArrayFields(); setFinalGeometry();"><i class="fas fa-floppy-disk"></i> speichern</button>
{% endif %}
{% if url_model_add %}
<button class="btn btn-primary" type="submit" onclick="cloneObject('{{ url_model_add }}'); setFinalArrayFields(); setFinalGeometry();"><i class="fas fa-clone"></i> {% if not forms_in_mobile_mode and not is_mobile %}als neuen Datensatz {% endif %}klonen</button>
<button class="btn btn-primary" type="submit" onclick="cloneObject('{{ url_model_add }}'); setFinalArrayFields(); setFinalGeometry();"><i class="fas fa-clone"></i> klonen</button>
{% endif %}
{% if url_model_delete_object %}
<a class="btn btn-danger" role="button" href="{{ url_model_delete_object }}"><i class="fas fa-trash"></i> {% if not forms_in_mobile_mode and not is_mobile %}Datensatz {% endif %}löschen</a>
<a class="btn btn-danger" role="button" href="{{ url_model_delete_object }}"><i class="fas fa-trash"></i> löschen</a>
{% endif %}
<a class="btn btn-warning" role="button" href="{{ url_back }}"><i class="fas fa-hand"></i> abbrechen</a>
</div>
</div>
{% endif %}
{% include "modal-error.html" %}
{% if geojson_input or gpx_input %}
{% include "modal-loading.html" %}
Expand Down Expand Up @@ -545,12 +559,6 @@ <h5 class="alert-heading">assoziierte Datensätze</h5>
$(document).ready(function () {
keepDjangoRequiredMessages();

// define available variable for the necessity of dynamically setting vertical positions of buttons
let buttonsPosition = false;
{% if not forms_in_mobile_mode and not is_mobile and model_geometry_type %}
buttonsPosition = true
{% endif %}

// define variable for array fields and their values
// (i.e. for those array fields containing more than one value)
let arrayFieldsValues = [];
Expand Down Expand Up @@ -656,7 +664,7 @@ <h5 class="alert-heading">assoziierte Datensätze</h5>
newField.attr('value', valuesParsed[i]);
newField.val(valuesParsed[i]);
// insert new field in the correct place and provide a button to delete the field
addField(newField, currentField, buttonsPosition);
addField(newField, currentField);
currentField = newField;
}
}
Expand All @@ -677,7 +685,7 @@ <h5 class="alert-heading">assoziierte Datensätze</h5>
newField.removeAttr('value');
newField.val('');
// insert new field in the correct place and provide a button to delete the field
addField(newField, currentField, buttonsPosition);
addField(newField, currentField);
});
}
});
Expand Down Expand Up @@ -761,10 +769,6 @@ <h5 class="alert-heading">assoziierte Datensätze</h5>
$('#addressToMap').prop('disabled', false);
});

// dynamically set vertical positions of buttons
if (buttonsPosition)
setButtonsPosition();

// customize labels for mandatory Boolean fields
$('input[type="checkbox"]:not([value])').parent().parent().find('label').addClass('required');

Expand Down
4 changes: 2 additions & 2 deletions datenmanagement/templates/datenmanagement/map.html
Original file line number Diff line number Diff line change
Expand Up @@ -196,15 +196,15 @@ <h6>Ein-Klick-Filter</h6>
{% endfor %}
</div>
{% endif %}
<div id="filter-buttons" class="d-grid mt-4 gap-2 d-md-block">
<div id="filter-buttons" class="d-grid mt-4 gap-2">
<button id="filter-apply" class="btn btn-success"><i class="fas fa-filter"></i> Filter anwenden</button>
<button id="filter-reset" class="btn btn-warning"><i class="fas fa-filter-circle-xmark"></i> Filter zurücksetzen</button>
</div>
</div>
{% endif %}
<div {% if map_filters_enabled %}id="map-control"{% endif %}{% if not is_mobile %} class="side"{% endif %}>
<h5>Kartenausschnitt</h5>
<div class="d-grid mt-2 gap-2 d-md-block">
<div class="d-grid mt-2 gap-2">
<button id="map-extent-filter" class="btn btn-success"><i class="fas fa-map-location"></i> {% if map_filters_enabled %}aktuelle Filtermenge{% else %}alle Objekte{% endif %}</button>
<button id="map-extent-initial" class="btn btn-warning"><i class="fas fa-map"></i> gesamt</button>
</div>
Expand Down
6 changes: 0 additions & 6 deletions datenwerft/secrets.template
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,6 @@ ADDRESS_SEARCH_KEY = 'abcdefghijklmnopqrstuvwxyz012345'
REVERSE_SEARCH_RADIUS = 200 # m


# Toolbox app:
# OWS proxy

OWS_BASE = 'https://geo.sv.rostock.de/geodienste'


# Datenmanagement app:
# FME Server

Expand Down
2 changes: 1 addition & 1 deletion toolbox/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def dispatch(self, request, *args, **kwargs):
:param kwargs:
:return:
"""
self.destination_url = settings.OWS_BASE + sub(
self.destination_url = sub(
pattern='^.*owsproxy',
repl='',
string=str(request.get_full_path())
Expand Down

0 comments on commit 2896b59

Please sign in to comment.