Properly handle justificatif_motivation case
This commit is contained in:
parent
6a3413018a
commit
6797c01b69
7 changed files with 27 additions and 11 deletions
|
@ -1,4 +1,4 @@
|
||||||
import Rails from 'rails-ujs';
|
import { ajax, delegate } from '@utils';
|
||||||
|
|
||||||
addEventListener('turbolinks:load', () => {
|
addEventListener('turbolinks:load', () => {
|
||||||
checker.deactivate();
|
checker.deactivate();
|
||||||
|
@ -14,6 +14,11 @@ addEventListener('attachment:update', ({ detail: { url } }) => {
|
||||||
checker.add(url);
|
checker.add(url);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
delegate('click', '[data-attachment-refresh]', event => {
|
||||||
|
event.preventDefault();
|
||||||
|
checker.check();
|
||||||
|
});
|
||||||
|
|
||||||
class AttachmentChecker {
|
class AttachmentChecker {
|
||||||
urls = new Set();
|
urls = new Set();
|
||||||
timeout;
|
timeout;
|
||||||
|
@ -41,13 +46,19 @@ class AttachmentChecker {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
activate() {
|
check() {
|
||||||
this.timeout = setTimeout(() => {
|
let urls = this.urls;
|
||||||
for (let url of this.urls) {
|
|
||||||
Rails.ajax({ url, type: 'get' });
|
|
||||||
}
|
|
||||||
this.checks++;
|
|
||||||
this.reset();
|
this.reset();
|
||||||
|
for (let url of urls) {
|
||||||
|
ajax({ url, type: 'get' });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
activate() {
|
||||||
|
clearTimeout(this.timeout);
|
||||||
|
this.timeout = setTimeout(() => {
|
||||||
|
this.checks++;
|
||||||
|
this.check();
|
||||||
}, this.interval);
|
}, this.interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import $ from 'jquery';
|
||||||
import debounce from 'debounce';
|
import debounce from 'debounce';
|
||||||
|
|
||||||
export { debounce };
|
export { debounce };
|
||||||
export const { fire } = Rails;
|
export const { fire, ajax } = Rails;
|
||||||
|
|
||||||
export function show({ classList }) {
|
export function show({ classList }) {
|
||||||
classList.remove('hidden');
|
classList.remove('hidden');
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
- if dossier.motivation.present?
|
- if dossier.motivation.present?
|
||||||
%h4 Motivation
|
%h4 Motivation
|
||||||
%p.dossier-motivation= dossier.motivation
|
%p.dossier-motivation= dossier.motivation
|
||||||
= render partial: 'new_user/dossiers/show/download_justificatif', locals: { dossier: dossier }
|
= render partial: 'users/dossiers/show/download_justificatif', locals: { dossier: dossier }
|
||||||
|
|
||||||
- if dossier.attestation.present?
|
- if dossier.attestation.present?
|
||||||
%h4 Attestation
|
%h4 Attestation
|
||||||
|
|
|
@ -1,2 +1,7 @@
|
||||||
<%= render_flash %>
|
<%= render_flash %>
|
||||||
<%= render_to_element('.state-button', partial: "state_button", locals: { dossier: dossier }) %>
|
<%= render_to_element('.state-button', partial: "state_button", locals: { dossier: dossier }) %>
|
||||||
|
|
||||||
|
<% attachment = dossier.justificatif_motivation.attachment %>
|
||||||
|
<% if attachment && attachment.virus_scanner.pending? %>
|
||||||
|
<%= fire_event('attachment:update', { url: attachment_url(attachment.id, { signed_id: attachment.blob.signed_id }) }.to_json ) %>
|
||||||
|
<% end %>
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
= attachment.filename.to_s
|
= attachment.filename.to_s
|
||||||
- if attachment.virus_scanner.pending?
|
- if attachment.virus_scanner.pending?
|
||||||
(analyse antivirus en cours
|
(analyse antivirus en cours
|
||||||
= link_to "rafraichir", request.path
|
= link_to "rafraichir", request.path, data: { 'attachment-refresh': true }
|
||||||
)
|
)
|
||||||
- elsif attachment.virus_scanner.infected?
|
- elsif attachment.virus_scanner.infected?
|
||||||
- if user_can_upload
|
- if user_can_upload
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
%h3 Motif de l’acceptation
|
%h3 Motif de l’acceptation
|
||||||
%blockquote= dossier.motivation
|
%blockquote= dossier.motivation
|
||||||
|
|
||||||
= render partial: 'new_user/dossiers/show/download_justificatif', locals: { dossier: dossier }
|
= render partial: 'users/dossiers/show/download_justificatif', locals: { dossier: dossier }
|
||||||
|
|
||||||
- if dossier.attestation.present?
|
- if dossier.attestation.present?
|
||||||
.action
|
.action
|
||||||
|
@ -71,7 +71,7 @@
|
||||||
%h3 Motif du refus
|
%h3 Motif du refus
|
||||||
%blockquote= dossier.motivation
|
%blockquote= dossier.motivation
|
||||||
|
|
||||||
= render partial: 'new_user/dossiers/show/download_justificatif', locals: { dossier: @dossier }
|
= render partial: 'users/dossiers/show/download_justificatif', locals: { dossier: dossier }
|
||||||
.action
|
.action
|
||||||
= link_to 'Envoyer un message à l’administration', messagerie_dossier_url(dossier, anchor: 'new_commentaire'), class: 'button'
|
= link_to 'Envoyer un message à l’administration', messagerie_dossier_url(dossier, anchor: 'new_commentaire'), class: 'button'
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@
|
||||||
= succeed '.' do
|
= succeed '.' do
|
||||||
%strong sans suite
|
%strong sans suite
|
||||||
|
|
||||||
= render partial: 'new_user/dossiers/show/download_justificatif', locals: { dossier: @dossier }
|
= render partial: 'users/dossiers/show/download_justificatif', locals: { dossier: dossier }
|
||||||
|
|
||||||
- if dossier.motivation.present?
|
- if dossier.motivation.present?
|
||||||
%h3 Motif du classement sans suite
|
%h3 Motif du classement sans suite
|
||||||
|
|
Loading…
Reference in a new issue