Add visibility widget for room
This commit is contained in:
parent
20aceaf162
commit
9c7252ee47
|
|
@ -6,13 +6,13 @@ describe('The Room Page', () => {
|
||||||
const slug = 'ein-historisches-festival';
|
const slug = 'ein-historisches-festival';
|
||||||
|
|
||||||
const RoomEntriesQuery = {
|
const RoomEntriesQuery = {
|
||||||
room: {
|
room: {
|
||||||
slug,
|
slug,
|
||||||
roomEntries: {
|
roomEntries: {
|
||||||
edges: [],
|
edges: [],
|
||||||
},
|
|
||||||
},
|
},
|
||||||
};
|
},
|
||||||
|
};
|
||||||
|
|
||||||
const operations = {
|
const operations = {
|
||||||
MeQuery: getMinimalMe({}),
|
MeQuery: getMinimalMe({}),
|
||||||
|
|
@ -61,7 +61,7 @@ describe('The Room Page', () => {
|
||||||
cy.get('.room-entry__content:first').should('contain', entryText).should('contain', 'Rachel Green');
|
cy.get('.room-entry__content:first').should('contain', entryText).should('contain', 'Rachel Green');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('changes visibility of a room', () => {
|
it.only('changes visibility of a room', () => {
|
||||||
const MeQuery = getMinimalMe({
|
const MeQuery = getMinimalMe({
|
||||||
isTeacher: true
|
isTeacher: true
|
||||||
});
|
});
|
||||||
|
|
@ -75,10 +75,12 @@ describe('The Room Page', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
cy.visit(`/room/${slug}`);
|
cy.visit(`/room/${slug}`);
|
||||||
|
cy.getByDataCy('room-visibility-status').should('contain', 'alle Beiträge');
|
||||||
cy.getByDataCy('toggle-room-actions-menu').click();
|
cy.getByDataCy('toggle-room-actions-menu').click();
|
||||||
cy.getByDataCy('change-visibility').click();
|
cy.getByDataCy('change-visibility').click();
|
||||||
cy.getByDataCy('modal-title').should('contain', 'Sichtbarkeit anpassen');
|
cy.getByDataCy('modal-title').should('contain', 'Sichtbarkeit anpassen');
|
||||||
cy.getByDataCy('select-option').eq(1).click();
|
cy.getByDataCy('select-option').eq(1).click();
|
||||||
cy.getByDataCy('modal-save-button').click();
|
cy.getByDataCy('modal-save-button').click();
|
||||||
|
cy.getByDataCy('room-visibility-status').should('contain', 'eigenen Beiträge');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -18,12 +18,13 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@import "@/styles/_mixins.scss";
|
@import "~styles/helpers";
|
||||||
|
|
||||||
.entry-count-widget {
|
.entry-count-widget {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
opacity: 0.6;
|
opacity: 0.6;
|
||||||
|
margin-right: $medium-spacing;
|
||||||
|
|
||||||
svg {
|
svg {
|
||||||
width: 30px;
|
width: 30px;
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@import "@/styles/_mixins.scss";
|
@import "~styles/helpers";
|
||||||
|
|
||||||
.room-group-widget {
|
.room-group-widget {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
<template>
|
||||||
|
<div class="room-visibility-widget">
|
||||||
|
<template v-if="restricted">
|
||||||
|
<eye-icon class="room-visibility-widget__icon"/>
|
||||||
|
<span class="room-visibility-widget__text">Raumeinträge sind für alle Lernenden sichtbar</span>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<closed-eye-icon class="room-visibility-widget__icon"/>
|
||||||
|
<span class="room-visibility-widget__text">Lernende sehen nur die eigenen Beiträge</span>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
import EyeIcon from '@/components/icons/EyeIcon';
|
||||||
|
import ClosedEyeIcon from '@/components/icons/ClosedEyeIcon';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
visibility: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
components: {
|
||||||
|
ClosedEyeIcon,
|
||||||
|
EyeIcon
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
@import "~styles/helpers";
|
||||||
|
|
||||||
|
.room-visibility-widget {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
opacity: 0.6;
|
||||||
|
|
||||||
|
&__icon {
|
||||||
|
width: 30px;
|
||||||
|
fill: $color-charcoal-dark;
|
||||||
|
margin-right: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
& > span {
|
||||||
|
@include room-widget-text-style;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
@ -18,6 +18,7 @@
|
||||||
{{ room.description }}
|
{{ room.description }}
|
||||||
</p>
|
</p>
|
||||||
<div class="room__meta">
|
<div class="room__meta">
|
||||||
|
<room-visibility-widget />
|
||||||
<room-group-widget v-bind="room.schoolClass"/>
|
<room-group-widget v-bind="room.schoolClass"/>
|
||||||
<entry-count-widget :entry-count="roomEntryCount"/>
|
<entry-count-widget :entry-count="roomEntryCount"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -44,11 +45,12 @@
|
||||||
import room from '@/mixins/room';
|
import room from '@/mixins/room';
|
||||||
import me from '@/mixins/me';
|
import me from '@/mixins/me';
|
||||||
import BackLink from '@/components/BackLink';
|
import BackLink from '@/components/BackLink';
|
||||||
|
import RoomVisibilityWidget from '@/components/rooms/RoomVisibilityWidget';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ['slug'],
|
props: ['slug'],
|
||||||
mixins: [room, me],
|
mixins: [room, me],
|
||||||
components: {BackLink},
|
components: {RoomVisibilityWidget, BackLink},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
canEdit() {
|
canEdit() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue