changeset 1343:8729d2708f65

browser (dialog): color of `OK` button can be specified: `ok_color` argument can be for the moment either `confirm` or `danger`
author Goffi <goffi@goffi.org>
date Mon, 24 Aug 2020 22:53:15 +0200
parents 1df0d1b28b83
children 472267dcd4d8
files libervia/pages/_browser/dialog.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libervia/pages/_browser/dialog.py	Mon Aug 24 22:52:04 2020 +0200
+++ b/libervia/pages/_browser/dialog.py	Mon Aug 24 22:53:15 2020 +0200
@@ -6,10 +6,12 @@
 
 class Confirm:
 
-    def __init__(self, message, ok_label="", cancel_label=""):
+    def __init__(self, message, ok_label="", cancel_label="", ok_color="success"):
         self._tpl = Template("dialogs/confirm.html")
         self.message = message
         self.ok_label = ok_label
+        assert ok_color in ("success", "danger")
+        self.ok_color = ok_color
         self.cancel_label = cancel_label
 
     def cancel_cb(self, evt, notif_elt):
@@ -21,6 +23,7 @@
         notif_elt = self._tpl.get_elt({
             "message": self.message,
             "ok_label": self.ok_label,
+            "ok_color": self.ok_color,
             "cancel_label": self.cancel_label,
         })