From 1d4cf236e82735d455525b879c41895d17c99461 Mon Sep 17 00:00:00 2001 From: Jenny Schweers Date: Thu, 19 Sep 2024 11:58:27 -0400 Subject: [PATCH 1/3] Migrated view to B5 --- corehq/apps/export/forms.py | 17 ++++++----------- .../bootstrap5/datasource_export_view.html | 8 ++++---- corehq/apps/export/views/download.py | 5 +++-- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/corehq/apps/export/forms.py b/corehq/apps/export/forms.py index 9ef5382e4221..d763206f5ea3 100644 --- a/corehq/apps/export/forms.py +++ b/corehq/apps/export/forms.py @@ -9,7 +9,6 @@ import dateutil from crispy_forms import layout as crispy from crispy_forms.helper import FormHelper -from corehq.apps.hqwebapp import crispy as hqcrispy from crispy_forms.bootstrap import StrictButton from corehq import privileges @@ -1087,8 +1086,6 @@ class DatasourceExportDownloadForm(forms.Form): def __init__(self, domain, *args, **kwargs): super(DatasourceExportDownloadForm, self).__init__(*args, **kwargs) self.helper = FormHelper() - self.helper.label_class = 'col-sm-3 col-md-2 col-lg-2' - self.helper.field_class = 'col-sm-9 col-md-8 col-lg-3' self.fields['data_source'].choices = self.domain_datasources(domain) @@ -1104,14 +1101,12 @@ def __init__(self, domain, *args, **kwargs): data_bind='visible: haveDatasources' ), ), - hqcrispy.FormActions( - StrictButton( - _("Download Data Export Tool query file"), - type="submit", - css_class="btn-primary", - data_bind="enable: haveDatasources" - ), - ) + StrictButton( + _("Download Data Export Tool query file"), + type="submit", + css_class="btn-primary", + data_bind="enable: haveDatasources" + ), ) @staticmethod diff --git a/corehq/apps/export/templates/export/bootstrap5/datasource_export_view.html b/corehq/apps/export/templates/export/bootstrap5/datasource_export_view.html index 297dba911202..167552de8281 100644 --- a/corehq/apps/export/templates/export/bootstrap5/datasource_export_view.html +++ b/corehq/apps/export/templates/export/bootstrap5/datasource_export_view.html @@ -1,4 +1,4 @@ -{% extends 'hqwebapp/bootstrap3/base_section.html' %} +{% extends 'hqwebapp/bootstrap5/base_section.html' %} {% load crispy_forms_tags %} {% load i18n %} {% load compress %} @@ -13,15 +13,15 @@ {% block page_content %}

{% blocktrans %} - Generate a query file for the Data Export Tool from any of the project's data sources. + Generate a query file for the Data Export Tool from any of the project's data sources. {% endblocktrans %}

{% blocktrans %} - The project has no data sources configured. + The project has no data sources configured. {% endblocktrans %}
- {% crispy form %} {# todo B5: check crispy #} + {% crispy form %}
{% endblock %} diff --git a/corehq/apps/export/views/download.py b/corehq/apps/export/views/download.py index a221b67177fa..ab36b6c59987 100644 --- a/corehq/apps/export/views/download.py +++ b/corehq/apps/export/views/download.py @@ -61,7 +61,7 @@ ExportsPermissionsManager, case_type_or_app_limit_exceeded ) -from corehq.apps.hqwebapp.decorators import use_daterangepicker +from corehq.apps.hqwebapp.decorators import use_bootstrap5, use_daterangepicker from corehq.apps.hqwebapp.widgets import DateRangePickerWidget from corehq.apps.locations.permissions import location_safe from corehq.apps.reports.analytics.esaccessors import media_export_is_too_big @@ -528,8 +528,9 @@ def parent_pages(self): class DownloadNewDatasourceExportView(BaseProjectDataView): urlname = "data_export_page" page_title = gettext_noop("Export Data Source Data") - template_name = 'export/bootstrap3/datasource_export_view.html' + template_name = 'export/bootstrap5/datasource_export_view.html' + @use_bootstrap5 def dispatch(self, *args, **kwargs): if not EXPORT_DATA_SOURCE_DATA.enabled(self.domain): raise Http404() From 9df710a24303747a3c803037165dd45b7f30499b Mon Sep 17 00:00:00 2001 From: Jenny Schweers Date: Thu, 19 Sep 2024 16:00:10 +0000 Subject: [PATCH 2/3] "Bootstrap 5 Migration - Marked template 'export/datasource_export_view.html' as complete and un-split files." --- .../bootstrap3/datasource_export_view.html | 27 ------------------- .../datasource_export_view.html | 0 corehq/apps/export/views/download.py | 2 +- .../bootstrap/status/bootstrap3_to_5.json | 3 ++- 4 files changed, 3 insertions(+), 29 deletions(-) delete mode 100644 corehq/apps/export/templates/export/bootstrap3/datasource_export_view.html rename corehq/apps/export/templates/export/{bootstrap5 => }/datasource_export_view.html (100%) diff --git a/corehq/apps/export/templates/export/bootstrap3/datasource_export_view.html b/corehq/apps/export/templates/export/bootstrap3/datasource_export_view.html deleted file mode 100644 index 8f1505b593e2..000000000000 --- a/corehq/apps/export/templates/export/bootstrap3/datasource_export_view.html +++ /dev/null @@ -1,27 +0,0 @@ -{% extends 'hqwebapp/bootstrap3/base_section.html' %} -{% load crispy_forms_tags %} -{% load i18n %} -{% load compress %} -{% load hq_shared_tags %} - -{% requirejs_main 'export/js/datasource_export' %} - -{% block page_title %} -{% trans "Export Data Source Data" %} -{% endblock %} - -{% block page_content %} -

