Browse Source

Hide reject media checkbox when not relevant. (#8426)

M Somerville 1 year ago
parent
commit
29da56cf75
2 changed files with 10 additions and 0 deletions
  1. 7
    0
      app/javascript/packs/admin.js
  2. 3
    0
      app/views/admin/domain_blocks/new.html.haml

+ 7
- 0
app/javascript/packs/admin.js View File

@@ -39,3 +39,10 @@ delegate(document, '.media-spoiler-hide-button', 'click', () => {
39 39
     element.click();
40 40
   });
41 41
 });
42
+
43
+delegate(document, '#domain_block_severity', 'change', ({ target }) => {
44
+  const rejectMediaDiv = document.querySelector('.input.with_label.domain_block_reject_media');
45
+  if (rejectMediaDiv) {
46
+    rejectMediaDiv.style.display = (target.value === 'suspend') ? 'none' : 'block';
47
+  }
48
+});

+ 3
- 0
app/views/admin/domain_blocks/new.html.haml View File

@@ -1,3 +1,6 @@
1
+- content_for :header_tags do
2
+  = javascript_pack_tag 'admin', integrity: true, async: true, crossorigin: 'anonymous'
3
+
1 4
 - content_for :page_title do
2 5
   = t('.title')
3 6
 

Loading…
Cancel
Save