$
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
import log from "./log";
|
||||
import * as riot from "riot";
|
||||
|
||||
export default class View {
|
||||
constructor() {
|
||||
this.title = document.getElementById("selector-top-title")
|
||||
this.zone = document.getElementById("selector-list-zone")
|
||||
this.path = document.getElementById("location")
|
||||
this.etab = document.getElementById("etab")
|
||||
this.path = document.getElementById("loc")
|
||||
this.etab = document.getElementById("etablanalytics-list")
|
||||
this.btn = document.getElementById("selector-top-btn")
|
||||
this.btn.onclick = () => {
|
||||
this.updateMenu(" ", "previous")
|
||||
@@ -29,25 +30,18 @@ export default class View {
|
||||
|
||||
if(title || data) {
|
||||
data.forEach((e) => {
|
||||
let li = document.createElement("li")
|
||||
li.className = "selector-list-inner"
|
||||
li.onclick = () => {
|
||||
let elem = document.createElement("selectorfragment")
|
||||
elem.onclick = () => {
|
||||
this.updateMenu(document.getElementById(`menu0-${e.name}`).innerText, "next")
|
||||
}
|
||||
|
||||
let name = document.createElement("a")
|
||||
name.innerText = e.name
|
||||
name.id = `menu0-${e.name}`
|
||||
name.className = "selector-list-names"
|
||||
this.zone.appendChild(elem)
|
||||
|
||||
let count = document.createElement("span")
|
||||
count.innerText = e.count
|
||||
count.className = "selector-list-counts"
|
||||
|
||||
li.appendChild(name)
|
||||
li.appendChild(count)
|
||||
|
||||
this.zone.appendChild(li)
|
||||
riot.mount(elem, {
|
||||
name: e.name,
|
||||
count: e.count,
|
||||
idd: `menu0-${e.name}`
|
||||
}, "selectorfragment")
|
||||
})
|
||||
}
|
||||
|
||||
@@ -59,7 +53,14 @@ export default class View {
|
||||
* @param { string[] } path Chemin courant.
|
||||
* */
|
||||
renderPath(path) {
|
||||
this.path.innerText = `${path[0]} / ${path[1]} / ${path[2]}`
|
||||
this.path.innerHTML = ""
|
||||
let elem = document.createElement("locfragment")
|
||||
this.path.appendChild(elem)
|
||||
|
||||
riot.mount(elem, {
|
||||
msg: path.filter(Boolean).join(" ► ")
|
||||
}, "locfragment")
|
||||
|
||||
log("Loc->View", `Chemin change ${path}`)
|
||||
}
|
||||
|
||||
@@ -69,13 +70,13 @@ export default class View {
|
||||
* */
|
||||
renderEtab(data) {
|
||||
this.etab.innerHTML =
|
||||
"<tr>" +
|
||||
"<tbody>" +
|
||||
" <th>Nom</th>" +
|
||||
" <th>Ville</th>" +
|
||||
" <th>Dept</th>" +
|
||||
" <th>Departement</th>" +
|
||||
" <th>Moyenne</th>" +
|
||||
" <th>Selectivite</th>" +
|
||||
"</tr>"
|
||||
"</tbody>"
|
||||
|
||||
data.forEach((e) => {
|
||||
let etab = e.fields.g_ea_lib_vx
|
||||
|
Reference in New Issue
Block a user