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 { ...@@ -31,53 +31,57 @@ export class CalculatorListComponent implements OnInit {
if (themes) { if (themes) {
// group by themes // group by themes
for (const theme of themes) { for (const theme of themes) {
// get theme details from config if (theme.name) {
const themeTitleKey = "INFO_THEME_" + theme.name + "_TITRE"; // get theme details from config
const themeDescriptionKey = "INFO_THEME_" + theme.name + "_DESCRIPTION"; const themeTitleKey = "INFO_THEME_" + theme.name + "_TITRE";
const credits = ServiceFactory.instance.i18nService.localizeText("INFO_THEME_CREDITS"); const themeDescriptionKey = "INFO_THEME_" + theme.name + "_DESCRIPTION";
const item = { const credits = ServiceFactory.instance.i18nService.localizeText("INFO_THEME_CREDITS");
title: ServiceFactory.instance.i18nService.localizeText(themeTitleKey), const item = {
description: ServiceFactory.instance.i18nService.localizeText(themeDescriptionKey), title: ServiceFactory.instance.i18nService.localizeText(themeTitleKey),
image: { description: ServiceFactory.instance.i18nService.localizeText(themeDescriptionKey),
path: "assets/images/themes/" + theme.image.path, image: {
title: theme.image.title, path: "assets/images/themes/" + theme.image.path,
credits: credits + " : " + theme.image.credits title: theme.image.title,
}, credits: credits + " : " + theme.image.credits
calculators: [] },
}; calculators: []
// get calculators for this theme };
for (const calcType of theme.calculators) { // get calculators for this theme
item.calculators.push({ for (const calcType of theme.calculators) {
type: calcType, item.calculators.push({
label: ServiceFactory.instance.formulaireService.getLocalisedTitleFromCalculatorType(calcType) type: calcType,
}); label: ServiceFactory.instance.formulaireService.getLocalisedTitleFromCalculatorType(calcType)
// mark as used });
const index = unusedCalculators.indexOf(calcType); // mark as used
if (index > -1) { const index = unusedCalculators.indexOf(calcType);
unusedCalculators.splice(index, 1); 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
// extra card for unused calculators if (unusedCalculators.length > 0) {
if (unusedCalculators.length > 0) { const unusedTheme = themes.find(i => i.name === undefined);
const unusedTheme = { unusedTheme.calculators = [];
title: "Pas utilisées", unusedTheme.title = ServiceFactory.instance.i18nService.localizeText("INFO_THEME_MODULES_INUTILISES_TITRE");
description: "Tout ce qu'est pas dans les autres thèmes", unusedTheme.description = ServiceFactory.instance.i18nService.localizeText("INFO_THEME_MODULES_INUTILISES_DESCRIPTION");
calculators: [] unusedTheme.image.path = "assets/images/themes/" + unusedTheme.image.path;
};
for (const t of unusedCalculators) { for (const t of unusedCalculators) {
if (t !== CalculatorType.Structure) { if (t !== CalculatorType.Structure) {
unusedTheme.calculators.push({ unusedTheme.calculators.push({
type: t, type: t,
label: ServiceFactory.instance.formulaireService.getLocalisedTitleFromCalculatorType(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 @@ ...@@ -13,7 +13,8 @@
"title": "Passe à poisson sur le Lez, entre Bollène et Suze", "title": "Passe à poisson sur le Lez, entre Bollène et Suze",
"credits": "Hervé Capra / Irstea" "credits": "Hervé Capra / Irstea"
}, },
"calculators": [ 5, 6, 10, 9 ] "calculators": [ 6, 10, 9 ],
"_calculators": [ 5, 6, 10, 9 ]
}, },
{ {
"name": "PASSE_NATURELLE", "name": "PASSE_NATURELLE",
...@@ -50,6 +51,14 @@ ...@@ -50,6 +51,14 @@
"credits": "David Dorchies / Irstea" "credits": "David Dorchies / Irstea"
}, },
"calculators": [ 8, 9, 10 ] "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 @@ ...@@ -126,6 +126,8 @@
"INFO_SETUP_PRECISION_CALCUL": "Computation accuracy", "INFO_SETUP_PRECISION_CALCUL": "Computation accuracy",
"INFO_SETUP_TITLE": "Application setup", "INFO_SETUP_TITLE": "Application setup",
"INFO_THEME_CREDITS": "Credit", "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_TITRE": "Basin pass",
"INFO_THEME_PASSE_A_BASSIN_DESCRIPTION": "A great pass with a great basin", "INFO_THEME_PASSE_A_BASSIN_DESCRIPTION": "A great pass with a great basin",
"INFO_THEME_PASSE_NATURELLE_TITRE": "Natural pass", "INFO_THEME_PASSE_NATURELLE_TITRE": "Natural pass",
......
...@@ -141,6 +141,8 @@ ...@@ -141,6 +141,8 @@
"INFO_SETUP_PRECISION_CALCUL": "Précision de calcul", "INFO_SETUP_PRECISION_CALCUL": "Précision de calcul",
"INFO_SETUP_TITLE": "Paramètres de l'application", "INFO_SETUP_TITLE": "Paramètres de l'application",
"INFO_THEME_CREDITS": "Crédit", "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_TITRE": "Passe à bassin",
"INFO_THEME_PASSE_A_BASSIN_DESCRIPTION": "Une super passe avec un super bassin", "INFO_THEME_PASSE_A_BASSIN_DESCRIPTION": "Une super passe avec un super bassin",
"INFO_THEME_PASSE_NATURELLE_TITRE": "Passe naturelle", "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