From f551a552259bcb45204f66385e35c085845d1734 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Thu, 6 Oct 2022 10:41:23 +0200 Subject: [PATCH] import sync and import views --- docs/changelog.rst | 8 +- geotrek/api/templates/mobile/sync_mobile.html | 72 ++++++++------- .../static/common/css/sync.css} | 0 .../templates/common/import_dataset.html | 90 +++++++++---------- .../common/templates/common/sync_rando.html | 5 +- 5 files changed, 94 insertions(+), 81 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 501debba82..5d9f293a07 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -5,6 +5,10 @@ CHANGELOG 2.91.1+dev (XXXX-XX-XX) ----------------------- +**Minor improvements** + +- Improve sync rando, sync mobile and import views. + **Improvments** - Cache API v2 Detail endpoints and themes list endpoint @@ -92,7 +96,7 @@ CHANGELOG ----------------------- **DO NOT USE IT!** - + **Warning** - Migrations for Touristic Events can fail depending on data for ``participant_number`` - Skip to 2.89.1 instead @@ -117,7 +121,7 @@ CHANGELOG - Fix TouristicEvent with no end dates are not returned in APIv2 (#3127) -**Minor improvements** +**Minor improvements** - Check ``begin_date`` is before ``end_date`` in TouristicEvent forms (#3237) - Set ``begin_date`` not null for TouristicEvents (#3237) 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" %}

+
+ +
+
+
+
+ +
+ +