Skip to content

Commit 8b3cc1d

Browse files
committed
[#4472] Remove unnecessary JavaScript from static error pages
Static error pages were previously loading the entire app's JavaScript, including components like ActiveStorage, which aren't needed on these pages. This was causing JavaScript console errors in system tests due to missing importmap references for ActiveStorage. Instead of adding unnecessary imports, this commit removes the JavaScript from the static error pages.
1 parent 6985595 commit 8b3cc1d

File tree

5 files changed

+42
-474
lines changed

5 files changed

+42
-474
lines changed

public/403.html

Lines changed: 5 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -11,132 +11,18 @@
1111
<link href="https://cdn.jsdelivr.net/npm/[email protected]/build/toastr.css" rel="stylesheet">
1212
<link href="https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/css/all.min.css" rel="stylesheet">
1313
<link href="https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/css/v4-shims.css" rel="stylesheet">
14-
1514
<link rel="stylesheet" href="/assets/application.css" media="all" />
16-
<script type="importmap" data-turbo-track="reload">{
17-
"imports": {
18-
"jquery": "https://ga.jspm.io/npm:[email protected]/dist/jquery.js",
19-
"admin-lte": "/assets/adminlte.js",
20-
"application": "/assets/application.js",
21-
"startup": "/assets/startup.js",
22-
"@hotwired/turbo-rails": "/assets/turbo.min.js",
23-
"@hotwired/stimulus": "/assets/stimulus.min.js",
24-
"@hotwired/stimulus-loading": "/assets/stimulusloading.js",
25-
"bootstrap": "/assets/bootstrap.min.js",
26-
"popper": "/assets/popper.js",
27-
"highcharts": "https://ga.jspm.io/npm:[email protected]/highcharts.js",
28-
"select2": "https://cdn.jsdelivr.net/npm/[email protected]/dist/js/select2.min.js",
29-
"trix": "https://ga.jspm.io/npm:[email protected]/dist/trix.esm.min.js",
30-
"@rails/actiontext": "https://ga.jspm.io/npm:@rails/[email protected]/app/assets/javascripts/actiontext.js",
31-
"luxon": "https://ga.jspm.io/npm:[email protected]/build/cjs-browser/luxon.js",
32-
"litepicker": "https://cdn.jsdelivr.net/npm/litepicker/dist/litepicker.js",
33-
"litepicker/ranges": "https://cdn.jsdelivr.net/npm/litepicker/dist/plugins/ranges.js",
34-
"toastr": "https://ga.jspm.io/npm:[email protected]/toastr.js",
35-
"@fullcalendar/core": "https://ga.jspm.io/npm:@fullcalendar/[email protected]/index.js",
36-
"preact": "https://ga.jspm.io/npm:[email protected]/dist/preact.module.js",
37-
"preact/compat": "https://ga.jspm.io/npm:[email protected]/compat/dist/compat.module.js",
38-
"preact/hooks": "https://ga.jspm.io/npm:[email protected]/hooks/dist/hooks.module.js",
39-
"@fullcalendar/luxon": "https://ga.jspm.io/npm:@fullcalendar/[email protected]/index.js",
40-
"@fullcalendar/core/": "https://ga.jspm.io/npm:@fullcalendar/[email protected]/",
41-
"@fullcalendar/daygrid": "https://ga.jspm.io/npm:@fullcalendar/[email protected]/index.js",
42-
"@fullcalendar/list": "https://ga.jspm.io/npm:@fullcalendar/[email protected]/index.js",
43-
"quagga": "https://ga.jspm.io/npm:[email protected]/dist/quagga.min.js",
44-
"@rails/ujs": "https://ga.jspm.io/npm:@rails/[email protected]/lib/assets/compiled/rails-ujs.js",
45-
"filterrific": "/assets/filterrific.js",
46-
"bootstrap-select": "https://ga.jspm.io/npm:[email protected]/dist/js/bootstrap-select.js",
47-
"jquery-ui": "https://ga.jspm.io/npm:[email protected]/ui/widget.js",
48-
"controllers/application": "/assets/controllers/application.js",
49-
"controllers/area_served_controller": "/assets/controllers/area_served_controller.js",
50-
"controllers/checkbox_with_nested_element_controller": "/assets/controllers/checkbox_with_nested_element_controller.js",
51-
"controllers/confirmation_controller": "/assets/controllers/confirmation_controller.js",
52-
"controllers/distribution_delivery_controller": "/assets/controllers/distribution_delivery_controller.js",
53-
"controllers/double_select_controller": "/assets/controllers/double_select_controller.js",
54-
"controllers/form_input_controller": "/assets/controllers/form_input_controller.js",
55-
"controllers/highchart_controller": "/assets/controllers/highchart_controller.js",
56-
"controllers": "/assets/controllers/index.js",
57-
"controllers/item_units_controller": "/assets/controllers/item_units_controller.js",
58-
"controllers/password_visibility_controller": "/assets/controllers/password_visibility_controller.js",
59-
"controllers/select2_controller": "/assets/controllers/select2_controller.js",
60-
"controllers/served_area_controller": "/assets/controllers/served_area_controller.js",
61-
"controllers/turbo_controller": "/assets/controllers/turbo_controller.js",
62-
"utils/barcode_items": "/assets/utils/barcode_items.js",
63-
"utils/barcode_scan": "/assets/utils/barcode_scan.js",
64-
"utils/deadline_day_pickers": "/assets/utils/deadline_day_pickers.js",
65-
"utils/distributions_and_transfers": "/assets/utils/distributions_and_transfers.js",
66-
"utils/donations": "/assets/utils/donations.js",
67-
"utils/purchases": "/assets/utils/purchases.js"
68-
}
69-
}</script>
70-
<link rel="modulepreload" href="https://ga.jspm.io/npm:[email protected]/dist/jquery.js">
71-
<link rel="modulepreload" href="/assets/adminlte.js">
72-
<link rel="modulepreload" href="/assets/application.js">
73-
<link rel="modulepreload" href="/assets/startup.js">
74-
<link rel="modulepreload" href="/assets/turbo.min.js">
75-
<link rel="modulepreload" href="/assets/stimulus.min.js">
76-
<link rel="modulepreload" href="/assets/stimulusloading.js">
77-
<link rel="modulepreload" href="/assets/bootstrap.min.js">
78-
<link rel="modulepreload" href="/assets/popper.js">
79-
<link rel="modulepreload" href="https://ga.jspm.io/npm:[email protected]/highcharts.js">
80-
<link rel="modulepreload" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/select2.min.js">
81-
<link rel="modulepreload" href="https://ga.jspm.io/npm:[email protected]/dist/trix.esm.min.js">
82-
<link rel="modulepreload" href="https://ga.jspm.io/npm:@rails/[email protected]/app/assets/javascripts/actiontext.js">
83-
<link rel="modulepreload" href="https://ga.jspm.io/npm:[email protected]/build/cjs-browser/luxon.js">
84-
<link rel="modulepreload" href="https://cdn.jsdelivr.net/npm/litepicker/dist/litepicker.js">
85-
<link rel="modulepreload" href="https://cdn.jsdelivr.net/npm/litepicker/dist/plugins/ranges.js">
86-
<link rel="modulepreload" href="https://ga.jspm.io/npm:[email protected]/toastr.js">
87-
<link rel="modulepreload" href="https://ga.jspm.io/npm:@fullcalendar/[email protected]/index.js">
88-
<link rel="modulepreload" href="https://ga.jspm.io/npm:[email protected]/dist/preact.module.js">
89-
<link rel="modulepreload" href="https://ga.jspm.io/npm:[email protected]/compat/dist/compat.module.js">
90-
<link rel="modulepreload" href="https://ga.jspm.io/npm:[email protected]/hooks/dist/hooks.module.js">
91-
<link rel="modulepreload" href="https://ga.jspm.io/npm:@fullcalendar/[email protected]/index.js">
92-
<link rel="modulepreload" href="https://ga.jspm.io/npm:@fullcalendar/[email protected]/">
93-
<link rel="modulepreload" href="https://ga.jspm.io/npm:@fullcalendar/[email protected]/index.js">
94-
<link rel="modulepreload" href="https://ga.jspm.io/npm:@fullcalendar/[email protected]/index.js">
95-
<link rel="modulepreload" href="https://ga.jspm.io/npm:[email protected]/dist/quagga.min.js">
96-
<link rel="modulepreload" href="https://ga.jspm.io/npm:@rails/[email protected]/lib/assets/compiled/rails-ujs.js">
97-
<link rel="modulepreload" href="/assets/filterrific.js">
98-
<link rel="modulepreload" href="https://ga.jspm.io/npm:[email protected]/dist/js/bootstrap-select.js">
99-
<link rel="modulepreload" href="https://ga.jspm.io/npm:[email protected]/ui/widget.js">
100-
<link rel="modulepreload" href="/assets/controllers/application.js">
101-
<link rel="modulepreload" href="/assets/controllers/area_served_controller.js">
102-
<link rel="modulepreload" href="/assets/controllers/checkbox_with_nested_element_controller.js">
103-
<link rel="modulepreload" href="/assets/controllers/confirmation_controller.js">
104-
<link rel="modulepreload" href="/assets/controllers/distribution_delivery_controller.js">
105-
<link rel="modulepreload" href="/assets/controllers/double_select_controller.js">
106-
<link rel="modulepreload" href="/assets/controllers/form_input_controller.js">
107-
<link rel="modulepreload" href="/assets/controllers/highchart_controller.js">
108-
<link rel="modulepreload" href="/assets/controllers/index.js">
109-
<link rel="modulepreload" href="/assets/controllers/item_units_controller.js">
110-
<link rel="modulepreload" href="/assets/controllers/password_visibility_controller.js">
111-
<link rel="modulepreload" href="/assets/controllers/select2_controller.js">
112-
<link rel="modulepreload" href="/assets/controllers/served_area_controller.js">
113-
<link rel="modulepreload" href="/assets/controllers/turbo_controller.js">
114-
<link rel="modulepreload" href="/assets/utils/barcode_items.js">
115-
<link rel="modulepreload" href="/assets/utils/barcode_scan.js">
116-
<link rel="modulepreload" href="/assets/utils/deadline_day_pickers.js">
117-
<link rel="modulepreload" href="/assets/utils/distributions_and_transfers.js">
118-
<link rel="modulepreload" href="/assets/utils/donations.js">
119-
<link rel="modulepreload" href="/assets/utils/purchases.js">
120-
<script type="module">import "application"</script>
121-
122-
<script type="esms-options">
123-
{
124-
"noLoadEventRetriggers": true
125-
}
126-
</script>
127-
12815
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
12916
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
13017
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
13118
<link rel="manifest" href="/site.webmanifest">
13219
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">
13320
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
134-
135-
<meta name="turbo-visit-control" content="reload">
136-
<meta name="turbo-cache-control" content="no-cache">
21+
<meta name="turbo-visit-control" content="reload">
22+
<meta name="turbo-cache-control" content="no-cache">
13723
</head>
138-
<body data-turbo="" data-controller='turbo'
139-
id="errors" class="not_found hold-transition sidebar-mini layout-fixed">
24+
25+
<body id="errors" class="not_found hold-transition sidebar-mini layout-fixed">
14026
<!-- Site wrapper -->
14127
<div class="wrapper">
14228
<nav class="main-header navbar navbar-expand navbar-white navbar-light">
@@ -188,7 +74,7 @@ <h1>403 Error Page</h1>
18874
<!-- Main content -->
18975
<section class="content">
19076
<div class="error-page">
191-
<h2 class="headline text-warning"> 403</h2>
77+
<h2 class="headline text-warning">403</h2>
19278
<br>
19379
<div class="error-content">
19480
<h3><i class="fas fa-exclamation-triangle text-warning"></i> Oops! The page you were looking for is forbidden.</h3>

public/404.html

Lines changed: 4 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -11,130 +11,17 @@
1111
<link href="https://cdn.jsdelivr.net/npm/[email protected]/build/toastr.css" rel="stylesheet">
1212
<link href="https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/css/all.min.css" rel="stylesheet">
1313
<link href="https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/css/v4-shims.css" rel="stylesheet">
14-
1514
<link rel="stylesheet" href="/assets/application.css" media="all" />
16-
<script type="importmap" data-turbo-track="reload">{
17-
"imports": {
18-
"jquery": "https://ga.jspm.io/npm:[email protected]/dist/jquery.js",
19-
"admin-lte": "/assets/adminlte.js",
20-
"application": "/assets/application.js",
21-
"startup": "/assets/startup.js",
22-
"@hotwired/turbo-rails": "/assets/turbo.min.js",
23-
"@hotwired/stimulus": "/assets/stimulus.min.js",
24-
"@hotwired/stimulus-loading": "/assets/stimulusloading.js",
25-
"bootstrap": "/assets/bootstrap.min.js",
26-
"popper": "/assets/popper.js",
27-
"highcharts": "https://ga.jspm.io/npm:[email protected]/highcharts.js",
28-
"select2": "https://cdn.jsdelivr.net/npm/[email protected]/dist/js/select2.min.js",
29-
"trix": "https://ga.jspm.io/npm:[email protected]/dist/trix.esm.min.js",
30-
"@rails/actiontext": "https://ga.jspm.io/npm:@rails/[email protected]/app/assets/javascripts/actiontext.js",
31-
"luxon": "https://ga.jspm.io/npm:[email protected]/build/cjs-browser/luxon.js",
32-
"litepicker": "https://cdn.jsdelivr.net/npm/litepicker/dist/litepicker.js",
33-
"litepicker/ranges": "https://cdn.jsdelivr.net/npm/litepicker/dist/plugins/ranges.js",
34-
"toastr": "https://ga.jspm.io/npm:[email protected]/toastr.js",
35-
"@fullcalendar/core": "https://ga.jspm.io/npm:@fullcalendar/[email protected]/index.js",
36-
"preact": "https://ga.jspm.io/npm:[email protected]/dist/preact.module.js",
37-
"preact/compat": "https://ga.jspm.io/npm:[email protected]/compat/dist/compat.module.js",
38-
"preact/hooks": "https://ga.jspm.io/npm:[email protected]/hooks/dist/hooks.module.js",
39-
"@fullcalendar/luxon": "https://ga.jspm.io/npm:@fullcalendar/[email protected]/index.js",
40-
"@fullcalendar/core/": "https://ga.jspm.io/npm:@fullcalendar/[email protected]/",
41-
"@fullcalendar/daygrid": "https://ga.jspm.io/npm:@fullcalendar/[email protected]/index.js",
42-
"@fullcalendar/list": "https://ga.jspm.io/npm:@fullcalendar/[email protected]/index.js",
43-
"quagga": "https://ga.jspm.io/npm:[email protected]/dist/quagga.min.js",
44-
"@rails/ujs": "https://ga.jspm.io/npm:@rails/[email protected]/lib/assets/compiled/rails-ujs.js",
45-
"filterrific": "/assets/filterrific.js",
46-
"bootstrap-select": "https://ga.jspm.io/npm:[email protected]/dist/js/bootstrap-select.js",
47-
"jquery-ui": "https://ga.jspm.io/npm:[email protected]/ui/widget.js",
48-
"controllers/application": "/assets/controllers/application.js",
49-
"controllers/area_served_controller": "/assets/controllers/area_served_controller.js",
50-
"controllers/checkbox_with_nested_element_controller": "/assets/controllers/checkbox_with_nested_element_controller.js",
51-
"controllers/confirmation_controller": "/assets/controllers/confirmation_controller.js",
52-
"controllers/distribution_delivery_controller": "/assets/controllers/distribution_delivery_controller.js",
53-
"controllers/double_select_controller": "/assets/controllers/double_select_controller.js",
54-
"controllers/form_input_controller": "/assets/controllers/form_input_controller.js",
55-
"controllers/highchart_controller": "/assets/controllers/highchart_controller.js",
56-
"controllers": "/assets/controllers/index.js",
57-
"controllers/item_units_controller": "/assets/controllers/item_units_controller.js",
58-
"controllers/password_visibility_controller": "/assets/controllers/password_visibility_controller.js",
59-
"controllers/select2_controller": "/assets/controllers/select2_controller.js",
60-
"controllers/served_area_controller": "/assets/controllers/served_area_controller.js",
61-
"controllers/turbo_controller": "/assets/controllers/turbo_controller.js",
62-
"utils/barcode_items": "/assets/utils/barcode_items.js",
63-
"utils/barcode_scan": "/assets/utils/barcode_scan.js",
64-
"utils/deadline_day_pickers": "/assets/utils/deadline_day_pickers.js",
65-
"utils/distributions_and_transfers": "/assets/utils/distributions_and_transfers.js",
66-
"utils/donations": "/assets/utils/donations.js",
67-
"utils/purchases": "/assets/utils/purchases.js"
68-
}
69-
}</script>
70-
<link rel="modulepreload" href="https://ga.jspm.io/npm:[email protected]/dist/jquery.js">
71-
<link rel="modulepreload" href="/assets/adminlte.js">
72-
<link rel="modulepreload" href="/assets/application.js">
73-
<link rel="modulepreload" href="/assets/startup.js">
74-
<link rel="modulepreload" href="/assets/turbo.min.js">
75-
<link rel="modulepreload" href="/assets/stimulus.min.js">
76-
<link rel="modulepreload" href="/assets/stimulusloading.js">
77-
<link rel="modulepreload" href="/assets/bootstrap.min.js">
78-
<link rel="modulepreload" href="/assets/popper.js">
79-
<link rel="modulepreload" href="https://ga.jspm.io/npm:[email protected]/highcharts.js">
80-
<link rel="modulepreload" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/select2.min.js">
81-
<link rel="modulepreload" href="https://ga.jspm.io/npm:[email protected]/dist/trix.esm.min.js">
82-
<link rel="modulepreload" href="https://ga.jspm.io/npm:@rails/[email protected]/app/assets/javascripts/actiontext.js">
83-
<link rel="modulepreload" href="https://ga.jspm.io/npm:[email protected]/build/cjs-browser/luxon.js">
84-
<link rel="modulepreload" href="https://cdn.jsdelivr.net/npm/litepicker/dist/litepicker.js">
85-
<link rel="modulepreload" href="https://cdn.jsdelivr.net/npm/litepicker/dist/plugins/ranges.js">
86-
<link rel="modulepreload" href="https://ga.jspm.io/npm:[email protected]/toastr.js">
87-
<link rel="modulepreload" href="https://ga.jspm.io/npm:@fullcalendar/[email protected]/index.js">
88-
<link rel="modulepreload" href="https://ga.jspm.io/npm:[email protected]/dist/preact.module.js">
89-
<link rel="modulepreload" href="https://ga.jspm.io/npm:[email protected]/compat/dist/compat.module.js">
90-
<link rel="modulepreload" href="https://ga.jspm.io/npm:[email protected]/hooks/dist/hooks.module.js">
91-
<link rel="modulepreload" href="https://ga.jspm.io/npm:@fullcalendar/[email protected]/index.js">
92-
<link rel="modulepreload" href="https://ga.jspm.io/npm:@fullcalendar/[email protected]/">
93-
<link rel="modulepreload" href="https://ga.jspm.io/npm:@fullcalendar/[email protected]/index.js">
94-
<link rel="modulepreload" href="https://ga.jspm.io/npm:@fullcalendar/[email protected]/index.js">
95-
<link rel="modulepreload" href="https://ga.jspm.io/npm:[email protected]/dist/quagga.min.js">
96-
<link rel="modulepreload" href="https://ga.jspm.io/npm:@rails/[email protected]/lib/assets/compiled/rails-ujs.js">
97-
<link rel="modulepreload" href="/assets/filterrific.js">
98-
<link rel="modulepreload" href="https://ga.jspm.io/npm:[email protected]/dist/js/bootstrap-select.js">
99-
<link rel="modulepreload" href="https://ga.jspm.io/npm:[email protected]/ui/widget.js">
100-
<link rel="modulepreload" href="/assets/controllers/application.js">
101-
<link rel="modulepreload" href="/assets/controllers/area_served_controller.js">
102-
<link rel="modulepreload" href="/assets/controllers/checkbox_with_nested_element_controller.js">
103-
<link rel="modulepreload" href="/assets/controllers/confirmation_controller.js">
104-
<link rel="modulepreload" href="/assets/controllers/distribution_delivery_controller.js">
105-
<link rel="modulepreload" href="/assets/controllers/double_select_controller.js">
106-
<link rel="modulepreload" href="/assets/controllers/form_input_controller.js">
107-
<link rel="modulepreload" href="/assets/controllers/highchart_controller.js">
108-
<link rel="modulepreload" href="/assets/controllers/index.js">
109-
<link rel="modulepreload" href="/assets/controllers/item_units_controller.js">
110-
<link rel="modulepreload" href="/assets/controllers/password_visibility_controller.js">
111-
<link rel="modulepreload" href="/assets/controllers/select2_controller.js">
112-
<link rel="modulepreload" href="/assets/controllers/served_area_controller.js">
113-
<link rel="modulepreload" href="/assets/controllers/turbo_controller.js">
114-
<link rel="modulepreload" href="/assets/utils/barcode_items.js">
115-
<link rel="modulepreload" href="/assets/utils/barcode_scan.js">
116-
<link rel="modulepreload" href="/assets/utils/deadline_day_pickers.js">
117-
<link rel="modulepreload" href="/assets/utils/distributions_and_transfers.js">
118-
<link rel="modulepreload" href="/assets/utils/donations.js">
119-
<link rel="modulepreload" href="/assets/utils/purchases.js">
120-
<script type="module">import "application"</script>
121-
122-
<script type="esms-options">
123-
{
124-
"noLoadEventRetriggers": true
125-
}
126-
</script>
127-
12815
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
12916
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
13017
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
13118
<link rel="manifest" href="/site.webmanifest">
13219
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">
13320
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
134-
135-
<meta name="turbo-visit-control" content="reload">
136-
<meta name="turbo-cache-control" content="no-cache">
21+
<meta name="turbo-visit-control" content="reload">
22+
<meta name="turbo-cache-control" content="no-cache">
13723
</head>
24+
13825
<body data-turbo="" data-controller='turbo'
13926
id="errors" class="not_found hold-transition sidebar-mini layout-fixed">
14027
<!-- Site wrapper -->
@@ -188,7 +75,7 @@ <h1>404 Error Page</h1>
18875
<!-- Main content -->
18976
<section class="content">
19077
<div class="error-page">
191-
<h2 class="headline text-warning"> 404</h2>
78+
<h2 class="headline text-warning">404</h2>
19279
<br>
19380
<div class="error-content">
19481
<h3><i class="fas fa-exclamation-triangle text-warning"></i> Oops! Page not found.</h3>

0 commit comments

Comments
 (0)