-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Integrate instructor request form FE with API * Remove redundant statement * Move URL regex const to backend const file * Fix import path * Move URL regex to FieldValidator * Add validators to match backend fields * Add error message box * Change submit button display when loading * Combine final action into subscribe * Add max length validators for institution and country * Fix lint errors * Add test cases to test submission * Add specific error messages for form validation * Remove home page URL field * Fix lint errors * Remove url regex from test * Update snap * Clean up test code * Remove comment about home page URL * Change canSubmit check to getter * Fix form submit button not re-enabling on error * Add name pattern validator to front-end * Fix snapshot
- Loading branch information
Showing
13 changed files
with
254 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package teammates.ui.constants; | ||
|
||
import com.fasterxml.jackson.annotation.JsonValue; | ||
|
||
import teammates.common.util.FieldValidator; | ||
|
||
/** | ||
* Special constants used by the back-end. | ||
*/ | ||
public enum ApiStringConst { | ||
// CHECKSTYLE.OFF:JavadocVariable | ||
EMAIL_REGEX(escapeRegex(FieldValidator.REGEX_EMAIL)); | ||
// CHECKSTYLE.ON:JavadocVariable | ||
|
||
private final Object value; | ||
|
||
ApiStringConst(Object value) { | ||
this.value = value; | ||
} | ||
|
||
@JsonValue | ||
public Object getValue() { | ||
return value; | ||
} | ||
|
||
/** | ||
* Escape regex pattern strings to ensure the pattern remains valid when converted to JS. | ||
*/ | ||
private static String escapeRegex(String regexStr) { | ||
String escapedRegexStr = regexStr; | ||
// Double escape backslashes | ||
escapedRegexStr = escapedRegexStr.replace("\\", "\\\\"); | ||
// Replace possessive zero or more times quantifier *+ that the email pattern uses | ||
// with greedy zero or more times quantifier * | ||
// as possessive quantifiers are not supported in JavaScript | ||
escapedRegexStr = escapedRegexStr.replace("*+", "*"); | ||
return escapedRegexStr; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,3 +20,7 @@ label.qn { | |
.red-font { | ||
color: red; | ||
} | ||
|
||
.error-box { | ||
margin: 1rem 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.