- {% blocktrans %} - Generate a query file for the Data Export Tool from any of the project's data sources. - {% endblocktrans %} -

-
-
- {% blocktrans %} - The project has no data sources configured. - {% endblocktrans %} -
- {% crispy form %} -
-{% endblock %} diff --git a/corehq/apps/export/templates/export/bootstrap5/datasource_export_view.html b/corehq/apps/export/templates/export/datasource_export_view.html similarity index 100% rename from corehq/apps/export/templates/export/bootstrap5/datasource_export_view.html rename to corehq/apps/export/templates/export/datasource_export_view.html diff --git a/corehq/apps/export/views/download.py b/corehq/apps/export/views/download.py index ab36b6c59987..d17070b5f4b2 100644 --- a/corehq/apps/export/views/download.py +++ b/corehq/apps/export/views/download.py @@ -528,7 +528,7 @@ def parent_pages(self): class DownloadNewDatasourceExportView(BaseProjectDataView): urlname = "data_export_page" page_title = gettext_noop("Export Data Source Data") - template_name = 'export/bootstrap5/datasource_export_view.html' + template_name = 'export/datasource_export_view.html' @use_bootstrap5 def dispatch(self, *args, **kwargs): diff --git a/corehq/apps/hqwebapp/utils/bootstrap/status/bootstrap3_to_5.json b/corehq/apps/hqwebapp/utils/bootstrap/status/bootstrap3_to_5.json index 4399d9bcbdc2..cb7966657c47 100644 --- a/corehq/apps/hqwebapp/utils/bootstrap/status/bootstrap3_to_5.json +++ b/corehq/apps/hqwebapp/utils/bootstrap/status/bootstrap3_to_5.json @@ -136,7 +136,8 @@ "in_progress": true, "templates": [ "download_data_files.html", - "paywall.html" + "paywall.html", + "datasource_export_view.html" ], "javascript": [ "js/download_data_files.js" From 653c16224bd03177b46c7ed9af8e4038181ad129 Mon Sep 17 00:00:00 2001 From: Jenny Schweers Date: Thu, 19 Sep 2024 16:01:09 +0000 Subject: [PATCH 3/3] "Bootstrap 5 Migration - Rebuilt diffs" --- .../datasource_export_view.html.diff.txt | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 corehq/apps/hqwebapp/tests/data/bootstrap5_diffs/export/datasource_export_view.html.diff.txt diff --git a/corehq/apps/hqwebapp/tests/data/bootstrap5_diffs/export/datasource_export_view.html.diff.txt b/corehq/apps/hqwebapp/tests/data/bootstrap5_diffs/export/datasource_export_view.html.diff.txt deleted file mode 100644 index 98aa61ed978d..000000000000 --- a/corehq/apps/hqwebapp/tests/data/bootstrap5_diffs/export/datasource_export_view.html.diff.txt +++ /dev/null @@ -1,19 +0,0 @@ ---- -+++ -@@ -4,7 +4,7 @@ - {% load compress %} - {% load hq_shared_tags %} - --{% requirejs_main 'export/js/datasource_export' %} -+{% requirejs_main_b5 'export/js/datasource_export' %} - - {% block page_title %} - {% trans "Export Data Source Data" %} -@@ -22,6 +22,6 @@ - The project has no data sources configured. - {% endblocktrans %} - -- {% crispy form %} -+ {% crispy form %} {# todo B5: check crispy #} - - {% endblock %}