aboutsummaryrefslogtreecommitdiffstats
path: root/web/js
diff options
context:
space:
mode:
authorDave Whiteland <dave@mysociety.org>2013-08-07 11:28:23 +0100
committerDave Whiteland <dave@mysociety.org>2013-09-05 17:31:06 +0100
commit8acaea9f91c7db24871e6e1bd9268d9bf3b0d52d (patch)
tree2aa4846cb1bc55986c5a0f69446e94201a9a34ac /web/js
parente69bc54641b9a584439ec934f1ed54e3e310e023 (diff)
hide open311 inputs for bodies unless needed
basically if send method is not email (or there's an endpoint value), don't show the form Maybe we need to have an "show all fields" button/link but for normal use I think this is OK
Diffstat (limited to 'web/js')
-rw-r--r--web/js/fixmystreet-admin.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/web/js/fixmystreet-admin.js b/web/js/fixmystreet-admin.js
index f13a66d9c..d55bbab21 100644
--- a/web/js/fixmystreet-admin.js
+++ b/web/js/fixmystreet-admin.js
@@ -1,4 +1,25 @@
$(function(){
// available for admin pages
+
+ // hide the open311_only section and reveal it only when send_method is relevant
+ var $open311_only = $('.admin-open311-only');
+ if ($open311_only) {
+ function hide_or_show_open311() {
+ var send_method = $('#send_method').val();
+ var show_open311 = false;
+ if ($('#endpoint').val()) {
+ show_open311 = true; // always show the form if there is an endpoint value
+ } else if (send_method && send_method.toLowerCase() != 'email') {
+ show_open311 = true;
+ }
+ if (show_open311) {
+ $open311_only.slideDown();
+ } else {
+ $open311_only.slideUp();
+ }
+ }
+ $('#send_method').on('change', hide_or_show_open311);
+ hide_or_show_open311();
+ }
});