From 8d3a31e612c510df48b8fa9497d888b1c69d1445 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Tue, 12 Jul 2022 14:46:57 +0200 Subject: [PATCH 1/8] improve sync_rando view --- geotrek/common/templates/common/sync_rando.html | 0 geotrek/common/urls.py | 4 +++- geotrek/common/views.py | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 geotrek/common/templates/common/sync_rando.html diff --git a/geotrek/common/templates/common/sync_rando.html b/geotrek/common/templates/common/sync_rando.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/geotrek/common/urls.py b/geotrek/common/urls.py index 172ad6fb7f..ebdbfcae74 100644 --- a/geotrek/common/urls.py +++ b/geotrek/common/urls.py @@ -7,7 +7,6 @@ from .models import HDViewPoint from . import views - class LangConverter(converters.StringConverter): regex = "[a-z]{2}(-[a-z]{2,4})?" # noqa @@ -63,6 +62,9 @@ class LangConverter(converters.StringConverter): class PublishableEntityOptions(MapEntityOptions): + document_public_view = views.DocumentPublic + document_public_booklet_view = views.DocumentBookletPublic + markup_public_view =views.MarkupPublic document_public_view = views.DocumentPublic document_public_booklet_view = views.DocumentBookletPublic markup_public_view = views.MarkupPublic diff --git a/geotrek/common/views.py b/geotrek/common/views.py index f6b4852bce..e9cd7b71fa 100644 --- a/geotrek/common/views.py +++ b/geotrek/common/views.py @@ -31,6 +31,10 @@ from django.views.defaults import page_not_found from django.views.decorators.http import require_http_methods, require_POST from django.views.generic import TemplateView, UpdateView, View +from django.views.generic import RedirectView, TemplateView, UpdateView, View +from django.views.decorators.http import require_POST, require_http_methods +from django.views.generic import RedirectView, View, FormView +from django.views.generic import TemplateView from django_celery_results.models import TaskResult from django_large_image.rest import LargeImageFileDetailMixin from geotrek.common.filters import HDViewPointFilterSet From d229609f6876e80d542d1efd2196bdeec67e8306 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Fri, 30 Sep 2022 11:23:44 +0200 Subject: [PATCH 2/8] pep8 --- geotrek/common/urls.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/geotrek/common/urls.py b/geotrek/common/urls.py index ebdbfcae74..172ad6fb7f 100644 --- a/geotrek/common/urls.py +++ b/geotrek/common/urls.py @@ -7,6 +7,7 @@ from .models import HDViewPoint from . import views + class LangConverter(converters.StringConverter): regex = "[a-z]{2}(-[a-z]{2,4})?" # noqa @@ -62,9 +63,6 @@ class LangConverter(converters.StringConverter): class PublishableEntityOptions(MapEntityOptions): - document_public_view = views.DocumentPublic - document_public_booklet_view = views.DocumentBookletPublic - markup_public_view =views.MarkupPublic document_public_view = views.DocumentPublic document_public_booklet_view = views.DocumentBookletPublic markup_public_view = views.MarkupPublic From d4166ca84fa6a93256f9216d085a28ea7097bc38 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Thu, 6 Oct 2022 10:41:23 +0200 Subject: [PATCH 3/8] import sync and import views --- docs/changelog.rst | 3 +- geotrek/api/templates/mobile/sync_mobile.html | 72 ++++++++------- .../static/common/css/sync.css} | 0 .../templates/common/import_dataset.html | 90 +++++++++---------- 4 files changed, 88 insertions(+), 77 deletions(-) rename geotrek/{trekking/static/trekking/css/sync_trek.css => common/static/common/css/sync.css} (100%) diff --git a/docs/changelog.rst b/docs/changelog.rst index c85cf11d15..3b2062ea24 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -936,6 +936,7 @@ In preparation for HD Views developments (PR #3298) - Show direction on lines with setting ``DIRECTION_ON_LINES_ENABLED`` in signage detail - Add mobile nginx configuration directly on Geotrek-admin +- Improve sync rando, sync mobile and import views. **Bug fixes** @@ -951,7 +952,7 @@ In preparation for HD Views developments (PR #3298) !!!! Clear cache after update. You can do this by going to admin panel, "clearcache" section, then delete default / fat and api_v2 !!!! -**Improvements** +**Improvments** - Cache API v2 Detail endpoints and themes list endpoint - Sensitive areas are now computed with buffered geometries with settings SENSITIVE_AREA_INTERSECTION_MARGIN. Use ST_INTERSECTS on it is faster. diff --git a/geotrek/api/templates/mobile/sync_mobile.html b/geotrek/api/templates/mobile/sync_mobile.html index f689781660..c0f6cefb9b 100644 --- a/geotrek/api/templates/mobile/sync_mobile.html +++ b/geotrek/api/templates/mobile/sync_mobile.html @@ -32,29 +32,29 @@ has_progress = true; disable_sync_button(false); - $('#progress-value').show(); - $("#progress-value").removeClass('bar-danger'); - $("#progress-value").parent().addClass("active"); + $("#progress-bar").removeClass('bg-danger'); + $("#progress-bar").parent().addClass("active"); if (this.result.current) { - $("#progress-value").css("width", this.result.current+'%'); + $("#progress-bar").css("width", this.result.current + '%'); - if (this.result.current == 100){ - $("#progress-value").parent().removeClass("active"); - $("#progress-value").addClass('bar-success'); - } + if (this.result.current == 100) { + $("#progress-bar").parent().removeClass("active"); + $("#progress-bar").addClass('bg-success'); + } } if (this.result.infos) { - $("#progress-text").text(this.result.infos); - } + $("#progress-bar").text(this.result.infos); + } } else { if (this.status == 'FAILURE'){ // case of exception in task - $("#progress-text").text("{% trans 'An error occured' %}"); - $('#exception-message').text(this.result.exc_type + ' : ' + this.result.exc_message) - $("#progress-value").addClass('bar-danger'); - $("#progress-value").parent().removeClass("active"); + $("#progress-bar").text("{% trans 'An error occured' %}"); + $('#exception-message').text(this.result.exc_type + ' : ' + this.result.exc_message) + $('#exception-message').show(); + $("#progress-bar").addClass('bg-danger'); + $("#progress-value").parent().removeClass("active"); } } }); @@ -70,11 +70,12 @@ get_sync_infos(); $('#btn-confirm')[0].addEventListener('click', function(evt) { - $("#progress-value").css("width", '0%'); - $("#progress-text").text(''); - $("#progress-value").parent().addClass("active"); - $("#progress-value").removeClass('bar-success'); - $("#progress-value").removeClass('bar-danger'); + $('#exception-message').hide(); + $("#progress-bar").css("width", '0%'); + $("#progress-bar").text(''); + $("#progress-bar").parent().addClass("active"); + $("#progress-bar").removeClass('bg-success'); + $("#progress-bar").removeClass('bg-danger'); $.post( $('#form-sync').attr('action'), @@ -87,10 +88,10 @@ window.setInterval(function(){ get_sync_infos(); - }, 500); + }, 1000); }); - + {% endblock extrahead %} {% block toolbar %} @@ -98,22 +99,31 @@ {% block mainpanel %} -
-

{% trans "Mobile sync" %}

-
-
- -
- {% block mainform %} - {% crispy form form.helper %} - {% endblock mainform %} +
+
+
+

{% trans "Mobile sync" %}

+
+ +
+
+
+
+ +
+ +