orphan tasks
This commit is contained in:
parent
8612f0ab8b
commit
3b489f1669
@ -4,6 +4,39 @@ Modal = require './modal.ls'
|
|||||||
UUID = require "uuid/v4"
|
UUID = require "uuid/v4"
|
||||||
bulma = require "./bulma.ls"
|
bulma = require "./bulma.ls"
|
||||||
|
|
||||||
|
col-to-lines = (column, self) ->
|
||||||
|
h \div.field.has-addons {
|
||||||
|
key: "field" + column.id
|
||||||
|
} [
|
||||||
|
h \p.control [
|
||||||
|
h \input.input {
|
||||||
|
key: "input" + column.id
|
||||||
|
value: column.title
|
||||||
|
oninput: (e) ->
|
||||||
|
self.extra_properties.columns.find((.id == column.id)).title := e.target.value
|
||||||
|
} [ ]
|
||||||
|
]
|
||||||
|
|
||||||
|
h \div.control.button.is-primary {
|
||||||
|
key: "button" + column.id
|
||||||
|
onclick: ->
|
||||||
|
# console.log "BEFORE REMOVING THE COLUMN: ", self.extra_properties.columns
|
||||||
|
self.extra_properties.columns := self.extra_properties.columns.filter((.id != column.id))
|
||||||
|
# console.log "AFTER REMOVING THE COLUMN: ", self.extra_properties.columns
|
||||||
|
} [ "DELETE" ]
|
||||||
|
]
|
||||||
|
|
||||||
|
# <div class="field has-addons">
|
||||||
|
# <p class="control">
|
||||||
|
# <input class="input" type="text" placeholder="Your email">
|
||||||
|
# </p>
|
||||||
|
# <p class="control">
|
||||||
|
# <a class="button is-static">
|
||||||
|
# @gmail.com
|
||||||
|
# </a>
|
||||||
|
# </p>
|
||||||
|
# </div>
|
||||||
|
|
||||||
ProjectCreationModal = (project, todod-ws) ->
|
ProjectCreationModal = (project, todod-ws) ->
|
||||||
|
|
||||||
# work on a copy of the columns
|
# work on a copy of the columns
|
||||||
@ -32,11 +65,20 @@ ProjectCreationModal = (project, todod-ws) ->
|
|||||||
+visible
|
+visible
|
||||||
content-render: (self) ->
|
content-render: (self) ->
|
||||||
h \div.form [
|
h \div.form [
|
||||||
|
|
||||||
|
bulma.field [
|
||||||
|
# console.log "NEW USER NAME: " + self.new-user
|
||||||
|
# bulma.label "Valeur actuelle : " + self.new-user
|
||||||
|
bulma.label "Project title"
|
||||||
|
|
||||||
h \input.input {
|
h \input.input {
|
||||||
value: self.title
|
value: self.title
|
||||||
oninput: (e) ->
|
oninput: (e) ->
|
||||||
self.title := e.target.value
|
self.title := e.target.value
|
||||||
}
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
h \hr []
|
||||||
|
|
||||||
bulma.field [
|
bulma.field [
|
||||||
# console.log "NEW USER NAME: " + self.new-user
|
# console.log "NEW USER NAME: " + self.new-user
|
||||||
@ -52,11 +94,7 @@ ProjectCreationModal = (project, todod-ws) ->
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
h \input.input {
|
h \hr []
|
||||||
value: self.title
|
|
||||||
oninput: (e) ->
|
|
||||||
self.title := e.target.value
|
|
||||||
}
|
|
||||||
|
|
||||||
h \aside.menu [
|
h \aside.menu [
|
||||||
h \p.menu-label [ "Permissions" ]
|
h \p.menu-label [ "Permissions" ]
|
||||||
@ -70,29 +108,14 @@ ProjectCreationModal = (project, todod-ws) ->
|
|||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
h \aside.menu [
|
h \hr []
|
||||||
h \p.menu-label [ "Choose the columns" ]
|
|
||||||
|
|
||||||
h \ul.menu-list self.extra_properties.columns.map (column) ->
|
h \p [ "Choose the columns" ]
|
||||||
|
|
||||||
h \li {
|
for dom in (self.extra_properties.columns.map (column) -> col-to-lines column, self)
|
||||||
key: column.id
|
dom
|
||||||
} [
|
|
||||||
h \input.input {
|
|
||||||
key: column.id
|
|
||||||
value: column.title
|
|
||||||
oninput: (e) ->
|
|
||||||
self.extra_properties.columns.find((.id == column.id)).title := e.target.value
|
|
||||||
} [ ]
|
|
||||||
|
|
||||||
h \div.button {
|
h \hr []
|
||||||
onclick: ->
|
|
||||||
# TODO: create a new entry in self.extra_properties.columns
|
|
||||||
self.extra_properties.columns := self.extra_properties.columns.filter((.id != column.id))
|
|
||||||
# self.todod-ws.edit-list
|
|
||||||
# todod-ws.edit-list project.id, self
|
|
||||||
} [ "X" ]
|
|
||||||
]
|
|
||||||
|
|
||||||
h \input.input {
|
h \input.input {
|
||||||
value: self.new-column-input.title
|
value: self.new-column-input.title
|
||||||
@ -111,7 +134,6 @@ ProjectCreationModal = (project, todod-ws) ->
|
|||||||
self.new-column-input.title := "New column !"
|
self.new-column-input.title := "New column !"
|
||||||
} [ "+" ]
|
} [ "+" ]
|
||||||
]
|
]
|
||||||
]
|
|
||||||
|
|
||||||
on-validation: ->
|
on-validation: ->
|
||||||
if project.id
|
if project.id
|
||||||
|
@ -6,6 +6,19 @@ Modal = require './modal.ls'
|
|||||||
TaskCreationModal = require './task-creation-modal.ls'
|
TaskCreationModal = require './task-creation-modal.ls'
|
||||||
ProjectCreationModal = require "./project-creation-modal.ls"
|
ProjectCreationModal = require "./project-creation-modal.ls"
|
||||||
|
|
||||||
|
is-right-column = (task, column-id) ->
|
||||||
|
task.extra_properties && task.extra_properties.column && task.extra_properties.column == column-id
|
||||||
|
|
||||||
|
has-column = (task) ->
|
||||||
|
task.extra_properties && task.extra_properties.column
|
||||||
|
|
||||||
|
# configured column, but inexistant (maybe removed since)
|
||||||
|
inexistant-column = (task, columns) ->
|
||||||
|
columns.filter((.id == task.extra_properties.column)).length == 0
|
||||||
|
|
||||||
|
orphan-tasks = (tasks, columns) ->
|
||||||
|
tasks.filter (task) -> (! has-column) || inexistant-column task, columns
|
||||||
|
|
||||||
Project = (self, todod-ws) ->
|
Project = (self, todod-ws) ->
|
||||||
self.todod-ws = todod-ws
|
self.todod-ws = todod-ws
|
||||||
self.tasks = []
|
self.tasks = []
|
||||||
@ -14,9 +27,14 @@ Project = (self, todod-ws) ->
|
|||||||
|
|
||||||
self.render-column = (column, first) ->
|
self.render-column = (column, first) ->
|
||||||
|
|
||||||
tasks-to-display = self.tasks.filter (task) ->
|
console.log "tasks: ", self.tasks
|
||||||
task.extra_properties && task.extra_properties.column && task.extra_properties.column == column.id
|
|
||||||
|| ((! task.extra_properties || ! task.extra_properties.column) && first)
|
tasks-to-display = self.tasks.filter (task) -> is-right-column task, column.id
|
||||||
|
|
||||||
|
if first
|
||||||
|
tasks-to-display ++= orphan-tasks self.tasks, self.extra_properties.columns
|
||||||
|
|
||||||
|
console.log "column: #{column.id}: ", tasks-to-display
|
||||||
|
|
||||||
h \div.column {
|
h \div.column {
|
||||||
key: column.id
|
key: column.id
|
||||||
|
@ -8,8 +8,9 @@ TaskCreationModal = (project, todod-ws, task) ->
|
|||||||
self = {
|
self = {
|
||||||
title: task.title || ""
|
title: task.title || ""
|
||||||
description: task.description || ""
|
description: task.description || ""
|
||||||
columns: []
|
extra_properties: {
|
||||||
column: void
|
column: task.list || ""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
modal = Modal {
|
modal = Modal {
|
||||||
@ -32,33 +33,24 @@ TaskCreationModal = (project, todod-ws, task) ->
|
|||||||
h \p.menu-label [ "Choose the column" ]
|
h \p.menu-label [ "Choose the column" ]
|
||||||
h \ul.menu-list project.extra_properties.columns.map (column) ->
|
h \ul.menu-list project.extra_properties.columns.map (column) ->
|
||||||
|
|
||||||
h \li [
|
h \li {
|
||||||
h \a {
|
|
||||||
classes: {
|
classes: {
|
||||||
is-active: self.extra_properties && self.extra_properties.column == column.id
|
is-active: self.extra_properties && self.extra_properties.column == column.id
|
||||||
}
|
}
|
||||||
|
} [
|
||||||
|
h \a {
|
||||||
onclick: ->
|
onclick: ->
|
||||||
self.column := column.id
|
self.extra_properties.column := column.id
|
||||||
} [ column.title ]
|
} [ column.title ]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
on-validation: ->
|
on-validation: ->
|
||||||
if task.id
|
if task.id
|
||||||
todod-ws.edit-task task.id, {
|
todod-ws.edit-task task.id, self
|
||||||
title: self.title
|
|
||||||
description: self.description
|
|
||||||
extra_properties: {
|
|
||||||
column: self.column || ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
todod-ws.add-task project.id, self.title, {
|
todod-ws.add-task project.id, self.title, self
|
||||||
description: self.description
|
|
||||||
extra_properties: {
|
|
||||||
column: self.column || ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, self
|
}, self
|
||||||
|
|
||||||
self.render = ->
|
self.render = ->
|
||||||
|
Loading…
Reference in New Issue
Block a user