aboutsummaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
Diffstat (limited to 'web')
-rw-r--r--web/cobrands/fixmystreet/fixmystreet.js34
1 files changed, 33 insertions, 1 deletions
diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js
index acdfc869d..ba93a6995 100644
--- a/web/cobrands/fixmystreet/fixmystreet.js
+++ b/web/cobrands/fixmystreet/fixmystreet.js
@@ -397,6 +397,34 @@ $.extend(fixmystreet.set_up, {
$('#mapForm').removeAttr('novalidate');
},
+ contribute_as: function() {
+ $('.js-contribute-as').on('change', function(){
+ var opt = this.options[this.selectedIndex],
+ val = opt.value,
+ txt = opt.text;
+ var $emailInput = $('#form_email');
+ var $nameInput = $('#form_name');
+ var $showNameCheckbox = $('#form_may_show_name');
+ var $addAlertCheckbox = $('#form_add_alert');
+ if (val === 'myself') {
+ $emailInput.val($emailInput.prop('defaultValue')).prop('disabled', true);
+ $nameInput.val($nameInput.prop('defaultValue')).prop('disabled', false);
+ $showNameCheckbox.prop('checked', false).prop('disabled', false);
+ $addAlertCheckbox.prop('checked', true).prop('disabled', false);
+ } else if (val === 'another_user') {
+ $emailInput.val('').prop('disabled', false);
+ $nameInput.val('').prop('disabled', false);
+ $showNameCheckbox.prop('checked', false).prop('disabled', false);
+ $addAlertCheckbox.prop('checked', true).prop('disabled', false);
+ } else if (val === 'body') {
+ $emailInput.val('-').prop('disabled', true);
+ $nameInput.val(txt).prop('disabled', true);
+ $showNameCheckbox.prop('checked', true).prop('disabled', true);
+ $addAlertCheckbox.prop('checked', false).prop('disabled', true);
+ }
+ }).change();
+ },
+
on_resize: function() {
var last_type;
$(window).on('resize', function() {
@@ -923,7 +951,11 @@ fixmystreet.display = {
fixmystreet.set_up.map_controls();
$('.js-back-to-report-list').attr('href', location.href);
- $sideReport.find('#key-tool-problems-nearby').addClass('js-back-to-report-list');
+ // Problems nearby should act the same as 'Back to all reports' on around,
+ // but on /my and /reports should go to that around page.
+ if (fixmystreet.original.page == 'around') {
+ $sideReport.find('#key-tool-problems-nearby').addClass('js-back-to-report-list');
+ }
fixmystreet.set_up.map_sidebar_key_tools();
fixmystreet.set_up.form_validation();
fixmystreet.set_up.email_login_form();