Removes boards correctly
This commit is contained in:
parent
c369ea6c9b
commit
61fa7b756e
|
@ -10,7 +10,7 @@ Board = Vue.extend
|
||||||
isPreset: ->
|
isPreset: ->
|
||||||
typeof this.board.id != 'number'
|
typeof this.board.id != 'number'
|
||||||
ready: ->
|
ready: ->
|
||||||
Sortable.create this.$el.parentNode,
|
this.sortable = Sortable.create this.$el.parentNode,
|
||||||
group: 'boards'
|
group: 'boards'
|
||||||
animation: 150
|
animation: 150
|
||||||
draggable: '.is-draggable'
|
draggable: '.is-draggable'
|
||||||
|
@ -19,5 +19,7 @@ Board = Vue.extend
|
||||||
ghostClass: 'is-ghost'
|
ghostClass: 'is-ghost'
|
||||||
onUpdate: (e) ->
|
onUpdate: (e) ->
|
||||||
BoardsStore.moveBoard(e.oldIndex + 1, e.newIndex + 1)
|
BoardsStore.moveBoard(e.oldIndex + 1, e.newIndex + 1)
|
||||||
|
beforeDestroy: ->
|
||||||
|
this.sortable.destroy()
|
||||||
|
|
||||||
Vue.component('board', Board)
|
Vue.component('board', Board)
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
BoardDelete = Vue.extend
|
BoardDelete = Vue.extend
|
||||||
props:
|
props:
|
||||||
boardId: Number
|
boardId: Number
|
||||||
|
methods:
|
||||||
|
deleteBoard: ->
|
||||||
|
$(this.$el).tooltip('destroy')
|
||||||
|
|
||||||
|
if confirm('Are you sure you want to delete this list?')
|
||||||
|
BoardsStore.removeBoard(this.boardId)
|
||||||
|
|
||||||
Vue.component 'board-delete', BoardDelete
|
Vue.component 'board-delete', BoardDelete
|
||||||
|
|
|
@ -56,5 +56,7 @@ BoardList = Vue.extend
|
||||||
this.$els.list.onscroll = =>
|
this.$els.list.onscroll = =>
|
||||||
if (this.scrollTop() > this.scrollHeight() - this.scrollOffset) and !this.loadMore
|
if (this.scrollTop() > this.scrollHeight() - this.scrollOffset) and !this.loadMore
|
||||||
this.loadFromLastId()
|
this.loadFromLastId()
|
||||||
|
beforeDestroy: ->
|
||||||
|
this.sortable.destroy()
|
||||||
|
|
||||||
Vue.component('board-list', BoardList)
|
Vue.component('board-list', BoardList)
|
||||||
|
|
|
@ -6,6 +6,9 @@
|
||||||
author: {}
|
author: {}
|
||||||
assignee: {}
|
assignee: {}
|
||||||
milestone: {}
|
milestone: {}
|
||||||
|
removeBoard: (id) ->
|
||||||
|
BoardsStore.state.boards = _.reject BoardsStore.state.boards, (board) ->
|
||||||
|
board.id is id
|
||||||
moveBoard: (oldIndex, newIndex) ->
|
moveBoard: (oldIndex, newIndex) ->
|
||||||
boardFrom = _.find BoardsStore.state.boards, (board) ->
|
boardFrom = _.find BoardsStore.state.boards, (board) ->
|
||||||
board.index is oldIndex
|
board.index is oldIndex
|
||||||
|
|
|
@ -110,6 +110,7 @@
|
||||||
color: $gray-darkest;
|
color: $gray-darkest;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
border: 0;
|
border: 0;
|
||||||
|
outline: 0;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
color: $gl-link-color;
|
color: $gl-link-color;
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
{{ board.title }}
|
{{ board.title }}
|
||||||
%span.pull-right
|
%span.pull-right
|
||||||
{{ board.issues.length }}
|
{{ board.issues.length }}
|
||||||
%board-delete{ "inline-template" => true, "v-if" => "!isPreset" }
|
%board-delete{ "inline-template" => true, "v-if" => "!isPreset", ":board-id" => "board.id" }
|
||||||
%button.board-delete.has-tooltip.pull-right{ type: "button", title: "Delete board", data: { placement: "bottom" } }
|
%button.board-delete.has-tooltip.pull-right{ type: "button", title: "Delete board", data: { placement: "bottom" }, "@click" => "deleteBoard" }
|
||||||
%span.sr-only
|
%span.sr-only
|
||||||
Delete board
|
Delete board
|
||||||
= icon("trash")
|
= icon("trash")
|
||||||
|
|
Loading…
Reference in New Issue