aboutsummaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
Diffstat (limited to 'web')
-rw-r--r--web/cobrands/fixmystreet/assets.js172
-rw-r--r--web/cobrands/fixmystreet/fixmystreet.js18
-rw-r--r--web/cobrands/fixmystreet/staff.js46
-rwxr-xr-xweb/cobrands/rutland/RCCLogo.gifbin0 -> 74768 bytes
-rwxr-xr-xweb/cobrands/rutland/_colours.scss34
-rwxr-xr-xweb/cobrands/rutland/base.scss16
-rw-r--r--web/cobrands/rutland/images/email-logo.gifbin0 -> 3606 bytes
-rwxr-xr-xweb/cobrands/rutland/layout.scss15
-rw-r--r--web/cobrands/sass/_base.scss3
-rw-r--r--web/cobrands/zurich/base.scss6
-rw-r--r--web/cobrands/zurich/js.js2
-rw-r--r--web/cobrands/zurich/layout.scss8
-rw-r--r--web/js/map-OpenLayers.js7
13 files changed, 204 insertions, 123 deletions
diff --git a/web/cobrands/fixmystreet/assets.js b/web/cobrands/fixmystreet/assets.js
index 26a13dc1d..14aab2db2 100644
--- a/web/cobrands/fixmystreet/assets.js
+++ b/web/cobrands/fixmystreet/assets.js
@@ -1,12 +1,97 @@
var fixmystreet = fixmystreet || {};
+/* Special USRN handling */
+
(function(){
-var selected_feature = null;
-var fault_popup = null;
var selected_usrn = null;
var usrn_field = null;
+fixmystreet.usrn = {
+ select: function(evt, lonlat) {
+ var usrn_providers = fixmystreet.map.getLayersBy('fixmystreet', {
+ test: function(options) {
+ return options && options.usrn;
+ }
+ });
+ if (usrn_providers.length) {
+ var usrn_layer = usrn_providers[0];
+ usrn_field = usrn_layer.fixmystreet.usrn.field;
+ var point = new OpenLayers.Geometry.Point(lonlat.lon, lonlat.lat);
+ var feature = usrn_layer.getFeatureAtPoint(point);
+ if (feature == null) {
+ // The click wasn't directly over a road, try and find one
+ // nearby
+ feature = usrn_layer.getNearestFeature(point, 10);
+ }
+ if (feature !== null) {
+ selected_usrn = feature.attributes[usrn_layer.fixmystreet.usrn.attribute];
+ } else {
+ selected_usrn = null;
+ }
+ fixmystreet.usrn.update_field();
+ }
+ },
+
+ update_field: function() {
+ $("input[name="+usrn_field+"]").val(selected_usrn);
+ }
+};
+
+$(fixmystreet).on('maps:update_pin', fixmystreet.usrn.select);
+$(fixmystreet).on('assets:selected', fixmystreet.usrn.select);
+$(fixmystreet).on('report_new:category_change:extras_received', fixmystreet.usrn.update_field);
+
+})();
+
+(function(){
+
+var selected_feature = null;
+var fault_popup = null;
+
+/*
+ * Adds the layer to the map and sets up event handlers and whatnot.
+ * Called as part of fixmystreet.assets.init for each asset layer on the map.
+ */
+function init_asset_layer(layer, pins_layer) {
+ fixmystreet.map.addLayer(layer);
+ if (layer.fixmystreet.asset_category) {
+ fixmystreet.map.events.register( 'zoomend', layer, check_zoom_message_visibility);
+ }
+
+ // Don't cover the existing pins layer
+ if (pins_layer) {
+ layer.setZIndex(pins_layer.getZIndex()-1);
+ }
+
+ // Make sure the fault markers always appear beneath the linked assets
+ if (layer.fixmystreet.fault_layer) {
+ fixmystreet.map.addLayer(layer.fixmystreet.fault_layer);
+ layer.fixmystreet.fault_layer.setZIndex(layer.getZIndex()-1);
+ }
+
+ if (!layer.fixmystreet.always_visible) {
+ // Show/hide the asset layer when the category is chosen
+ $("#problem_form").on("change.category", "select#form_category", function(){
+ var category = $(this).val();
+ if (category == layer.fixmystreet.asset_category) {
+ layer.setVisibility(true);
+ if (layer.fixmystreet.fault_layer) {
+ layer.fixmystreet.fault_layer.setVisibility(true);
+ }
+ zoom_to_assets(layer);
+ } else {
+ layer.setVisibility(false);
+ if (layer.fixmystreet.fault_layer) {
+ layer.fixmystreet.fault_layer.setVisibility(false);
+ }
+ }
+ });
+ }
+
+}
+
+
function close_fault_popup() {
if (!!fault_popup) {
fixmystreet.map.removePopup(fault_popup);
@@ -37,7 +122,7 @@ function asset_selected(e) {
// Pick up the USRN for the location of this asset. NB we do this *before*
// handling the attributes on the selected feature in case the feature has
// its own USRN which should take precedence.
- fixmystreet.assets.select_usrn(lonlat);
+ $(fixmystreet).trigger('assets:selected', [ lonlat ]);
// Set the extra field to the value of the selected feature
$.each(this.fixmystreet.attributes, function (field_name, attribute_name) {
@@ -253,14 +338,15 @@ fixmystreet.assets = {
var protocol_options;
var protocol;
if (options.http_options !== undefined) {
- protocol_options = OpenLayers.Util.extend(options.http_options, {});
- if (protocol_options.format_class) {
- protocol_options.format = new protocol_options.format_class(protocol_options.format_options);
- } else {
- protocol_options.format = new OpenLayers.Format.GML({
- geometryName: options.geometryName
- });
+ protocol_options = options.http_options;
+ OpenLayers.Util.applyDefaults(options, {
+ format_class: OpenLayers.Format.GML,
+ format_options: {}
+ });
+ if (options.geometryName) {
+ options.format_options.geometryName = options.geometryName;
}
+ protocol_options.format = new options.format_class(options.format_options);
protocol = new OpenLayers.Protocol.HTTP(protocol_options);
} else {
protocol_options = {
@@ -374,25 +460,6 @@ fixmystreet.assets = {
if (select_feature_control) {
fixmystreet.assets.controls.push(select_feature_control);
}
-
- if (!asset_layer.fixmystreet.always_visible) {
- // Show/hide the asset layer when the category is chosen
- $("#problem_form").on("change.category", "select#form_category", function(){
- var category = $(this).val();
- if (category == options.asset_category) {
- asset_layer.setVisibility(true);
- if (asset_layer.fixmystreet.fault_layer) {
- asset_layer.fixmystreet.fault_layer.setVisibility(true);
- }
- zoom_to_assets(asset_layer);
- } else {
- asset_layer.setVisibility(false);
- if (asset_layer.fixmystreet.fault_layer) {
- asset_layer.fixmystreet.fault_layer.setVisibility(false);
- }
- }
- });
- }
},
init: function() {
@@ -418,58 +485,13 @@ fixmystreet.assets = {
var pins_layer = fixmystreet.map.getLayersByName("Pins")[0];
for (var i = 0; i < fixmystreet.assets.layers.length; i++) {
- var layer = fixmystreet.assets.layers[i];
- fixmystreet.map.addLayer(layer);
- if (layer.fixmystreet.asset_category) {
- fixmystreet.map.events.register( 'zoomend', layer, check_zoom_message_visibility);
- }
-
- // Don't cover the existing pins layer
- if (pins_layer) {
- layer.setZIndex(pins_layer.getZIndex()-1);
- }
-
- // Make sure the fault markers always appear beneath the linked assets
- if (layer.fixmystreet.fault_layer) {
- fixmystreet.map.addLayer(layer.fixmystreet.fault_layer);
- layer.fixmystreet.fault_layer.setZIndex(layer.getZIndex()-1);
- }
-
+ init_asset_layer(fixmystreet.assets.layers[i], pins_layer);
}
for (i = 0; i < fixmystreet.assets.controls.length; i++) {
fixmystreet.map.addControl(fixmystreet.assets.controls[i]);
fixmystreet.assets.controls[i].activate();
}
- },
-
- select_usrn: function(lonlat) {
- var usrn_providers = fixmystreet.map.getLayersBy('fixmystreet', {
- test: function(options) {
- return options && options.usrn;
- }
- });
- if (usrn_providers.length) {
- var usrn_layer = usrn_providers[0];
- usrn_field = usrn_layer.fixmystreet.usrn.field;
- var point = new OpenLayers.Geometry.Point(lonlat.lon, lonlat.lat);
- var feature = usrn_layer.getFeatureAtPoint(point);
- if (feature == null) {
- // The click wasn't directly over a road, try and find one
- // nearby
- feature = usrn_layer.getNearestFeature(point, 10);
- }
- if (feature !== null) {
- selected_usrn = feature.attributes[usrn_layer.fixmystreet.usrn.attribute];
- } else {
- selected_usrn = null;
- }
- fixmystreet.assets.update_usrn_field();
- }
- },
-
- update_usrn_field: function() {
- $("input[name="+usrn_field+"]").val(selected_usrn);
}
};
diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js
index 1253af6b6..d85a5cdbc 100644
--- a/web/cobrands/fixmystreet/fixmystreet.js
+++ b/web/cobrands/fixmystreet/fixmystreet.js
@@ -151,8 +151,6 @@ function isR2L() {
});
})(jQuery);
-fixmystreet.hooks = fixmystreet.hooks || {};
-
fixmystreet.mobile_reporting = {
apply_ui: function() {
// Creates the "app-like" mobile reporting UI with full screen map
@@ -411,24 +409,20 @@ $.extend(fixmystreet.set_up, {
if ( data.category_extra ) {
if ( $category_meta.length ) {
$category_meta.replaceWith( data.category_extra );
+ // Preserve any existing values
+ $category_meta.find("[name]").each(function() {
+ $('#category_meta').find("[name="+this.name+"]").val(this.value);
+ });
} else {
$('#form_category_row').after( data.category_extra );
}
} else {
$category_meta.empty();
}
- if (fixmystreet.assets) {
- fixmystreet.assets.update_usrn_field();
- }
+ $(fixmystreet).trigger('report_new:category_change:extras_received');
});
- if (fixmystreet.hooks.update_problem_fields) {
- args.prefill_reports = $(this).data('prefill');
- args.role = $(this).data('role');
- args.body = $(this).data('body');
-
- fixmystreet.hooks.update_problem_fields(args);
- }
+ $(fixmystreet).trigger('report_new:category_change', [ $(this) ]);
});
},
diff --git a/web/cobrands/fixmystreet/staff.js b/web/cobrands/fixmystreet/staff.js
index 4577ab65e..dd65bc3ce 100644
--- a/web/cobrands/fixmystreet/staff.js
+++ b/web/cobrands/fixmystreet/staff.js
@@ -428,31 +428,33 @@ $.extend(fixmystreet.set_up, {
});
-$.extend(fixmystreet.hooks, {
- update_problem_fields: function(args) {
- if (args.prefill_reports && args.role == 'inspector') {
- var title = 'A ' + args.category + ' problem has been found';
- var description = 'A ' + args.category + ' problem has been found by ' + args.body;
-
- var $title_field = $('#form_title');
- var $description_field = $('#form_detail');
-
- if ($title_field.val().length === 0 || $title_field.data('autopopulated') === true) {
- $title_field.val(title);
- $title_field.data('autopopulated', true);
- }
-
- if ($description_field.val().length === 0 || $description_field.data('autopopulated') === true) {
- $description_field.val(description);
- $description_field.data('autopopulated', true);
- }
+$(fixmystreet).on('report_new:category_change', function(evt, $this) {
+ var category = $this.val();
+ var prefill_reports = $this.data('prefill');
+ var role = $this.data('role');
+ var body = $this.data('body');
+
+ if (prefill_reports && role == 'inspector') {
+ var title = 'A ' + category + ' problem has been found';
+ var description = 'A ' + category + ' problem has been found by ' + body;
+
+ var $title_field = $('#form_title');
+ var $description_field = $('#form_detail');
+
+ if ($title_field.val().length === 0 || $title_field.data('autopopulated') === true) {
+ $title_field.val(title);
+ $title_field.data('autopopulated', true);
+ }
- $('#form_title, #form_detail').on('keyup', function() {
- $(this).data('autopopulated', false);
- });
+ if ($description_field.val().length === 0 || $description_field.data('autopopulated') === true) {
+ $description_field.val(description);
+ $description_field.data('autopopulated', true);
}
- }
+ $('#form_title, #form_detail').on('keyup', function() {
+ $(this).data('autopopulated', false);
+ });
+ }
});
fixmystreet.maps = fixmystreet.maps || {};
diff --git a/web/cobrands/rutland/RCCLogo.gif b/web/cobrands/rutland/RCCLogo.gif
new file mode 100755
index 000000000..aeacf01f6
--- /dev/null
+++ b/web/cobrands/rutland/RCCLogo.gif
Binary files differ
diff --git a/web/cobrands/rutland/_colours.scss b/web/cobrands/rutland/_colours.scss
new file mode 100755
index 000000000..c3666ca17
--- /dev/null
+++ b/web/cobrands/rutland/_colours.scss
@@ -0,0 +1,34 @@
+/* LAYOUT */
+
+// If you are wanting a right-to-left layout, uncomment the following line.
+// $direction: right;
+
+/* COLOURS */
+
+$orange: #ff9900;
+$bluey: #6688ff;
+$RCCGreen: #a7b980;
+$RCCGreen_dark: #265123;
+$RCCbg: #F1F1F1;
+
+$primary: $RCCGreen;
+$primary_b: #000000;
+$primary_text: #222222;
+
+$base_bg: $RCCbg;
+$base_fg: #000;
+
+$map_nav_bg: $RCCbg;
+$nav_fg: #000;
+$nav_fg_hover: $primary;
+
+// Colour used for front page 'how to report a problem' steps
+$col_big_numbers: #ccc;
+
+$col_click_map: $RCCGreen_dark;
+
+$col_fixed_label: #00BD08;
+$col_fixed_label_dark: #4B8304;
+
+//$image-sprite: '/cobrands/rutland/RCCLogo.gif';
+
diff --git a/web/cobrands/rutland/base.scss b/web/cobrands/rutland/base.scss
new file mode 100755
index 000000000..4837e970a
--- /dev/null
+++ b/web/cobrands/rutland/base.scss
@@ -0,0 +1,16 @@
+@import "../sass/h5bp";
+@import "./_colours";
+@import "../sass/mixins";
+
+@import "../sass/base";
+
+
+#site-logo {
+ background: url("/cobrands/rutland/RCCLogo.gif");
+ background-size: contain;
+ height: 50px;
+ width: 110px;
+}
+
+
+
diff --git a/web/cobrands/rutland/images/email-logo.gif b/web/cobrands/rutland/images/email-logo.gif
new file mode 100644
index 000000000..bab9d2eef
--- /dev/null
+++ b/web/cobrands/rutland/images/email-logo.gif
Binary files differ
diff --git a/web/cobrands/rutland/layout.scss b/web/cobrands/rutland/layout.scss
new file mode 100755
index 000000000..eb0447be2
--- /dev/null
+++ b/web/cobrands/rutland/layout.scss
@@ -0,0 +1,15 @@
+@import "_colours";
+@import "../sass/layout";
+
+
+body.frontpage #site-header {
+ height: 10em;
+}
+
+
+body.frontpage #site-logo {
+ background: url("/cobrands/rutland/RCCLogo.gif");
+ background-size: contain;
+ height: 100px;
+ width: 220px;
+}
diff --git a/web/cobrands/sass/_base.scss b/web/cobrands/sass/_base.scss
index 4f46d685a..4e2a2fd5f 100644
--- a/web/cobrands/sass/_base.scss
+++ b/web/cobrands/sass/_base.scss
@@ -560,6 +560,9 @@ ul.error {
font-size: 1.25em;
border-bottom: 0.25em solid #333;
}
+ a:visited {
+ color: #333;
+ }
a:hover, span.hover {
background-color: #333;
color: #fff;
diff --git a/web/cobrands/zurich/base.scss b/web/cobrands/zurich/base.scss
index 101118a02..f526a8f1e 100644
--- a/web/cobrands/zurich/base.scss
+++ b/web/cobrands/zurich/base.scss
@@ -224,9 +224,9 @@ h4.static-with-rule {
margin-right: 0.2em;
}
- table tr.is-deleted {
- background-color: transparent;
- }
+}
+table#admin_bodies tr.is-deleted {
+ background-color: transparent;
}
.admin-label--inline {
diff --git a/web/cobrands/zurich/js.js b/web/cobrands/zurich/js.js
index d2909bb6d..8b30436d5 100644
--- a/web/cobrands/zurich/js.js
+++ b/web/cobrands/zurich/js.js
@@ -77,7 +77,7 @@ $(function() {
$('#assignation__category').show();
$('#assignation__subdivision').show();
}
- if ((state === 'closed') || (state === 'investigating')) {
+ if ((state === 'external') || (state === 'wish')) {
$('#assignation__external').show();
} else {
$('#assignation__external').hide();
diff --git a/web/cobrands/zurich/layout.scss b/web/cobrands/zurich/layout.scss
index d49f400e6..31469926f 100644
--- a/web/cobrands/zurich/layout.scss
+++ b/web/cobrands/zurich/layout.scss
@@ -283,6 +283,10 @@ body.mappage.admin {
}
}
+.admin-report-edit--interact {
+ margin-top: -1.25em; // To counteract the label's default top margin
+}
+
.admin {
.content {
margin: 2em 0 1em;
@@ -300,10 +304,6 @@ body.mappage.admin {
font-weight: bold;
padding-right: 0.333em;
}
- :first-child > label {
- // avoid empty space above first label in a container
- margin-top: 0;
- }
textarea {
min-height: 0;
}
diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js
index 5ebb9a18e..0a1c947a0 100644
--- a/web/js/map-OpenLayers.js
+++ b/web/js/map-OpenLayers.js
@@ -59,12 +59,7 @@ $.extend(fixmystreet.utils, {
document.getElementById('fixmystreet.latitude').value = lat;
document.getElementById('fixmystreet.longitude').value = lon;
- // This tight coupling isn't ideal. A better solution would be for the
- // asset code to register an event handler somewhere, but the correct
- // place isn't apparent.
- if (fixmystreet.assets) {
- fixmystreet.assets.select_usrn(lonlat);
- }
+ $(fixmystreet).trigger('maps:update_pin', [ lonlat ]);
return {
'url': { 'lon': lon, 'lat': lat },