Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
yaohaixiao committed Jul 27, 2019
2 parents de308dc + c7d4fca commit f520277
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 34 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Plan - A Javascript todo list app, easy to use & nice UI.
- Support markdown grammar;
- Nice UI with 8 themes;
- Highlight important tasks and delayed tasks;
- User experience is friendly and easy to use.
- User friendly and easy to use.

## Browser Support

Expand Down
1 change: 1 addition & 0 deletions docs/css/app.min.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/js/app.min.js

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions src/scripts/plan.columns.js
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,6 @@ const Columns = {
let plan = this.getPlan(parseInt(id, 10))

emitter.emit('panel.view.update', plan)
emitter.emit('panel.view.open')

return this
},
Expand Down Expand Up @@ -636,7 +635,6 @@ const Columns = {
let plan = this.getPlan(parseInt(id, 10))

emitter.emit('panel.edit.update', plan)
emitter.emit('panel.edit.open')

return this
},
Expand Down
4 changes: 2 additions & 2 deletions src/scripts/plan.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import emitter from './plan.emitter'
import dragula from 'dragula'
import marked from 'marked'

class PlanV2 {
class Plan {
constructor (options) {
this.attributes = {
template: 0,
Expand Down Expand Up @@ -511,4 +511,4 @@ class PlanV2 {
}
}

export default PlanV2
export default Plan
41 changes: 20 additions & 21 deletions src/scripts/plan.panel.edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const Panel = {
on($wrap, '.edit-deadline-input', 'click', this._onDeadlineInputFocus, this)
on($wrap, '.edit-calendar-icon', 'click', this._onCalendarIconClick, this)

emitter.on('panel.edit.update', this.setPlan.bind(this))
emitter.on('panel.edit.update', this.update.bind(this))
emitter.on('panel.edit.open', this.open.bind(this))
emitter.on('panel.edit.close', this.close.bind(this))

Expand Down Expand Up @@ -114,9 +114,6 @@ const Panel = {
return this
},
open () {
let $deadline = $wrap.querySelector('#edit-deadline')
let $icon = $wrap.querySelector('.edit-calendar-icon')

if (this.isOpened()) {
return this
}
Expand All @@ -126,21 +123,6 @@ const Panel = {
emitter.emit('panel.trash.close')
emitter.emit('panel.setting.close')

$calendar = new Calendar({
parent: 'edit-calendar',
time: this.getPlan().deadline,
hasFooter: false,
onDatePick: (time) => {
$deadline.value = time
$calendar.hide()
removeClass($icon, 'field-icon-checked')
}
})

$calendar.hide()

this.update()

addClass($wrap, 'panel-opened')

emitter.emit('columns.close')
Expand All @@ -150,16 +132,18 @@ const Panel = {
isOpened () {
return hasClass($wrap, 'panel-opened')
},
update () {
let plan = this.getPlan()
update (plan) {
let $title = $wrap.querySelector('#edit-title')
let $create = $wrap.querySelector('#edit-create')
let $deadline = $wrap.querySelector('#edit-deadline')
let $icon = $wrap.querySelector('.edit-calendar-icon')
let $estimate = $wrap.querySelector('#edit-estimate')
let $level = $wrap.querySelector('#edit-level')
let $desc = $wrap.querySelector('#edit-desc')
let $checked = $wrap.querySelector(`[data-level="${plan.level}"]`)

this.setPlan(plan)

$title.value = plan.title
$create.innerHTML = plan.create
$deadline.value = plan.deadline
Expand All @@ -171,6 +155,21 @@ const Panel = {
addClass($checked, 'field-level-checked')
}

$calendar = new Calendar({
parent: 'edit-calendar',
time: this.getPlan().deadline,
hasFooter: false,
onDatePick: (time) => {
$deadline.value = time
$calendar.hide()
removeClass($icon, 'field-icon-checked')
}
})

$calendar.hide()

this.open()

return this
},
empty () {
Expand Down
14 changes: 7 additions & 7 deletions src/scripts/plan.panel.view.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const Panel = {
on($wrap, '.view-cancel', 'click', this._onCancelClick, this)
on($wrap, '.view-edit', 'click', this._onEditClick, this)

emitter.on('panel.view.update', this.setPlan.bind(this))
emitter.on('panel.view.update', this.update.bind(this))
emitter.on('panel.view.open', this.open.bind(this))
emitter.on('panel.view.close', this.close.bind(this))

Expand All @@ -71,7 +71,7 @@ const Panel = {
off($wrap, 'click', this._onCancelClick)
off($wrap, 'click', this._onEditClick)

emitter.off('panel.view.update', this.setPlan.bind(this))
emitter.off('panel.view.update', this.update.bind(this))
emitter.off('panel.view.open', this.open.bind(this))
emitter.off('panel.view.close', this.close.bind(this))

Expand All @@ -92,17 +92,14 @@ const Panel = {
emitter.emit('panel.trash.close')
emitter.emit('panel.setting.close')

this.update()

addClass($wrap, 'panel-opened')

emitter.emit('columns.close')

return this
},
update () {
update (plan) {
const CLS_LEVEL = 'field-view-level field-level-icon field-level-checked'
let plan = this.getPlan()
let elements = this.getEls()
let $title = elements.title
let $create = elements.create
Expand All @@ -116,6 +113,8 @@ const Panel = {
})
let $icon

this.setPlan(plan)

$title.innerHTML = plan.title
$create.innerHTML = plan.create
$deadline.innerHTML = plan.deadline
Expand Down Expand Up @@ -189,6 +188,8 @@ const Panel = {
$logs.innerHTML = ''
$logs.appendChild($list)

this.open()

return this
},
empty () {
Expand Down Expand Up @@ -218,7 +219,6 @@ const Panel = {
},
_onEditClick () {
emitter.emit('panel.edit.update', this.getPlan())
emitter.emit('panel.edit.open')

return this
}
Expand Down

0 comments on commit f520277

Please sign in to comment.