Skip to content

Commit

Permalink
Merge branch 'master' into production
Browse files Browse the repository at this point in the history
  • Loading branch information
HejdaJakub committed Jul 4, 2023
2 parents 063c3c3 + cc0682b commit 361fd5b
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ public interface PerunRegistrarTranslation extends PerunTranslation {
@DefaultMessage("You must select at least one option!")
public String cantBeEmptyCheckBox();

@DefaultMessage("You must check this box!")
public String cantBeEmptySingleCheckBox();

@DefaultMessage("Incorrect email address format!")
public String incorrectEmail();

Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ public boolean validateLocal(Checkbox checkbox) {
} else {
// single checkbox - prefer own error message
setResult(Result.EMPTY);
checkbox.setRawStatus(getErrorMsgOrDefault(checkbox), ValidationState.ERROR);
String msg = getErrorMsgOrDefault(checkbox);
if (msg.equals(getTransl().incorrectFormat())) {
msg = getTransl().cantBeEmptySingleCheckBox();
}
checkbox.setRawStatus(msg, ValidationState.ERROR);
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ duplicateKeys=Každý klíč musí být unikátní!
cantBeEmpty=Položka <b>nesmí být prázdná!</b>
cantBeEmptySelect=Musíte vybrat jednu z možností!
cantBeEmptyCheckBox=Musíte vybrat alespoň jednu možnost!
cantBeEmptySingleCheckBox=Tuhle položku musíte označit!
incorrectEmail=Neplatný formát e-mailové adresy!
checkAndSubmit=Zkontrolovat a odeslat formulář
passEmpty=Heslo <b>nesmí být prázdné!</b>
Expand Down

0 comments on commit 361fd5b

Please sign in to comment.