PageSourceSearch

https://sifrcrm.up.railway.app/assets/controllers/table_sort_contr…ffe1a6404a8055ee19acc43c7b34089192b0fd16.js

js sifrcrm.up.railway.app collected 2026-10-03 12:17:00 UTC 1,070 bytes, 31 lines download raw bytes

1import { Controller } from "@hotwired/stimulus"
2
3// Sort-only column header (components/tables/_table_column). Click cycles
4// asc → desc → none by rewriting `<searchKey>[s]` in the table's Ransack form
5// and submitting it — the same form the table-filter controller writes to.
6export default class extends Controller {
7  static values = {
8    formId: String,
9    searchKey: { type: String, default: "q" },
10    column: String,
11    current: { type: String, default: "" }
12  }
13
14  cycle(event) {
15    event.preventDefault()
16    const form = document.getElementById(this.formIdValue)
17    if (!form) return
18
19    form.querySelectorAll(`input[name="${this.searchKeyValue}[s]"]`).forEach(input => input.remove())
20
21    const next = this.currentValue === "asc" ? "desc" : this.currentValue === "desc" ? "" : "asc"
22    if (next) {
23      const input = document.createElement("input")
24      input.type = "hidden"
25      input.name = `${this.searchKeyValue}[s]`
26      input.value = `${this.columnValue} ${next}`
27      form.appendChild(input)
28    }
29    form.requestSubmit()
30  }
31};

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.