Skip to content
Snippets Groups Projects
Commit 7d1eff91 authored by Benoit Alessandroni's avatar Benoit Alessandroni
Browse files

Somes fixes while trying to debug the refresh issues

parent 00a7a144
No related branches found
No related tags found
1 merge request!151Bug/#140
Pipeline #5626 failed
...@@ -101,13 +101,38 @@ async function refreshList(formId, listId) { ...@@ -101,13 +101,38 @@ async function refreshList(formId, listId) {
let list = document.getElementById(listId); let list = document.getElementById(listId);
if (list) { if (list) {
let listProxy = await list.component.resource let listProxy = await list.component.resource;
// Refresh du cache sur la liste
listProxy.clearCache(); listProxy.clearCache();
list.dataset.src = list.dataset.src; list.dataset.src = list.dataset.src;
} }
}); });
} }
/**
* Refresh user and account information after a form submission
* @param {String} formId - Id of the sumitted form
* @param {String} listId - Id of the user object to refresh
*/
async function refreshUser(formId, listId) {
let form = document.getElementById(formId);
form.addEventListener("save", async function() {
let list = document.getElementById(listId);
if (list) {
let listProxy = await list.component.resource;
let account = await listProxy['account'];
// Refresh du cache sur le User
listProxy.clearCache();
account.clearCache();
list.dataset.src = list.dataset.src;
}
});
}
/** /**
* Remove pagination when there is no resource in a step group. * Remove pagination when there is no resource in a step group.
*/ */
...@@ -553,7 +578,6 @@ function addProperFilterToSearchComponents(targetId) { ...@@ -553,7 +578,6 @@ function addProperFilterToSearchComponents(targetId) {
let language_field_search = more_criterias_form.querySelector( let language_field_search = more_criterias_form.querySelector(
`select[name="language"]` `select[name="language"]`
); );
let language_hidden_field = baseElement.querySelectorAll( let language_hidden_field = baseElement.querySelectorAll(
'hidden-widget[name="more_criterias_hidden"] select[name="language"]' 'hidden-widget[name="more_criterias_hidden"] select[name="language"]'
); );
...@@ -785,25 +809,20 @@ jQuery(document).ready(function($) { ...@@ -785,25 +809,20 @@ jQuery(document).ready(function($) {
refreshList("validation_form", "pending_resources"); refreshList("validation_form", "pending_resources");
refreshList("refusal_dialog_form", "pending_resources"); refreshList("refusal_dialog_form", "pending_resources");
refreshList("improvement_dialog_form", "pending_resources"); refreshList("improvement_dialog_form", "pending_resources");
initFileUpload("entrepreneur_profile_creation", "account.picture"); refreshUser("entrepreneur_profile_creation", "entrepreneur_info");
refreshList("entrepreneur_profile_creation", "entrepreneur_info"); refreshUser("entrepreneur_profile_creation", "entrepreneur_contact");
refreshList("entrepreneur_profile_creation", "entrepreneur_contact"); refreshUser("entrepreneur_profile_creation", "entrepreneur_account_picture");
refreshList("entrepreneur_profile_creation", "entrepreneur_account_picture"); refreshUser("mentor_profile_creation", "mentor_info");
initFileUpload("mentor_profile_creation", "account.picture"); refreshUser("mentor_profile_creation", "mentor_complementary");
refreshList("mentor_profile_creation", "mentor_info"); refreshUser("mentor_profile_creation", "mentor_contact");
refreshList("mentor_profile_creation", "mentor_complementary"); refreshUser("mentor_profile_creation", "mentor_account_picture");
refreshList("mentor_profile_creation", "mentor_contact"); refreshUser("entrepreneur_profile_edition", "entrepreneur_info");
refreshList("mentor_profile_creation", "mentor_account_picture"); refreshUser("entrepreneur_profile_edition", "entrepreneur_contact");
initFileUpload("entrepreneur_profile_edition", "account.picture"); refreshUser("entrepreneur_profile_edition", "entrepreneur_account_picture");
refreshList("entrepreneur_profile_edition", "entrepreneur_info"); refreshUser("mentor_profile_edition", "mentor_info");
refreshList("entrepreneur_profile_edition", "entrepreneur_contact"); refreshUser("mentor_profile_edition", "mentor_complementary");
refreshList("entrepreneur_profile_edition", "entrepreneur_account_picture"); refreshUser("mentor_profile_edition", "mentor_contact");
initFileUpload("mentor_profile_edition", "account.picture"); refreshUser("mentor_profile_edition", "mentor_account_picture");
refreshList("mentor_profile_edition", "mentor_info");
refreshList("mentor_profile_edition", "mentor_complementary");
refreshList("mentor_profile_edition", "mentor_contact");
refreshList("mentor_profile_edition", "mentor_account_picture");
refreshRequestList("change_status_request", "request_list");
addProperFilterToSearchComponents("entrepreneur-resource-list"); addProperFilterToSearchComponents("entrepreneur-resource-list");
addProperFilterToSearchComponents("mentor-database"); addProperFilterToSearchComponents("mentor-database");
...@@ -879,7 +898,10 @@ jQuery(document).ready(function($) { ...@@ -879,7 +898,10 @@ jQuery(document).ready(function($) {
//Init the form file behaviour //Init the form file behaviour
initFileUpload("resource_creation_form", "preview_image"); initFileUpload("resource_creation_form", "preview_image");
initFileUpload("resource_edition_form", "preview_image"); initFileUpload("resource_edition_form", "preview_image");
initFileUpload("mentor_profile_creation", "account.picture");
initFileUpload("mentor_profile_edition", "account.picture"); initFileUpload("mentor_profile_edition", "account.picture");
refreshRequestList("change_status_request", "request_list");
//Manage the accordion in request mentor dashboard. //Manage the accordion in request mentor dashboard.
manageAccordionForRequest(); manageAccordionForRequest();
...@@ -931,9 +953,8 @@ jQuery(document).ready(function($) { ...@@ -931,9 +953,8 @@ jQuery(document).ready(function($) {
//manage accordion for "More criteria" //manage accordion for "More criteria"
manageAccordionMoreCriteria(); manageAccordionMoreCriteria();
//Init the form file behaviour
// initFileUpload();
initFileUpload("entrepreneur_profile_edition", "account.picture"); initFileUpload("entrepreneur_profile_edition", "account.picture");
initFileUpload("entrepreneur_profile_creation", "account.picture");
//Correct the native default of pagination //Correct the native default of pagination
refreshPagination(); refreshPagination();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment