Skip to content

Commit ecdfad1

Browse files
committed
Term and Conditions in features
1 parent 45b542f commit ecdfad1

File tree

3 files changed

+34
-42
lines changed

3 files changed

+34
-42
lines changed

services/static-webserver/client/source/class/osparc/study/PricingUnitLicense.js

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,6 @@ qx.Class.define("osparc.study.PricingUnitLicense", {
2929
nullable: true,
3030
event: "changeShowRentButton"
3131
},
32-
33-
licenseUrl: {
34-
check: "String",
35-
init: false,
36-
nullable: true,
37-
event: "changeLicenseUrl"
38-
},
3932
},
4033

4134
statics: {
@@ -97,47 +90,18 @@ qx.Class.define("osparc.study.PricingUnitLicense", {
9790
let msg = this.getUnitData().getName() + this.tr(" will be available until ") + osparc.utils.Utils.formatDate(expirationDate);
9891
msg += "<br>";
9992
msg += `The rental will cost ${nCredits} credits`;
93+
msg += `I hereby accept the Terms and Conditions`;
10094
const confirmationWin = new osparc.ui.window.Confirmation(msg).set({
10195
caption: this.tr("Rent"),
10296
confirmText: this.tr("Rent"),
10397
});
10498

105-
if (this.getLicenseUrl()) {
106-
const useCacheCB = new qx.ui.form.CheckBox().set({
107-
value: false,
108-
label: this.tr("Accept <u>Terms and Conditions</u>"),
109-
rich: true,
110-
});
111-
useCacheCB.getChildControl("label").set({
112-
anonymous: false,
113-
cursor: "pointer",
114-
});
115-
useCacheCB.getChildControl("label").addListener("tap", () => this.__openLicense());
116-
confirmationWin.addWidget(useCacheCB);
117-
confirmationWin.getExtraWidgetsLayout().setPaddingTop(0); // reset paddingTop
118-
useCacheCB.bind("value", confirmationWin.getConfirmButton(), "enabled");
119-
}
120-
12199
confirmationWin.open();
122100
confirmationWin.addListener("close", () => {
123101
if (confirmationWin.getConfirmed()) {
124102
this.fireEvent("rentPricingUnit");
125103
}
126104
}, this);
127105
},
128-
129-
__openLicense: function() {
130-
let rawLink = this.getLicenseUrl() || "";
131-
if (rawLink.includes("github")) {
132-
// make sure the raw version of the link is shown
133-
rawLink += "?raw=true";
134-
}
135-
const mdWindow = new osparc.ui.markdown.MarkdownWindow(rawLink).set({
136-
caption: this.tr("Terms and Conditions"),
137-
width: 800,
138-
height: 600,
139-
});
140-
mdWindow.open();
141-
},
142106
}
143107
});

services/static-webserver/client/source/class/osparc/vipMarket/AnatomicalModelDetails.js

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ qx.Class.define("osparc.vipMarket.AnatomicalModelDetails", {
139139
topGrid.setColumnFlex(0, 1);
140140
const headerLayout = new qx.ui.container.Composite(topGrid);
141141
const anatomicalModel = licensedItemBundleData["licensedResources"][selectedIdx]["source"];
142-
const anatomicalModel = anatomicalModelsData["licensedResources"][selectedIdx]["source"];
143142
let description = anatomicalModel["description"] || "";
144143
description = description.replace(/SPEAG/g, " "); // remove SPEAG substring
145144
const delimiter = " - ";
@@ -257,7 +256,7 @@ qx.Class.define("osparc.vipMarket.AnatomicalModelDetails", {
257256
value: "DOI",
258257
font: "text-14",
259258
alignX: "right",
260-
marginTop: 16,
259+
marginTop: 10,
261260
});
262261
featuresLayout.add(doiTitle, {
263262
column: 0,
@@ -268,7 +267,7 @@ qx.Class.define("osparc.vipMarket.AnatomicalModelDetails", {
268267
const doiLabel = new osparc.ui.basic.LinkLabel("-").set({
269268
font: "text-14",
270269
alignX: "left",
271-
marginTop: 16,
270+
marginTop: 10,
272271
});
273272
if (doi) {
274273
doiLabel.set({
@@ -283,6 +282,23 @@ qx.Class.define("osparc.vipMarket.AnatomicalModelDetails", {
283282
column: 1,
284283
row: idx,
285284
});
285+
idx++;
286+
}
287+
288+
if (licensedItemBundleData["termsOfUseUrl"] || anatomicalModel["termsOfUseUrl"]) { // remove the first one when this info goes down to the model
289+
const tAndC = new qx.ui.basic.Label().set({
290+
font: "text-14",
291+
value: this.tr("<u>Terms and Conditions</u>"),
292+
rich: true,
293+
anonymous: false,
294+
cursor: "pointer",
295+
});
296+
tAndC.addListener("tap", () => this.__openLicense(licensedItemBundleData["termsOfUseUrl"] || anatomicalModel["termsOfUseUrl"]));
297+
featuresLayout.add(tAndC, {
298+
column: 1,
299+
row: idx,
300+
});
301+
idx++;
286302
}
287303

288304
middleLayout.add(featuresLayout);
@@ -293,6 +309,19 @@ qx.Class.define("osparc.vipMarket.AnatomicalModelDetails", {
293309
this.__selectedModelLayout.add(importSection);
294310
},
295311

312+
__openLicense: function(rawLink) {
313+
if (rawLink.includes("github")) {
314+
// make sure the raw version of the link is shown
315+
rawLink += "?raw=true";
316+
}
317+
const mdWindow = new osparc.ui.markdown.MarkdownWindow(rawLink).set({
318+
caption: this.tr("Terms and Conditions"),
319+
width: 800,
320+
height: 600,
321+
});
322+
mdWindow.open();
323+
},
324+
296325
__createImportSection: function(anatomicalModelsData, selectedIdx) {
297326
const importSection = new qx.ui.container.Composite(new qx.ui.layout.VBox().set({
298327
alignX: "center"
@@ -359,7 +388,6 @@ qx.Class.define("osparc.vipMarket.AnatomicalModelDetails", {
359388
});
360389
const pUnit = new osparc.study.PricingUnitLicense(pricingUnit).set({
361390
showRentButton: true,
362-
licenseUrl: licensedItemData["termsOfUseUrl"],
363391
});
364392
pUnit.addListener("rentPricingUnit", () => {
365393
this.fireDataEvent("modelPurchaseRequested", {

services/static-webserver/client/source/class/osparc/vipMarket/MarketWindow.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ qx.Class.define("osparc.vipMarket.MarketWindow", {
2323

2424
osparc.utils.Utils.setIdToWidget(this, "storeWindow");
2525

26-
const width = 1080;
26+
const width = Math.min(1100, window.innerWidth); // since we go over the supported minimum, take the min
2727
const height = 700;
2828
this.set({
2929
width,

0 commit comments

Comments
 (0)