debian-mirror-gitlab/app/assets/javascripts/boards/components/board_card.vue

102 lines
2.1 KiB
Vue
Raw Normal View History

2018-03-17 18:26:18 +05:30
<script>
2018-12-13 13:39:08 +05:30
/* eslint-disable vue/require-default-prop */
import IssueCardInner from './issue_card_inner.vue';
import eventHub from '../eventhub';
import boardsStore from '../stores/boards_store';
2018-03-17 18:26:18 +05:30
2018-12-13 13:39:08 +05:30
export default {
name: 'BoardsIssueCard',
components: {
IssueCardInner,
},
props: {
list: {
type: Object,
default: () => ({}),
2018-03-17 18:26:18 +05:30
},
2018-12-13 13:39:08 +05:30
issue: {
type: Object,
default: () => ({}),
2018-03-17 18:26:18 +05:30
},
2018-12-13 13:39:08 +05:30
issueLinkBase: {
type: String,
default: '',
2018-03-17 18:26:18 +05:30
},
2018-12-13 13:39:08 +05:30
disabled: {
type: Boolean,
default: false,
2018-03-17 18:26:18 +05:30
},
2018-12-13 13:39:08 +05:30
index: {
type: Number,
default: 0,
},
rootPath: {
type: String,
default: '',
},
groupId: {
type: Number,
},
},
data() {
return {
showDetail: false,
detailIssue: boardsStore.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;
2018-11-08 19:23:39 +05:30
2018-12-13 13:39:08 +05:30
if (this.showDetail) {
this.showDetail = false;
2018-03-17 18:26:18 +05:30
2018-12-13 13:39:08 +05:30
if (boardsStore.detail.issue && boardsStore.detail.issue.id === this.issue.id) {
eventHub.$emit('clearDetailIssue');
} else {
eventHub.$emit('newDetailIssue', this.issue);
2019-09-04 21:01:54 +05:30
boardsStore.setListDetail(this.list);
2018-03-17 18:26:18 +05:30
}
2018-12-13 13:39:08 +05:30
}
2018-03-17 18:26:18 +05:30
},
2018-12-13 13:39:08 +05:30
},
};
2018-03-17 18:26:18 +05:30
</script>
<template>
<li
:class="{
'user-can-drag': !disabled && issue.id,
'is-disabled': disabled || !issue.id,
2019-02-15 15:39:39 +05:30
'is-active': issueDetailVisible,
2018-03-17 18:26:18 +05:30
}"
:index="index"
:data-issue-id="issue.id"
2019-12-04 20:38:33 +05:30
data-qa-selector="board_card"
2019-07-31 22:56:46 +05:30
class="board-card p-3 rounded"
2018-03-17 18:26:18 +05:30
@mousedown="mouseDown"
@mousemove="mouseMove"
2019-03-02 22:35:43 +05:30
@mouseup="showIssue($event)"
2019-02-15 15:39:39 +05:30
>
2018-03-17 18:26:18 +05:30
<issue-card-inner
:list="list"
:issue="issue"
:issue-link-base="issueLinkBase"
2018-03-27 19:54:05 +05:30
:group-id="groupId"
2018-03-17 18:26:18 +05:30
:root-path="rootPath"
:update-filters="true"
/>
</li>
</template>