small fixes

This commit is contained in:
Philippe PITTOLI 2019-12-08 04:08:21 +01:00
parent 59af49f314
commit fe814797fd
5 changed files with 51 additions and 47 deletions

View File

@ -187,7 +187,7 @@ model.todod-ws.add-event-listener \list-updated, (message) ->
new-project = Project message.list, model.todod-ws
model.project-list.map (project) ->
model.project-list := model.project-list.map (project) ->
if project.id == message.list.id
new-project
else

View File

@ -11,7 +11,10 @@ Modal = (args, caller) ->
visible: args.visible || false
content: args.content || []
content-render: args.content-render || ->
background-args: args.background-args || []
background-args: args.background-args || { onclick: ->
self.visible := false
self.on-cancellation!
}
on-validation: args.on-validation || ->
on-cancellation: args.on-cancellation || ->
validation-label: args.validation-label || "Ok"
@ -19,8 +22,6 @@ Modal = (args, caller) ->
}
self.render = ->
console.log "Rendering a modal: ", self, self.content
is-active = (if self.visible == true then \.is-active else "")
h \div.modal + is-active, self.modal-args, [
h \div.modal-background self.background-args

View File

@ -8,7 +8,7 @@ col-to-lines = (column, self) ->
h \div.field.has-addons {
key: "field" + column.id
} [
h \p.control [
h \p.control.is-expanded [
h \input.input {
key: "input" + column.id
value: column.title
@ -17,12 +17,10 @@ col-to-lines = (column, self) ->
} [ ]
]
h \div.control.button.is-primary {
h \div.control.button.is-danger.is-outlined {
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" ]
]
@ -45,7 +43,6 @@ ProjectCreationModal = (project, todod-ws) ->
for col in project.extra_properties.columns
new-col = {}
for k,v of col
# console.log "element : ", k, "value: ", v
new-col[k] = v
columns-copy ++= [ new-col ]
@ -67,8 +64,6 @@ ProjectCreationModal = (project, todod-ws) ->
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 {
@ -81,8 +76,6 @@ ProjectCreationModal = (project, todod-ws) ->
h \hr []
bulma.field [
# console.log "NEW USER NAME: " + self.new-user
# bulma.label "Valeur actuelle : " + self.new-user
bulma.label "Adding a user"
bulma.input {
value: self.new-user
@ -117,15 +110,19 @@ ProjectCreationModal = (project, todod-ws) ->
h \hr []
h \div.field.has-addons {
key: "adding-field"
} [
h \p.control.is-expanded [
h \input.input {
value: self.new-column-input.title
oninput: (e) ->
self.new-column-input.title := e.target.value
} [ ]
]
h \div.button {
h \div.control.button.is-success.is-outlined {
onclick: ->
# TODO: create a new entry in self.extra_properties.columns
new-col = {
id: UUID!
title: self.new-column-input.title
@ -135,6 +132,8 @@ ProjectCreationModal = (project, todod-ws) ->
} [ "+" ]
]
]
on-validation: ->
if project.id
todod-ws.edit-list project.id, self

View File

@ -28,15 +28,11 @@ Project = (self, todod-ws) ->
self.render-column = (column, first) ->
console.log "tasks: ", self.tasks
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 {
key: column.id
} [
@ -86,7 +82,6 @@ Project = (self, todod-ws) ->
self.render = ->
# console.log "Project to render: ", self
h \div.project {} [
h \div.columns [

View File

@ -2,6 +2,26 @@
h = require 'maquette' .h
Modal = require './modal.ls'
column-form-selection = (self, column) ->
checked = false
if self.extra_properties && self.extra_properties.column == column.id
checked = true
h \label.radio [
column.title
h \input {
type: "radio"
name: "column"
checked: checked
value: column.title
onclick: ->
self.extra_properties.column := column.id
} [ ]
]
TaskCreationModal = (project, todod-ws, task) ->
task ||= {}
@ -33,21 +53,10 @@ TaskCreationModal = (project, todod-ws, task) ->
self.description := e.target.value
}
h \aside.menu [
h \p.menu-label [ "Choose the column" ]
h \ul.menu-list project.extra_properties.columns.map (column) ->
h \li {
classes: {
is-active: self.extra_properties && self.extra_properties.column == column.id
}
} [
h \a {
onclick: ->
self.extra_properties.column := column.id
} [ column.title ]
]
]
h \p [ "Choose the column" ]
h \div.control project.extra_properties.columns.map (column) -> column-form-selection self, column
]
on-validation: ->