Skip to content

Commit

Permalink
fix(registrar): use shorter names of ebmedded groups withou prefix
Browse files Browse the repository at this point in the history
* Use the group names in embedded group form item (for group) without prefix.
* This change is applied only for group forms.
  • Loading branch information
HejdaJakub committed Jun 22, 2023
1 parent a4d2119 commit 4ae277d
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package cz.metacentrum.perun.wui.registrar.widgets.items;

import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Widget;
import cz.metacentrum.perun.wui.model.beans.ApplicationFormItemData;
import cz.metacentrum.perun.wui.model.beans.ApplicationFormItemTexts;
Expand All @@ -24,6 +25,25 @@ public GroupCheckBox(PerunForm form, ApplicationFormItemData item, String lang)

private boolean preview = false;

@Override
protected Widget initWidget() {
super.initWidget();

boolean isGroupApplication = Window.Location.getParameter("group") != null;
if (isGroupApplication) {
for (Widget widget : getWidget()) {
if (widget instanceof CheckBox) {
CheckBox checkBox = (CheckBox) widget;
String[] parsedGroupName = checkBox.getText().split(Window.Location.getParameter("group") + ":");
// use group name without parent group prefix
checkBox.setText(parsedGroupName[1]);
}
}
}

return getWidget();
}

@Override
protected Widget initWidgetOnlyPreview() {
setSelectOptionsFromValue();
Expand Down

0 comments on commit 4ae277d

Please sign in to comment.