Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 43 additions & 4 deletions src/components/board/Board.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,33 @@
<template>
<div class="board-wrapper">
<Controls :board="board" />

<transition name="fade" mode="out-in">
<div v-if="loading" key="loading" class="emptycontent">
<div class="icon icon-loading" />
<h2>{{ t('deck', 'Loading board') }}</h2>
<p />
</div>
<div v-else-if="board && !loading" key="board" class="board">
<EmptyContent v-else-if="isEmpty" key="empty" icon="icon-deck">
{{ t('deck', 'No lists available') }}
<template #desc>
{{ t('deck', 'Create a new list to add cards to this board') }}
<form @submit.prevent="addNewStack()">
<input id="new-stack-input-main"
v-model="newStackTitle"
v-focus
type="text"
class="no-close"
:placeholder="t('deck', 'List name')"
required>
<input v-tooltip="t('deck', 'Add new list')"
class="icon-confirm"
type="submit"
value="">
</form>
</template>
</EmptyContent>
<div v-else-if="!isEmpty && !loading" key="board" class="board">
<Container lock-axix="y"
orientation="horizontal"
:drag-handle-selector="dragHandleSelector"
Expand All @@ -54,6 +74,7 @@ import { Container, Draggable } from 'vue-smooth-dnd'
import { mapState, mapGetters } from 'vuex'
import Controls from '../Controls'
import Stack from './Stack'
import { EmptyContent } from '@nextcloud/vue'

export default {
name: 'Board',
Expand All @@ -62,6 +83,7 @@ export default {
Container,
Draggable,
Stack,
EmptyContent,
},
inject: [
'boardApi',
Expand All @@ -75,6 +97,7 @@ export default {
data() {
return {
loading: true,
newStackTitle: '',
}
},
computed: {
Expand All @@ -91,6 +114,9 @@ export default {
dragHandleSelector() {
return this.canEdit ? null : '.no-drag'
},
isEmpty() {
return this.stacksByBoard.length === 0
},
},
watch: {
id: 'fetchData',
Expand All @@ -117,13 +143,13 @@ export default {
this.$store.dispatch('orderStack', { stack: this.stacksByBoard[removedIndex], removedIndex, addedIndex })
},

createStack() {
addNewStack() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure that newStackTitle is emptied once the stack has been created.

const newStack = {
title: 'FooBar',
title: this.newStackTitle,
boardId: this.id,
order: this.stacksByBoard().length,
}
this.$store.dispatch('createStack', newStack)
this.newStackTitle = ''
},
},
}
Expand All @@ -137,6 +163,19 @@ export default {
$stack-spacing: 10px;
$stack-width: 300px;

form {
text-align: center;
display: flex;
width: 100%;
max-width: 200px;
margin: auto;
margin-top: 20px;

input[type=text] {
flex-grow: 1;
}
}

.board-wrapper {
position: relative;
width: 100%;
Expand Down
2 changes: 1 addition & 1 deletion webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ const config = {
}
};

module.exports = merge(config, webpackConfig)
module.exports = merge(webpackConfig, config)