Skip to content

Commit 7ad4728

Browse files
committed
refactor
1 parent 98eeca5 commit 7ad4728

File tree

1 file changed

+15
-20
lines changed
  • services/static-webserver/client/source/class/osparc/ui/window

1 file changed

+15
-20
lines changed

services/static-webserver/client/source/class/osparc/ui/window/Confirmation.js

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ qx.Class.define("osparc.ui.window.Confirmation", {
4040
check: [null, "create", "warning", "delete"],
4141
init: null,
4242
nullable: true,
43-
apply: "__applyConfirmAppearance"
43+
event: "changeConfirmAction",
4444
},
4545

4646
confirmed: {
@@ -50,7 +50,6 @@ qx.Class.define("osparc.ui.window.Confirmation", {
5050
},
5151

5252
members: {
53-
5453
_createChildControlImpl: function(id) {
5554
let control;
5655
switch (id) {
@@ -64,6 +63,20 @@ qx.Class.define("osparc.ui.window.Confirmation", {
6463
this.setConfirmed(true);
6564
this.close(1);
6665
}, this);
66+
this.bind("confirmAction", control, "appearance", {
67+
converter: value => {
68+
switch (value) {
69+
case "create":
70+
return "strong-button";
71+
case "warning":
72+
return "warning-button";
73+
case "delete":
74+
return "danger-button";
75+
default:
76+
return "strong-button";
77+
}
78+
}
79+
});
6780
const command = new qx.ui.command.Command("Enter");
6881
control.setCommand(command);
6982
const btnsLayout = this.getChildControl("buttons-layout");
@@ -81,23 +94,5 @@ qx.Class.define("osparc.ui.window.Confirmation", {
8194
getCancelButton: function() {
8295
return this.getChildControl("cancel-button");
8396
},
84-
85-
__applyConfirmAppearance: function(confirmationAction) {
86-
const confirmButton = this.getChildControl("confirm-button");
87-
switch (confirmationAction) {
88-
case "create":
89-
confirmButton.setAppearance("strong-button");
90-
break;
91-
case "warning":
92-
confirmButton.setAppearance("warning-button");
93-
break;
94-
case "delete":
95-
confirmButton.setAppearance("danger-button");
96-
break;
97-
default:
98-
confirmButton.resetAppearance();
99-
break;
100-
}
101-
}
10297
}
10398
});

0 commit comments

Comments
 (0)