Commit 82f761ae authored by Lucas Détré's avatar Lucas Détré

Merge branch 'docker-vue' of...

Merge branch 'docker-vue' of ssh://git.beta.pole-emploi.fr:23/open-source/trefle into beautify-referentiel
parents fe6ee830 2dabd86b
Pipeline #2066 passed with stage
in 1 minute and 16 seconds
......@@ -73,8 +73,8 @@ Add this env var:
OLD_VERSION api-vX.X.X
BACK_VERSION backoffice-vX.X.X
LBF_CHARMAP "sA,4B,RC,cD,oE,gF,yG,wH,mI,HJ,7K,EL,aM,YN,XO,8P,GQ,BR,kS,iT,IU,AV,TW,DX,pY,JZ,2a,Lb,Mc, d,de,Cf,Qg,fh,ri,Pj,Nk,Vl,vm,0n,Ko,ep,jq,Zr,9s,ht,Fu,tv,-w,Ux,1y,xz,30,u1,52,q3,W4,S5,66,n7,b8,O9,_+,l/,z "
CATALOG_USER TREFLE
CATALOG_KEY 7482dd55a687e405521bd95e72ac70fa8ac0e671
CATALOG_USER {ASK-YOUR-LBF-CATALOG-API-USER}
CATALOG_KEY {ASK-YOUR-LBF-CATALOG-API-KEY}
CATALOG_URL https://labonneformation.pole-emploi.fr/api/v1/detail
TREFLE_GIT https://git.beta.pole-emploi.fr/open-source/trefle.git
......
......@@ -1396,9 +1396,9 @@
"dev": true
},
"serialize-javascript": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-2.1.0.tgz",
"integrity": "sha512-a/mxFfU00QT88umAJQsNWOnUKckhNCqOl028N48e7wFmo2/EHpTo9Wso+iJJCMrQnmFvcjto5RJdAHEvVhcyUQ==",
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-2.1.2.tgz",
"integrity": "sha512-rs9OggEUF0V4jUSecXazOYsLfu7OGK2qIn3c7IPBiffz32XniEp/TX9Xmc9LQfK2nQ2QKHvZ2oygKUGU0lG4jQ==",
"dev": true
},
"slash": {
......@@ -3298,9 +3298,9 @@
"dev": true
},
"serialize-javascript": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-2.1.0.tgz",
"integrity": "sha512-a/mxFfU00QT88umAJQsNWOnUKckhNCqOl028N48e7wFmo2/EHpTo9Wso+iJJCMrQnmFvcjto5RJdAHEvVhcyUQ==",
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-2.1.2.tgz",
"integrity": "sha512-rs9OggEUF0V4jUSecXazOYsLfu7OGK2qIn3c7IPBiffz32XniEp/TX9Xmc9LQfK2nQ2QKHvZ2oygKUGU0lG4jQ==",
"dev": true
},
"slash": {
......
This diff is collapsed.
<template>
<div id="Scenarios"></div>
<div id="Scenarios">
<div class="container">
<div class="row">
<div class="col-md-6">
<ul>
<li v-for="filter in filterList" :key="filter.id">
<a href="#" :class="{selected: filters[filter].selected}" :title="filter" @click="selectToggle(filters[filter])">
{{ filter }}
</a>
</li>
</ul>
<div v-if="nbSelected">
<ul>
<li v-for="scenario in activeScenario" :key="scenario.id">
<h4>
{{ scenario.name }}
<a :href="'https://framagit.org/ybon/trefle/tree/master/'+scenario.filename+'#L'+scenario.line" target=_blank>
<i class=icon>edit</i>
</a>
</h4>
</li>
</ul>
</div>
</div>
<div class="col-md-6">
<div v-if="!nbSelected">
<p>Sélectionner au moins une catégorie dans le menu.</p>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'Scenarios'
name: 'Scenarios',
data: function () {
return {
scenarios: {},
active: [],
selected_filters: [],
filters: [],
toggled: "",
}
},
methods: {
load: function () {
this.$http.get('/explore/scenarios').then(response => {
this.scenarios = response.body
this.selected_filters = decodeURIComponent(this.$route.params.filters).split(',')
if(this.filters) {
this.active = []
}
for (var i = 0, scenario; i < this.scenarios.length; i++) {
scenario = this.scenarios[i]
if (scenario.tags.length>0) {
for (var k = 0; k < scenario.tags.length; k++) {
if (this.filters.indexOf(scenario.tags[k]) === -1)
{
var isSelected=(this.selected_filters.indexOf(scenario.tags[k]) > -1)
this.filters.push({tag:scenario.tags[k], selected:isSelected})
}
}
}
this.active.push(scenario)
}
this.filters.sort((a, b) => a.tag.localeCompare(b.tag))
this.filters = this.filters.reduce(function(filters, item){ filters[item.tag]=item; return filters }, {})
}).created;
},
selectToggle: function(item){
item.selected = !item.selected
this.$router.append('test')
}
},
created: function () {
this.load();
},
computed: {
activeScenario: function(){
var activeScenario = []
var scenarios = this.scenarios
this.filterList.forEach(function(tag){
scenarios.forEach(function(scenario){
var idx = scenario.tags.indexOf(tag)
if(idx > -1 && !(idx in activeScenario)){
activeScenario[idx]=scenario
}
})
})
return activeScenario
},
filterList: function(){
var filterList = []
var scenarios = this.scenarios
Object.values(this.filters).forEach(function(filter){
if(filter.selected){
scenarios.forEach(function(scenario){
if(scenario.tags.indexOf(filter.tag) > -1){
scenario.tags.forEach(function(tag){
if(filterList.indexOf(tag) === -1){
filterList.push(tag)
}
})
}
})
}
});
if(filterList.length === 0) filterList = Object.keys(this.filters)
filterList.sort((a, b) => a.localeCompare(b))
return filterList
},
selectedItem: function(){
var itemList = Object.values(this.filters).reduce(function(selected, item){ if(item.selected && selected.indexOf(item.tag) === -1) selected.push(item); return selected }, []);
if(itemList.length === 0)
itemList = this.filters
return itemList;
},
nbSelected: function