Skip to content

Commit 2057d34

Browse files
committed
optOutMessage
1 parent f665a5c commit 2057d34

File tree

1 file changed

+36
-35
lines changed
  • services/static-webserver/client/source/class/osparc/desktop/account

1 file changed

+36
-35
lines changed

services/static-webserver/client/source/class/osparc/desktop/account/ProfilePage.js

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -216,15 +216,43 @@ qx.Class.define("osparc.desktop.account.ProfilePage", {
216216
},
217217

218218
__createPrivacySection: function() {
219+
// binding to a model
220+
const raw = {
221+
"hideUsername": false,
222+
"hideFullname": true,
223+
"hideEmail": true,
224+
};
225+
226+
const privacyModel = this.__userPrivacyModel = qx.data.marshal.Json.createModel(raw);
227+
219228
const box = osparc.ui.window.TabbedView.createSectionBox(this.tr("Privacy"));
220229
box.set({
221230
alignX: "left",
222231
maxWidth: 500
223232
});
224233

225-
const label = osparc.ui.window.TabbedView.createHelpLabel(this.tr("For Privacy reasons, you might want to hide your First and Last Names and/or the Email to other users"));
234+
const label = osparc.ui.window.TabbedView.createHelpLabel(this.tr("For Privacy reasons, you might want to hide some personal fields."));
226235
box.add(label);
227236

237+
const optOutMessage = new qx.ui.basic.Atom().set({
238+
label: "If all searchable fields are showHidden, you will not be ",
239+
icon: "@FontAwesome5Solid/copy/10",
240+
iconPosition: "right",
241+
gap: 8,
242+
cursor: "pointer",
243+
alignX: "center",
244+
allowGrowX: false,
245+
visibility: "excluded",
246+
});
247+
box.add(optOutMessage);
248+
if (
249+
this.__userPrivacyModel.getHideUsername() &&
250+
this.__userPrivacyModel.getHideFullname() &&
251+
this.__userPrivacyModel.getHideEmail()
252+
) {
253+
optOutMessage.show();
254+
}
255+
228256
const hideUsername = new qx.ui.form.CheckBox().set({
229257
value: false
230258
});
@@ -241,15 +269,7 @@ qx.Class.define("osparc.desktop.account.ProfilePage", {
241269
form.add(hideEmail, "Hide Email", null, "hideEmail");
242270
box.add(new qx.ui.form.renderer.Single(form));
243271

244-
// binding to a model
245-
const raw = {
246-
"hideUsername": false,
247-
"hideFullname": true,
248-
"hideEmail": true,
249-
};
250-
251-
const model = this.__userPrivacyModel = qx.data.marshal.Json.createModel(raw);
252-
const controller = new qx.data.controller.Object(model);
272+
const controller = new qx.data.controller.Object(privacyModel);
253273
controller.addTarget(hideUsername, "value", "hideUsername", true);
254274
controller.addTarget(hideFullname, "value", "hideFullname", true);
255275
controller.addTarget(hideEmail, "value", "hideEmail", true);
@@ -268,14 +288,14 @@ qx.Class.define("osparc.desktop.account.ProfilePage", {
268288
const patchData = {
269289
"privacy": {}
270290
};
271-
if (this.__userPrivacyData["hideUsername"] !== model.getHideUsername()) {
272-
patchData["privacy"]["hideUsername"] = model.getHideUsername();
291+
if (this.__userPrivacyData["hideUsername"] !== privacyModel.getHideUsername()) {
292+
patchData["privacy"]["hideUsername"] = privacyModel.getHideUsername();
273293
}
274-
if (this.__userPrivacyData["hideFullname"] !== model.getHideFullname()) {
275-
patchData["privacy"]["hideFullname"] = model.getHideFullname();
294+
if (this.__userPrivacyData["hideFullname"] !== privacyModel.getHideFullname()) {
295+
patchData["privacy"]["hideFullname"] = privacyModel.getHideFullname();
276296
}
277-
if (this.__userPrivacyData["hideEmail"] !== model.getHideEmail()) {
278-
patchData["privacy"]["hideEmail"] = model.getHideEmail();
297+
if (this.__userPrivacyData["hideEmail"] !== privacyModel.getHideEmail()) {
298+
patchData["privacy"]["hideEmail"] = privacyModel.getHideEmail();
279299
}
280300

281301
if (
@@ -306,25 +326,6 @@ qx.Class.define("osparc.desktop.account.ProfilePage", {
306326
osparc.FlashMessenger.logError(err, this.tr("Unsuccessful privacy update"));
307327
});
308328
}
309-
310-
const optOutMessage = new qx.ui.basic.Atom().set({
311-
label: "If all searchable fields are showHidden, you will not be ",
312-
icon: "@FontAwesome5Solid/copy/10",
313-
iconPosition: "right",
314-
gap: 8,
315-
cursor: "pointer",
316-
alignX: "center",
317-
allowGrowX: false,
318-
visibility: "excluded",
319-
});
320-
box.add(optOutMessage);
321-
if (
322-
this.__userPrivacyModel.getHideUsername() &&
323-
this.__userPrivacyModel.getHideFullname() &&
324-
this.__userPrivacyModel.getHideEmail()
325-
) {
326-
optOutMessage.show();
327-
}
328329
});
329330

330331
return box;

0 commit comments

Comments
 (0)