Commit 0d6d44d6 authored by Mathias Chouet's avatar Mathias Chouet 🍝
Browse files

Fix #293 - help links for results

parent a8e2aa81
......@@ -248,6 +248,15 @@ Custom Material SVG Icons will only show up when the application is deployed on
- pour l'entête d'un _template_container_: `{... "type": "template_container",
"help": "aide.html", ...}`
- éventuellement l'URL de l'aide pour un résultat en particulier, dans le bloc d'options de la configuration :
- ```json
{
"type": "options",
"resultsHelp": {
"HG": "devalaison/grille.html#hauteur-de-grille"
}
- dans _src/app/calculators/ma-calculette_ :
Créer les fichiers d'internationalisation (_ma-calculette.<langue>.json_). Il doivent reprendre tous les ids utilisés dans le fichier de configuration et fournir leur traduction.
......
......@@ -40,6 +40,9 @@
"type": "options",
"gridTypeSelectId": "select_grid_type",
"gridProfileSelectId": "select_grid_profile",
"help": "devalaison/grille"
"help": "devalaison/grille",
"resultsHelp": {
"HG": "devalaison/grille#hauteur-de-grille"
}
}
]
\ No newline at end of file
......@@ -12,7 +12,7 @@
<ng-container matColumnDef="parametre">
<th mat-header-cell *matHeaderCellDef>{{ uitextParamFixes }}</th>
<td mat-cell *matCellDef="let element" [ngClass]="{'highlightedResult': element.isCalcResult}">{{ element.label }}</td>
<td mat-cell *matCellDef="let element" [innerHTML]="element.label" [ngClass]="{'highlightedResult': element.isCalcResult}"></td>
</ng-container>
<ng-container matColumnDef="valeur">
<th mat-header-cell *matHeaderCellDef>{{ uitextValeurs }}</th>
......
......@@ -41,6 +41,12 @@ table.mat-table {
::ng-deep .mat-cell {
padding-top: 8px;
padding-bottom: 8px;
.material-icons {
font-size: 1.4em;
vertical-align: bottom;
margin-left: 4px;
}
}
}
......
......@@ -101,6 +101,7 @@ export class FixedResultsComponent extends ResultsComponent {
const pos = fp.paramDefinition.parentNub.findPositionInParent();
label = this.intlService.localizeText("INFO_OUVRAGE") + "" + (pos + 1) + ": " + label;
}
label += this._fixedResults.getHelpLink(symbol);
data.push({
label: label,
value: this.formattedValue(fp),
......@@ -138,7 +139,8 @@ export class FixedResultsComponent extends ResultsComponent {
unit = p.unit;
}
} catch (e) { /* silent fail */ }
const label = this.formService.expandVariableNameAndUnit(ct, k, unit);
let label = this.formService.expandVariableNameAndUnit(ct, k, unit);
label += this._fixedResults.getHelpLink(symbol);
data.push({
label: label,
value: this.intlService.formatResult(k, er),
......@@ -160,10 +162,12 @@ export class FixedResultsComponent extends ResultsComponent {
ct = sn.parent.calcType;
}
const cn = capitalize(this.intlService.childName(sn));
let label = sprintf(this.intlService.localizeText("INFO_STUFF_N"), cn)
+ (c.findPositionInParent() + 1) + " : "
+ this.formService.expandVariableNameAndUnit(ct, k);
label += this._fixedResults.getHelpLink(symbol);
data.push({
label: sprintf(this.intlService.localizeText("INFO_STUFF_N"), cn)
+ (c.findPositionInParent() + 1) + " : "
+ this.formService.expandVariableNameAndUnit(ct, k),
label: label,
value: this.intlService.formatResult(k, er),
isCalcResult: true // for CSS
});
......@@ -191,6 +195,7 @@ export class FixedResultsComponent extends ResultsComponent {
const pos = fp.paramDefinition.parentNub.findPositionInParent();
label = this.intlService.localizeText("INFO_OUVRAGE") + "" + (pos + 1) + ": " + label;
}
label += this._fixedResults.getHelpLink(fp.symbol);
data.push({
label: label,
value: this.formattedValue(fp),
......@@ -223,7 +228,8 @@ export class FixedResultsComponent extends ResultsComponent {
unit = p.unit;
}
} catch (e) { /* silent fail */ }
const label = this.formService.expandVariableNameAndUnit(ct, k, unit);
let label = this.formService.expandVariableNameAndUnit(ct, k, unit);
label += this._fixedResults.getHelpLink(k);
data.push({
label: label,
value: this.intlService.formatResult(k, er),
......@@ -242,10 +248,12 @@ export class FixedResultsComponent extends ResultsComponent {
ct = sn.parent.calcType;
}
const cn = capitalize(this.intlService.childName(sn));
let label = sprintf(this.intlService.localizeText("INFO_STUFF_N"), cn)
+ (c.findPositionInParent() + 1) + " : "
+ this.formService.expandVariableNameAndUnit(ct, k);
label += this._fixedResults.getHelpLink(k);
data.push({
label: sprintf(this.intlService.localizeText("INFO_STUFF_N"), cn)
+ (c.findPositionInParent() + 1) + " : "
+ this.formService.expandVariableNameAndUnit(ct, k),
label: label,
value: this.intlService.formatResult(k, er),
isCalcResult: true // for CSS
});
......
......@@ -33,8 +33,8 @@
</ng-container>
<!-- generic column -->
<ng-container *ngFor="let h of headersWithoutLogColumn; let i = index" [matColumnDef]="h">
<th mat-header-cell *matHeaderCellDef>{{ h }}</th>
<td mat-cell *matCellDef="let element">{{ element[i+1] }}</td>
<th mat-header-cell *matHeaderCellDef [innerHTML]="h"></th>
<td mat-cell *matCellDef="let element" [innerHTML]="element[i+1]"></td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="headers"></tr>
......
......@@ -61,6 +61,12 @@ table.mat-table {
color: black;
padding: 5px;
border: none;
.material-icons {
font-size: 1.4em;
vertical-align: bottom;
margin-left: 4px;
}
}
::ng-deep .mat-cell {
......
......@@ -19,7 +19,7 @@
<table mat-table [dataSource]="dataSet">
<ng-container *ngFor="let h of headers; let i = index" [matColumnDef]="h">
<th mat-header-cell *matHeaderCellDef>{{ h }}</th>
<th mat-header-cell *matHeaderCellDef [innerHTML]="h"></th>
<td mat-cell *matCellDef="let element" [innerHTML]="element[i]"></td>
</ng-container>
......
......@@ -62,5 +62,11 @@ table.mat-table {
font-size: 1em;
color: black;
padding: 5px;
.material-icons {
font-size: 1.4em;
vertical-align: bottom;
margin-left: 4px;
}
}
}
......@@ -19,7 +19,7 @@
<table mat-table [dataSource]="dataSet">
<ng-container *ngFor="let h of headers; let i = index" [matColumnDef]="h">
<th mat-header-cell *matHeaderCellDef>{{ h }}</th>
<th mat-header-cell *matHeaderCellDef [innerHTML]="h"></th>
<td mat-cell *matCellDef="let element" [innerHTML]="element[i]"></td>
</ng-container>
......
......@@ -62,5 +62,11 @@ table.mat-table {
font-size: 1em;
color: black;
padding: 5px;
.material-icons {
font-size: 1.4em;
vertical-align: bottom;
margin-left: 4px;
}
}
}
......@@ -101,7 +101,6 @@ export class SectionResultsComponent extends ResultsComponent implements DoCheck
}
private updateResults() {
console.log("UPDATE RESULTS");
if (this._results && this._sectionCanvas) {
this._resultElement = new ResultElement();
......
......@@ -18,6 +18,11 @@ export class FormulaireBase extends FormulaireDefinition {
this._formCompute = new FormComputeFixedVar(this, (this._formResult as FormResultFixedVar));
}
protected completeParse(json: {}) {
super.completeParse(json);
this._formResult.helpLinks = this._resultsHelpLinks;
}
/**
* Resets the form results, the results panel on screen, the model
* results, and does the same for all depending modules
......
......@@ -153,6 +153,7 @@ export class FormulaireMacrorugoCompound extends FormulaireBase {
protected completeParse(json: {}) {
this.subscribeFieldsetContainer();
this.updateApronState(this.mrcNub.properties.getPropValue("inclinedApron"));
this._formResult.helpLinks = this._resultsHelpLinks;
}
private get fieldsetContainer(): FieldsetContainer {
......
......@@ -170,6 +170,7 @@ export class FormulaireParallelStructure extends FormulaireBase {
protected completeParse(json: {}) {
this.subscribeFieldsetContainer();
this._formResult.helpLinks = this._resultsHelpLinks;
}
private get fieldsetContainer(): FieldsetContainer {
......
......@@ -23,6 +23,7 @@ export class FormulaireRegimeUniforme extends FormulaireBase implements Observer
protected completeParse(json: {}) {
super.completeParse(json);
this._formResult.helpLinks = this._resultsHelpLinks;
}
// interface Observer
......
......@@ -19,6 +19,7 @@ import { PabTable } from "../pab-table";
* classe de base pour tous les formulaires
*/
export abstract class FormulaireDefinition extends FormulaireNode implements Observer {
/** nom du module de calcul */
private _calculatorName: string;
......@@ -28,6 +29,9 @@ export abstract class FormulaireDefinition extends FormulaireNode implements Obs
/** propriétés par défaut (lues si _currentNub === undefined ) */
protected _props = {};
/** aide en ligne pour les résultats */
protected _resultsHelpLinks: { [key: string]: string };
/** fichier de configuration */
private _jsonConfig: {};
......@@ -137,8 +141,10 @@ export abstract class FormulaireDefinition extends FormulaireNode implements Obs
this._props["nodeType"] = ComputeNodeType[dnt];
}
this._helpLink = json["help"];
this._resultsHelpLinks = json["resultsHelp"];
}
/** called at the end of parseConfig() */
protected completeParse(json: {}) {
}
......
......@@ -56,6 +56,9 @@ export class FormResultFixedVar extends FormResult {
public get results(): CalculatorResults[] {
const res: CalculatorResults[] = [];
// ensure help links are propagated
this._fixedResults.helpLinks = this.helpLinks;
this._varResults.helpLinks = this.helpLinks;
res.push(this._fixedResults);
res.push(this._varResults);
return res;
......
......@@ -24,6 +24,8 @@ export class FormResultMacrorugoCompound extends FormResult {
}
public get results(): CalculatorResults[] {
// ensure help links are propagated
this._mrcResults.helpLinks = this.helpLinks;
return [ this._mrcResults ];
}
......
......@@ -24,6 +24,8 @@ export class FormResultPab extends FormResult {
}
public get results(): CalculatorResults[] {
// ensure help links are propagated
this._pabResults.helpLinks = this.helpLinks;
return [ this._pabResults ];
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment