Skip to content

Commit 79c02d8

Browse files
committed
getInstitutionAlias
1 parent 84da7ef commit 79c02d8

File tree

3 files changed

+46
-28
lines changed

3 files changed

+46
-28
lines changed

services/static-webserver/client/source/class/osparc/auth/ui/RequestAccount.js

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -83,27 +83,12 @@ qx.Class.define("osparc.auth.ui.RequestAccount", {
8383
this._form.add(phone, this.tr("Phone Number"), null, "phone");
8484

8585

86-
const organization = new qx.ui.form.TextField();
87-
doubleSpaced.push(organization);
88-
switch (osparc.product.Utils.getProductName()) {
89-
case "s4l":
90-
this._form.add(organization, this.tr("Company Name"), null, "company");
91-
organization.setRequired(true);
92-
break;
93-
case "s4lacad":
94-
case "s4ldesktopacad":
95-
this._form.add(organization, this.tr("University"), null, "university");
96-
organization.setRequired(true);
97-
break;
98-
case "tiplite":
99-
this._form.add(organization, this.tr("University"), null, "university");
100-
break;
101-
case "tis":
102-
this._form.add(organization, this.tr("Organization"), null, "organization");
103-
break;
104-
case "osparc":
105-
this._form.add(organization, this.tr("Research Group/Organization"), null, "organization");
106-
break;
86+
const institution = new qx.ui.form.TextField();
87+
doubleSpaced.push(institution);
88+
const institutionAlias = osparc.product.Utils.getInstitutionAlias();
89+
this._form.add(institution, institutionAlias.label, null, institutionAlias.key);
90+
if (institutionAlias.required) {
91+
institution.setRequired(true);
10792
}
10893

10994

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ qx.Class.define("osparc.desktop.account.ProfilePage", {
595595
const box = this.self().createSectionBox(this.tr("Contact"));
596596

597597
const institution = new qx.ui.form.TextField().set({
598-
placeholder: this.tr("Institution"),
598+
placeholder: osparc.product.Utils.getInstitutionAlias().label,
599599
readOnly: true,
600600
});
601601

@@ -624,12 +624,12 @@ qx.Class.define("osparc.desktop.account.ProfilePage", {
624624
});
625625

626626
const personalInfoForm = new qx.ui.form.Form();
627-
personalInfoForm.add(institution, "Institution", null, "institution");
628-
personalInfoForm.add(address, "Address", null, "address");
629-
personalInfoForm.add(city, "City", null, "city");
630-
personalInfoForm.add(state, "State", null, "state");
631-
personalInfoForm.add(country, "Country", null, "country");
632-
personalInfoForm.add(postalCode, "Postal Code", null, "postalCode");
627+
personalInfoForm.add(institution, osparc.product.Utils.getInstitutionAlias().label, null, "institution");
628+
personalInfoForm.add(address, this.tr("Address"), null, "address");
629+
personalInfoForm.add(city, this.tr("City"), null, "city");
630+
personalInfoForm.add(state, this.tr("State"), null, "state");
631+
personalInfoForm.add(country, this.tr("Country"), null, "country");
632+
personalInfoForm.add(postalCode, this.tr("Postal Code"), null, "postalCode");
633633
this.__personalInfoRenderer = new qx.ui.form.renderer.Single(personalInfoForm);
634634
box.add(this.__personalInfoRenderer);
635635

services/static-webserver/client/source/class/osparc/product/Utils.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,39 @@ qx.Class.define("osparc.product.Utils", {
155155
return resourceType;
156156
},
157157

158+
getInstitutionAlias: function() {
159+
switch (osparc.product.Utils.getProductName()) {
160+
case "s4l":
161+
return {
162+
label: this.tr("Company Name"),
163+
key: "company",
164+
required: true,
165+
};
166+
case "s4lacad":
167+
case "s4ldesktopacad":
168+
return {
169+
label: this.tr("University"),
170+
key: "university",
171+
required: true,
172+
};
173+
case "tiplite":
174+
return {
175+
label: this.tr("University"),
176+
key: "university",
177+
};
178+
case "tis":
179+
return {
180+
label: this.tr("Organization"),
181+
key: "organization",
182+
};
183+
case "osparc":
184+
return {
185+
label: this.tr("Research Group/Organization"),
186+
key: "organization",
187+
};
188+
}
189+
},
190+
158191
getLogoPath: function(longLogo = true) {
159192
let logosPath = null;
160193
const colorManager = qx.theme.manager.Color.getInstance();

0 commit comments

Comments
 (0)