From 80d3797e6252da0db1911ccc14f85e7402a903c9 Mon Sep 17 00:00:00 2001 From: Luka Vandervelden Date: Thu, 26 Dec 2019 08:18:55 +0100 Subject: [PATCH] Modals have coloured buttons. --- client/modal.ls | 4 ++++ client/project-creation-modal.ls | 3 +++ client/project.ls | 8 ++++++++ client/task-creation-modal.ls | 4 ++++ client/task-removal-modal.ls | 2 ++ client/users-cache.ls | 1 + 6 files changed, 22 insertions(+) diff --git a/client/modal.ls b/client/modal.ls index fe187ea..9c8f760 100644 --- a/client/modal.ls +++ b/client/modal.ls @@ -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 ] ] ] diff --git a/client/project-creation-modal.ls b/client/project-creation-modal.ls index 7d8bbdd..50ad38e 100644 --- a/client/project-creation-modal.ls +++ b/client/project-creation-modal.ls @@ -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" diff --git a/client/project.ls b/client/project.ls index 6cfb2f3..bbd9d91 100644 --- a/client/project.ls +++ b/client/project.ls @@ -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: -> diff --git a/client/task-creation-modal.ls b/client/task-creation-modal.ls index 0d04bbb..24f8b25 100644 --- a/client/task-creation-modal.ls +++ b/client/task-creation-modal.ls @@ -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 [ diff --git a/client/task-removal-modal.ls b/client/task-removal-modal.ls index 4964a1b..dabe77c 100644 --- a/client/task-removal-modal.ls +++ b/client/task-removal-modal.ls @@ -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 diff --git a/client/users-cache.ls b/client/users-cache.ls index a141041..f14bdbb 100644 --- a/client/users-cache.ls +++ b/client/users-cache.ls @@ -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 [