controller

This commit is contained in:
Kara Diaby 2022-11-29 09:37:58 +01:00
parent bc101b34cd
commit f5e4c28fc1
2 changed files with 39 additions and 0 deletions

View file

@ -244,6 +244,11 @@ module Instructeurs
redirect_to instructeur_procedure_path(@procedure)
end
def administrateurs
@procedure = procedure
@administrateurs = procedure.administrateurs
end
private
def create_bulk_message_mail(dossier_count, dossier_state)

View file

@ -0,0 +1,34 @@
import { Controller } from '@hotwired/stimulus';
const SUCCESS_MESSAGE_TIMEOUT = 1000;
export class ClipboardController extends Controller {
static values = { text: String };
static targets = ['success'];
declare readonly textValue: string;
declare readonly successTarget: HTMLElement;
declare readonly hasSuccessTarget: boolean;
#timer?: ReturnType<typeof setTimeout>;
disconnect(): void {
clearTimeout(this.#timer);
}
copy() {
navigator.clipboard
.writeText(this.textValue)
.then(() => this.displayCopyConfirmation());
}
private displayCopyConfirmation() {
if (this.hasSuccessTarget) {
this.successTarget.classList.remove('hidden');
clearTimeout(this.#timer);
this.#timer = setTimeout(() => {
this.successTarget.classList.add('hidden');
}, SUCCESS_MESSAGE_TIMEOUT);
}
}
}