Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
yaohaixiao committed Jul 27, 2019
2 parents c7d4fca + bd1b310 commit e2c29f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 73 deletions.
2 changes: 1 addition & 1 deletion docs/js/app.min.js

Large diffs are not rendered by default.

76 changes: 4 additions & 72 deletions src/scripts/plan.js
Original file line number Diff line number Diff line change
Expand Up @@ -413,99 +413,31 @@ class Plan {
}

drop ($plan, $target, $source) {
let filter = this.getFilter()
let id = $plan.getAttribute('data-id')
let plan = this.getPlan(parseInt(id, 10))
let $columns = this.$columns
let sourceStatus = $source.getAttribute('data-status')
let targetStatus = $target.getAttribute('data-status')
let $sourceCount = $columns.getStatusCountEl(sourceStatus)
let $targetCount = $columns.getStatusCountEl(targetStatus)
let code
let text

if (targetStatus === sourceStatus) {
return this
}

// 移动到回收站
if (targetStatus === 'deleted') {
plan.deleted = true
code = OPERATIONS.remove.code
text = OPERATIONS.remove.text
} else {
// 从回收站移出来
if (sourceStatus === 'deleted') {
code = OPERATIONS.replace.text
text = OPERATIONS.replace.text

// 根据过滤器,更新相应的属性
switch (filter) {
case 'marked':
plan.marked = true
break
case 'spades':
plan.level = 0
break
case 'heart':
plan.level = 1
break
case 'clubs':
plan.level = 2
break
case 'diamonds':
plan.level = 3
break
}

plan.deleted = false
plan.status = parseInt(targetStatus, 10)
} else {
code = OPERATIONS.status.text
text = OPERATIONS.status.text

plan.status = parseInt(targetStatus, 10)
}
}
plan.status = parseInt(targetStatus, 10)

plan.update.unshift({
time: getMoments(),
code: code,
operate: text
code: OPERATIONS.status.text,
operate: OPERATIONS.status.text
})
plan.delayed = isDelayed(plan)
this.setPlan(plan)

updateStatusChangedCount($sourceCount, $targetCount)

if (plan.deleted) {
addClass($plan, 'task-deleted')
$plan.setAttribute('data-deleted', '1')
} else {
emitter.emit('columns.edit', plan)

removeClass($plan, 'task-deleted')
$plan.setAttribute('data-deleted', '0')

replaceClass($plan, 'task-status-' + plan.status, 'task-status-' + sourceStatus)
$plan.setAttribute('data-status', plan.status)
}

if (plan.marked) {
addClass($plan, 'task-marked')
$plan.setAttribute('data-marked', '1')
} else {
removeClass($plan, 'task-marked')
$plan.setAttribute('data-marked', '0')
}

if (plan.delayed) {
addClass($plan, 'task-delayed')
$plan.setAttribute('data-delay', '1')
} else {
removeClass($plan, 'task-delayed')
$plan.setAttribute('data-delay', '0')
}
emitter.emit('columns.edit', plan)

return this
}
Expand Down

0 comments on commit e2c29f1

Please sign in to comment.