aboutsummaryrefslogtreecommitdiffstats
path: root/templates/web/base
diff options
context:
space:
mode:
Diffstat (limited to 'templates/web/base')
-rw-r--r--templates/web/base/admin/report_edit.html4
-rw-r--r--templates/web/base/alert/index.html3
-rw-r--r--templates/web/base/around/index.html3
-rw-r--r--templates/web/base/around/lookup_by_ref.html3
-rw-r--r--templates/web/base/common_header_tags.html18
-rw-r--r--templates/web/base/common_scripts.html77
-rw-r--r--templates/web/base/front/javascript.html12
-rw-r--r--templates/web/base/header.html5
-rw-r--r--templates/web/base/index.html5
-rw-r--r--templates/web/base/maps/bing.html8
-rw-r--r--templates/web/base/maps/fms.html6
-rw-r--r--templates/web/base/maps/google-ol.html14
-rw-r--r--templates/web/base/maps/google.html6
-rw-r--r--templates/web/base/maps/mapquest-attribution.html8
-rw-r--r--templates/web/base/maps/osm-streetview.html8
-rw-r--r--templates/web/base/maps/osm-toner-lite.html9
-rw-r--r--templates/web/base/maps/osm.html5
-rw-r--r--templates/web/base/report/_inspect.html2
-rw-r--r--templates/web/base/report/photo-js.html3
19 files changed, 89 insertions, 110 deletions
diff --git a/templates/web/base/admin/report_edit.html b/templates/web/base/admin/report_edit.html
index c58b2d605..ff99bb907 100644
--- a/templates/web/base/admin/report_edit.html
+++ b/templates/web/base/admin/report_edit.html
@@ -1,8 +1,8 @@
[%
PROCESS "maps/${map.type}.html" admin = 1;
+ SET bodyclass = 'mappage with-notes';
INCLUDE 'admin/header.html'
- title = tprintf(loc('Editing problem %d'), problem.id ),
- bodyclass = 'mappage with-notes';
+ title = tprintf(loc('Editing problem %d'), problem.id );
PROCESS 'admin/report_blocks.html'
-%]
diff --git a/templates/web/base/alert/index.html b/templates/web/base/alert/index.html
index 38ed6f6f5..1442e6bdc 100644
--- a/templates/web/base/alert/index.html
+++ b/templates/web/base/alert/index.html
@@ -1,4 +1,5 @@
-[% INCLUDE 'header.html', title = loc('Local RSS feeds and email alerts'), bodyclass = 'fullwidthpage' %]
+[% SET bodyclass = 'alertpage fullwidthpage' %]
+[% INCLUDE 'header.html', title = loc('Local RSS feeds and email alerts') %]
<h1>[% loc('Local RSS feeds and email alerts') %]</h1>
diff --git a/templates/web/base/around/index.html b/templates/web/base/around/index.html
index f2be5575c..8f6af6225 100644
--- a/templates/web/base/around/index.html
+++ b/templates/web/base/around/index.html
@@ -1,5 +1,6 @@
[% pre_container_extra = INCLUDE 'around/postcode_form.html' %]
-[% INCLUDE 'header.html', title = loc('Reporting a problem'), bodyclass = 'frontpage fullwidthpage' %]
+[% SET bodyclass = 'frontpage fullwidthpage' ~%]
+[% INCLUDE 'header.html', title = loc('Reporting a problem') %]
[%
# NOTE ON PARTIAL REPORTS:
diff --git a/templates/web/base/around/lookup_by_ref.html b/templates/web/base/around/lookup_by_ref.html
index 5c08a7ceb..747354c1e 100644
--- a/templates/web/base/around/lookup_by_ref.html
+++ b/templates/web/base/around/lookup_by_ref.html
@@ -1,5 +1,6 @@
[% pre_container_extra = INCLUDE 'around/postcode_form.html', pc = ref %]
-[% INCLUDE 'header.html', title = loc('Reporting a problem'), bodyclass = 'frontpage fullwidthpage' %]
+[% SET bodyclass = 'frontpage fullwidthpage' ~%]
+[% INCLUDE 'header.html', title = loc('Reporting a problem') %]
[% IF matching_reports %]
<p>[% loc('We found more than one match for that problem reference:') %]</p>
diff --git a/templates/web/base/common_header_tags.html b/templates/web/base/common_header_tags.html
index 321e45649..f65f1e336 100644
--- a/templates/web/base/common_header_tags.html
+++ b/templates/web/base/common_header_tags.html
@@ -33,3 +33,21 @@
[% "$title :: " | html IF title %]
[% site_name -%]
</title>
+
+[% IF bodyclass.match('frontpage') %]
+ <link rel="prefetch" href="[% version('/js/validation_rules.js') %]">
+ [%~ IF NOT c.user_exists OR NOT (c.user.from_body OR c.user.is_superuser) %]
+ <link rel="prefetch" href="[% version('/jslib/jquery-1.7.2.min.js') %]">
+ [%~ END %]
+ <link rel="prefetch" href="[% version('/js/jquery.multi-select.js') %]">
+ <link rel="prefetch" href="[% version('/vendor/jquery.validate.min.js') %]">
+ <link rel="prefetch" href="[% version('/cobrands/fixmystreet/fixmystreet.js') %]">
+[% END %]
+[% IF NOT bodyclass.match('mappage') %]
+ [% FOR script IN map_js %]
+ <link rel="prefetch" href="[% IF script.match('^/'); version(script); ELSE; script; END %]">
+ [% END %]
+ <link rel="prefetch" href="[% version('/cobrands/fixmystreet/map.js') %]">
+ <link rel="prefetch" href="[% version('/vendor/dropzone.min.js') %]">
+ <link rel="prefetch" href="[% version('/vendor/fancybox/jquery.fancybox-1.3.4.pack.js') %]">
+[% END %]
diff --git a/templates/web/base/common_scripts.html b/templates/web/base/common_scripts.html
index 057ecfd67..c6225e8fa 100644
--- a/templates/web/base/common_scripts.html
+++ b/templates/web/base/common_scripts.html
@@ -7,28 +7,75 @@ scripts = [];
scripts.push(
start _ "/js/translation_strings." _ lang_code _ ".js?" _ Math.int( date.now / 3600 ),
- version('/jslib/jquery-1.7.2.min.js'),
- version('/js/validation_rules.js'),
- version('/vendor/jquery.validate.min.js'),
- version('/vendor/dropzone.min.js'),
- version('/js/jquery.multi-select.js'),
- version('/cobrands/fixmystreet/fixmystreet.js'),
);
-IF c.user_exists AND (c.user.from_body OR c.user.is_superuser);
+SET jquery_loaded = 0;
+SET geolocation_loaded = 0;
+IF bodyclass.match('frontpage');
+ SET geolocation_loaded = 1;
scripts.push(
- version('/cobrands/fixmystreet/staff.js')
+ version('/js/front.js'),
+ version('/js/geolocation.js'),
+ );
+ELSIF bodyclass.match('alertpage');
+ SET geolocation_loaded = 1;
+ scripts.push(
+ version('/js/geolocation.js'),
+ );
+ELSE;
+ SET jquery_loaded = 1;
+ scripts.push(
+ version('/js/validation_rules.js'),
+ version('/jslib/jquery-1.7.2.min.js'),
+ version('/js/jquery.multi-select.js'),
+ version('/vendor/jquery.validate.min.js'),
+ version('/cobrands/fixmystreet/fixmystreet.js'),
);
END;
-FOR script IN map_js;
+FOR script IN extra_js;
scripts.push(script);
END;
-scripts.push(
- version('/cobrands/fixmystreet/map.js'),
- version('/cobrands/fixmystreet/offline.js'),
-);
+IF c.user_exists AND (c.user.from_body OR c.user.is_superuser);
+ IF NOT geolocation_loaded;
+ scripts.push(
+ version('/js/geolocation.js'),
+ );
+ END;
+ IF NOT jquery_loaded;
+ scripts.push(
+ version('/jslib/jquery-1.7.2.min.js'),
+ );
+ END;
+ scripts.push(
+ version('/cobrands/fixmystreet/staff.js')
+ );
+ IF c.user.has_body_permission_to('planned_reports');
+ scripts.push(
+ version('/cobrands/fixmystreet/offline.js'),
+ );
+ END;
+END;
+
+IF bodyclass.match('mappage');
+ FOR script IN map_js;
+ IF script.match('^/');
+ scripts.push(version(script));
+ ELSE;
+ scripts.push(script);
+ END;
+ END;
+ scripts.push(
+ version('/cobrands/fixmystreet/map.js'),
+ version('/vendor/dropzone.min.js'),
+ version('/vendor/fancybox/jquery.fancybox-1.3.4.pack.js'),
+ );
+ELSE;
+ scripts.push(
+ version('/cobrands/fixmystreet/prefetch-polyfill.js'),
+ );
+END;
IF admin;
scripts.push(
@@ -37,10 +84,6 @@ IF admin;
);
END;
-FOR script IN extra_js;
- scripts.push(script);
-END;
-
TRY;
PROCESS 'footer_extra_js.html';
CATCH file;
diff --git a/templates/web/base/front/javascript.html b/templates/web/base/front/javascript.html
deleted file mode 100644
index 69eb626f7..000000000
--- a/templates/web/base/front/javascript.html
+++ /dev/null
@@ -1,12 +0,0 @@
-[%
-# Assume using OpenStreetMap maps
-map_js = [
- version('/vendor/yepnope.js'),
- [ version('/cobrands/fixmystreet/front.js'), {
- id = 'script_front',
- 'data-scripts' = version('/vendor/OpenLayers/OpenLayers.fixmystreet.js') _ ',' _
- version('/js/map-OpenLayers.js') _ ',' _
- version('/js/map-OpenStreetMap.js')
- } ],
-]
-%]
diff --git a/templates/web/base/header.html b/templates/web/base/header.html
index 37c81f454..faba02519 100644
--- a/templates/web/base/header.html
+++ b/templates/web/base/header.html
@@ -21,11 +21,6 @@
[% INCLUDE 'header_opengraph.html' %]
[% INCLUDE 'header/css.html' %]
[% INCLUDE 'common_header_tags.html' %]
-
- [% IF c.req.uri.host == 'osm.fixmystreet.com' %]
- <link rel="canonical" href="https://www.fixmystreet.com[% c.req.uri.path_query %]">
- [% END %]
-
[% TRY %][% PROCESS 'header_extra.html' %][% CATCH file %][% END %]
</head>
diff --git a/templates/web/base/index.html b/templates/web/base/index.html
index 92c6b1eed..620c1a2be 100644
--- a/templates/web/base/index.html
+++ b/templates/web/base/index.html
@@ -1,7 +1,6 @@
-[% PROCESS 'front/javascript.html' %]
-
[% pre_container_extra = PROCESS 'around/postcode_form.html' %]
-[% INCLUDE 'header.html', title = '', bodyclass = 'frontpage fullwidthpage' inline_css = 1 %]
+[% SET bodyclass = 'frontpage fullwidthpage' %]
+[% INCLUDE 'header.html', title = '', inline_css = 1 %]
[% IF error %]
<p class="form-error">[% error %]</p>
diff --git a/templates/web/base/maps/bing.html b/templates/web/base/maps/bing.html
deleted file mode 100644
index df45eced5..000000000
--- a/templates/web/base/maps/bing.html
+++ /dev/null
@@ -1,8 +0,0 @@
-[%
-map_js = [
- version('/vendor/OpenLayers/OpenLayers.fixmystreet.js'),
- version('/js/map-OpenLayers.js'),
- version('/js/map-bing-ol.js'),
-];
-map_html = INCLUDE maps/openlayers.html
-%]
diff --git a/templates/web/base/maps/fms.html b/templates/web/base/maps/fms.html
index ff5b4eab6..286ecc8ff 100644
--- a/templates/web/base/maps/fms.html
+++ b/templates/web/base/maps/fms.html
@@ -1,9 +1,3 @@
[%
-map_js = [
- version('/vendor/OpenLayers/OpenLayers.fixmystreet.js'),
- version('/js/map-OpenLayers.js'),
- version('/js/map-bing-ol.js'),
- version('/js/map-fms.js'),
-];
map_html = INCLUDE maps/openlayers.html include_key = 1
%]
diff --git a/templates/web/base/maps/google-ol.html b/templates/web/base/maps/google-ol.html
index d88043403..3cd21fab3 100644
--- a/templates/web/base/maps/google-ol.html
+++ b/templates/web/base/maps/google-ol.html
@@ -1,17 +1,3 @@
-[%
-google_maps_url = "https://maps.googleapis.com/maps/api/js?v=3";
-IF c.config.GOOGLE_MAPS_API_KEY;
- google_maps_url = google_maps_url _ "&amp;key=" _ c.config.GOOGLE_MAPS_API_KEY;
-END;
-
-map_js = [
- google_maps_url,
- version('/vendor/OpenLayers/OpenLayers.google.js'),
- version('/js/map-OpenLayers.js'),
- version('/js/map-google-ol.js'),
-]
-%]
-
[% map_sub_links = BLOCK %]
<a class="hidden-nojs" id="map_layer_toggle" href="">[% loc('Satellite') %]</a>
[% END %]
diff --git a/templates/web/base/maps/google.html b/templates/web/base/maps/google.html
index ec9885a04..e8c07b113 100644
--- a/templates/web/base/maps/google.html
+++ b/templates/web/base/maps/google.html
@@ -6,12 +6,6 @@
color: #000;
}
</style>
-[%
-map_js = [
- "http://maps.googleapis.com/maps/api/js?sensor=false",
- version('/js/map-google.js'),
-]
-%]
[% map_html = BLOCK %]
<script nonce="[% csp_nonce %]">
diff --git a/templates/web/base/maps/mapquest-attribution.html b/templates/web/base/maps/mapquest-attribution.html
deleted file mode 100644
index 43d6106a5..000000000
--- a/templates/web/base/maps/mapquest-attribution.html
+++ /dev/null
@@ -1,8 +0,0 @@
-[%
-map_js = [
- version('/vendor/OpenLayers/OpenLayers.fixmystreet.js'),
- version('/js/map-OpenLayers.js'),
- version('/js/map-OpenStreetMap.js'),
-];
-map_html = INCLUDE maps/openlayers.html
-%]
diff --git a/templates/web/base/maps/osm-streetview.html b/templates/web/base/maps/osm-streetview.html
deleted file mode 100644
index f68f53039..000000000
--- a/templates/web/base/maps/osm-streetview.html
+++ /dev/null
@@ -1,8 +0,0 @@
-[%
-map_js = [
- version('/vendor/OpenLayers/OpenLayers.fixmystreet.js'),
- version('/js/map-OpenLayers.js'),
- version('/js/map-streetview.js'),
-];
-map_html = INCLUDE maps/openlayers.html
-%]
diff --git a/templates/web/base/maps/osm-toner-lite.html b/templates/web/base/maps/osm-toner-lite.html
deleted file mode 100644
index 22b6636c5..000000000
--- a/templates/web/base/maps/osm-toner-lite.html
+++ /dev/null
@@ -1,9 +0,0 @@
-[%
-map_js = [
- version('/vendor/OpenLayers/OpenLayers.fixmystreet.js'),
- "https://stamen-maps.a.ssl.fastly.net/js/tile.stamen.js?v1.3.0",
- version('/js/map-OpenLayers.js'),
- version('/js/map-toner-lite.js'),
-];
-map_html = INCLUDE maps/openlayers.html
-%]
diff --git a/templates/web/base/maps/osm.html b/templates/web/base/maps/osm.html
index 43d6106a5..51c3ad388 100644
--- a/templates/web/base/maps/osm.html
+++ b/templates/web/base/maps/osm.html
@@ -1,8 +1,3 @@
[%
-map_js = [
- version('/vendor/OpenLayers/OpenLayers.fixmystreet.js'),
- version('/js/map-OpenLayers.js'),
- version('/js/map-OpenStreetMap.js'),
-];
map_html = INCLUDE maps/openlayers.html
%]
diff --git a/templates/web/base/report/_inspect.html b/templates/web/base/report/_inspect.html
index e4e3ac9e6..5088332ce 100644
--- a/templates/web/base/report/_inspect.html
+++ b/templates/web/base/report/_inspect.html
@@ -44,7 +44,7 @@
<a target="_blank" href="https://www.google.com/maps/dir/Current+Location/[% problem.latitude %],[% problem.longitude %]" class="btn btn--block btn--navigate">[% loc('Navigate to this problem') %]</a>
</p>
<p>
- <a href="#" class="btn btn--block btn--geolocate" id="geolocate_link">[% loc('Set to my current location') %]</a>
+ <a href="#" class="btn btn--block btn--geolocate">[% loc('Set to my current location') %]</a>
</p>
</div>
diff --git a/templates/web/base/report/photo-js.html b/templates/web/base/report/photo-js.html
index 8c8c91669..6f3dd55d1 100644
--- a/templates/web/base/report/photo-js.html
+++ b/templates/web/base/report/photo-js.html
@@ -1,6 +1,3 @@
[% extra_css = BLOCK %]
<link rel="stylesheet" href="[% version('/vendor/fancybox/jquery.fancybox-1.3.4.css') %]">
[% END %]
-[% extra_js = [
- version('/vendor/fancybox/jquery.fancybox-1.3.4.pack.js')
-] %]