Refactored FilterBar to only show school-classes of logged in user
This commit is contained in:
parent
d273d711c1
commit
41d6e87f81
|
|
@ -3,20 +3,20 @@
|
||||||
|
|
||||||
<radiobutton label="Alles" :checked="!currentFilter" v-on:input="updateFilter(false)"></radiobutton>
|
<radiobutton label="Alles" :checked="!currentFilter" v-on:input="updateFilter(false)"></radiobutton>
|
||||||
<radiobutton
|
<radiobutton
|
||||||
v-for="group in userGroups"
|
v-for="schoolClass in schoolClasses"
|
||||||
:key="group.id"
|
:key="schoolClass.id"
|
||||||
:label="group.name"
|
:label="schoolClass.name"
|
||||||
:item="group"
|
:item="schoolClass"
|
||||||
:checked="group.id === currentFilter"
|
:checked="schoolClass.id === currentFilter"
|
||||||
v-on:input="updateFilter(group.id)"
|
v-on:input="updateFilter(schoolClass.id)"
|
||||||
></radiobutton>
|
></radiobutton>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {userGroupsQuery} from '@/helpers/user-groups'
|
|
||||||
import {mapActions} from 'vuex';
|
import {mapActions} from 'vuex';
|
||||||
import Radiobutton from '@/components/Radiobutton';
|
import Radiobutton from '@/components/Radiobutton';
|
||||||
|
import ME_QUERY from '@/graphql/gql/meQuery.gql';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
|
@ -24,18 +24,23 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
apollo: {
|
apollo: {
|
||||||
userGroupsQuery: userGroupsQuery
|
me: {
|
||||||
|
query: ME_QUERY
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
userGroups: []
|
me: {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
currentFilter() {
|
currentFilter() {
|
||||||
return this.$store.state.filterForGroup;
|
return this.$store.state.filterForGroup;
|
||||||
|
},
|
||||||
|
schoolClasses() {
|
||||||
|
return this.$getRidOfEdges(this.me.schoolclassSet);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,9 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import CHANGE_CONTENT_BLOCK_MUTATION from '@/graphql/gql/mutations/mutateContentBlock.gql';
|
import CHANGE_CONTENT_BLOCK_MUTATION from '@/graphql/gql/mutations/mutateContentBlock.gql';
|
||||||
// import MODULE_DETAILS_QUERY from '@/graphql/gql/moduleDetailsQuery.gql';
|
|
||||||
|
|
||||||
import Checkbox from '@/components/Checkbox';
|
import Checkbox from '@/components/Checkbox';
|
||||||
import {userGroupsQuery} from '@/helpers/user-groups'
|
import ME_QUERY from '@/graphql/gql/meQuery.gql'
|
||||||
|
// import MODULE_DETAILS_QUERY from '@/graphql/gql/moduleDetailsQuery.gql';
|
||||||
|
|
||||||
// import store from '@/store/index';
|
// import store from '@/store/index';
|
||||||
|
|
||||||
|
|
@ -28,12 +27,14 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
apollo: {
|
apollo: {
|
||||||
userGroupsQuery: userGroupsQuery
|
me: {
|
||||||
|
query: ME_QUERY,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
userGroups: []
|
me: {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -56,15 +57,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// refetchQueries: [{
|
|
||||||
// query: MODULE_DETAILS_QUERY,
|
|
||||||
// variables: {
|
|
||||||
// slug: store.state.moduleSlug
|
|
||||||
// }
|
|
||||||
// }]
|
|
||||||
// update: (store, {data: {mutateContentBlock: {contentBlock}}}) => {
|
|
||||||
// this.$store.dispatch('updateContentBlocks');
|
|
||||||
// }
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@
|
||||||
<script>
|
<script>
|
||||||
import RoomColors from '@/components/rooms/RoomColors';
|
import RoomColors from '@/components/rooms/RoomColors';
|
||||||
|
|
||||||
import {userGroupsQuery} from '@/helpers/user-groups'
|
// import {userGroupsQuery} from '@/helpers/user-groups'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ['room'],
|
props: ['room'],
|
||||||
|
|
@ -66,7 +66,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
apollo: {
|
apollo: {
|
||||||
userGroupsQuery: userGroupsQuery
|
// userGroupsQuery: userGroupsQuery
|
||||||
},
|
},
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
|
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
import USER_GROUPS_QUERY from '@/graphql/gql/userGroupsQuery.gql';
|
|
||||||
|
|
||||||
export const userGroupsQuery = {
|
|
||||||
query: USER_GROUPS_QUERY,
|
|
||||||
manual: true,
|
|
||||||
result({data, loading, networkStatus}) {
|
|
||||||
if (!loading) {
|
|
||||||
const cleanedData = this.$getRidOfEdges(data)
|
|
||||||
this.userGroups = cleanedData.userGroups || {};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Loading…
Reference in New Issue