diff --git a/corehq/apps/hqadmin/static/hqadmin/js/mass_email.js b/corehq/apps/hqadmin/static/hqadmin/js/mass_email.js new file mode 100644 index 000000000000..586b2819f267 --- /dev/null +++ b/corehq/apps/hqadmin/static/hqadmin/js/mass_email.js @@ -0,0 +1,19 @@ +hqDefine("hqadmin/js/mass_email", [ + 'jquery', + 'commcarehq', +], function ( + $ +) { + $(function () { + $('#real_email').click(function (e) { + if ($(this).prop('checked')) { + $('#warning_modal').modal('show'); + e.preventDefault(); + } + }); + + $('#accept_mass_email').click(function () { + $('#real_email').prop('checked', 'checked'); + }); + }); +}); diff --git a/corehq/apps/hqadmin/templates/hqadmin/disable_two_factor.html b/corehq/apps/hqadmin/templates/hqadmin/disable_two_factor.html index 5aa01b0300c6..c0a7a37e93a2 100644 --- a/corehq/apps/hqadmin/templates/hqadmin/disable_two_factor.html +++ b/corehq/apps/hqadmin/templates/hqadmin/disable_two_factor.html @@ -1,14 +1,15 @@ -{% extends "hqadmin/hqadmin_base_report.html" %} +{% extends "hqwebapp/bootstrap3/base_section.html" %} {% load i18n %} {% load crispy_forms_tags %} -{% block reportcontent %} -

{% block title %}{% trans "Temporarily Disable Two-factor Authentication" %}{% endblock %}

+{% block title %}{{ current_page.page_name }}{% endblock %} + +{% block page_content %}

{% blocktrans %}You are about to temporarily disable two-factor authentication for {{ username }}. This compromises their account security, are you sure?{% endblocktrans %}

When temporarily disabling and resetting Two-Factor Auth it is important to verify that the request was made by the owner of the account (and not faked by someone else).

-

Please follow the guidelines on the wiki.

+

Please follow the guidelines on the wiki.

{% crispy form %} {% endblock %} diff --git a/corehq/apps/hqadmin/templates/hqadmin/disable_user.html b/corehq/apps/hqadmin/templates/hqadmin/disable_user.html index 2203333c57d8..75b5110c7fbc 100644 --- a/corehq/apps/hqadmin/templates/hqadmin/disable_user.html +++ b/corehq/apps/hqadmin/templates/hqadmin/disable_user.html @@ -1,9 +1,10 @@ -{% extends "hqadmin/hqadmin_base_report.html" %} +{% extends "hqwebapp/bootstrap3/base_section.html" %} {% load i18n %} {% load crispy_forms_tags %} -{% block reportcontent %} -

{% block title %}{{ verb|title }} {% trans "User Account" %}{% endblock %}

+{% block title %}{{ current_page.page_name }}{% endblock %} + +{% block page_content %}

{% blocktrans %}You are about to {{ verb }} the user account for "{{ username }}".{% endblocktrans %}

This will prevent them from using CommCare HQ at all and will be enforced immediately.

{% crispy form %} diff --git a/corehq/apps/hqadmin/templates/hqadmin/global_thresholds.html b/corehq/apps/hqadmin/templates/hqadmin/global_thresholds.html index 610e22b16a2d..6ba866e7dcf7 100644 --- a/corehq/apps/hqadmin/templates/hqadmin/global_thresholds.html +++ b/corehq/apps/hqadmin/templates/hqadmin/global_thresholds.html @@ -1,7 +1,9 @@ -{% extends "hqadmin/hqadmin_base_report.html" %} +{% extends "hqwebapp/bootstrap3/base_section.html" %} {% load hq_shared_tags %} -{% block reportcontent %} +{% block title %}{{ current_page.page_name }}{% endblock %} + +{% block page_content %} {% include "domain/admin/partials/bootstrap3/project_limits_table.html" %} diff --git a/corehq/apps/hqadmin/templates/hqadmin/hqadmin_base_report.html b/corehq/apps/hqadmin/templates/hqadmin/hqadmin_base_report.html deleted file mode 100644 index 374241b4b965..000000000000 --- a/corehq/apps/hqadmin/templates/hqadmin/hqadmin_base_report.html +++ /dev/null @@ -1,61 +0,0 @@ -{% extends "hqwebapp/bootstrap3/two_column.html" %} -{% load hq_shared_tags %} -{% load i18n %} - -{% block title %}{% if current_page and section %}{% if current_page.title %}{{ current_page.title }} : {% endif %}{{ section.page_name }} {% else %}{{ report.title }}{% endif %}: Admin Reports{% endblock %} - -{% block js %}{{ block.super }} - {% if not use_js_bundler %} - {% if request.use_datatables %} - - {% endif %} - {% if request.use_jquery_ui %} - - {% endif %} - - - {% endif %} -{% endblock %} - -{% block page_breadcrumbs %} - -{% endblock %} - -{% block pre_page_content %} - {% if report.is_exportable or report.is_emailable or report.is_printable %} -
- {% if report.is_exportable %} - - {% trans "Export to Excel" %} - - {% endif %} - - {% if report.is_emailable and request.couch_user.can_download_reports %} - - {% trans "Email report" %} - - {% endif %} - - {% if report.is_printable %} - - {% trans "Print" %} - - {% endif %} -
- {% endif %} -{% endblock %} - -{% block page_content %} - {% initial_page_data 'aoColumns' aoColumns %} - {% if not hide_filters %} - {% include "hqadmin/hqadmin_base_filters.html" %} - {% endif %} -
- {% block reportcontent %}{% endblock %} -
-{% endblock %} diff --git a/corehq/apps/hqadmin/templates/hqadmin/mass_email.html b/corehq/apps/hqadmin/templates/hqadmin/mass_email.html index 2e49c5472728..79a389627b74 100644 --- a/corehq/apps/hqadmin/templates/hqadmin/mass_email.html +++ b/corehq/apps/hqadmin/templates/hqadmin/mass_email.html @@ -1,25 +1,12 @@ -{% extends "hqadmin/hqadmin_base_report.html" %} +{% extends "hqwebapp/bootstrap3/base_section.html" %} {% load hq_shared_tags %} {% load i18n %} -{% block title %}Mass Email Users{% endblock %} -{% block js-inline %} {{ block.super }} - -{% endblock %} -{% block reportcontent %} -

+{% block title %}{{ current_page.page_name }}{% endblock %} + +{% js_entry_b3 "hqadmin/js/mass_email" %} + +{% block page_content %} {% if form.errors %}
{{ form.errors }}
{% endif %} @@ -28,7 +15,7 @@ This is the email mailing list tool. Please exercise caution when using it.

-

+

Leave the email all users checkbox unchecked to send a test email only to yourself. This is useful for verifying that your formatting is correct before sending a real message. @@ -49,8 +36,7 @@ name="email_subject" type="text" class="form-control" - placeholder="Enter subject..."> - + placeholder="Enter subject..."/>

diff --git a/corehq/apps/hqadmin/templates/hqadmin/messaging_case_updates.html b/corehq/apps/hqadmin/templates/hqadmin/messaging_case_updates.html index e3834eb99787..4d60df305559 100644 --- a/corehq/apps/hqadmin/templates/hqadmin/messaging_case_updates.html +++ b/corehq/apps/hqadmin/templates/hqadmin/messaging_case_updates.html @@ -1,9 +1,9 @@ -{% extends "hqadmin/hqadmin_base_report.html" %} +{% extends "hqwebapp/bootstrap3/base_section.html" %} {% load crispy_forms_tags %} {% load i18n %} -{% block reportcontent %} -

{% trans "Reprocess Messaging Case Updates" %}

-
- {% crispy form %} -
+ +{% block title %}{{ current_page.page_name }}{% endblock %} + +{% block page_content %} + {% crispy form %} {% endblock %} diff --git a/corehq/apps/hqadmin/templates/hqadmin/system_info.html b/corehq/apps/hqadmin/templates/hqadmin/system_info.html index 4d4b6de6c945..e46eaf13e66b 100644 --- a/corehq/apps/hqadmin/templates/hqadmin/system_info.html +++ b/corehq/apps/hqadmin/templates/hqadmin/system_info.html @@ -1,11 +1,13 @@ -{% extends "hqadmin/hqadmin_base_report.html" %} +{% extends "hqwebapp/bootstrap3/base_section.html" %} {% load hq_shared_tags %} {% load i18n %} {% load humanize %} {% js_entry_b3 'hqadmin/js/system_info' %} -{% block reportcontent %} +{% block title %}{{ current_page.page_name }}{% endblock %} + +{% block page_content %} {% initial_page_data "celery_update" celery_update %} {% initial_page_data "couch_update" couch_update %} {% initial_page_data "is_bigcouch" is_bigcouch %} diff --git a/corehq/apps/hqadmin/views/__init__.py b/corehq/apps/hqadmin/views/__init__.py index 5a1a925bb3f3..976108073d1b 100644 --- a/corehq/apps/hqadmin/views/__init__.py +++ b/corehq/apps/hqadmin/views/__init__.py @@ -31,5 +31,4 @@ from corehq.apps.hqadmin.views.utils import ( BaseAdminSectionView, default, - get_hqadmin_base_context, ) diff --git a/corehq/apps/hqadmin/views/operations.py b/corehq/apps/hqadmin/views/operations.py index 1d7516d41dea..5676c8990114 100644 --- a/corehq/apps/hqadmin/views/operations.py +++ b/corehq/apps/hqadmin/views/operations.py @@ -17,7 +17,7 @@ from corehq.apps.hqadmin.tasks import send_mass_emails from corehq.apps.hqadmin.views.utils import ( BaseAdminSectionView, - get_hqadmin_base_context, + get_breadcrumbs, ) from corehq.form_processor.exceptions import CaseNotFound from corehq.form_processor.models import CommCareCase @@ -40,9 +40,10 @@ def mass_email(request): else: form = EmailForm() - context = get_hqadmin_base_context(request) - context['hide_filters'] = True - context['form'] = form + context = { + 'form': form, + **get_breadcrumbs('Mass Email Users', 'mass_email'), + } return render(request, "hqadmin/mass_email.html", context) @@ -97,11 +98,9 @@ def form(self): @property def page_context(self): - context = get_hqadmin_base_context(self.request) - context.update({ + return { 'form': self.form, - }) - return context + } def get_case(self, case_id): try: diff --git a/corehq/apps/hqadmin/views/system.py b/corehq/apps/hqadmin/views/system.py index e4e5ab278c50..e358270d53aa 100644 --- a/corehq/apps/hqadmin/views/system.py +++ b/corehq/apps/hqadmin/views/system.py @@ -32,7 +32,6 @@ from corehq.apps.hqadmin.utils import get_celery_stats from corehq.apps.hqadmin.views.utils import ( BaseAdminSectionView, - get_hqadmin_base_context, ) from corehq.apps.hqwebapp.decorators import use_datatables, use_jquery_ui from corehq.apps.receiverwrapper.rate_limiter import ( @@ -56,7 +55,7 @@ def dispatch(self, request, *args, **kwargs): def page_context(self): environment = settings.SERVER_ENVIRONMENT - context = get_hqadmin_base_context(self.request) + context = {} context['couch_update'] = self.request.GET.get('couch_update', 5000) context['celery_update'] = self.request.GET.get('celery_update', 10000) context['db_update'] = self.request.GET.get('db_update', 30000) diff --git a/corehq/apps/hqadmin/views/users.py b/corehq/apps/hqadmin/views/users.py index b408c41b9fda..cf34bbf3c387 100644 --- a/corehq/apps/hqadmin/views/users.py +++ b/corehq/apps/hqadmin/views/users.py @@ -1,9 +1,7 @@ import csv import itertools -import settings import os import urllib.parse -import uuid from collections import Counter from datetime import datetime, timedelta from io import StringIO @@ -56,7 +54,7 @@ SuperuserManagementForm, OffboardingUserListForm, ) -from corehq.apps.hqadmin.views.utils import BaseAdminSectionView +from corehq.apps.hqadmin.views.utils import BaseAdminSectionView, get_breadcrumbs from corehq.apps.hqmedia.tasks import create_files_for_ccz from corehq.apps.ota.views import get_restore_params, get_restore_response from corehq.apps.users.audit.change_messages import UserChangeMessage @@ -457,7 +455,8 @@ def get(self, request, *args, **kwargs): def get_context_data(self, **kwargs): context = super(DisableUserView, self).get_context_data(**kwargs) - context['verb'] = 'disable' if self.user.is_active else 'enable' + verb = 'Disable' if self.user.is_active else 'Enable' + context.update(get_breadcrumbs(f'{verb} User Account', 'disable_user')) context['username'] = self.username return context @@ -539,6 +538,7 @@ def get_initial(self): def render_to_response(self, context, **response_kwargs): context.update({ + **get_breadcrumbs('Temporarily Disable Two-factor Authentication', self.urlname), 'username': self.request.GET.get("q"), }) return super().render_to_response(context, **response_kwargs) diff --git a/corehq/apps/hqadmin/views/utils.py b/corehq/apps/hqadmin/views/utils.py index 68cfc4419e1c..244bb55847bb 100644 --- a/corehq/apps/hqadmin/views/utils.py +++ b/corehq/apps/hqadmin/views/utils.py @@ -12,9 +12,16 @@ def default(request): return HttpResponseRedirect(UserListReport.get_url()) -def get_hqadmin_base_context(request): +def get_breadcrumbs(current_title, current_urlname): return { - "domain": None, + 'current_page': { + 'url': reverse(current_urlname), + 'page_name': current_title, + }, + 'section': { + 'url': reverse('default_admin_report'), + 'title': 'Admin', + }, }