From 2e86433d25587a27fb4e0784073b6928a6b7e083 Mon Sep 17 00:00:00 2001
From: Philippe PITTOLI
Date: Fri, 6 Dec 2019 05:04:55 +0100
Subject: [PATCH] adding, editing, removing tasks: done
---
client/project.ls | 14 ++++++++++----
client/task-creation-modal.ls | 24 ++++++++++++++++++++++--
client/task.ls | 2 +-
3 files changed, 33 insertions(+), 7 deletions(-)
diff --git a/client/project.ls b/client/project.ls
index c69bb26..1f18758 100644
--- a/client/project.ls
+++ b/client/project.ls
@@ -17,9 +17,15 @@ Project = (self, todod-ws) ->
|| ((! task.extra_properties || ! task.extra_properties.column) && first)
h \div.column [
- bulma.title 4 column.title
- for task in tasks-to-display
- task.render!
+ h \div.card { key: self.id } [
+ h \div.cart-head [
+ h \p.title.is-4 [ column.titleĀ ]
+ ]
+ h \div.card-content { key: self.id } [
+ for task in tasks-to-display
+ task.render!
+ ]
+ ]
]
self.render = ->
@@ -39,7 +45,7 @@ Project = (self, todod-ws) ->
h \div.navbar-item [
h \div.button.is-success.is-outlined {
onclick: ->
- modal := TaskCreationModal self.id, self.todod-ws
+ modal := TaskCreationModal self, self.todod-ws
} [ "+" ]
]
diff --git a/client/task-creation-modal.ls b/client/task-creation-modal.ls
index 40d2d36..52b8818 100644
--- a/client/task-creation-modal.ls
+++ b/client/task-creation-modal.ls
@@ -2,12 +2,14 @@
h = require 'maquette' .h
Modal = require './modal.ls'
-TaskCreationModal = (project-id, todod-ws, task) ->
+TaskCreationModal = (project, todod-ws, task) ->
task ||= {}
self = {
title: task.title || ""
description: task.description || ""
+ columns: []
+ column: void
}
modal = Modal {
@@ -24,16 +26,34 @@ TaskCreationModal = (project-id, todod-ws, task) ->
oninput: (e) ->
self.description := e.target.value
}
+
+ h \div.menu [
+ h \p.menu-label [ "Choose the column" ]
+ h \ul.menu-list project.extra_properties.columns.map (column) ->
+ h \li [
+ h \a {
+ onclick: ->
+ self.column := column.id
+ } [ column.title ]
+ ]
+
+ ]
]
on-validation: ->
if task.id
todod-ws.edit-task task.id, {
title: self.title
description: self.description
+ extra_properties: {
+ column: self.column || ""
+ }
}
else
- todod-ws.add-task project-id, self.title, {
+ todod-ws.add-task project.id, self.title, {
description: self.description
+ extra_properties: {
+ column: self.column || ""
+ }
}
}
diff --git a/client/task.ls b/client/task.ls
index 977dce7..73535b3 100644
--- a/client/task.ls
+++ b/client/task.ls
@@ -47,7 +47,7 @@ Task = (self, project, todod-ws) ->
]
h \div.button {
onclick: ->
- modal := TaskCreationModal project.id, todod-ws, self
+ modal := TaskCreationModal project, todod-ws, self
} [ "Edit" ]
h \div.button {
onclick: ->