Commit f4d03b7a authored by Yohan Boniface's avatar Yohan Boniface

Explorer: display label from enum if any

parent e3af3fd7
# Changelog
## dev
- explorer: display label from enum if any
## 0.4.0
- fixed Actalians CPF rules which were also targetting «période de
......
<context>
<table>
<tr each={ value, key in this.opts.data }><th>{ this.renderLabel(key, value) }</th><td>{ this.renderValue(key, value) }</td></tr>
</table>
<style scoped>
table {
table-layout: fixed;
width: 100%;
overflow: hidden;
}
th {
text-align: left;
width: 40%;
}
td {
width: 50%;
}
tr:nth-child(even) {
background: #f3f3f3;
}
</style>
<script>
this.renderValue = (key, value) => {
if (SCHEMA[key]['type'] === 'array') return value.join(', ')
if (SCHEMA[key]['format'] === 'date') return (new Date(value * 1000)).toLocaleDateString()
if (SCHEMA[key]['enum']) return SCHEMA[key]['enum'][value]
return value
}
this.renderLabel = (key, value) => {
return SCHEMA[key]['label']
}
</script>
</context>
......@@ -28,9 +28,7 @@
</ul>
<p if={ !this.financements.length }>Aucun financement trouvé.</p>
<h2>Contexte</h2>
<table>
<tr each={ value, key in this.context }><th>{ this.renderLabel(key, value) }</th><td>{ this.renderValue(key, value) }</td></tr>
</table>
<context data={ this.context }></context>
<h2>Scénario de test</h2>
<rule if={ this.scenario } content={ this.scenario }></rule>
</section>
......@@ -79,16 +77,6 @@
this.decodeLBFURL(url, this.simulate)
}
this.renderValue = (key, value) => {
if (SCHEMA[key]['type'] === 'array') return value.join(', ')
if (SCHEMA[key]['format'] === 'date') return (new Date(value * 1000)).toLocaleDateString()
return value
}
this.renderLabel = (key, value) => {
return SCHEMA[key]['label']
}
</script>
<style scoped>
......@@ -99,21 +87,6 @@
padding: 10px;
border-left: 1px solid #ddd;
}
table {
table-layout: fixed;
width: 100%;
overflow: hidden;
}
th {
text-align: left;
width: 40%;
}
td {
width: 50%;
}
tr:nth-child(even) {
background: #f3f3f3;
}
.result {
border-bottom: 1px solid #eee;
}
......
......@@ -14,6 +14,7 @@
<script src="components/tools.tag.html" type="riot/tag"></script>
<script src="components/idcc-search.tag.html" type="riot/tag"></script>
<script src="components/catalog.tag.html" type="riot/tag"></script>
<script src="components/context.tag.html" type="riot/tag"></script>
<header data-is=navbar></header>
<main>
......
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