diff options
Diffstat (limited to 'web')
-rw-r--r-- | web/cobrands/fixmystreet/admin.js | 17 | ||||
-rw-r--r-- | web/cobrands/fixmystreet/fixmystreet.js | 12 | ||||
-rw-r--r-- | web/cobrands/sass/_base.scss | 41 |
3 files changed, 53 insertions, 17 deletions
diff --git a/web/cobrands/fixmystreet/admin.js b/web/cobrands/fixmystreet/admin.js index 4ed9b1866..b598f52dd 100644 --- a/web/cobrands/fixmystreet/admin.js +++ b/web/cobrands/fixmystreet/admin.js @@ -106,23 +106,6 @@ $(function(){ } }).change(); - // On category edit page, hide the reputation input if inspection isn't required - $("form#category_edit #inspection_required").change(function() { - var $p = $("form#category_edit #reputation_threshold").closest("p"); - var $hint = $p.prevUntil().first(); - if (this.checked) { - $p.removeClass("hidden"); - if ($hint.length) { - $hint.removeClass("hidden"); - } - } else { - $p.addClass("hidden"); - if ($hint.length) { - $hint.addClass("hidden"); - } - } - }); - // Bits for the report extra fields form builder: // Reveal the UI when 'show' link is clicked diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js index cda196864..c7749c729 100644 --- a/web/cobrands/fixmystreet/fixmystreet.js +++ b/web/cobrands/fixmystreet/fixmystreet.js @@ -991,6 +991,18 @@ $.extend(fixmystreet.set_up, { } }, + toggle_visibility: function() { + $('input[type="checkbox"][data-toggle-visibility]').each(function(){ + var input = this; + var $target = $( $(this).attr('data-toggle-visibility') ); + var update = function() { + $target.toggleClass('hidden-js', ! input.checked ); + }; + $(input).on('change', update); + update(); + }); + }, + form_section_previews: function() { $('.js-form-section-preview').each(function(){ var $el = $(this); diff --git a/web/cobrands/sass/_base.scss b/web/cobrands/sass/_base.scss index 063136eb8..63ff19524 100644 --- a/web/cobrands/sass/_base.scss +++ b/web/cobrands/sass/_base.scss @@ -331,6 +331,45 @@ select.form-control { max-width: 27em; } +// Handy for lining up "child" form groups below show/hide checkboxes. +.form-group--indented { + padding-left: 2em; +} + +.form-check { + margin-top: 1.5em; // match margin-top on regular labels + padding-left: 2em; + position: relative; + + & > input { + position: absolute; + top: 0.3em; + left: 0.5em; + } + + label { + margin-top: 0.5em; + } +} + +.form-check--inline { + margin: 0.5em 0; + + label { + margin: 0; + display: inline; + } + + .form-hint { + display: inline; + + &:before { + content: "\2013"; + margin: 0 0.3em 0 0.1em; + } + } +} + .required-text { position: absolute; #{$right}: 0; @@ -2030,7 +2069,9 @@ label .muted { } .form-hint { + display: block; color: #666; + margin-bottom: 0.5em; // Reduce space between labels and their form-hints label + & { |