mirror of
https://github.com/czhu12/canine.git
synced 2025-12-30 15:49:54 -06:00
22 lines
783 B
JavaScript
22 lines
783 B
JavaScript
import { Controller } from "@hotwired/stimulus"
|
|
|
|
export default class extends Controller {
|
|
static targets = ["input", "card", "chartUrl"]
|
|
static values = { repository: String }
|
|
|
|
connect() {
|
|
}
|
|
|
|
selectCard(event) {
|
|
event.preventDefault()
|
|
this.inputTarget.value = event.currentTarget.dataset.cardName
|
|
this.cardTargets.forEach(card => card.classList.remove('ring', 'ring-primary'))
|
|
event.currentTarget.classList.add('ring', 'ring-primary')
|
|
// Show Input
|
|
this.element.querySelectorAll('.card-form').forEach(form => form.classList.add('hidden'))
|
|
this.element.querySelectorAll(`.card-${event.currentTarget.dataset.cardName}`).forEach(form => form.classList.remove("hidden"));
|
|
|
|
this.chartUrlTarget.value = event.currentTarget.dataset.chartUrl
|
|
}
|
|
}
|