Browse Source

Pre-fill domain block/allow domain from search filter (#18172)

closed-social-glitch-2
Claire 2 years ago
committed by GitHub
parent
commit
e7f0c9f7da
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 2 deletions
  1. +10
    -0
      app/javascript/packs/admin.js
  2. +5
    -2
      app/views/admin/instances/index.html.haml

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

@ -100,6 +100,16 @@ ready(() => {
const registrationMode = document.getElementById('form_admin_settings_registrations_mode');
if (registrationMode) onChangeRegistrationMode(registrationMode);
document.querySelector('a#add-instance-button')?.addEventListener('click', (e) => {
const domain = document.getElementById('by_domain')?.value;
if (domain) {
const url = new URL(event.target.href);
url.searchParams.set('_domain', domain);
e.target.href = url;
}
});
const React = require('react');
const ReactDOM = require('react-dom');

+ 5
- 2
app/views/admin/instances/index.html.haml View File

@ -1,11 +1,14 @@
- content_for :page_title do
= t('admin.instances.title')
- content_for :header_tags do
= javascript_pack_tag 'admin', async: true, crossorigin: 'anonymous'
- content_for :heading_actions do
- if whitelist_mode?
= link_to t('admin.domain_allows.add_new'), new_admin_domain_allow_path, class: 'button'
= link_to t('admin.domain_allows.add_new'), new_admin_domain_allow_path, class: 'button', id: 'add-instance-button'
- else
= link_to t('admin.domain_blocks.add_new'), new_admin_domain_block_path, class: 'button'
= link_to t('admin.domain_blocks.add_new'), new_admin_domain_block_path, class: 'button', id: 'add-instance-button'
.filters
.filter-subset

Loading…
Cancel
Save