PageSourceSearch

https://newleftreview.org/assets/controllers/subscription_filters_…7555c4e48d79f6436102b1178479c66c9b9c21df.js

js newleftreview.org collected 2026-10-02 02:32:07 UTC 1,287 bytes, 40 lines download raw bytes

1import { Controller } from '@hotwired/stimulus'
2
3export default class extends Controller {
4  static targets = [
5    'recipientType',
6    'subscriptionType',
7    'institutionTier',
8    'mailingFilters',
9    'agent',
10    'autoRenewalStatus',
11    'renewalProcessor',
12    'deliveryCountry',
13    'deliveryRegion',
14    'endUserCountry',
15    'endUserRegion',
16  ]
17
18  connect() {
19    this.updateVisibility()
20  }
21
22  updateVisibility() {
23    const institutionSelected = this.recipientTypeTargets.some(({ checked, value }) => checked && value === 'institution')
24    const digitalOnly = this.subscriptionTypeTarget.value === 'digital'
25
26    this.toggleSection(this.institutionTierTarget, institutionSelected)
27    this.toggleSection(this.agentTarget, institutionSelected)
28    this.toggleSection(this.mailingFiltersTarget, !digitalOnly)
29    this.toggleSection(this.renewalProcessorTarget, Boolean(this.autoRenewalStatusTarget.value))
30    this.toggleSection(this.deliveryRegionTarget, !this.deliveryCountryTarget.value)
31    this.toggleSection(this.endUserRegionTarget, !this.endUserCountryTarget.value)
32  }
33
34  toggleSection(element, visible) {
35    element.classList.toggle('hide', !visible)
36    element.querySelectorAll('input, select').forEach((field) => {
37      field.disabled = !visible
38    })
39  }
40};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.