diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-07-06 10:31:04 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2017-07-06 10:44:27 +0100 |
commit | c8426e7fef0780efee2146c40435ae140e4e88dd (patch) | |
tree | 660dedbdd183f1f1ab887a3946b1a92a4e54e7d5 /web | |
parent | 19c7a8e1f7bd2774affd890698e40902a8c19a34 (diff) |
Don't preselect inspector template on page load.
Diffstat (limited to 'web')
-rw-r--r-- | web/cobrands/fixmystreet/staff.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/web/cobrands/fixmystreet/staff.js b/web/cobrands/fixmystreet/staff.js index 50d049217..5355a8f54 100644 --- a/web/cobrands/fixmystreet/staff.js +++ b/web/cobrands/fixmystreet/staff.js @@ -241,22 +241,26 @@ $.extend(fixmystreet.set_up, { $priorities.val(curr_pri); }); - // The inspect form submit button can change depending on the selected state - $inspect_form.find("[name=state]").change(function(){ - var state = $(this).val(); + function state_change(state) { + // The inspect form submit button can change depending on the selected state var $submit = $inspect_form.find("input[type=submit][name=save]"); - var value = $submit.attr('data-value-'+state); + var value = $submit.attr('data-value-' + state); $submit.val(value || $submit.data('valueOriginal')); updateTemplates({'state': state}); - + } + var $state_dropdown = $inspect_form.find("[name=state]"); + state_change($state_dropdown.val()); + $state_dropdown.change(function(){ + var state = $(this).val(); + state_change(state); // We might also have a response template to preselect for the new state var $select = $inspect_form.find("select.js-template-name"); var $option = $select.find("option[data-problem-state='"+state+"']").first(); if ($option.length) { $select.val($option.val()).change(); } - }).change(); + }); $('.js-toggle-public-update').each(function() { var $checkbox = $(this); |