diff --git a/src/App.vue b/src/App.vue index 995f2bbdf..c27aca5a7 100644 --- a/src/App.vue +++ b/src/App.vue @@ -157,8 +157,7 @@ export default { .modal__card { min-width: 320px; - width: 50vw; - max-width: 800px; + width: 100%; min-height: 200px; height: auto; } @@ -171,6 +170,7 @@ export default { } .modal-wrapper--normal .modal-container{ - width: 800px !important; + width: 900px !important; } + diff --git a/src/components/card/CardModal.vue b/src/components/card/CardModal.vue index 5e71f633a..1b39e0112 100644 --- a/src/components/card/CardModal.vue +++ b/src/components/card/CardModal.vue @@ -43,7 +43,7 @@ Due date -
+
Project
@@ -57,6 +57,7 @@ +
@@ -64,17 +65,22 @@

Activities

-
+
- +
-

- You have created card Example Task 3 in list To do on board Personal -

+ +
    + +
@@ -91,12 +97,24 @@ import MembersTab from './MembersTab.vue' import TagsTab from './TagsTab.vue' import DueDateTab from './DueDateTab.vue' import Description from './Description.vue' +import ProjectTab from './ProjectTab.vue' +import CommentForm from './CommentForm' +import CommentItem from './CommentItem' const capabilities = window.OC.getCapabilities() export default { name: 'CardModal', - components: { Avatar, MembersTab, Description, TagsTab, DueDateTab }, + components: { + Avatar, + MembersTab, + Description, + TagsTab, + DueDateTab, + ProjectTab, + CommentForm, + CommentItem, + }, mixins: [relativeDate], props: { id: { @@ -116,6 +134,7 @@ export default { }, data() { return { + newComment: '', titleEditable: false, titleEditing: '', hasActivity: capabilities && capabilities.activity, @@ -125,8 +144,13 @@ export default { } }, computed: { + ...mapGetters([ + 'getCommentsForCard', + 'hasMoreComments', + ]), ...mapState({ currentBoard: state => state.currentBoard, + replyTo: state => state.comment.replyTo, }), ...mapGetters(['canEdit', 'assignables', 'cardActions', 'stackById']), title() { @@ -156,7 +180,39 @@ export default { }, }, }, + mounted() { + this.loadComments() + }, methods: { + cancelReply() { + this.$store.dispatch('setReplyTo', null) + }, + async createComment(content) { + const commentObj = { + cardId: this.currentCard.id, + comment: content, + } + await this.$store.dispatch('createComment', commentObj) + this.$store.dispatch('setReplyTo', null) + this.newComment = '' + await this.loadComments() + }, + async loadComments() { + this.$store.dispatch('setReplyTo', null) + this.error = null + this.isLoading = true + try { + await this.$store.dispatch('fetchComments', { cardId: this.currentCard.id }) + this.isLoading = false + if (this.currentCard.commentsUnread > 0) { + await this.$store.dispatch('markCommentsAsRead', this.currentCard.id) + } + } catch (e) { + this.isLoading = false + console.error('Failed to fetch more comments during infinite loading', e) + this.error = t('deck', 'Failed to load comments') + } + }, descriptionChanged(newDesc) { this.copiedCard.description = newDesc }, @@ -200,8 +256,8 @@ export default { diff --git a/src/components/card/ProjectTab.vue b/src/components/card/ProjectTab.vue new file mode 100644 index 000000000..0fa8b2d53 --- /dev/null +++ b/src/components/card/ProjectTab.vue @@ -0,0 +1,44 @@ + + + + +