PageSourceSearch

https://educared.fundaciontelefonica.com.pe/assets/controllers/schools_controller-41e994f7.js

js fundaciontelefonica.com.pe collected 2026-10-02 06:43:57 UTC 1,443 bytes, 49 lines download raw bytes

1import { Controller } from "@hotwired/stimulus"
2
3// Connects to data-controller="schools"
4export default class extends Controller {
5  static targets = ["area", "subArea", "locality", "school"]
6  static values = { baseUrl: String }
7
8  areaChanged(e) {
9    const area = this.areaTarget.value
10    Turbo.visit(this.buildUrl(area), { frame: "sub-areas-frame" })
11    if (this.hasLocalityTarget) {
12      this.clearOptions(this.localityTarget)
13    }
14    this.clearOptions(this.schoolTarget)
15  }
16
17  subAreaChanged() {
18    const area = this.areaTarget.value
19    const subArea = this.subAreaTarget.value
20    if (this.hasLocalityTarget) {
21      Turbo.visit(this.buildUrl(area, subArea), { frame: "localities-frame" })
22      this.clearOptions(this.schoolTarget)
23    } else {
24      Turbo.visit(this.buildUrl(area, subArea), { frame: "schools-frame" })
25    }
26  }
27
28  localityChanged() {
29    const area = this.areaTarget.value
30    const subArea = this.subAreaTarget.value
31    const locality = this.localityTarget.value
32    Turbo.visit(this.buildUrl(area, subArea, locality), { frame: "schools-frame" })
33  }
34
35  buildUrl(area, subArea = "", locality = ""){
36    const params = new URLSearchParams({
37      area: area,
38      sub_area: subArea,
39      locality: locality
40    })
41
42    return `${this.baseUrlValue}?${params.toString()}`
43  }
44
45  clearOptions(target) {
46    const firstOption = target.querySelector("option");
47    target.replaceChildren(firstOption);
48  }
49}

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.