Skip to content

Commit 12264dd

Browse files
committed
dynamic eyes
1 parent 43c5e89 commit 12264dd

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

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

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ qx.Class.define("osparc.desktop.account.ProfilePage", {
4545
members: {
4646
__userProfileData: null,
4747
__userProfileModel: null,
48+
__userProfileRenderer: null,
4849
__userPrivacyData: null,
4950
__userPrivacyModel: null,
5051
__userProfileForm: null,
@@ -79,6 +80,16 @@ qx.Class.define("osparc.desktop.account.ProfilePage", {
7980
"hideFullname": "hideFullname" in privacyData ? privacyData["hideFullname"] : true,
8081
"hideEmail": "hideEmail" in privacyData ? privacyData["hideEmail"] : true,
8182
});
83+
84+
const visibleIcon = "@FontAwesome5Solid/eye/12";
85+
const hiddenIcon = "@FontAwesome5Solid/eye-slash/12";
86+
const icons = {
87+
0: this.__userPrivacyModel.getHideUsername() ? hiddenIcon : visibleIcon,
88+
1: this.__userPrivacyModel.getHideFullname() ? hiddenIcon : visibleIcon,
89+
2: this.__userPrivacyModel.getHideFullname() ? hiddenIcon : visibleIcon,
90+
3: this.__userPrivacyModel.getHideEmail() ? hiddenIcon : visibleIcon,
91+
};
92+
this.__userProfileRenderer.setIcons(icons);
8293
}
8394
},
8495

@@ -111,13 +122,7 @@ qx.Class.define("osparc.desktop.account.ProfilePage", {
111122
form.add(firstName, "First Name", null, "firstName");
112123
form.add(lastName, "Last Name", null, "lastName");
113124
form.add(email, "Email", null, "email");
114-
const icons = {
115-
0: "@FontAwesome5Solid/eye/12",
116-
1: "@FontAwesome5Solid/eye-slash/12",
117-
2: "@FontAwesome5Solid/eye-slash/12",
118-
3: "@FontAwesome5Solid/eye-slash/12",
119-
};
120-
const singleWithIcon = new osparc.ui.form.renderer.SingleWithIcon(form, icons);
125+
const singleWithIcon = this.__userProfileRenderer = new osparc.ui.form.renderer.SingleWithIcon(form);
121126
box.add(singleWithIcon);
122127

123128
const expirationLayout = new qx.ui.container.Composite(new qx.ui.layout.HBox(5)).set({

services/static-webserver/client/source/class/osparc/ui/form/renderer/SingleWithIcon.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ qx.Class.define("osparc.ui.form.renderer.SingleWithIcon", {
3131
members: {
3232
__icons: null,
3333

34-
setIcons(icons) {
34+
setIcons: function(icons) {
3535
this.__icons = icons;
3636

37-
this._render();
37+
this._onFormChange();
3838
},
3939

4040
// overridden

0 commit comments

Comments
 (0)