Modals have coloured buttons.

dev
Luka Vandervelden 2019-12-26 08:18:55 +01:00
parent ddc756191f
commit 80d3797e62
6 changed files with 22 additions and 0 deletions

View File

@ -19,6 +19,8 @@ Modal = (args, caller) ->
on-cancellation: args.on-cancellation || ->
validation-label: args.validation-label || "Ok"
cancellation-label: args.cancellation-label || "Cancel"
validation-classes: args.validation-classes || {}
cancellation-classes: args.cancellation-classes || {}
}
self.render = ->
@ -41,6 +43,7 @@ Modal = (args, caller) ->
onclick: ->
self.visible := false
self.on-validation self
classes: self.validation-classes
} [ self.validation-label ]
]
h \div.column {} [
@ -48,6 +51,7 @@ Modal = (args, caller) ->
onclick: ->
self.visible := false
self.on-cancellation self
classes: self.cancellation-classes
} [ self.cancellation-label ]
]
]

View File

@ -116,6 +116,9 @@ ProjectCreationModal = (args) ->
on-cancellation: ->
self.visible := false
validation-label: if self.project.id then "Edit Project" else "Add Project"
validation-classes: {+"is-success", +"is-outlined"}
content-render: -> [
field {key: \title} [
label "Title"

View File

@ -78,6 +78,10 @@ Project = (self, todod-ws, users-cache) ->
onclick: ->
modal := Modal {
+visible
validation-label: "Delete"
validation-classes: {+"is-danger", +"is-outlined"}
content: [ "Are you sure you want to remove this column?" ]
on-validation: ->
modal.visible := false
@ -162,6 +166,10 @@ Project = (self, todod-ws, users-cache) ->
onclick: ->
modal := Modal {
+visible
validation-label: "Delete"
validation-classes: {+"is-danger", +"is-outlined"}
content:
h \p [ "Are you sure you want to remove board #{self.title}?" ]
on-validation: ->

View File

@ -77,6 +77,10 @@ TaskCreationModal = (project, todod-ws, task, users-cache) ->
modal = Modal {
+visible
validation-label: if task.id then "Edit Task" else "Add Task"
validation-classes: {+"is-success", +"is-outlined"}
content-render: (self) ->
h \div.form [

View File

@ -14,6 +14,8 @@ TaskRemovalModal = (project-id, todod-ws, task) ->
+visible
content: h \div.is-danger [ "Do you want to remove the task ?" ]
validation-label: "Delete"
validation-classes: {+"is-danger", +"is-outlined"}
on-validation: ->
if task.id
todod-ws.remove-task task.id

View File

@ -27,6 +27,7 @@ UsersCache = (authd-ws, on-user) ->
if user = self.get-user uid
h \div.level.user {key: "user-#{uid}"} [
h \div.level-left [
console.log "#{user.login}", user.profile?.avatar
if avatar = user.profile?.avatar
h \div.level-item [
h \figure.image.is-32x32.is-rounded [