Update change visibility modal
This commit is contained in:
parent
94bd5757e5
commit
d509b24666
|
|
@ -44,6 +44,10 @@ describe('The Room Page', () => {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const checkRadioButton = () => {
|
||||||
|
cy.get('.base-input-container__input:checked + .base-input-container__radiobutton svg').should('have.length', 1);
|
||||||
|
};
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.setup();
|
cy.setup();
|
||||||
});
|
});
|
||||||
|
|
@ -107,8 +111,24 @@ describe('The Room Page', () => {
|
||||||
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.get('.change-visibility__radio').should('have.length', 2);
|
||||||
|
cy.get('.change-visibility__radio--selected').should('have.length', 1);
|
||||||
|
checkRadioButton();
|
||||||
|
cy.get('.change-visibility__radio--selected').should('have.length', 1).should('contain', 'alle Lernenden');
|
||||||
|
checkRadioButton();
|
||||||
|
cy.getByDataCy('select-option').eq(0).click();
|
||||||
|
cy.get('.change-visibility__radio--selected').should('have.length', 1);
|
||||||
|
checkRadioButton();
|
||||||
cy.getByDataCy('select-option').eq(1).click();
|
cy.getByDataCy('select-option').eq(1).click();
|
||||||
|
cy.getByDataCy('select-option').eq(1).click();
|
||||||
|
cy.get('.change-visibility__radio--selected').should('have.length', 1).should('contain', 'eigenen Beiträge');
|
||||||
|
checkRadioButton();
|
||||||
cy.getByDataCy('modal-save-button').click();
|
cy.getByDataCy('modal-save-button').click();
|
||||||
cy.getByDataCy('room-visibility-status').should('contain', 'eigenen Beiträge');
|
cy.getByDataCy('room-visibility-status').should('contain', 'eigenen Beiträge');
|
||||||
|
cy.getByDataCy('toggle-room-actions-menu').click();
|
||||||
|
cy.getByDataCy('change-visibility').click();
|
||||||
|
cy.getByDataCy('modal-title').should('contain', 'Sichtbarkeit anpassen');
|
||||||
|
cy.get('.change-visibility__radio--selected').should('have.length', 1).should('contain', 'eigenen Beiträge');
|
||||||
|
checkRadioButton();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,16 @@
|
||||||
<div class="change-visibility__content">
|
<div class="change-visibility__content">
|
||||||
<radiobutton
|
<radiobutton
|
||||||
:checked="!restricted"
|
:checked="!restricted"
|
||||||
|
:class="{'change-visibility__radio--selected': !restricted}"
|
||||||
data-cy="select-option"
|
data-cy="select-option"
|
||||||
|
class="change-visibility__radio"
|
||||||
label="Raumeinträge sind für alle Lernenden sichtbar"
|
label="Raumeinträge sind für alle Lernenden sichtbar"
|
||||||
@input="restrict(false)"/>
|
@input="restrict(false)"/>
|
||||||
<radiobutton
|
<radiobutton
|
||||||
:checked="restricted"
|
:checked="restricted"
|
||||||
|
:class="{'change-visibility__radio--selected': restricted}"
|
||||||
data-cy="select-option"
|
data-cy="select-option"
|
||||||
|
class="change-visibility__radio"
|
||||||
label="Lernende sehen nur die eigenen Beiträge"
|
label="Lernende sehen nur die eigenen Beiträge"
|
||||||
@input="restrict(true)"/>
|
@input="restrict(true)"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -44,7 +48,7 @@
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
restricted: undefined
|
restricted: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -77,6 +81,11 @@
|
||||||
&__content {
|
&__content {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
padding: $medium-spacing 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__radio:first-of-type {
|
||||||
|
margin-bottom: $medium-spacing;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,16 @@
|
||||||
import PopoverLink from '@/components/ui/PopoverLink';
|
import PopoverLink from '@/components/ui/PopoverLink';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ['id'],
|
props: {
|
||||||
|
id: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
restricted: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
PopoverLink,
|
PopoverLink,
|
||||||
|
|
@ -94,7 +103,8 @@
|
||||||
this.$router.push({name: 'edit-room', params: {id: this.id}});
|
this.$router.push({name: 'edit-room', params: {id: this.id}});
|
||||||
},
|
},
|
||||||
changeVisibility() {
|
changeVisibility() {
|
||||||
this.$modal.open('change-visibility', {restricted: false})
|
this.showMenu = false;
|
||||||
|
this.$modal.open('change-visibility', {restricted: this.restricted})
|
||||||
.then((restricted) => {
|
.then((restricted) => {
|
||||||
this.$apollo.mutate({
|
this.$apollo.mutate({
|
||||||
mutation: UPDATE_ROOM_VISIBILITY_MUTATION,
|
mutation: UPDATE_ROOM_VISIBILITY_MUTATION,
|
||||||
|
|
@ -107,7 +117,7 @@
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
console.log('nay');
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,9 @@
|
||||||
<widget-footer
|
<widget-footer
|
||||||
data-cy="widget-footer"
|
data-cy="widget-footer"
|
||||||
v-if="canEditRoom">
|
v-if="canEditRoom">
|
||||||
<room-actions :id="id"/>
|
<room-actions
|
||||||
|
:restricted="restricted"
|
||||||
|
:id="id"/>
|
||||||
</widget-footer>
|
</widget-footer>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -28,7 +30,7 @@
|
||||||
import {meQuery} from '@/graphql/queries';
|
import {meQuery} from '@/graphql/queries';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ['slug', 'title', 'entryCount', 'appearance', 'schoolClass', 'id'],
|
props: ['slug', 'title', 'entryCount', 'appearance', 'schoolClass', 'id', 'restricted'],
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
EntryCountWidget,
|
EntryCountWidget,
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,15 @@
|
||||||
:checked="checked"
|
:checked="checked"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
class="base-input-container__input"
|
class="base-input-container__input"
|
||||||
@change.prevent="$emit('input', $event.target.checked, item)"
|
@click.prevent="$emit('input', $event.target.checked, item)"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
:class="{'base-input-container__checkbox': type==='checkbox', 'base-input-container__radiobutton': type === 'radiobutton'}"
|
:class="{'base-input-container__checkbox': type==='checkbox', 'base-input-container__radiobutton': type === 'radiobutton'}"
|
||||||
class="base-input-container__icon checkbox">
|
class="base-input-container__icon checkbox">
|
||||||
<tick v-if="type === 'checkbox'"/>
|
<tick v-if="type === 'checkbox'"/>
|
||||||
<circle-icon v-if="type === 'radiobutton'"/>
|
<circle-icon
|
||||||
|
data-cy="circle-icon"
|
||||||
|
v-if="type === 'radiobutton'"/>
|
||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
class="base-input-container__label"
|
class="base-input-container__label"
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
<div class="room__context-menu">
|
<div class="room__context-menu">
|
||||||
<room-actions
|
<room-actions
|
||||||
:id="room.id"
|
:id="room.id"
|
||||||
|
:restricted="room.restricted"
|
||||||
class="room__actions"
|
class="room__actions"
|
||||||
v-if="canEdit"/>
|
v-if="canEdit"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue