From 29da56cf75c1381b31a8b26738a94eff482f8099 Mon Sep 17 00:00:00 2001 From: M Somerville Date: Sat, 25 Aug 2018 12:26:17 +0100 Subject: [PATCH] Hide reject media checkbox when not relevant. (#8426) --- app/javascript/packs/admin.js | 7 +++++++ app/views/admin/domain_blocks/new.html.haml | 3 +++ 2 files changed, 10 insertions(+) diff --git a/app/javascript/packs/admin.js b/app/javascript/packs/admin.js index 5dbcc03d3..ce5f70ee7 100644 --- a/app/javascript/packs/admin.js +++ b/app/javascript/packs/admin.js @@ -39,3 +39,10 @@ delegate(document, '.media-spoiler-hide-button', 'click', () => { element.click(); }); }); + +delegate(document, '#domain_block_severity', 'change', ({ target }) => { + const rejectMediaDiv = document.querySelector('.input.with_label.domain_block_reject_media'); + if (rejectMediaDiv) { + rejectMediaDiv.style.display = (target.value === 'suspend') ? 'none' : 'block'; + } +}); diff --git a/app/views/admin/domain_blocks/new.html.haml b/app/views/admin/domain_blocks/new.html.haml index 38fa90169..2b8b24e23 100644 --- a/app/views/admin/domain_blocks/new.html.haml +++ b/app/views/admin/domain_blocks/new.html.haml @@ -1,3 +1,6 @@ +- content_for :header_tags do + = javascript_pack_tag 'admin', integrity: true, async: true, crossorigin: 'anonymous' + - content_for :page_title do = t('.title')