sync
This commit is contained in:
parent
08e07f5963
commit
3402d6f33c
6 changed files with 68 additions and 46 deletions
19
src/App.vue
19
src/App.vue
|
@ -1,6 +1,7 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import MainMenu from '@/components/MainMenu.vue'
|
import MainMenu from '@/components/MainMenu.vue'
|
||||||
import SearchBar from '@/components/SearchBar.vue'
|
import SearchBar from '@/components/SearchBar.vue'
|
||||||
|
import FilterView from './components/papers/FilterView.vue'
|
||||||
import FooterMenu from '@/components/FooterMenu.vue'
|
import FooterMenu from '@/components/FooterMenu.vue'
|
||||||
|
|
||||||
export type Papers = {
|
export type Papers = {
|
||||||
|
@ -19,6 +20,7 @@ export default {
|
||||||
components: {
|
components: {
|
||||||
MainMenu,
|
MainMenu,
|
||||||
SearchBar,
|
SearchBar,
|
||||||
|
FilterView,
|
||||||
FooterMenu,
|
FooterMenu,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
@ -29,12 +31,15 @@ export default {
|
||||||
value: '',
|
value: '',
|
||||||
type: '',
|
type: '',
|
||||||
},
|
},
|
||||||
apiUri: 'https://raw.githubusercontent.com/CodeforLeipzig/stadtratmonitor/master/input.json',
|
filter: {
|
||||||
papers: [] as Papers[],
|
type: {
|
||||||
paperFilter: {
|
key: '',
|
||||||
type: '',
|
value: '',
|
||||||
|
},
|
||||||
originator: '',
|
originator: '',
|
||||||
},
|
},
|
||||||
|
apiUri: 'https://raw.githubusercontent.com/CodeforLeipzig/stadtratmonitor/master/input.json',
|
||||||
|
papers: [] as Papers[],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -64,7 +69,11 @@ export default {
|
||||||
<main class="flex flex-row max-w-5xl m-auto">
|
<main class="flex flex-row max-w-5xl m-auto">
|
||||||
|
|
||||||
</main>
|
</main>
|
||||||
<RouterView :papers="papers"></RouterView>
|
<RouterView
|
||||||
|
:papers="papers"
|
||||||
|
:search="search"
|
||||||
|
:filter="filter"
|
||||||
|
></RouterView>
|
||||||
<footer>
|
<footer>
|
||||||
<!-- <FooterMenu /> -->
|
<!-- <FooterMenu /> -->
|
||||||
</footer>
|
</footer>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export default {
|
export default {
|
||||||
updated() {
|
updated() {
|
||||||
this.$emit('paperFilter', this.paperFilter)
|
this.$emit('filter', this.filter)
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -51,7 +51,7 @@ export default {
|
||||||
key: 'WA',
|
key: 'WA',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
paperFilter: {
|
filter: {
|
||||||
type: {
|
type: {
|
||||||
key: '',
|
key: '',
|
||||||
value: '',
|
value: '',
|
||||||
|
@ -83,7 +83,7 @@ export default {
|
||||||
<legend>Kategorie</legend>
|
<legend>Kategorie</legend>
|
||||||
<select
|
<select
|
||||||
class="w-40 p-2 bg-background-100 dark:bg-background-900 rounded-lg"
|
class="w-40 p-2 bg-background-100 dark:bg-background-900 rounded-lg"
|
||||||
v-model="paperFilter.type">
|
v-model="filter.type">
|
||||||
<option
|
<option
|
||||||
v-for="(type, i) of paperTypes"
|
v-for="(type, i) of paperTypes"
|
||||||
:key="i"
|
:key="i"
|
||||||
|
@ -93,7 +93,7 @@ export default {
|
||||||
</select>
|
</select>
|
||||||
<button
|
<button
|
||||||
class="pl-2"
|
class="pl-2"
|
||||||
@click.prevent="paperFilter.type = { key: '', value: ''}"
|
@click.prevent="filter.type = { key: '', value: ''}"
|
||||||
title="zurücksetzen"
|
title="zurücksetzen"
|
||||||
>✖
|
>✖
|
||||||
</button>
|
</button>
|
||||||
|
@ -102,12 +102,12 @@ export default {
|
||||||
<legend>Einreicher</legend>
|
<legend>Einreicher</legend>
|
||||||
<select
|
<select
|
||||||
class="w-40 p-2 bg-background-100 dark:bg-background-900 rounded-lg"
|
class="w-40 p-2 bg-background-100 dark:bg-background-900 rounded-lg"
|
||||||
v-model="paperFilter.originator">
|
v-model="filter.originator">
|
||||||
<option v-for="(originator, i) of paperOriginators" :key="i">{{ originator }}</option>
|
<option v-for="(originator, i) of paperOriginators" :key="i">{{ originator }}</option>
|
||||||
</select>
|
</select>
|
||||||
<button
|
<button
|
||||||
class="pl-2"
|
class="pl-2"
|
||||||
@click.prevent="paperFilter.originator = ''"
|
@click.prevent="filter.originator = ''"
|
||||||
title="zurücksetzen"
|
title="zurücksetzen"
|
||||||
>✖
|
>✖
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -3,30 +3,30 @@ import { type Papers } from '@/App.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
papers: Array<any>,
|
search: Object,
|
||||||
paperQuery: Object,
|
filter: Object,
|
||||||
paperFilter: Object,
|
topics: Object,
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
filteredData() {
|
filteredData() {
|
||||||
const paperQuery: String = this.paperQuery?.value
|
const paperQuery: String = this.search?.value
|
||||||
let filteredPapers: Papers[] = this.papers
|
let filteredTopics: any = this.topics?.paper
|
||||||
if (paperQuery !== '') {
|
if (paperQuery !== '') {
|
||||||
filteredPapers = this.papers.filter((paper) => {
|
filteredTopics = this.topics?.paper.filter((paper: any) => {
|
||||||
return paper.name.toLowerCase().includes(paperQuery.toLowerCase()) || paper.content.toLowerCase().includes(paperQuery.toLowerCase()) || paper.reference.toLowerCase().includes(paperQuery.toLowerCase())
|
return paper.name.toLowerCase().includes(paperQuery.toLowerCase()) || paper.content.toLowerCase().includes(paperQuery.toLowerCase()) || paper.reference.toLowerCase().includes(paperQuery.toLowerCase())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (this.paperFilter?.type !== '') {
|
if (this.filter?.type !== '') {
|
||||||
filteredPapers = filteredPapers.filter((paper) => {
|
filteredTopics = filteredTopics.filter((topic: any) => {
|
||||||
return paper.reference.includes(this.paperFilter?.type.key) && paper.paper_type.includes(this.paperFilter?.type.value)
|
return topic.reference.includes(this.filter?.type.key) && topic.paper_type.includes(this.filter?.type.value)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (this.paperFilter?.originator !== '') {
|
if (this.filter?.originator !== '') {
|
||||||
filteredPapers = filteredPapers.filter((paper) => {
|
filteredTopics = filteredTopics.filter((topic: any) => {
|
||||||
return paper.originator.includes(this.paperFilter?.originator)
|
return topic.originator.includes(this.filter?.originator)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return filteredPapers
|
return filteredTopics
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -43,7 +43,7 @@ export default {
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<ul
|
<ul
|
||||||
v-if="filteredData.length"
|
v-if="filteredData"
|
||||||
class="w-full grid grid-flow-row gap-2 my-2"
|
class="w-full grid grid-flow-row gap-2 my-2"
|
||||||
>
|
>
|
||||||
<p>Wir konnten {{ filteredData.length }} Einträge finden</p>
|
<p>Wir konnten {{ filteredData.length }} Einträge finden</p>
|
||||||
|
@ -60,11 +60,11 @@ export default {
|
||||||
</article>
|
</article>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p
|
<!-- <p
|
||||||
class="flex place-content-center my-60 text-lg"
|
class="flex place-content-center my-60 text-lg"
|
||||||
v-else-if="papers.length"
|
v-else-if="topics?.length"
|
||||||
>Für dieses Anfrage liegen uns keine Ergebnisse vor.
|
>Für dieses Anfrage liegen uns keine Ergebnisse vor.
|
||||||
</p>
|
</p> -->
|
||||||
<p
|
<p
|
||||||
class="flex place-content-center my-60 text-lg"
|
class="flex place-content-center my-60 text-lg"
|
||||||
v-else
|
v-else
|
|
@ -3,7 +3,11 @@ import Landing from '@/views/TheLanding.vue'
|
||||||
|
|
||||||
const routes: Array<any> = [
|
const routes: Array<any> = [
|
||||||
{ path: '/', name: 'landing', component: Landing },
|
{ path: '/', name: 'landing', component: Landing },
|
||||||
{ path: '/themen/', name: 'topics', component: ()=>import("@/views/TheTopics.vue") },
|
{
|
||||||
|
path: '/themen/',
|
||||||
|
name: 'topics',
|
||||||
|
component: ()=>import("@/views/TheTopics.vue"),
|
||||||
|
},
|
||||||
{ path: '/themen/:reference', name: 'topics.show', component: ()=>import("@/views/TopicsShow.vue") },
|
{ path: '/themen/:reference', name: 'topics.show', component: ()=>import("@/views/TopicsShow.vue") },
|
||||||
{ path: '/karte', name: 'map', component: ()=>import("@/views/TheMap.vue") },
|
{ path: '/karte', name: 'map', component: ()=>import("@/views/TheMap.vue") },
|
||||||
{ path: '/doku', name: 'documentation', component: ()=>import("@/views/TheDocumentation.vue") },
|
{ path: '/doku', name: 'documentation', component: ()=>import("@/views/TheDocumentation.vue") },
|
||||||
|
|
|
@ -1,33 +1,39 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import FilterView from '@/components/papers/FilterView.vue'
|
import FilterView from '@/components/papers/FilterView.vue'
|
||||||
import PaperList from '@/components/papers/PaperList.vue'
|
import TopicList from '@/components/papers/TopicList.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
FilterView,
|
FilterView,
|
||||||
PaperList,
|
TopicList,
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
papers: this.papers,
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
topics() {
|
topics() {
|
||||||
return [...new Set(this.papers?.map((paper: any) => paper.reference))]
|
const topicReferences = [...new Set(this.papers?.map((paper: any) => paper.reference))]
|
||||||
|
return topicReferences.map( (entry: any) => {
|
||||||
|
return {
|
||||||
|
'ref': entry,
|
||||||
|
'paper': this.papers?.find( (paper: any) => paper.reference == entry)
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
papers: Array,
|
||||||
|
search: Object,
|
||||||
|
filter: Object,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FilterView
|
<FilterView
|
||||||
@paperFilter="(filter) => paperFilter = filter"
|
@filter="(filter: any) => filter = filter"
|
||||||
:papers="papers"
|
:papers="papers"
|
||||||
/>
|
/>
|
||||||
<PaperList
|
<TopicList
|
||||||
:paperQuery="search"
|
:topics="topics"
|
||||||
:paperFilter="paperFilter"
|
:search="search"
|
||||||
/>
|
:filter="filter"
|
||||||
{{ topics }}
|
></TopicList>
|
||||||
</template>
|
</template>
|
|
@ -8,6 +8,9 @@ export default {
|
||||||
this.papers?.find( (paper: any) => paper.reference == this.topicId )
|
this.papers?.find( (paper: any) => paper.reference == this.topicId )
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
props: {
|
||||||
|
papers: Array,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue