Skip to content

Commit

Permalink
edit to root
Browse files Browse the repository at this point in the history
  • Loading branch information
odeimaiz committed Dec 9, 2024
1 parent bc7cea9 commit 9e4b9aa
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ qx.Class.define("osparc.pricing.UnitsList", {
let pUnit = null;
if (pricingUnit.getClassification() === "LICENSE") {
pUnit = new osparc.study.PricingUnitLicense(pricingUnit).set({
showEditButton: true,
showRentButton: false,
});
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ qx.Class.define("osparc.study.PricingUnit", {
init: null,
apply: "_buildLayout"
},

showEditButton: {
check: "Boolean",
init: false,
nullable: true,
event: "changeShowEditButton"
},
},

members: {
Expand All @@ -56,6 +63,10 @@ qx.Class.define("osparc.study.PricingUnit", {
});
this._add(control);
break;
case "edit-button":
control = new qx.ui.form.Button(qx.locale.Manager.tr("Edit"));
this._add(control);
break;
}
return control || this.base(arguments, id);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ qx.Class.define("osparc.study.PricingUnitLicense", {
properties: {
showRentButton: {
check: "Boolean",
init: true,
init: false,
nullable: true,
event: "changeShowRentButton"
},
Expand Down Expand Up @@ -56,6 +56,13 @@ qx.Class.define("osparc.study.PricingUnitLicense", {
converter: v => qx.locale.Manager.tr("Credits") + ": " + v
});

// add edit button
const editButton = this.getChildControl("edit-button");
this.bind("showEditButton", editButton, "visibility", {
converter: show => show ? "visible" : "excluded"
})
editButton.addListener("execute", () => this.fireEvent("editPricingUnit"));

// add rent button
const rentButton = this.getChildControl("rent-button");
this.bind("showRentButton", rentButton, "visibility", {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,6 @@ qx.Class.define("osparc.study.PricingUnitTier", {
nullable: true,
event: "changeShowUnitExtraInfo"
},

showEditButton: {
check: "Boolean",
init: false,
nullable: true,
event: "changeShowEditButton"
},
},

members: {
Expand All @@ -62,10 +55,6 @@ qx.Class.define("osparc.study.PricingUnitTier", {
});
this._add(control);
break;
case "edit-button":
control = new qx.ui.form.Button(qx.locale.Manager.tr("Edit"));
this._add(control);
break;
}
return control || this.base(arguments, id);
},
Expand Down

0 comments on commit 9e4b9aa

Please sign in to comment.