Add modal for adding notes
This commit is contained in:
parent
a8a6abb2d8
commit
67cfc4b572
|
|
@ -22,6 +22,7 @@
|
||||||
import NewProjectEntryWizard from '@/components/portfolio/NewProjectEntryWizard';
|
import NewProjectEntryWizard from '@/components/portfolio/NewProjectEntryWizard';
|
||||||
import EditProjectEntryWizard from '@/components/portfolio/EditProjectEntryWizard';
|
import EditProjectEntryWizard from '@/components/portfolio/EditProjectEntryWizard';
|
||||||
import NewObjectiveWizard from '@/components/objective-groups/NewObjectiveWizard';
|
import NewObjectiveWizard from '@/components/objective-groups/NewObjectiveWizard';
|
||||||
|
import NewNoteWizard from '@/components/notes/NewNoteWizard';
|
||||||
import FullscreenImage from '@/components/FullscreenImage';
|
import FullscreenImage from '@/components/FullscreenImage';
|
||||||
import FullscreenInfographic from '@/components/FullscreenInfographic';
|
import FullscreenInfographic from '@/components/FullscreenInfographic';
|
||||||
import FullscreenVideo from '@/components/FullscreenVideo';
|
import FullscreenVideo from '@/components/FullscreenVideo';
|
||||||
|
|
@ -48,6 +49,7 @@
|
||||||
NewProjectEntryWizard,
|
NewProjectEntryWizard,
|
||||||
EditProjectEntryWizard,
|
EditProjectEntryWizard,
|
||||||
NewObjectiveWizard,
|
NewObjectiveWizard,
|
||||||
|
NewNoteWizard,
|
||||||
FullscreenImage,
|
FullscreenImage,
|
||||||
FullscreenInfographic,
|
FullscreenInfographic,
|
||||||
FullscreenVideo
|
FullscreenVideo
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="modal__backdrop">
|
<div class="modal__backdrop">
|
||||||
<div class="modal" :class="{'modal--hide-header': hideHeader || fullscreen, 'modal--fullscreen': fullscreen}">
|
<div class="modal"
|
||||||
|
:class="{'modal--hide-header': hideHeader || fullscreen, 'modal--fullscreen': fullscreen, 'modal--small': small}">
|
||||||
<div class="modal__header">
|
<div class="modal__header">
|
||||||
<slot name="header"></slot>
|
<slot name="header"></slot>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -32,6 +33,10 @@
|
||||||
fullscreen: {
|
fullscreen: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
|
},
|
||||||
|
small: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -68,49 +73,6 @@
|
||||||
-ms-grid-rows: auto 1fr 65px;
|
-ms-grid-rows: auto 1fr 65px;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
&--hide-header {
|
|
||||||
grid-template-rows: 1fr 65px;
|
|
||||||
grid-template-areas: "body" "footer";
|
|
||||||
}
|
|
||||||
|
|
||||||
&--hide-header &__header {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
&--hide-header &__body {
|
|
||||||
padding: $default-padding;
|
|
||||||
}
|
|
||||||
|
|
||||||
&--fullscreen {
|
|
||||||
width: 95vw;
|
|
||||||
height: auto;
|
|
||||||
grid-template-rows: 1fr;
|
|
||||||
-ms-grid-rows: 1fr;
|
|
||||||
grid-template-areas: "body";
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
&--fullscreen &__footer {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
&--fullscreen &__body {
|
|
||||||
padding: 0;
|
|
||||||
scrollbar-width: none;
|
|
||||||
margin-right: -5px;
|
|
||||||
|
|
||||||
height: auto;
|
|
||||||
max-height: 95vh;
|
|
||||||
|
|
||||||
&::-webkit-scrollbar {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&--fullscreen &__close-button {
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__backdrop {
|
&__backdrop {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
@ -165,5 +127,59 @@
|
||||||
border-top: 1px solid $color-silver-light;
|
border-top: 1px solid $color-silver-light;
|
||||||
padding: 16px $modal-lateral-padding;
|
padding: 16px $modal-lateral-padding;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$parent: &;
|
||||||
|
|
||||||
|
&--hide-header {
|
||||||
|
grid-template-rows: 1fr 65px;
|
||||||
|
grid-template-areas: "body" "footer";
|
||||||
|
|
||||||
|
#{$parent}__header {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#{$parent}__body {
|
||||||
|
padding: $default-padding;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
&--fullscreen {
|
||||||
|
width: 95vw;
|
||||||
|
height: auto;
|
||||||
|
grid-template-rows: 1fr;
|
||||||
|
-ms-grid-rows: 1fr;
|
||||||
|
grid-template-areas: "body";
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
#{$parent}__footer {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#{$parent}__body {
|
||||||
|
padding: 0;
|
||||||
|
scrollbar-width: none;
|
||||||
|
margin-right: -5px;
|
||||||
|
|
||||||
|
height: auto;
|
||||||
|
max-height: 95vh;
|
||||||
|
|
||||||
|
&::-webkit-scrollbar {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#{$parent}__close-button {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&--small {
|
||||||
|
height: auto;
|
||||||
|
|
||||||
|
#{$parent}__body {
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="content-component" :class="{'content-component--bookmarked': bookmarked}">
|
<div class="content-component" :class="{'content-component--bookmarked': bookmarked}">
|
||||||
<bookmark-actions @bookmark="bookmarkContent(component.id, !bookmarked)" :bookmarked="bookmarked"></bookmark-actions>
|
<bookmark-actions
|
||||||
|
@add-note="addNote(component.id)"
|
||||||
|
@bookmark="bookmarkContent(component.id, !bookmarked)"
|
||||||
|
:bookmarked="bookmarked"></bookmark-actions>
|
||||||
<component
|
<component
|
||||||
:is="component.type"
|
:is="component.type"
|
||||||
v-bind="component">
|
v-bind="component">
|
||||||
|
|
@ -59,6 +62,12 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
addNote(id) {
|
||||||
|
this.$store.dispatch('addNote', {
|
||||||
|
content: id,
|
||||||
|
contentBlock: this.parent
|
||||||
|
});
|
||||||
|
},
|
||||||
bookmarkContent(id, bookmarked) {
|
bookmarkContent(id, bookmarked) {
|
||||||
this.$apollo.mutate({
|
this.$apollo.mutate({
|
||||||
mutation: UPDATE_CONTENT_BOOKMARK,
|
mutation: UPDATE_CONTENT_BOOKMARK,
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
:class="{'bookmark-actions__action--bookmarked': bookmarked}">
|
:class="{'bookmark-actions__action--bookmarked': bookmarked}">
|
||||||
<bookmark-icon :bookmarked="bookmarked"></bookmark-icon>
|
<bookmark-icon :bookmarked="bookmarked"></bookmark-icon>
|
||||||
</a>
|
</a>
|
||||||
<a class="bookmark-actions__action">
|
<a class="bookmark-actions__action" v-if="bookmarked" @click="$emit('add-note')">
|
||||||
<add-note-icon></add-note-icon>
|
<add-note-icon></add-note-icon>
|
||||||
<note-icon v-if="false"></note-icon>
|
<note-icon v-if="false"></note-icon>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
<template>
|
||||||
|
<modal :hide-header="true" :small="true">
|
||||||
|
<modal-input v-on:input="note = $event"
|
||||||
|
placeholder="Notiz erfassen"
|
||||||
|
:value="note"
|
||||||
|
></modal-input>
|
||||||
|
<div slot="footer">
|
||||||
|
<a class="button button--primary" data-cy="modal-save-button"
|
||||||
|
@click="addNote(note)">Speichern</a>
|
||||||
|
<a class="button" @click="hide">Löschen</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import Modal from '@/components/Modal';
|
||||||
|
import ModalInput from '@/components/ModalInput';
|
||||||
|
|
||||||
|
import ADD_NOTE_MUTATION from '@/graphql/gql/mutations/addNote.gql';
|
||||||
|
|
||||||
|
import {mapGetters} from 'vuex';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
Modal,
|
||||||
|
ModalInput
|
||||||
|
},
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
note: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
...mapGetters(['currentContent', 'currentContentBlock'])
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
addNote(text) {
|
||||||
|
this.$apollo.mutate({
|
||||||
|
mutation: ADD_NOTE_MUTATION,
|
||||||
|
variables: {
|
||||||
|
input: {
|
||||||
|
note: {
|
||||||
|
content: this.currentContent,
|
||||||
|
contentBlock: this.currentContentBlock,
|
||||||
|
text
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
console.log(note);
|
||||||
|
},
|
||||||
|
hide() {
|
||||||
|
this.$store.dispatch('hideModal');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
mutation AddNote($input: AddNoteInput!) {
|
||||||
|
addNote(input: $input) {
|
||||||
|
note {
|
||||||
|
id
|
||||||
|
text
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -12,6 +12,7 @@ export default new Vuex.Store({
|
||||||
showMobileNavigation: false,
|
showMobileNavigation: false,
|
||||||
contentBlockPosition: {},
|
contentBlockPosition: {},
|
||||||
scrollPosition: 0,
|
scrollPosition: 0,
|
||||||
|
currentContent: '',
|
||||||
currentContentBlock: '',
|
currentContentBlock: '',
|
||||||
currentRoomEntry: '',
|
currentRoomEntry: '',
|
||||||
parentRoom: null,
|
parentRoom: null,
|
||||||
|
|
@ -33,18 +34,16 @@ export default new Vuex.Store({
|
||||||
},
|
},
|
||||||
|
|
||||||
getters: {
|
getters: {
|
||||||
showModal: state => {
|
showModal: state => state.showModal,
|
||||||
return state.showModal
|
showMobileNavigation: state => state.showMobileNavigation,
|
||||||
},
|
|
||||||
showMobileNavigation: state => {
|
|
||||||
return state.showMobileNavigation
|
|
||||||
},
|
|
||||||
scrollToAssignmentId: state => state.scrollToAssignmentId,
|
scrollToAssignmentId: state => state.scrollToAssignmentId,
|
||||||
scrollToAssignmentReady: state => state.scrollToAssignmentReady,
|
scrollToAssignmentReady: state => state.scrollToAssignmentReady,
|
||||||
scrollingToAssignment: state => state.scrollingToAssignment,
|
scrollingToAssignment: state => state.scrollingToAssignment,
|
||||||
currentProjectEntry: state => state.currentProjectEntry,
|
currentProjectEntry: state => state.currentProjectEntry,
|
||||||
editModule: state => state.editModule,
|
editModule: state => state.editModule,
|
||||||
currentObjectiveGroup: state => state.currentObjectiveGroup
|
currentObjectiveGroup: state => state.currentObjectiveGroup,
|
||||||
|
currentContent: state => state.currentContent,
|
||||||
|
currentContentBlock: state => state.currentContentBlock
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|
@ -58,6 +57,7 @@ export default new Vuex.Store({
|
||||||
},
|
},
|
||||||
resetModalState({commit}) {
|
resetModalState({commit}) {
|
||||||
commit('setCurrentRoomEntry', '');
|
commit('setCurrentRoomEntry', '');
|
||||||
|
commit('setCurrentContent', '');
|
||||||
commit('setCurrentContentBlock', '');
|
commit('setCurrentContentBlock', '');
|
||||||
commit('setContentBlockPosition', {});
|
commit('setContentBlockPosition', {});
|
||||||
commit('setParentRoom', null);
|
commit('setParentRoom', null);
|
||||||
|
|
@ -122,6 +122,11 @@ export default new Vuex.Store({
|
||||||
commit('setCurrentProjectEntry', payload);
|
commit('setCurrentProjectEntry', payload);
|
||||||
dispatch('showModal', 'edit-project-entry-wizard');
|
dispatch('showModal', 'edit-project-entry-wizard');
|
||||||
},
|
},
|
||||||
|
addNote({commit, dispatch}, payload) {
|
||||||
|
commit('setCurrentContentBlock', payload.contentBlock);
|
||||||
|
commit('setCurrentContent', payload.content);
|
||||||
|
dispatch('showModal', 'new-note-wizard');
|
||||||
|
},
|
||||||
showFullscreenImage({commit, dispatch}, payload) {
|
showFullscreenImage({commit, dispatch}, payload) {
|
||||||
commit('setImageUrl', payload);
|
commit('setImageUrl', payload);
|
||||||
dispatch('showModal', 'fullscreen-image');
|
dispatch('showModal', 'fullscreen-image');
|
||||||
|
|
@ -146,7 +151,8 @@ export default new Vuex.Store({
|
||||||
scrollingToAssignment({commit, state, dispatch}, payload) {
|
scrollingToAssignment({commit, state, dispatch}, payload) {
|
||||||
if (payload && !state.scrollingToAssignment) {
|
if (payload && !state.scrollingToAssignment) {
|
||||||
commit('setScrollingToAssignment', true);
|
commit('setScrollingToAssignment', true);
|
||||||
};
|
}
|
||||||
|
;
|
||||||
|
|
||||||
if (!payload && state.scrollingToAssignment) {
|
if (!payload && state.scrollingToAssignment) {
|
||||||
commit('setScrollingToAssignment', false);
|
commit('setScrollingToAssignment', false);
|
||||||
|
|
@ -174,6 +180,9 @@ export default new Vuex.Store({
|
||||||
setContentBlockPosition(state, payload) {
|
setContentBlockPosition(state, payload) {
|
||||||
state.contentBlockPosition = payload;
|
state.contentBlockPosition = payload;
|
||||||
},
|
},
|
||||||
|
setCurrentContent(state, payload) {
|
||||||
|
state.currentContent = payload;
|
||||||
|
},
|
||||||
setCurrentContentBlock(state, payload) {
|
setCurrentContentBlock(state, payload) {
|
||||||
state.currentContentBlock = payload;
|
state.currentContentBlock = payload;
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue