diff options
author | Eric Eastwood <contact@ericeastwood.com> | 2017-11-14 00:05:40 -0600 |
---|---|---|
committer | Oswaldo Ferreira <oswaldo@gitlab.com> | 2017-11-20 12:38:53 -0200 |
commit | f494dbc51592766317718c4d656d2b74f9fcb3ab (patch) | |
tree | 4f75cd930da83bf68adeb94ed840775a3795a48a /app/assets/javascripts/boards/components/board_card.vue | |
parent | d2699aea57eaef6adee25bb453a6096b80dda28f (diff) | |
download | gitlab-ce-f494dbc51592766317718c4d656d2b74f9fcb3ab.tar.gz |
Async notification subscriptions in issue boards
Diffstat (limited to 'app/assets/javascripts/boards/components/board_card.vue')
-rw-r--r-- | app/assets/javascripts/boards/components/board_card.vue | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/app/assets/javascripts/boards/components/board_card.vue b/app/assets/javascripts/boards/components/board_card.vue new file mode 100644 index 00000000000..0b220a56e0b --- /dev/null +++ b/app/assets/javascripts/boards/components/board_card.vue @@ -0,0 +1,71 @@ +<script> +import './issue_card_inner'; +import eventHub from '../eventhub'; + +const Store = gl.issueBoards.BoardsStore; + +export default { + name: 'BoardsIssueCard', + components: { + 'issue-card-inner': gl.issueBoards.IssueCardInner, + }, + props: { + list: Object, + issue: Object, + issueLinkBase: String, + disabled: Boolean, + index: Number, + rootPath: String, + }, + data() { + return { + showDetail: false, + detailIssue: Store.detail, + }; + }, + computed: { + issueDetailVisible() { + return this.detailIssue.issue && this.detailIssue.issue.id === this.issue.id; + }, + }, + methods: { + mouseDown() { + this.showDetail = true; + }, + mouseMove() { + this.showDetail = false; + }, + showIssue(e) { + if (e.target.classList.contains('js-no-trigger')) return; + + if (this.showDetail) { + this.showDetail = false; + + if (Store.detail.issue && Store.detail.issue.id === this.issue.id) { + eventHub.$emit('clearDetailIssue'); + } else { + eventHub.$emit('newDetailIssue', this.issue); + Store.detail.list = this.list; + } + } + }, + }, +}; +</script> + +<template> + <li class="card" + :class="{ 'user-can-drag': !disabled && issue.id, 'is-disabled': disabled || !issue.id, 'is-active': issueDetailVisible }" + :index="index" + :data-issue-id="issue.id" + @mousedown="mouseDown" + @mousemove="mouseMove" + @mouseup="showIssue($event)"> + <issue-card-inner + :list="list" + :issue="issue" + :issue-link-base="issueLinkBase" + :root-path="rootPath" + :update-filters="true" /> + </li> +</template> |