Skip to content

Commit

Permalink
Merge pull request #33446 from dimagi/bmb/b5-schedule-demo
Browse files Browse the repository at this point in the history
[B5] Migrate schedule demo modal to bootstrap 5
  • Loading branch information
biyeun authored Sep 18, 2023
2 parents 68aa1c8 + 7c2bb62 commit b61dc61
Show file tree
Hide file tree
Showing 11 changed files with 482 additions and 67 deletions.
6 changes: 3 additions & 3 deletions corehq/apps/analytics/static/analytix/js/hubspot.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ hqDefine('analytix/js/hubspot', [
phoneNumberSelector: $form.find('input[name="phone"]'),
submitCallbackFn: function () {
$('#get-demo-cta-success').fadeIn();
$('#get-demo-cta-form-content').addClass('hidden');
$('#get-demo-cta-form-content').addClass('hidden').addClass('d-none'); // todo after bootstrap 5 migration

kissmetrics.track.event("Demo Workflow - Contact Info Received");
},
Expand Down Expand Up @@ -118,8 +118,8 @@ hqDefine('analytix/js/hubspot', [
submitCallbackFn: function () {
kissmetrics.track.event("Get Trial Workflow - Contact Info Received");

$('#choose-callback-options').toggleClass('hidden');
$('#get-trial-cta-form-content').addClass('hidden');
$('#choose-callback-options').toggleClass('hidden').toggleClass('d-none'); // todo after bootstrap 5 migration
$('#get-trial-cta-form-content').addClass('hidden').addClass('d-none'); // todo after bootstrap 5 migration
$('#start-trial-modal-header').text(gettext("Your trial request has been received!"));
},
});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
{% load i18n %}

<form class="form-ko-validation" method="post">
{% csrf_token %}
<div class="modal-body">
<!-- ko if: showErrorMessage -->
<div class="alert alert-warning">
<p data-bind="text: errorMessage"></p>
</div>
<!-- /ko -->
<div class="row mb-3">
<div class="col-sm-6">
<label class="form-label">
{% trans "First name" %}<span class="asteriskField">*</span>
</label>
<input type="text"
name="firstname"
data-bind="textInput: firstname"
class="form-control">
</div>
<div class="col-sm-6">
<label class="form-label">
{% trans "Last name" %}<span class="asteriskField">*</span>
</label>
<input type="text"
name="lastname"
data-bind="textInput: lastname"
class="form-control">
</div>
</div>
<div class="mb-3">
<label class="form-label">
{% trans "Organization" %}<span class="asteriskField">*</span>
</label>
<input type="text"
name="company"
data-bind="textInput: company"
class="form-control">
</div>
<div class="mb-3">
<label class="form-label">
{% trans "Professional email address" %}<span class="asteriskField">*</span>
</label>
<input type="email"
name="email"
data-bind="textInput: email"
class="form-control">
</div>
<div class="mb-3"
data-bind="visible: showContactMethod">
<label class="form-label">
{% trans "How should we contact you?" %}<span class="asteriskField">*</span>
</label>
<select name="preferred_method_of_contact"
data-bind="value: preferred_method_of_contact"
class="form-select">
<option value="">{% trans "Please Select" %}</option>
<option value="Phone">{% trans "Phone" %}</option>
<option value="Skype">{% trans "Skype" %}</option>
<!-- ko if: useWhatsApp -->
<option value="WhatsApp">{% trans "WhatsApp" %}</option>
<!-- /ko -->
<!-- ko if: useGoogleHangouts -->
<option value="Google hangouts">{% trans "Google hangouts" %}</option>
<!-- /ko -->
</select>
</div>
<div class="mb-3"
data-bind="visible: showPhoneNumber">
<label class="form-label">
{% trans "Preferred phone number" %}<span class="asteriskField">*</span>
</label>
<input type="text"
name="phone"
data-bind="textInput: phone"
class="form-control">
</div>
<div class="mb-3"
data-bind="visible: showSkype">
<label class="form-label">
{% trans "Skype username" %}<span class="asteriskField">*</span>
</label>
<input type="text"
name="skype__c"
data-bind="textInput: skype__c"
class="form-control">
</div>
<div class="mb-3"
data-bind="visible: showWhatsApp">
<label class="form-label">
{% trans "Preferred WhatsApp number" %}<span class="asteriskField">*</span>
</label>
<input type="text"
name="preferred_whatsapp_number"
data-bind="textInput: preferred_whatsapp_number"
class="form-control">
</div>
<div class="mb-3"
data-bind="visible: showPreferredLanguage">
<label class="form-label">
{% trans "Preferred Language" %}<span class="asteriskField">*</span>
</label>
<select name="language__c"
data-bind="value: language__c"
class="form-select">
<option value="">{% trans "Please Select" %}</option>
<option value="English">{% trans "English" %}</option>
<option value="French">{% trans "French" %}</option>
<option value="Spanish">{% trans "Spanish" %}</option>
</select>
</div>
{% blocktrans %}
By clicking this button, you agree to Dimagi's
<a href="http://www.dimagi.com/terms/latest/tos/" target="_blank">Terms of Service</a> and
<a href="http://www.dimagi.com/terms/latest/privacy/" target="_blank">Privacy Policy</a>.
{% endblocktrans %}
</div>
<div class="modal-footer">
<button class="btn btn btn-primary"
data-bind="click: submitForm, disable: isSubmitDisabled"
type="button">
<!-- ko text: nextButtonText --><!-- /ko -->
</button>
</div>
</form>
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,6 @@
class="navbar navbar-expand-lg bg-light border-bottom-1 navbar-hq-main-menu">
<div class="container-fluid">

{% if not request.user.is_authenticated %}
<nav class="navbar-menus navbar-signin" role="navigation">
<div class="nav-settings-bar p-2">
<a href="{% url "login" %}" class="btn btn-primary navbar-btn">{% trans 'Sign In' %}</a>
{% if is_saas_environment and ANALYTICS_IDS.HUBSPOT_API_ID %}
<a href="#cta-form-get-demo"
data-toggle="modal"
id="cta-form-get-demo-button-header"
class="btn btn-purple navbar-btn">
{% trans 'Schedule a Demo' %}
</a>
{% endif %}
</div>
</nav>
{% endif %}

<div class="navbar-header hq-header">
<a href="{% if request|toggle_enabled:"USER_TESTING_SIMPLIFY" %}#{% else %}{% url "homepage" %}{% endif %}" class="navbar-brand">
{% if CUSTOM_LOGO_URL %}
Expand All @@ -64,7 +48,6 @@
{% endif %}

{% if not request|toggle_enabled:"USER_TESTING_SIMPLIFY" and request.user.is_authenticated %}

<div class="collapse navbar-collapse ms-2" id="hq-full-menu">
<div class="nav-settings-bar">
{% include 'hqwebapp/includes/bootstrap5/global_navigation_bar.html' %}
Expand All @@ -75,6 +58,22 @@
</div>
{% endif %}

{% if not request.user.is_authenticated %}
<nav class="navbar-signin ms-2" role="navigation">
<div class="nav-settings-bar">
<a href="{% url "login" %}" class="btn btn-primary navbar-btn">{% trans 'Sign In' %}</a>
{% if is_saas_environment and ANALYTICS_IDS.HUBSPOT_API_ID %}
<a href="#cta-form-get-demo"
data-bs-toggle="modal"
id="cta-form-get-demo-button-header"
class="btn btn-purple navbar-btn">
{% trans 'Schedule a Demo' %}
</a>
{% endif %}
</div>
</nav>
{% endif %}

</div>
</nav>
{% endblock navigation %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ <h4 class="modal-title">

{# Hubspot Form #}
<div id="get-demo-cta-form-content">
{% include "analytics/forms/hubspot_cta_form.html" %}
{% include "analytics/forms/bootstrap3/hubspot_cta_form.html" %}
</div>

<div id="get-demo-cta-success" style="display: none;">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
{% load i18n %}

<div class="modal fade"
tabindex="-1"
aria-labelledby="requestDemoModal"
aria-hidden="true"
id="cta-form-get-demo">
<div class="modal-dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">{% trans 'Close' %}</span></button>
<h4 class="modal-title">
<h1 class="modal-title fs-5" id="requestDemoModal">
{% if not request.user.is_authenticated %}
{% trans "Request a CommCare Demo" %}
{% else %}
{% trans "Get a Tour of CommCare" %}
{% endif %}
</h4>
</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>

{# Hubspot Form #}
<div id="get-demo-cta-form-content">
{% include "analytics/forms/hubspot_cta_form.html" %}
{% include "analytics/forms/bootstrap5/hubspot_cta_form.html" %}
</div>

<div id="get-demo-cta-success" style="display: none;">
Expand All @@ -29,10 +32,9 @@ <h4 class="modal-title">
</p>
</div>
<div class="modal-footer">
<a href="#" data-dismiss="modal" class="btn btn-default">{% trans "Done" %}</a>
<a href="#" data-bs-dismiss="modal" class="btn btn-outline-primary">{% trans "Done" %}</a>
</div>
</div>

</div>
</div>
</div>
8 changes: 8 additions & 0 deletions corehq/apps/hqwebapp/tests/data/bootstrap5_diff_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,13 @@
"label": "javascript/notifications",
"compare_all_files": true
}
],
"apps/analytics/templates/analytics": [
{
"directories": ["forms/bootstrap3/", "forms/bootstrap5/"],
"file_type": "template",
"label": "analytics/forms",
"compare_all_files": true
}
]
}
Loading

0 comments on commit b61dc61

Please sign in to comment.