select github repository

This commit is contained in:
Chris Zhu
2025-01-24 11:58:05 -08:00
parent 40aa5a4c4b
commit 43265699b5
6 changed files with 120 additions and 13 deletions

View File

@@ -0,0 +1,34 @@
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static targets = ["frame", "repository", "button", "publicRepository", "modal"]
connect() {
this.frameTarget.addEventListener("turbo:frame-load", this.onFrameLoad.bind(this))
}
selectPublicRepository() {
this.repositoryTarget.value = this.publicRepositoryTarget.value
// Close the modal
this.modalTarget.removeAttribute("open")
}
onFrameLoad(event) {
this.buttonTarget.removeAttribute("disabled")
}
selectRepository(e) {
this.repositoryTarget.value = e.target.dataset.repositoryName;
this.modalTarget.removeAttribute("open")
}
connectToGithub(e) {
// Set attribute of src to the url of the frame
console.log(this.frameTarget)
this.frameTarget.setAttribute("src", "/integrations/github/repositories")
// Disable the button after clicking
this.buttonTarget.setAttribute("disabled", "true")
}
}