27 lines
894 B
JavaScript
27 lines
894 B
JavaScript
import { Controller } from '@hotwired/stimulus';
|
|
import $ from 'jquery';
|
|
|
|
export default class extends Controller {
|
|
mainObj
|
|
deleteButtons
|
|
confirmModalObj
|
|
confirmModalUsernameObj
|
|
connect() {
|
|
this.mainObj = $(".page.admin.users");
|
|
this.deleteButtons = this.mainObj.find(".confirmRemoveUser");
|
|
this.confirmModalObj = this.mainObj.find("#removeConfirmModal");
|
|
this.confirmModalUsernameObj = this.confirmModalObj.find(".insertUsername");
|
|
this.bindOnClick()
|
|
}
|
|
|
|
bindOnClick() {
|
|
this.deleteButtons.on("click", (e) => {
|
|
const obj = $(e.currentTarget),
|
|
username = $(obj).attr("data-username"),
|
|
formLink = $(obj).attr("data-formlink");
|
|
|
|
this.confirmModalUsernameObj.html(username);
|
|
this.confirmModalObj.find("form").attr("action", formLink);
|
|
});
|
|
}
|
|
} |