aboutsummaryrefslogtreecommitdiffstats
path: root/web/js/fixmystreet.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/js/fixmystreet.js')
-rw-r--r--web/js/fixmystreet.js17
1 files changed, 7 insertions, 10 deletions
diff --git a/web/js/fixmystreet.js b/web/js/fixmystreet.js
index b689d501c..1d5ef6b97 100644
--- a/web/js/fixmystreet.js
+++ b/web/js/fixmystreet.js
@@ -53,13 +53,7 @@ $(function(){
var submitted = false;
$("form.validate").validate({
- rules: {
- title: { required: true },
- detail: { required: true },
- email: { required: true },
- update: { required: true },
- rznvy: { required: true }
- },
+ rules: validation_rules,
messages: validation_strings,
onkeyup: false,
onfocusout: false,
@@ -134,10 +128,12 @@ $(function(){
// Geolocation
if (geo_position_js.init()) {
+ var link = '<a href="#LINK" id="geolocate_link">&hellip; ' + validation_strings.geolocate + '</a>';
+ $('form[action="/alert/list"]').append(link.replace('LINK','alert/list'));
if ($('body.frontpage').length) {
- $('#postcodeForm').after('<a href="#" id="geolocate_link">&hellip; or locate me automatically</a>');
+ $('#postcodeForm').after(link.replace('LINK','around'));
} else{
- $('#postcodeForm').append('<a href="#" id="geolocate_link">&hellip; or locate me automatically</a>');
+ $('#postcodeForm').append(link.replace('LINK','around'));
}
$('#geolocate_link').click(function(e) {
var $link = $(this);
@@ -152,7 +148,8 @@ $(function(){
$link.find('img').remove();
var latitude = pos.coords.latitude;
var longitude = pos.coords.longitude;
- location.href = '/around?latitude=' + latitude + ';longitude=' + longitude;
+ var page = $link.attr('href').substr(1);
+ location.href = '/' + page + '?latitude=' + latitude + ';longitude=' + longitude;
}, function(err) {
$link.find('img').remove();
if (err.code == 1) { // User said no