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

Merge branch 'master' into Feature/Validation-process-dialog

parents 2524bf2f ff1bd1f1
No related branches found
No related tags found
1 merge request!43Feature: Fullfill the validation process explanation in dialog.
......@@ -125,7 +125,12 @@ sib-widget(name='cs-profile-picture')
img(name="${name}", src="\${value || '/images/alien.jpg'}", alt="Coopstarter")
sib-widget(name="hidden-widget")
template
div(data-content style="display:none;")
\ No newline at end of file
sib-widget(name="hidden-widget")
template
div(data-content style="display:none;")
sib-widget(name="fake-tabs")
template
h2.fake-tabs ${value}
\ No newline at end of file
......@@ -7,9 +7,6 @@ header#header(role='banner')
include ./components/header.pug
section#home
div#coopstarter-loader
hidden Loading, please wait...
//TODO:
//-Distinguish the search form from the listing
//-Create two Sib-displays getting the resources by "types"
......
This diff is collapsed.
......@@ -14,6 +14,18 @@ function openTab(pageName, elmnt) {
elmnt.classList.add("active");
}
//Manage the visual of the fake tabs in entrepreneur dashboard.
function openFakeTab(elmnt) {
// Hide all elements with class="tabcontent" by default */
var i, tablinks;
tablinks = document.getElementsByClassName("tablink");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].classList.remove("active");
}
elmnt.classList.add("active");
}
function linkDatasetToField(detail, targetFormName, inputName) {
let targetForm = document.getElementById(targetFormName);
targetForm.addEventListener("populate", event => {
......@@ -74,7 +86,6 @@ function selectHiddenManagement(select_hidden, option_selected, form) {
}
form.querySelector("sib-form").component.inputChange();
refreshPagination();
}
//Manage input hidden field to fullfill them with more "more criterias" selection
......@@ -82,7 +93,37 @@ function inputHiddenManagement(field, field_search, form) {
field.setAttribute("value", field_search.value);
form.querySelector("sib-form").component.inputChange();
refreshPagination();
}
//Manage select hidden for type to fullfill them with more "more criterias" selection
function selectHiddenManagementForType(tab, form) {
let type_hidden_field = document.querySelectorAll(
'hidden-widget[name="more_criterias_hidden"] select[name="type"]'
);
if (tab.classList.contains("active")) {
//Fullfill hidden field
let type_field_search = tab
.querySelector(`sib-display`)
.getAttribute("data-src");
type_hidden_field.forEach(function(select_hidden) {
options_hidden = select_hidden.getElementsByTagName("option");
for (let option_hidden of options_hidden) {
option_hidden.removeAttribute("selected");
if (option_hidden.value == '{"@id": "' + type_field_search + '"}') {
//Actually selecting the option if it is the good one
option_hidden.setAttribute("selected", "selected");
select_hidden.setAttribute("value", option_hidden.value);
form.querySelector("sib-form").component.inputChange();
refreshPagination();
}
}
//Trigerring a reload of the associated form
let parent_form = select_hidden.closest("sib-form");
parent_form.component.inputChange();
refreshPagination();
});
}
}
jQuery(document).ready(function($) {
......@@ -133,8 +174,15 @@ jQuery(document).ready(function($) {
forms.forEach(form => {
form.addEventListener("populate", e => {
//Manage fake tabs
let tabs = document.getElementsByClassName("filter_by_type");
for (let tab of tabs) {
selectHiddenManagementForType(tab, form);
}
//On load in dashbord Entrepreneur
refreshPagination();
//SEARCH BY KEYWORD
//To retrieve keyword
//https://git.happy-dev.fr/startinblox/framework/sib-core/issues/379
......@@ -152,7 +200,6 @@ jQuery(document).ready(function($) {
hidden_field.setAttribute("value", keyword_field.value);
form.querySelector("sib-form").component.inputChange();
refreshPagination();
});
});
......@@ -168,14 +215,12 @@ jQuery(document).ready(function($) {
};
//MORE CRITERIAS
//TODO: Refactor this section ?
const more_criterias_form = document.getElementById("more_criterias");
// https://git.happy-dev.fr/startinblox/framework/sib-core/issues/453
window.setTimeout(() => {
//Refresh data list on delete resources
const deleteButton = document.querySelectorAll("sib-delete");
for (var i = 0; i < deleteButton.length; i++) {
deleteButton[i].addEventListener("resourceDeleted", e => {
const historyList = document.getElementById("resources-history");
......@@ -198,13 +243,21 @@ jQuery(document).ready(function($) {
});
}
//Manage fake tabs for type
let tabs = document.getElementsByClassName("filter_by_type");
for (let tab of tabs) {
tab.addEventListener(
"click",
selectHiddenManagementForType(tab, form)
);
}
//To retrieve format
//TODO: How we should filled the hidden field with multiple value?
//TODO: The hidden search field set with one value doesn't work
let format_field_search = more_criterias_form.querySelector(
`select[name="format"]`
);
format_hidden_field = document.querySelectorAll(
let format_hidden_field = document.querySelectorAll(
'hidden-widget[name="more_criterias_hidden"] select[name="format"]'
);
......
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