Fix props cassé
This commit is contained in:
parent
59e30c88ba
commit
785aaba8b8
@ -4,7 +4,7 @@
|
||||
<div class="box p-3 m-2">
|
||||
<img class="mt-1 ml-5 mr-auto" style="margin: auto;" src="../resources/logo-parcoursup.svg"/>
|
||||
</div>
|
||||
<search></search>
|
||||
<search partouse={searchListener}></search>
|
||||
</div>
|
||||
|
||||
<div class="column">
|
||||
@ -17,7 +17,10 @@
|
||||
|
||||
<script>
|
||||
export default {
|
||||
|
||||
//Fonction qui va écouter ce que <search> a à dire.
|
||||
searchListener(arg) {
|
||||
console.log("Search il a dit: " + arg)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
<school>
|
||||
<div class="box p-2 m-2">
|
||||
<iframe width="100%" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://www.openstreetmap.org/export/embed.html?bbox=-14.655761718750002%2C40.56389453066509%2C13.601074218750002%2C51.754240074033525&layer=mapnik" style="border-radius: 5px;"></iframe>
|
||||
<iframe width="100%" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0"
|
||||
src="https://www.openstreetmap.org/export/embed.html?bbox=-14.655761718750002%2C40.56389453066509%2C13.601074218750002%2C51.754240074033525&layer=mapnik"
|
||||
style="border-radius: 5px;"></iframe>
|
||||
<br>
|
||||
<div class="block control has-icons-left is-inline-block is-pulled-right">
|
||||
<input class="input" type="search" placeholder="Établissement">
|
||||
@ -8,9 +10,6 @@
|
||||
<i class="fas fa-search"></i>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<table class="table is-fullwidth is-hoverable">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -7,9 +7,9 @@
|
||||
<div id="list-formations">
|
||||
<ul>
|
||||
<li class="m-1" each={item in this.state.items}>
|
||||
<button class="button is-fullwidth" disabled={state.updating} onclick={()=>cruiseForward(item.name)}>
|
||||
<span style="font-size: .75em;"><strong>{item.name}</strong></span>
|
||||
<div style="margin-left: auto;"></div>
|
||||
<button class="button is-fullwidth p-2" disabled={state.updating} onclick={()=>cruiseForward(item.name)}>
|
||||
<span style="font-size: .75em; max-size: 90%"><strong>{item.name}</strong></span>
|
||||
<div style="margin-left: auto;"></div>
|
||||
<span class="tag is-primary">{item.count}</span>
|
||||
</button>
|
||||
</li>
|
||||
@ -49,12 +49,24 @@
|
||||
promise.then((response) => {
|
||||
this.state.allItems = response
|
||||
this.filterSearch()
|
||||
this.update({
|
||||
updating: false
|
||||
})
|
||||
}, () => {
|
||||
if (!this.state.currentStep) {
|
||||
this.cruiseBack()
|
||||
}
|
||||
|
||||
this.update({
|
||||
updating: false
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
clearSearch() {
|
||||
this.$("input").value = ""
|
||||
},
|
||||
|
||||
filterSearch() {
|
||||
let input = this.$("input")
|
||||
if (!input) return
|
||||
@ -76,7 +88,6 @@
|
||||
},
|
||||
|
||||
cruiseForward(selection) {
|
||||
if (this.state.currentStep >= 2) return
|
||||
switch (this.state.currentStep) {
|
||||
case 0:
|
||||
this.state.filiere = selection
|
||||
@ -85,11 +96,20 @@
|
||||
case 1:
|
||||
this.state.specialite = selection
|
||||
break
|
||||
}
|
||||
|
||||
case 2:
|
||||
console.log(this.props)
|
||||
console.log(this.root)
|
||||
console.log("end")
|
||||
return
|
||||
|
||||
default:
|
||||
return
|
||||
}
|
||||
this.state.currentStep++
|
||||
|
||||
this.updateList()
|
||||
this.clearSearch()
|
||||
this.update({
|
||||
placeholder: PLACEHOLDERS[this.state.currentStep]
|
||||
})
|
||||
@ -100,6 +120,7 @@
|
||||
this.state.currentStep--
|
||||
|
||||
this.updateList()
|
||||
this.clearSearch()
|
||||
this.update({
|
||||
placeholder: PLACEHOLDERS[this.state.currentStep]
|
||||
})
|
||||
@ -111,104 +132,16 @@
|
||||
placeholder: PLACEHOLDERS[0],
|
||||
currentStep: 0,
|
||||
allItems: null,
|
||||
filter: null,
|
||||
items: null,
|
||||
filiere: null,
|
||||
specialite: null,
|
||||
updating: false
|
||||
updating: false,
|
||||
}
|
||||
},
|
||||
|
||||
onMounted() {
|
||||
onMounted(props, state) {
|
||||
this.updateList()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*const searchURL = `https://data.enseignementsup-recherche.gouv.fr/api/records/1.0/search/?dataset=fr-esr-parcoursup&timezone=Europe%2FBerlin`
|
||||
|
||||
async function fetchFiliere(state) {
|
||||
if (state.sousfili){
|
||||
return PAPI.fetchSpecialites(state.sousfili)
|
||||
} else if (state.fili && !state.sousfili){
|
||||
return PAPI.fetchFiliere(state.fili)
|
||||
} else if (!state.fili && !state.sousfili){
|
||||
return PAPI.fetchFilieres()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export default function search(){
|
||||
return {
|
||||
onBeforeMount(props, state) {
|
||||
// initial state
|
||||
this.state = {
|
||||
placeholder: "Formation",
|
||||
items: null,
|
||||
allitems: null,
|
||||
fili: null,
|
||||
sousfili: null
|
||||
}
|
||||
fetchFiliere(this.state).then((response) => {
|
||||
this.update({
|
||||
items: response,
|
||||
allitems: response
|
||||
})
|
||||
})
|
||||
},
|
||||
searchF(e){
|
||||
let responseFiltered=[]
|
||||
this.state.allitems.forEach(formation => {
|
||||
if (formation.name.toUpperCase().includes(e.target.value.toUpperCase())) {
|
||||
responseFiltered.push(formation)
|
||||
}
|
||||
});
|
||||
this.update({
|
||||
items: responseFiltered
|
||||
})
|
||||
},
|
||||
filter(fili){
|
||||
console.log("filter! "+fili)
|
||||
if (this.state.placeholder==="Filière de formation"){
|
||||
this.update({
|
||||
placeholder: "Filière de formation détaillée",
|
||||
sousfili: fili,
|
||||
})
|
||||
} else if (this.state.placeholder="Formation"){
|
||||
this.update({
|
||||
placeholder: "Filière de formation",
|
||||
fili: fili
|
||||
})
|
||||
}
|
||||
fetchFiliere(this.state).then((response) => {
|
||||
this.update({
|
||||
allitems: response,
|
||||
items: response
|
||||
})
|
||||
console.log(this.state.items)
|
||||
})
|
||||
},
|
||||
back(){
|
||||
console.log("back")
|
||||
if (this.state.placeholder==="Filière de formation"){
|
||||
this.update({
|
||||
placeholder: "Formation",
|
||||
fili: null,
|
||||
})
|
||||
} else if (this.state.placeholder="Filière de formation détaillée"){
|
||||
this.update({
|
||||
placeholder: "Filière de formation",
|
||||
sousfili: null
|
||||
})
|
||||
}
|
||||
fetchFiliere(this.state).then((response) => {
|
||||
this.update({
|
||||
allitems: response,
|
||||
items: response
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}*/
|
||||
</script>
|
||||
</search>
|
@ -10,9 +10,8 @@
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/riot/7.1.0/riot+compiler.min.js" integrity="sha512-sSGKGR9MvL0bUx3CScaBb56crXwspwDkL/JnB0IrLFQfw3uvSUlITQtsTtDZctshhv5wdwIt+qZeN8zThRF4Dw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<main-controller>
|
||||
|
||||
<body class="pr-4">
|
||||
<main-controller>
|
||||
</main-controller>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,38 +1,47 @@
|
||||
var mainController = {
|
||||
css: null,
|
||||
exports: {},
|
||||
template: (template, expressionTypes, bindingTypes, getComponent) => template('<div class="columns"><div class="column is-one-third"><div class="box p-3 m-2"><img class="mt-1 ml-5 mr-auto" style="margin: auto;" src="../resources/logo-parcoursup.svg"/></div><search expr12="expr12"></search></div><div class="column"><fili-info expr13="expr13"></fili-info><school expr14="expr14"></school></div></div><school-info expr15="expr15"></school-info>', [{
|
||||
exports: {
|
||||
//Fonction qui va écouter ce que <search> a à dire.
|
||||
searchListener(arg) {
|
||||
console.log("Search il a dit: " + arg);
|
||||
}
|
||||
},
|
||||
template: (template, expressionTypes, bindingTypes, getComponent) => template('<div class="columns"><div class="column is-one-third"><div class="box p-3 m-2"><img class="mt-1 ml-5 mr-auto" style="margin: auto;" src="../resources/logo-parcoursup.svg"/></div><search expr932="expr932"></search></div><div class="column"><fili-info expr933="expr933"></fili-info><school expr934="expr934"></school></div></div><school-info expr935="expr935"></school-info>', [{
|
||||
type: bindingTypes.TAG,
|
||||
getComponent: getComponent,
|
||||
evaluate: _scope => 'search',
|
||||
slots: [],
|
||||
attributes: [],
|
||||
redundantAttribute: 'expr12',
|
||||
selector: '[expr12]'
|
||||
attributes: [{
|
||||
type: expressionTypes.ATTRIBUTE,
|
||||
name: 'partouse',
|
||||
evaluate: _scope => _scope.searchListener
|
||||
}],
|
||||
redundantAttribute: 'expr932',
|
||||
selector: '[expr932]'
|
||||
}, {
|
||||
type: bindingTypes.TAG,
|
||||
getComponent: getComponent,
|
||||
evaluate: _scope => 'fili-info',
|
||||
slots: [],
|
||||
attributes: [],
|
||||
redundantAttribute: 'expr13',
|
||||
selector: '[expr13]'
|
||||
redundantAttribute: 'expr933',
|
||||
selector: '[expr933]'
|
||||
}, {
|
||||
type: bindingTypes.TAG,
|
||||
getComponent: getComponent,
|
||||
evaluate: _scope => 'school',
|
||||
slots: [],
|
||||
attributes: [],
|
||||
redundantAttribute: 'expr14',
|
||||
selector: '[expr14]'
|
||||
redundantAttribute: 'expr934',
|
||||
selector: '[expr934]'
|
||||
}, {
|
||||
type: bindingTypes.TAG,
|
||||
getComponent: getComponent,
|
||||
evaluate: _scope => 'school-info',
|
||||
slots: [],
|
||||
attributes: [],
|
||||
redundantAttribute: 'expr15',
|
||||
selector: '[expr15]'
|
||||
redundantAttribute: 'expr935',
|
||||
selector: '[expr935]'
|
||||
}]),
|
||||
name: 'main-controller'
|
||||
};
|
||||
|
@ -68,53 +68,53 @@ var school = {
|
||||
}
|
||||
};
|
||||
},
|
||||
template: (template, expressionTypes, bindingTypes, getComponent) => template('<div class="box p-2 m-2"><iframe width="100%" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://www.openstreetmap.org/export/embed.html?bbox=-14.655761718750002%2C40.56389453066509%2C13.601074218750002%2C51.754240074033525&layer=mapnik" style="border-radius: 5px;"></iframe><br/><div class="block control has-icons-left is-inline-block is-pulled-right"><input class="input" type="search" placeholder="Établissement"/><span class="icon is-small is-left"><i class="fas fa-search"></i></span></div><table class="table is-fullwidth is-hoverable"><thead><tr><th><abbr title="name">Nom</abbr></th><th><abbr title="city">Ville</abbr></th><th><abbr title="dept">Dpt</abbr></th><th><abbr title="moyenne">Moyenne</abbr></th><th><abbr title="selectivite">Sélectivité</abbr></th></tr></thead><tbody><tr expr16="expr16"></tr></tbody></table></div>', [{
|
||||
template: (template, expressionTypes, bindingTypes, getComponent) => template('<div class="box p-2 m-2"><iframe width="100%" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://www.openstreetmap.org/export/embed.html?bbox=-14.655761718750002%2C40.56389453066509%2C13.601074218750002%2C51.754240074033525&layer=mapnik" style="border-radius: 5px;"></iframe><br/><div class="block control has-icons-left is-inline-block is-pulled-right"><input class="input" type="search" placeholder="Établissement"/><span class="icon is-small is-left"><i class="fas fa-search"></i></span></div><table class="table is-fullwidth is-hoverable"><thead><tr><th><abbr title="name">Nom</abbr></th><th><abbr title="city">Ville</abbr></th><th><abbr title="dept">Dpt</abbr></th><th><abbr title="moyenne">Moyenne</abbr></th><th><abbr title="selectivite">Sélectivité</abbr></th></tr></thead><tbody><tr expr406="expr406"></tr></tbody></table></div>', [{
|
||||
type: bindingTypes.EACH,
|
||||
getKey: null,
|
||||
condition: null,
|
||||
template: template('<td expr17="expr17"> </td><td expr18="expr18"> </td><td expr19="expr19"> </td><td expr20="expr20"> </td><td expr21="expr21"> </td>', [{
|
||||
redundantAttribute: 'expr17',
|
||||
selector: '[expr17]',
|
||||
template: template('<td expr407="expr407"> </td><td expr408="expr408"> </td><td expr409="expr409"> </td><td expr410="expr410"> </td><td expr411="expr411"> </td>', [{
|
||||
redundantAttribute: 'expr407',
|
||||
selector: '[expr407]',
|
||||
expressions: [{
|
||||
type: expressionTypes.TEXT,
|
||||
childNodeIndex: 0,
|
||||
evaluate: _scope => _scope.etablissement.fields.g_ea_lib_vx
|
||||
}]
|
||||
}, {
|
||||
redundantAttribute: 'expr18',
|
||||
selector: '[expr18]',
|
||||
redundantAttribute: 'expr408',
|
||||
selector: '[expr408]',
|
||||
expressions: [{
|
||||
type: expressionTypes.TEXT,
|
||||
childNodeIndex: 0,
|
||||
evaluate: _scope => _scope.etablissement.fields.ville_etab
|
||||
}]
|
||||
}, {
|
||||
redundantAttribute: 'expr19',
|
||||
selector: '[expr19]',
|
||||
redundantAttribute: 'expr409',
|
||||
selector: '[expr409]',
|
||||
expressions: [{
|
||||
type: expressionTypes.TEXT,
|
||||
childNodeIndex: 0,
|
||||
evaluate: _scope => _scope.etablissement.fields.dep
|
||||
}]
|
||||
}, {
|
||||
redundantAttribute: 'expr20',
|
||||
selector: '[expr20]',
|
||||
redundantAttribute: 'expr410',
|
||||
selector: '[expr410]',
|
||||
expressions: [{
|
||||
type: expressionTypes.TEXT,
|
||||
childNodeIndex: 0,
|
||||
evaluate: _scope => _scope.etablissement.fields.moyenne
|
||||
}]
|
||||
}, {
|
||||
redundantAttribute: 'expr21',
|
||||
selector: '[expr21]',
|
||||
redundantAttribute: 'expr411',
|
||||
selector: '[expr411]',
|
||||
expressions: [{
|
||||
type: expressionTypes.TEXT,
|
||||
childNodeIndex: 0,
|
||||
evaluate: _scope => _scope.etablissement.fields.taux_acces_ens
|
||||
}]
|
||||
}]),
|
||||
redundantAttribute: 'expr16',
|
||||
selector: '[expr16]',
|
||||
redundantAttribute: 'expr406',
|
||||
selector: '[expr406]',
|
||||
itemName: 'etablissement',
|
||||
indexName: null,
|
||||
evaluate: _scope => _scope.state.items
|
||||
|
@ -55,8 +55,18 @@ var search = {
|
||||
this.update({
|
||||
updating: false
|
||||
});
|
||||
}, () => {
|
||||
if (!this.state.currentStep) {
|
||||
this.cruiseBack();
|
||||
}
|
||||
this.update({
|
||||
updating: false
|
||||
});
|
||||
});
|
||||
},
|
||||
clearSearch() {
|
||||
this.$("input").value = "";
|
||||
},
|
||||
filterSearch() {
|
||||
let input = this.$("input");
|
||||
if (!input) return;
|
||||
@ -75,7 +85,6 @@ var search = {
|
||||
});
|
||||
},
|
||||
cruiseForward(selection) {
|
||||
if (this.state.currentStep >= 2) return;
|
||||
switch (this.state.currentStep) {
|
||||
case 0:
|
||||
this.state.filiere = selection;
|
||||
@ -83,9 +92,17 @@ var search = {
|
||||
case 1:
|
||||
this.state.specialite = selection;
|
||||
break;
|
||||
case 2:
|
||||
console.log(this.props);
|
||||
console.log(this.root);
|
||||
console.log("end");
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
this.state.currentStep++;
|
||||
this.updateList();
|
||||
this.clearSearch();
|
||||
this.update({
|
||||
placeholder: PLACEHOLDERS[this.state.currentStep]
|
||||
});
|
||||
@ -94,6 +111,7 @@ var search = {
|
||||
if (!this.state.currentStep) return;
|
||||
this.state.currentStep--;
|
||||
this.updateList();
|
||||
this.clearSearch();
|
||||
this.update({
|
||||
placeholder: PLACEHOLDERS[this.state.currentStep]
|
||||
});
|
||||
@ -104,20 +122,19 @@ var search = {
|
||||
placeholder: PLACEHOLDERS[0],
|
||||
currentStep: 0,
|
||||
allItems: null,
|
||||
filter: null,
|
||||
items: null,
|
||||
filiere: null,
|
||||
specialite: null,
|
||||
updating: false
|
||||
};
|
||||
},
|
||||
onMounted() {
|
||||
onMounted(props, state) {
|
||||
this.updateList();
|
||||
}
|
||||
},
|
||||
template: (template, expressionTypes, bindingTypes, getComponent) => template('<div class="box p-1 m-2"><div class="columns m-1"><input expr304="expr304" class="input" type="input"/><button expr305="expr305" class="button ml-1"><</button></div><div id="list-formations"><ul><li expr306="expr306" class="m-1"></li></ul></div></div>', [{
|
||||
redundantAttribute: 'expr304',
|
||||
selector: '[expr304]',
|
||||
template: (template, expressionTypes, bindingTypes, getComponent) => template('<div class="box p-1 m-2"><div class="columns m-1"><input expr966="expr966" class="input" type="input"/><button expr967="expr967" class="button ml-1"><</button></div><div id="list-formations"><ul><li expr968="expr968" class="m-1"></li></ul></div></div>', [{
|
||||
redundantAttribute: 'expr966',
|
||||
selector: '[expr966]',
|
||||
expressions: [{
|
||||
type: expressionTypes.EVENT,
|
||||
name: 'onkeyup',
|
||||
@ -128,8 +145,8 @@ var search = {
|
||||
evaluate: _scope => _scope.state.placeholder
|
||||
}]
|
||||
}, {
|
||||
redundantAttribute: 'expr305',
|
||||
selector: '[expr305]',
|
||||
redundantAttribute: 'expr967',
|
||||
selector: '[expr967]',
|
||||
expressions: [{
|
||||
type: expressionTypes.ATTRIBUTE,
|
||||
name: 'disabled',
|
||||
@ -143,9 +160,9 @@ var search = {
|
||||
type: bindingTypes.EACH,
|
||||
getKey: null,
|
||||
condition: null,
|
||||
template: template('<button expr307="expr307" class="button is-fullwidth"><span style="font-size: .75em;"><strong expr308="expr308"> </strong></span><div style="margin-left: auto;"></div><span expr309="expr309" class="tag is-primary"> </span></button>', [{
|
||||
redundantAttribute: 'expr307',
|
||||
selector: '[expr307]',
|
||||
template: template('<button expr969="expr969" class="button is-fullwidth p-2"><span style="font-size: .75em; max-size: 90%"><strong expr970="expr970"> </strong></span><div style="margin-left: auto;"></div><span expr971="expr971" class="tag is-primary"> </span></button>', [{
|
||||
redundantAttribute: 'expr969',
|
||||
selector: '[expr969]',
|
||||
expressions: [{
|
||||
type: expressionTypes.ATTRIBUTE,
|
||||
name: 'disabled',
|
||||
@ -156,24 +173,24 @@ var search = {
|
||||
evaluate: _scope => () => _scope.cruiseForward(_scope.item.name)
|
||||
}]
|
||||
}, {
|
||||
redundantAttribute: 'expr308',
|
||||
selector: '[expr308]',
|
||||
redundantAttribute: 'expr970',
|
||||
selector: '[expr970]',
|
||||
expressions: [{
|
||||
type: expressionTypes.TEXT,
|
||||
childNodeIndex: 0,
|
||||
evaluate: _scope => _scope.item.name
|
||||
}]
|
||||
}, {
|
||||
redundantAttribute: 'expr309',
|
||||
selector: '[expr309]',
|
||||
redundantAttribute: 'expr971',
|
||||
selector: '[expr971]',
|
||||
expressions: [{
|
||||
type: expressionTypes.TEXT,
|
||||
childNodeIndex: 0,
|
||||
evaluate: _scope => _scope.item.count
|
||||
}]
|
||||
}]),
|
||||
redundantAttribute: 'expr306',
|
||||
selector: '[expr306]',
|
||||
redundantAttribute: 'expr968',
|
||||
selector: '[expr968]',
|
||||
itemName: 'item',
|
||||
indexName: null,
|
||||
evaluate: _scope => _scope.state.items
|
||||
|
@ -16,9 +16,10 @@ riot.register("fili-info", FiliInfo)
|
||||
riot.register("search", Search)
|
||||
riot.register("school", School)
|
||||
|
||||
riot.mount("main-controller")
|
||||
riot.mount("school-info")
|
||||
|
||||
riot.mount("line-graph")
|
||||
riot.mount("fili-info")
|
||||
riot.mount("search")
|
||||
riot.mount("school")
|
||||
riot.mount("school-info")
|
||||
riot.mount("fili-info")
|
||||
riot.mount("school")
|
||||
riot.mount("main-controller")
|
Loading…
Reference in New Issue
Block a user