Before a few renames
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { Controller } from "@hotwired/stimulus"
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = [ "selector", "link" ]
|
||||
static values = { urlTemplate: String } // Pass template like "/users/:id/edit"
|
||||
|
||||
update() {
|
||||
console.log("## ## %%")
|
||||
const selectedId = this.selectorTarget.value
|
||||
// Replace placeholder with selected ID
|
||||
const newUrl = this.urlTemplateValue.replace(":id", selectedId)
|
||||
|
||||
// Update the link href
|
||||
this.linkTarget.href = newUrl
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user