Refactored from method to computed
This commit is contained in:
parent
1d29cc51ec
commit
9efd000aa1
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<div class="content-block__container">
|
||||
<div class="content-block" :class="specialClass">
|
||||
<div v-if="canChangeContentBlock()" class="content-block__actions">
|
||||
<div v-if="canChangeContentBlock" class="content-block__actions">
|
||||
<a @click="toggleVisibility()" class="content-block__visibility-button">
|
||||
<eye-icon class="content-block__action-icon"></eye-icon>
|
||||
</a>
|
||||
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
</div>
|
||||
|
||||
<add-content-block-button v-if="canChangeContentBlock()" :after="contentBlock.id"></add-content-block-button>
|
||||
<add-content-block-button v-if="canChangeContentBlock" :after="contentBlock.id"></add-content-block-button>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
@ -69,6 +69,9 @@
|
|||
computed: {
|
||||
specialClass() {
|
||||
return `content-block--${this.contentBlock.type.toLowerCase()}`
|
||||
},
|
||||
canChangeContentBlock() {
|
||||
return this.me.permissions.includes('user.can_edit_modules');
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -79,9 +82,6 @@
|
|||
editContentBlock() {
|
||||
this.$store.dispatch('editContentBlock', this.contentBlock.id);
|
||||
},
|
||||
canChangeContentBlock() {
|
||||
return this.me.permissions.includes('user.can_edit_modules');
|
||||
}
|
||||
},
|
||||
|
||||
apollo: {
|
||||
|
|
|
|||
|
|
@ -15,10 +15,9 @@ class MutateRoom(relay.ClientIDMutation):
|
|||
|
||||
@classmethod
|
||||
def mutate_and_get_payload(cls, *args, **kwargs):
|
||||
# FIXME
|
||||
room_data = kwargs.get('room')
|
||||
user_group = get_object(SchoolClass, room_data.get('user_group').get('id'))
|
||||
room_data['user_group'] = user_group.id
|
||||
school_class = get_object(SchoolClass, room_data.get('school_class').get('id'))
|
||||
room_data['school_class'] = school_class.id
|
||||
if room_data.get('id') is not None:
|
||||
room = get_object(Room, room_data['id'])
|
||||
serializer = RoomSerializer(room, data=room_data)
|
||||
|
|
|
|||
Loading…
Reference in New Issue