-
-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
"Bootstrap 5 Migration - Rebuilt diffs"
- Loading branch information
Showing
26 changed files
with
1,775 additions
and
306 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 11 additions & 1 deletion
12
...bapp/tests/data/bootstrap5_diffs/javascript/repeaters/js/repeat_record_report.js.diff.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 changes: 84 additions & 16 deletions
100
corehq/apps/hqwebapp/tests/data/bootstrap5_diffs/javascript/reports/js/async.js.diff.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,141 @@ | ||
--- | ||
+++ | ||
@@ -1,9 +1,9 @@ | ||
@@ -1,13 +1,15 @@ | ||
-hqDefine("reports/js/bootstrap3/async", [ | ||
+hqDefine("reports/js/bootstrap5/async", [ | ||
'jquery', | ||
'underscore', | ||
- 'hqwebapp/js/bootstrap3/alert_user', | ||
+ 'bootstrap5', | ||
+ 'hqwebapp/js/bootstrap5/alert_user', | ||
'reports/js/charts/main', | ||
- 'reports/js/filters/bootstrap3/main', | ||
+ 'reports/js/filters/bootstrap5/main', | ||
'reports/js/util', | ||
], function ( | ||
$, | ||
@@ -165,7 +165,7 @@ | ||
_, | ||
+ bootstrap, | ||
alertUser, | ||
chartsMain, | ||
filtersMain, | ||
@@ -18,7 +20,8 @@ | ||
var self = {}; | ||
self.reportContent = $('#report-content'); | ||
self.filterForm = o.filterForm || $('#paramSelectorForm'); | ||
- self.loadingIssueModal = $('#loadingReportIssueModal'); | ||
+ self.loadingIssueModalElem = $('#loadingReportIssueModal'); | ||
+ self.loadingIssueModal = new bootstrap.Modal(self.loadingIssueModalElem.get(0)); | ||
self.issueAttempts = 0; | ||
self.hqLoading = null; | ||
self.standardReport = o.standardReport; | ||
@@ -53,7 +56,7 @@ | ||
} catch (e) { | ||
console.log(e); | ||
} | ||
- $('#reportFiltersAccordion').removeClass('hide'); | ||
+ $('#reportFiltersAccordion').removeClass('d-none'); | ||
self.standardReport.resetFilterState(); | ||
}; | ||
|
||
@@ -149,9 +152,9 @@ | ||
processFilters = processFilters + "&filterSet=" + setFilters; | ||
} | ||
if (setFilters) { | ||
- $(self.standardReport.exportReportButton).removeClass('hide'); | ||
- $(self.standardReport.emailReportButton).removeClass('hide'); | ||
- $(self.standardReport.printReportButton).removeClass('hide'); | ||
+ $(self.standardReport.exportReportButton).removeClass('d-none'); | ||
+ $(self.standardReport.emailReportButton).removeClass('d-none'); | ||
+ $(self.standardReport.printReportButton).removeClass('d-none'); | ||
} | ||
|
||
self.reportRequest = $.ajax({ | ||
@@ -164,8 +167,8 @@ | ||
loadFilters(data); | ||
} | ||
self.issueAttempts = 0; | ||
if ($('loadingIssueModal').hasClass('show')) { | ||
- if ($('loadingIssueModal').hasClass('show')) { | ||
- self.loadingIssueModal.modal('hide'); | ||
+ self.loadingIssueModal.modal('hide'); /* todo B5: plugin:modal */ | ||
+ if (self.loadingIssueModalElem.hasClass('show')) { | ||
+ self.loadingIssueModal.hide(); | ||
} | ||
self.hqLoading = $(self.loaderClass); | ||
self.reportContent.html(data.report); | ||
@@ -185,7 +185,7 @@ | ||
@@ -175,17 +178,17 @@ | ||
$(popover).remove(); | ||
}); | ||
self.reportContent.append(self.hqLoading); | ||
- self.hqLoading.removeClass('hide'); | ||
+ self.hqLoading.removeClass('d-none'); | ||
|
||
// Assorted UI cleanup/initialization | ||
- $('.hq-report-time-notice').removeClass('hide'); | ||
+ $('.hq-report-time-notice').removeClass('d-none'); | ||
|
||
$('.loading-backdrop').fadeOut(); | ||
self.hqLoading.fadeOut(); | ||
|
||
if (!initialLoad || !self.standardReport.needsFilters) { | ||
self.standardReport.filterSubmitButton | ||
- .button('reset'); | ||
+ .button('reset'); /* todo B5: plugin:button */ | ||
+ .changeButtonState('reset'); | ||
setTimeout(function () { | ||
// Bootstrap clears all btn styles except btn on reset | ||
// This gets around it by waiting 10ms. | ||
@@ -197,7 +197,7 @@ | ||
@@ -197,7 +200,7 @@ | ||
}, 10); | ||
} else { | ||
self.standardReport.filterSubmitButton | ||
- .button('reset') | ||
+ .button('reset') /* todo B5: plugin:button */ | ||
+ .changeButtonState('reset') | ||
.addClass('btn-primary') | ||
.removeClass('disabled') | ||
.prop('disabled', false); | ||
@@ -216,10 +216,10 @@ | ||
self.loadingIssueModal.find('.report-error-status').html('<strong>' + data.status + '</strong> ' + | ||
@@ -213,13 +216,13 @@ | ||
} else { | ||
humanReadable = self.humanReadableErrors[data.status]; | ||
} | ||
- self.loadingIssueModal.find('.report-error-status').html('<strong>' + data.status + '</strong> ' + | ||
+ self.loadingIssueModalElem.find('.report-error-status').html('<strong>' + data.status + '</strong> ' + | ||
((humanReadable) ? humanReadable : "")); | ||
if (self.issueAttempts > 0) { | ||
- self.loadingIssueModal.find('.btn-primary').button('fail'); | ||
+ self.loadingIssueModal.find('.btn-primary').button('fail'); /* todo B5: plugin:button */ | ||
+ self.loadingIssueModalElem.find('.btn-primary').changeButtonState('fail'); | ||
} | ||
self.issueAttempts += 1; | ||
- self.loadingIssueModal.modal('show'); | ||
+ self.loadingIssueModal.modal('show'); /* todo B5: plugin:modal */ | ||
+ self.loadingIssueModal.show(); | ||
} else { | ||
self.hqLoading = $(self.loaderClass); | ||
self.hqLoading.find('h4').text(gettext("Loading Stopped")); | ||
@@ -227,7 +227,7 @@ | ||
@@ -227,7 +230,7 @@ | ||
} | ||
}, | ||
beforeSend: function () { | ||
- self.standardReport.filterSubmitButton.button('loading'); | ||
+ self.standardReport.filterSubmitButton.button('loading'); /* todo B5: plugin:button */ | ||
+ self.standardReport.filterSubmitButton.changeButtonState('loading'); | ||
$('.loading-backdrop').fadeIn(); | ||
if (self.hqLoading) { | ||
self.hqLoading.attr('style', 'position: absolute; top: 30px; left: 40%;'); | ||
@@ -239,7 +239,7 @@ | ||
@@ -239,7 +242,7 @@ | ||
}; | ||
|
||
$(document).on('click', '.try-again', function () { | ||
- self.loadingIssueModal.find('.btn-primary').button('loading'); | ||
+ self.loadingIssueModal.find('.btn-primary').button('loading'); /* todo B5: plugin:button */ | ||
+ self.loadingIssueModalElem.find('.btn-primary').changeButtonState('loading'); | ||
if (self.isCaseListRelated(window.location.pathname)) { | ||
self.getQueryId(window.location.search.substr(1), true, true, window.location.pathname); | ||
} else { | ||
@@ -247,9 +250,9 @@ | ||
} | ||
}); | ||
|
||
- self.loadingIssueModal.on('hide hide.bs.modal', function () { | ||
+ self.loadingIssueModalElem.on('hide hide.bs.modal', function () { | ||
self.hqLoading = $(self.loaderClass); | ||
- self.hqLoading.find('.js-loading-spinner').addClass('hide'); | ||
+ self.hqLoading.find('.js-loading-spinner').addClass('d-none'); | ||
self.hqLoading.find('h4').text(gettext('We were unsuccessful loading the report:')) | ||
.attr('style', 'margin-bottom: 10px;'); | ||
}); |
88 changes: 75 additions & 13 deletions
88
corehq/apps/hqwebapp/tests/data/bootstrap5_diffs/javascript/reports/js/base.js.diff.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,85 @@ | ||
--- | ||
+++ | ||
@@ -1,8 +1,8 @@ | ||
@@ -1,45 +1,45 @@ | ||
-hqDefine("reports/js/bootstrap3/base", [ | ||
+hqDefine("reports/js/bootstrap5/base", [ | ||
'jquery', | ||
'hqwebapp/js/initial_page_data', | ||
- 'jquery', | ||
- 'hqwebapp/js/initial_page_data', | ||
- 'reports/js/filters/bootstrap3/main', | ||
- 'reports/js/bootstrap3/report_config_models', | ||
+ 'reports/js/filters/bootstrap5/main', | ||
+ 'reports/js/bootstrap5/report_config_models', | ||
'reports/js/bootstrap3/tabular', | ||
'commcarehq', | ||
], function ( | ||
@@ -36,7 +36,7 @@ | ||
reportConfigsView.setConfigBeingViewed(reportConfigModels.reportConfig(defaultConfig)); | ||
} | ||
- 'reports/js/bootstrap3/tabular', | ||
- 'commcarehq', | ||
-], function ( | ||
- $, | ||
- initialPageData, | ||
- filtersMain, | ||
- reportConfigModels | ||
-) { | ||
- $(function () { | ||
- filtersMain.init(); | ||
+import 'commcarehq'; | ||
|
||
- var defaultConfig = initialPageData.get('default_config') || {}; | ||
- if (initialPageData.get('has_datespan')) { | ||
- defaultConfig.date_range = 'last7'; | ||
- } else { | ||
- defaultConfig.date_range = null; | ||
- } | ||
- defaultConfig.has_ucr_datespan = false; | ||
- defaultConfig.datespan_filters = []; | ||
- defaultConfig.datespan_slug = null; | ||
+import $ from 'jquery'; | ||
|
||
- var $savedReports = $("#savedReports"); | ||
- if ($savedReports.length) { | ||
- var reportConfigsView = reportConfigModels.reportConfigsViewModel({ | ||
- filterForm: $("#reportFilters"), | ||
- items: initialPageData.get('report_configs'), | ||
- defaultItem: defaultConfig, | ||
- saveUrl: initialPageData.reverse("add_report_config"), | ||
- }); | ||
- $savedReports.koApplyBindings(reportConfigsView); | ||
- reportConfigsView.setConfigBeingViewed(reportConfigModels.reportConfig(defaultConfig)); | ||
- } | ||
+import {Tooltip} from 'bootstrap5'; | ||
|
||
- $('#email-enabled').tooltip({ | ||
+ $('#email-enabled').tooltip({ /* todo B5: plugin:tooltip */ | ||
+import initialPageData from 'hqwebapp/js/initial_page_data'; | ||
+import filtersMain from 'reports/js/filters/bootstrap5/main'; | ||
+import reportConfigModels from 'reports/js/bootstrap5/report_config_models'; | ||
+ | ||
+import 'reports/js/bootstrap5/tabular'; | ||
+ | ||
+$(function () { | ||
+ filtersMain.init(); | ||
+ | ||
+ var defaultConfig = initialPageData.get('default_config') || {}; | ||
+ if (initialPageData.get('has_datespan')) { | ||
+ defaultConfig.date_range = 'last7'; | ||
+ } else { | ||
+ defaultConfig.date_range = null; | ||
+ } | ||
+ defaultConfig.has_ucr_datespan = false; | ||
+ defaultConfig.datespan_filters = []; | ||
+ defaultConfig.datespan_slug = null; | ||
+ | ||
+ var $savedReports = $("#savedReports"); | ||
+ if ($savedReports.length) { | ||
+ var reportConfigsView = reportConfigModels.reportConfigsViewModel({ | ||
+ filterForm: $("#reportFilters"), | ||
+ items: initialPageData.get('report_configs'), | ||
+ defaultItem: defaultConfig, | ||
+ saveUrl: initialPageData.reverse("add_report_config"), | ||
+ }); | ||
+ $savedReports.koApplyBindings(reportConfigsView); | ||
+ reportConfigsView.setConfigBeingViewed(reportConfigModels.reportConfig(defaultConfig)); | ||
+ } | ||
+ | ||
+ if ($('#email-enabled').length) { | ||
+ new Tooltip($('#email-enabled').get(0), { | ||
placement: 'right', | ||
html: true, | ||
title: gettext("You can email a saved version<br />of this report."), | ||
}); | ||
- }); | ||
+ } | ||
}); |
Oops, something went wrong.