mirror of
https://github.com/voltbonn/diversity.volt.link.git
synced 2024-06-28 08:50:56 +00:00
team selector
This commit is contained in:
parent
059e403040
commit
096bcebdd8
|
@ -721,10 +721,10 @@ body.success .submitWrapper {
|
|||
}
|
||||
|
||||
.chip_box {
|
||||
margin: -5px;
|
||||
margin: -4px;
|
||||
}
|
||||
.chip_box .chip {
|
||||
margin: 5px;
|
||||
margin: 4px;
|
||||
}
|
||||
|
||||
body[show=""] .page[page="intro"],
|
||||
|
|
|
@ -151,17 +151,16 @@
|
|||
|
||||
<div
|
||||
id="team_suggestions"
|
||||
class="chip_box"
|
||||
style="
|
||||
white-space: nowrap;
|
||||
overflow: auto;
|
||||
display: flex;
|
||||
gap: 5px;
|
||||
padding-bottom: 16px;
|
||||
margin: 4px 0 -4px 0;
|
||||
"
|
||||
>
|
||||
<div class="chip add">Bonn</div>
|
||||
<div class="chip add">Berlin</div>
|
||||
</div>
|
||||
></div>
|
||||
|
||||
<div id="selected_teams_wrapper">
|
||||
<br />
|
||||
<h3 data-translation-key="metadata_team_search_description-">Ausgewählte Teams:</h3>
|
||||
|
||||
|
@ -169,6 +168,7 @@
|
|||
<span id="teams_selected"></span><!--
|
||||
--><span id="teams_selected_automatically"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -38,7 +38,7 @@ function renderTeamSuggestions() {
|
|||
|
||||
const team_suggestions_input_value = team_suggestions_input.value.toLowerCase()
|
||||
|
||||
|
||||
if (team_suggestions_input_value.length > 0) {
|
||||
// filter out parent_teams that are in the teams array
|
||||
const teams_selected_ids = [...teams_selected]
|
||||
.flatMap(team => [
|
||||
|
@ -62,6 +62,7 @@ function renderTeamSuggestions() {
|
|||
team_suggestions.appendChild(team_chip)
|
||||
}
|
||||
}
|
||||
}
|
||||
function renderTeamSelected() {
|
||||
const teams_selected_node = document.getElementById('teams_selected')
|
||||
teams_selected_node.innerHTML = ''
|
||||
|
@ -71,6 +72,13 @@ function renderTeamSelected() {
|
|||
return a.name.toLowerCase() > b.name.toLowerCase() ? 1 : -1
|
||||
})
|
||||
|
||||
const selected_teams_wrapper_node = document.getElementById('selected_teams_wrapper')
|
||||
if (filtered_teams.length === 0) {
|
||||
selected_teams_wrapper_node.style.display = 'none'
|
||||
} else {
|
||||
selected_teams_wrapper_node.style.display = 'block'
|
||||
}
|
||||
|
||||
for (const team of filtered_teams) {
|
||||
const team_chip = document.createElement('div')
|
||||
team_chip.classList.add('chip')
|
||||
|
@ -127,7 +135,13 @@ function loadTeams() {
|
|||
console.error(error)
|
||||
})
|
||||
}
|
||||
function initTeams() {
|
||||
loadTeams()
|
||||
renderTeamSuggestions()
|
||||
renderTeamSelected()
|
||||
renderTeamSelectedAutomatically()
|
||||
}
|
||||
initTeams()
|
||||
|
||||
const CloudFunctionsPrefix = 'https://us-central1-volt-4eca0.cloudfunctions.net/save_formdata'
|
||||
|
||||
|
|
Loading…
Reference in a new issue