Skip to content

Commit

Permalink
Merge pull request #35305 from dimagi/jls/webpack-easiest-20-percent
Browse files Browse the repository at this point in the history
[webpack] Migrate easy, low-risk apps
  • Loading branch information
orangejenny authored Nov 4, 2024
2 parents bcd4eab + 17619cc commit 7e60e09
Show file tree
Hide file tree
Showing 60 changed files with 88 additions and 245 deletions.
1 change: 1 addition & 0 deletions corehq/apps/accounting/static/accounting/js/widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ hqDefine('accounting/js/widgets', [
'underscore',
'hqwebapp/js/utils/email',
'select2/dist/js/select2.full.min',
'commcarehq_b3',
], function (
$,
ko,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% load crispy_forms_tags %}
{% load hq_shared_tags %}

{% requirejs_main "accounting/js/widgets" %}
{% js_entry_b3 "accounting/js/widgets" %}

{% block page_content %}
{% crispy trigger_form %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% load crispy_forms_tags %}
{% load hq_shared_tags %}

{% requirejs_main "accounting/js/widgets" %}
{% js_entry_b3 "accounting/js/widgets" %}

{% block page_content %}
{% crispy trigger_email_form %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% load crispy_forms_tags %}
{% load hq_shared_tags %}

{% requirejs_main "accounting/js/widgets" %}
{% js_entry_b3 "accounting/js/widgets" %}

{% block page_content %}
{% crispy trigger_customer_form %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% load crispy_forms_tags %}
{% load hq_shared_tags %}

{% requirejs_main "accounting/js/widgets" %}
{% js_entry_b3 "accounting/js/widgets" %}

{% block page_content %}
{% crispy trigger_form %}
Expand Down
1 change: 1 addition & 0 deletions corehq/apps/builds/static/builds/js/edit_builds.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ hqDefine('builds/js/edit_builds', [
'underscore',
'knockout',
'hqwebapp/js/initial_page_data',
'commcarehq',
], function ($, _, ko, initialPageData) {
var doc = initialPageData.get('doc');

Expand Down
2 changes: 1 addition & 1 deletion corehq/apps/builds/templates/builds/edit_menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{% load compress %}
{% load i18n %}

{% requirejs_main_b5 'builds/js/edit_builds' %}
{% js_entry 'builds/js/edit_builds' %}

{% block page_title %}
{% trans "Editing CommCare Builds" %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ hqDefine('commtrack/js/products_and_programs_main', [
'es6!hqwebapp/js/bootstrap5_loader',
'commtrack/js/base_list_view_model',
'hqwebapp/js/bootstrap5/widgets', // "Additional Information" on product page uses a .hqwebapp-select2
'commcarehq',
], function (
$,
ko,
Expand Down
1 change: 1 addition & 0 deletions corehq/apps/hqadmin/static/hqadmin/js/admin_restore.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ hqDefine('hqadmin/js/admin_restore',[
"jquery",
"hqwebapp/js/base_ace",
"jquery-treetable/jquery.treetable",
"commcarehq_b3",
],function ($, baseAce) {
$(function () {
$("#timingTable").treetable();
Expand Down
1 change: 1 addition & 0 deletions corehq/apps/hqadmin/static/hqadmin/js/app_build_timings.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
hqDefine('hqadmin/js/app_build_timings', [
"jquery",
"jquery-treetable/jquery.treetable",
"commcarehq_b3",
], function ($) {
$(function () {
$("#timingTable").treetable({
Expand Down
21 changes: 0 additions & 21 deletions corehq/apps/hqadmin/static/hqadmin/js/authenticate_as.js

This file was deleted.

3 changes: 2 additions & 1 deletion corehq/apps/hqadmin/static/hqadmin/js/raw_doc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ hqDefine('hqadmin/js/raw_doc', [
'jquery',
'underscore',
'hqwebapp/js/initial_page_data',
"hqwebapp/js/base_ace",
'hqwebapp/js/base_ace',
'commcarehq_b3',
], function ($, _, intialPageData, baseAce) {
$(function () {
var allDatabase = intialPageData.get('all_databases').map(function (database) {
Expand Down
2 changes: 1 addition & 1 deletion corehq/apps/hqadmin/templates/hqadmin/admin_restore.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<link type="text/css" rel="stylesheet" href="{% static 'jquery-treetable/css/jquery.treetable.css' %}"/>
{% endblock stylesheets %}

{% requirejs_main 'hqadmin/js/admin_restore' %}
{% js_entry_b3 'hqadmin/js/admin_restore' %}

{% block content %}
<div class="container-fluid">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<link type="text/css" rel="stylesheet" href="{% static 'jquery-treetable/css/jquery.treetable.css' %}"/>
{% endblock stylesheets %}

{% requirejs_main 'hqadmin/js/app_build_timings' %}
{% js_entry_b3 'hqadmin/js/app_build_timings' %}

{% block content %}
<div class="container-fluid">
Expand Down
25 changes: 0 additions & 25 deletions corehq/apps/hqadmin/templates/hqadmin/authenticate_as.html

This file was deleted.

2 changes: 1 addition & 1 deletion corehq/apps/hqadmin/templates/hqadmin/raw_doc.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{% block title %}Doc {{ doc_id }} ({{ doc_type }}){% endblock %}

{% block js %}{{ block.super }}
{% requirejs_main 'hqadmin/js/raw_doc' %}
{% js_entry_b3 'hqadmin/js/raw_doc' %}
{% endblock %}


Expand Down
3 changes: 3 additions & 0 deletions corehq/apps/hqwebapp/templatetags/hq_shared_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,9 @@ def __repr__(self):

@register.filter
def webpack_bundles(entry_name):
if settings.UNIT_TESTING:
return []

from corehq.apps.hqwebapp.utils.webpack import get_webpack_manifest, WebpackManifestNotFoundError
from corehq.apps.hqwebapp.utils.bootstrap import get_bootstrap_version, BOOTSTRAP_5, BOOTSTRAP_3
bootstrap_version = get_bootstrap_version()
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@
"is_complete": true
},
"notifications": {
"in_progress": true
"in_progress": true,
"templates": [
"manage_notifications.html"
]
},
"reminders": {
"is_complete": true
Expand Down
1 change: 1 addition & 0 deletions corehq/apps/integration/static/integration/js/biometric.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ hqDefine('integration/js/biometric', [
'jquery',
'hqwebapp/js/initial_page_data',
'integration/js/simprints',
'commcarehq',
], function (
$,
initialPageData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ hqDefine("integration/js/dialer/domain_dialer_main", [
"detectrtc/DetectRTC",
"integration/js/dialer/amazon-connect-min",
"integration/js/dialer/connect-streams-min",
"commcarehq",
], function (
initialPageData,
dialer_utils
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{% load hq_shared_tags %}
{% load crispy_forms_tags %}

{% requirejs_main_b5 'integration/js/biometric' %}
{% js_entry 'integration/js/biometric' %}

{% block page_content %}
{% initial_page_data 'simprintsFormData' simprints_form.initial_data %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% load i18n %}
{% load hq_shared_tags %}
{% load compress %}
{% requirejs_main_b5 "integration/js/dialer/domain_dialer_main" %}
{% js_entry "integration/js/dialer/domain_dialer_main" %}

{% block stylesheets %}
{{ block.super }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% load i18n %}
{% load hq_shared_tags %}
{% load compress %}
{% requirejs_main_b5 "integration/js/dialer/domain_dialer_main" %}
{% js_entry "integration/js/dialer/domain_dialer_main" %}

{% block stylesheets %}
{{ block.super }}
Expand Down
44 changes: 19 additions & 25 deletions corehq/apps/notifications/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

from crispy_forms import bootstrap as twbscrispy
from crispy_forms import layout as crispy
from crispy_forms.helper import FormHelper

from corehq.apps.hqwebapp import crispy as hqcrispy
from corehq.apps.hqwebapp.widgets import BootstrapCheckboxInput

from .models import NOTIFICATION_TYPES, Notification

Expand All @@ -27,8 +27,11 @@ class NotificationCreationForm(forms.Form):
choices=NOTIFICATION_TYPES,
)
domain_specific = forms.BooleanField(
label=gettext_lazy("This notification is not for all domains"),
required=False
label=gettext_lazy("Domain-specific"),
required=False,
widget=BootstrapCheckboxInput(
inline_label=gettext_lazy("This notification is not for all domains"),
),
)
domains = SimpleArrayField(
base_field=forms.CharField(),
Expand All @@ -42,37 +45,28 @@ class NotificationCreationForm(forms.Form):
def __init__(self, *args, **kwargs):
from corehq.apps.notifications.views import ManageNotificationView
super(NotificationCreationForm, self).__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper = hqcrispy.HQFormHelper()

self.helper.form_method = 'POST'
self.helper.form_class = 'form-horizontal'
self.helper.form_action = '#'

self.helper.label_class = 'col-sm-3 col-md-2'
self.helper.field_class = 'col-sm-9 col-md-8 col-lg-6'

self.helper.layout = crispy.Layout(
crispy.Field('content'),
crispy.Field('url'),
crispy.Field('type'),
hqcrispy.B3MultiField(
"Domain Specific",
crispy.Field('domain_specific')
),
twbscrispy.PrependedText('domain_specific', ''),
crispy.Field('domains'),
hqcrispy.FormActions(
twbscrispy.StrictButton(
_("Submit Information"),
type="submit",
css_class="btn btn-primary",
name="submit",
),
hqcrispy.LinkButton(
_("Cancel"),
reverse(ManageNotificationView.urlname),
css_class="btn btn-default",
name="cancel",
),
twbscrispy.StrictButton(
_("Submit Information"),
type="submit",
css_class="btn btn-primary",
name="submit",
),
hqcrispy.LinkButton(
_("Cancel"),
reverse(ManageNotificationView.urlname),
css_class="btn btn-outline-primary",
name="cancel",
),
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
hqDefine('notifications/js/manage_notifications', [
'jquery',
'hqwebapp/js/initial_page_data',
'commcarehq',
], function (
$,
initialPageData
Expand Down
Loading

0 comments on commit 7e60e09

Please sign in to comment.