aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/Map/BathNES.pm2
-rw-r--r--web/cobrands/bathnes/base.scss15
-rw-r--r--web/cobrands/bathnes/js.js51
3 files changed, 68 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Map/BathNES.pm b/perllib/FixMyStreet/Map/BathNES.pm
index b21ba6ce7..45261a625 100644
--- a/perllib/FixMyStreet/Map/BathNES.pm
+++ b/perllib/FixMyStreet/Map/BathNES.pm
@@ -11,7 +11,9 @@ sub map_javascript { [
'/vendor/OpenLayers.Projection.OrdnanceSurvey.js',
'/js/map-OpenLayers.js',
'/js/map-OpenStreetMap.js',
+ '/cobrands/fixmystreet-uk-councils/roadworks.js',
'/cobrands/fixmystreet/assets.js',
+ '/cobrands/bathnes/js.js',
'/cobrands/bathnes/assets.js',
] }
diff --git a/web/cobrands/bathnes/base.scss b/web/cobrands/bathnes/base.scss
index 934d9ffdd..f84323b1c 100644
--- a/web/cobrands/bathnes/base.scss
+++ b/web/cobrands/bathnes/base.scss
@@ -76,3 +76,18 @@ a:active, a:hover { color: $link-hover-colour; }
color: #fff;
}
}
+
+.js-roadworks-message {
+ margin: 1em -1em;
+ padding: 1em;
+ background-color: #00aeef;
+ color: #fff;
+ dt {
+ float: left;
+ margin-right: 0.25em;
+ }
+
+ p:last-child {
+ font-weight: bold;
+ }
+}
diff --git a/web/cobrands/bathnes/js.js b/web/cobrands/bathnes/js.js
new file mode 100644
index 000000000..06741e10d
--- /dev/null
+++ b/web/cobrands/bathnes/js.js
@@ -0,0 +1,51 @@
+(function(){
+
+if (!fixmystreet.maps) {
+ return;
+}
+
+fixmystreet.roadworks.display_message = function(feature) {
+ var attr = feature.attributes,
+ start = new Date(attr.start.replace(/{ts '([^ ]*).*/, '$1')).toDateString(),
+ end = new Date(attr.end.replace(/{ts '([^ ]*).*/, '$1')).toDateString(),
+ tooltip = attr.tooltip.replace(/\\n/g, '\n'),
+ desc = attr.works_desc.replace(/\\n/g, '\n');
+
+ var $msg = $('<div class="js-roadworks-message box-warning"><h3>Roadworks are scheduled near this location, so you may not need to report your issue.</h3></div>');
+ var $dl = $("<dl></dl>").appendTo($msg);
+ $dl.append("<dt>Dates:</dt>");
+ $dl.append($("<dd></dd>").text(start + " until " + end));
+ $dl.append("<dt>Summary:</dt>");
+ var $summary = $("<dd></dd>").appendTo($dl);
+ tooltip.split("\n").forEach(function(para) {
+ if (para.match(/^(\d{2}\s+\w{3}\s+(\d{2}:\d{2}\s+)?\d{4}( - )?){2}/)) {
+ // skip showing the date again
+ return;
+ }
+ if (para.match(/^delays/)) {
+ // skip showing traffic delay information
+ return;
+ }
+ $summary.append(para).append("<br />");
+ });
+ if (desc) {
+ $dl.append("<dt>Description:</dt>");
+ $dl.append($("<dd></dd>").text(desc));
+ }
+ $dl.append($("<p>If you think this issue needs immediate attention you can continue your report below</p>"));
+
+ $('.change_location').after($msg);
+};
+
+var org_id = '114';
+var body = "Bath and North East Somerset Council";
+fixmystreet.assets.add($.extend(true, {}, fixmystreet.roadworks.layer_future, {
+ http_options: { params: { organisation_id: org_id } },
+ body: body
+}));
+fixmystreet.assets.add($.extend(true, {}, fixmystreet.roadworks.layer_planned, {
+ http_options: { params: { organisation_id: org_id } },
+ body: body
+}));
+
+})();