77 <div class =" stack"
88 :class =" {
99 'stack--done-column': isDoneColumn,
10- 'stack--add-card-at-top': canAddCardAtTop ,
11- 'stack--add-card-at-bottom': canAddCardAtBottom ,
10+ 'stack--add-card-at-top': canAddCard && stackAddCardAtTop ,
11+ 'stack--add-card-at-bottom': canAddCard && !stackAddCardAtTop ,
1212 'stack--dragging-card': draggingCard,
1313 }"
1414 :data-cy-stack =" stack.title" >
100100 </div >
101101 </NcModal >
102102
103- <div v-if =" canAddCardAtTop" class =" stack__card-add stack__card-add--top" >
104- <NcButton v-if =" ! showAddCard "
105- data-cy="action:add-card "
106- class="stack__card-add-button"
107- type="tertiary"
108- :wide =" true "
109- @click .stop =" showAddCard = true " >
110- <template #icon >
111- <PlusIcon :size =" 20 " />
112- </template >
113- {{ t('deck', 'Add card') }}
114- </NcButton >
115- <form v-else
116- :class =" { 'icon-loading-small': stateCardCreating }"
117- @submit.prevent.stop =" clickAddCard()" >
118- <label for =" new-stack-input-main" class =" hidden-visually" >{{ t('deck', 'Add a new card') }}</label >
119- <input id =" new-stack-input-main"
120- ref =" newCardInput"
121- v-model =" newCardTitle"
122- type =" text"
123- class =" no-close"
124- :disabled =" stateCardCreating"
125- :placeholder =" t('deck', 'Card name')"
126- required
127- pattern =" .*\S+.*"
128- @focus =" onCreateCardFocus"
129- @keydown.esc.stop =" closeCardCreation" >
130- <input v-show =" !stateCardCreating"
131- class =" icon-confirm"
132- type =" submit"
133- value =" " >
134- </form >
135- </div >
136-
137103 <Container :get-child-payload =" payloadForCard (stack .id )"
138104 class="dnd-container stack__cards-list"
139105 group-name="stack"
154120 </Draggable >
155121 </Container >
156122
157- <div v-if =" canAddCardAtBottom " class =" stack__card-add stack__card-add--bottom " >
123+ <div v-if =" canAddCard " class =" stack__card-add" >
158124 <NcButton v-if =" ! showAddCard "
159125 data-cy="action:add-card "
160126 class="stack__card-add-button"
180146 required
181147 pattern =" .*\S+.*"
182148 @focus =" onCreateCardFocus"
183- @keydown.esc.stop =" closeCardCreation " >
149+ @keydown.esc.stop =" showAddCard = false " >
184150 <input v-show =" !stateCardCreating"
185151 class =" icon-confirm"
186152 type =" submit"
@@ -284,11 +250,8 @@ export default {
284250 stackAddCardAtTop () {
285251 return this .$store .getters .config (' stackAddCardAtTop' ) === true
286252 },
287- canAddCardAtTop () {
288- return this .canEdit && ! this .showArchived && ! this .isArchived && this .stackAddCardAtTop
289- },
290- canAddCardAtBottom () {
291- return this .canEdit && ! this .showArchived && ! this .isArchived && ! this .stackAddCardAtTop
253+ canAddCard () {
254+ return this .canEdit && ! this .showArchived && ! this .isArchived
292255 },
293256 },
294257 watch: {
@@ -310,10 +273,6 @@ export default {
310273 methods: {
311274 ... mapActions (useTrashbinStore, [' stackUndoDelete' ]),
312275 ... mapActions (useStackStore, [' setDoneStack' , ' deleteStack' , ' updateStack' ]),
313- closeCardCreation () {
314- this .showAddCard = false
315- return false
316- },
317276 stopCardCreation (e ) {
318277 // For some reason the submit event triggers a MouseEvent that is bubbling to the outside
319278 // so we have to ignore it
@@ -469,19 +428,26 @@ export default {
469428 min- height: 0 ;
470429 }
471430
472- & .stack -- add- card- at- bottom {
473- // The card list fills the column and reaches underneath the add card
474- // control (see Board.vue), so that cards can be dropped anywhere in
475- // the free space of the list.
476- & .stack -- dragging- card .stack__card - add-- bottom {
477- // smooth-dnd resolves the hovered container with elementFromPoint(),
478- // so the control has to let the drag through to the list underneath
479- // it, otherwise dragging over it would count as leaving the list.
480- pointer- events: none;
481- }
431+ & .stack -- add- card- at- bottom .stack -- dragging- card .stack__card - add {
432+ // The card list reaches underneath the control (see Board.vue) and
433+ // smooth-dnd resolves the hovered container with elementFromPoint(),
434+ // so the control must not swallow the drag.
435+ pointer- events: none;
482436 }
483437
484438 & .stack -- add- card- at- top {
439+ .stack__header {
440+ order: 1 ;
441+ }
442+
443+ .stack__card - add {
444+ order: 2 ;
445+ }
446+
447+ .stack__cards - list {
448+ order: 3 ;
449+ }
450+
485451 & : after {
486452 content: ' ' ;
487453 display: block;
@@ -614,7 +580,7 @@ export default {
614580 background- color: var (-- color- main- background);
615581 position: relative;
616582
617- & -- top {
583+ . stack -- add - card - at - top & {
618584 padding- top: $stack- gap;
619585
620586 & : after {
@@ -631,7 +597,7 @@ export default {
631597 }
632598 }
633599
634- & -- bottom {
600+ . stack -- add - card - at - bottom & {
635601 padding- bottom: $stack- gap;
636602 }
637603
0 commit comments