Skip to content
Snippets Groups Projects
Commit 3fbf5638 authored by mathias.chouet's avatar mathias.chouet
Browse files

Amélioration page de liste

image temporaire pour "autres"
parent 7b5d6f5a
No related branches found
No related tags found
No related merge requests found
......@@ -31,53 +31,57 @@ export class CalculatorListComponent implements OnInit {
if (themes) {
// group by themes
for (const theme of themes) {
// get theme details from config
const themeTitleKey = "INFO_THEME_" + theme.name + "_TITRE";
const themeDescriptionKey = "INFO_THEME_" + theme.name + "_DESCRIPTION";
const credits = ServiceFactory.instance.i18nService.localizeText("INFO_THEME_CREDITS");
const item = {
title: ServiceFactory.instance.i18nService.localizeText(themeTitleKey),
description: ServiceFactory.instance.i18nService.localizeText(themeDescriptionKey),
image: {
path: "assets/images/themes/" + theme.image.path,
title: theme.image.title,
credits: credits + " : " + theme.image.credits
},
calculators: []
};
// get calculators for this theme
for (const calcType of theme.calculators) {
item.calculators.push({
type: calcType,
label: ServiceFactory.instance.formulaireService.getLocalisedTitleFromCalculatorType(calcType)
});
// mark as used
const index = unusedCalculators.indexOf(calcType);
if (index > -1) {
unusedCalculators.splice(index, 1);
if (theme.name) {
// get theme details from config
const themeTitleKey = "INFO_THEME_" + theme.name + "_TITRE";
const themeDescriptionKey = "INFO_THEME_" + theme.name + "_DESCRIPTION";
const credits = ServiceFactory.instance.i18nService.localizeText("INFO_THEME_CREDITS");
const item = {
title: ServiceFactory.instance.i18nService.localizeText(themeTitleKey),
description: ServiceFactory.instance.i18nService.localizeText(themeDescriptionKey),
image: {
path: "assets/images/themes/" + theme.image.path,
title: theme.image.title,
credits: credits + " : " + theme.image.credits
},
calculators: []
};
// get calculators for this theme
for (const calcType of theme.calculators) {
item.calculators.push({
type: calcType,
label: ServiceFactory.instance.formulaireService.getLocalisedTitleFromCalculatorType(calcType)
});
// mark as used
const index = unusedCalculators.indexOf(calcType);
if (index > -1) {
unusedCalculators.splice(index, 1);
}
}
this._items.push(item);
}
this._items.push(item);
// else special theme for unused calculators
}
}
// extra card for unused calculators
if (unusedCalculators.length > 0) {
const unusedTheme = {
title: "Pas utilisées",
description: "Tout ce qu'est pas dans les autres thèmes",
calculators: []
};
for (const t of unusedCalculators) {
if (t !== CalculatorType.Structure) {
unusedTheme.calculators.push({
type: t,
label: ServiceFactory.instance.formulaireService.getLocalisedTitleFromCalculatorType(t)
});
// extra card for unused calculators
if (unusedCalculators.length > 0) {
const unusedTheme = themes.find(i => i.name === undefined);
unusedTheme.calculators = [];
unusedTheme.title = ServiceFactory.instance.i18nService.localizeText("INFO_THEME_MODULES_INUTILISES_TITRE");
unusedTheme.description = ServiceFactory.instance.i18nService.localizeText("INFO_THEME_MODULES_INUTILISES_DESCRIPTION");
unusedTheme.image.path = "assets/images/themes/" + unusedTheme.image.path;
for (const t of unusedCalculators) {
if (t !== CalculatorType.Structure) {
unusedTheme.calculators.push({
type: t,
label: ServiceFactory.instance.formulaireService.getLocalisedTitleFromCalculatorType(t)
});
}
}
if (unusedTheme.calculators.length > 0) {
this._items.push(unusedTheme);
} // else the only remaining calculator was "Structure", the one we don't want
}
if (unusedTheme.calculators.length > 0) {
this._items.push(unusedTheme);
} // else the only remaining calculator was "Structure", the one we don't want
}
}
......
......@@ -13,7 +13,8 @@
"title": "Passe à poisson sur le Lez, entre Bollène et Suze",
"credits": "Hervé Capra / Irstea"
},
"calculators": [ 5, 6, 10, 9 ]
"calculators": [ 6, 10, 9 ],
"_calculators": [ 5, 6, 10, 9 ]
},
{
"name": "PASSE_NATURELLE",
......@@ -50,6 +51,14 @@
"credits": "David Dorchies / Irstea"
},
"calculators": [ 8, 9, 10 ]
},
{
"_comment": "card for calculators not used in any theme",
"image": {
"path": "autres.jpg",
"title": "",
"credits": ""
}
}
]
}
src/assets/images/themes/autres.jpg

37.5 KiB

......@@ -126,6 +126,8 @@
"INFO_SETUP_PRECISION_CALCUL": "Computation accuracy",
"INFO_SETUP_TITLE": "Application setup",
"INFO_THEME_CREDITS": "Credit",
"INFO_THEME_MODULES_INUTILISES_TITRE": "Other calculator modules",
"INFO_THEME_MODULES_INUTILISES_DESCRIPTION": "Calculator modules not used in themes above",
"INFO_THEME_PASSE_A_BASSIN_TITRE": "Basin pass",
"INFO_THEME_PASSE_A_BASSIN_DESCRIPTION": "A great pass with a great basin",
"INFO_THEME_PASSE_NATURELLE_TITRE": "Natural pass",
......
......@@ -141,6 +141,8 @@
"INFO_SETUP_PRECISION_CALCUL": "Précision de calcul",
"INFO_SETUP_TITLE": "Paramètres de l'application",
"INFO_THEME_CREDITS": "Crédit",
"INFO_THEME_MODULES_INUTILISES_TITRE": "Autres modules de calcul",
"INFO_THEME_MODULES_INUTILISES_DESCRIPTION": "Modules de calculs non utilisés dans les thèmes ci-dessus",
"INFO_THEME_PASSE_A_BASSIN_TITRE": "Passe à bassin",
"INFO_THEME_PASSE_A_BASSIN_DESCRIPTION": "Une super passe avec un super bassin",
"INFO_THEME_PASSE_NATURELLE_TITRE": "Passe naturelle",
......
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