From 99ebbde0db56dc9aacb7b3f738249e36177c88c0 Mon Sep 17 00:00:00 2001 From: Matt Riley Date: Tue, 10 Dec 2024 14:16:22 -0500 Subject: [PATCH 1/2] Fix a bug with display logic for translated enterprise tiles --- .../static/enterprise/js/project_dashboard.js | 4 ++-- .../enterprise/partials/project_tile.html | 14 +++----------- .../templates/enterprise/project_dashboard.html | 2 +- corehq/apps/enterprise/views.py | 1 + 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/corehq/apps/enterprise/static/enterprise/js/project_dashboard.js b/corehq/apps/enterprise/static/enterprise/js/project_dashboard.js index 1bf5290e47dc..e962e769f402 100644 --- a/corehq/apps/enterprise/static/enterprise/js/project_dashboard.js +++ b/corehq/apps/enterprise/static/enterprise/js/project_dashboard.js @@ -258,12 +258,12 @@ hqDefine("enterprise/js/project_dashboard", [ const maxDateRangeDays = initialPageData.get("max_date_range_days"); const displayMap = { - "form_submission": formSubmissionsDisplay, + "form_submissions": formSubmissionsDisplay, "sms": smsDisplay, }; const dateRangeModal = DateRangeModal($dateRangeModal, datePicker, dateRangePresetOptions, maxDateRangeDays, displayMap); - $("#form_submission_dateRangeDisplay").koApplyBindings(formSubmissionsDisplay); + $("#form_submissions_dateRangeDisplay").koApplyBindings(formSubmissionsDisplay); $("#sms_dateRangeDisplay").koApplyBindings(smsDisplay); $dateRangeModal.koApplyBindings( dateRangeModal diff --git a/corehq/apps/enterprise/templates/enterprise/partials/project_tile.html b/corehq/apps/enterprise/templates/enterprise/partials/project_tile.html index 83a68d0493b6..777a1365718d 100644 --- a/corehq/apps/enterprise/templates/enterprise/partials/project_tile.html +++ b/corehq/apps/enterprise/templates/enterprise/partials/project_tile.html @@ -14,21 +14,13 @@

{{ report.title }}

{{ report.total_description }}
- {% if report.title == "Mobile Form Submissions" %} + {% if report.slug in uses_date_range %} - {% elif report.title == "SMS Usage" %} - {% else %}
{{ " " }}
diff --git a/corehq/apps/enterprise/templates/enterprise/project_dashboard.html b/corehq/apps/enterprise/templates/enterprise/project_dashboard.html index 6326db287a26..447dd744dfec 100644 --- a/corehq/apps/enterprise/templates/enterprise/project_dashboard.html +++ b/corehq/apps/enterprise/templates/enterprise/project_dashboard.html @@ -15,7 +15,7 @@
{% for report in reports %} - {% include 'enterprise/partials/project_tile.html' with report=report %} + {% include 'enterprise/partials/project_tile.html' with report=report uses_date_range=uses_date_range %} {% endfor %}
diff --git a/corehq/apps/enterprise/views.py b/corehq/apps/enterprise/views.py index 8f2c9354595e..5b1e439f397f 100644 --- a/corehq/apps/enterprise/views.py +++ b/corehq/apps/enterprise/views.py @@ -93,6 +93,7 @@ def platform_overview(request, domain): EnterpriseReport.ODATA_FEEDS, EnterpriseReport.SMS, )], + 'uses_date_range': [EnterpriseReport.FORM_SUBMISSIONS, EnterpriseReport.SMS], 'metric_type': 'Platform Overview', }) From 3a007c0de23909fa28d0b43176753f8f939776b9 Mon Sep 17 00:00:00 2001 From: Matt Riley Date: Tue, 10 Dec 2024 14:18:00 -0500 Subject: [PATCH 2/2] Remove nonbreaking space from template logic --- .../enterprise/templates/enterprise/partials/project_tile.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/corehq/apps/enterprise/templates/enterprise/partials/project_tile.html b/corehq/apps/enterprise/templates/enterprise/partials/project_tile.html index 777a1365718d..606186dfa715 100644 --- a/corehq/apps/enterprise/templates/enterprise/partials/project_tile.html +++ b/corehq/apps/enterprise/templates/enterprise/partials/project_tile.html @@ -23,7 +23,7 @@

{{ report.title }}

data-sender="{{ report.slug }}" >  {% else %} -
{{ " " }}
+
 
{% endif %}