Ver Fonte

Fix project auto-generated name not stopping after encountering word with bracket

Alan Lam há 2 anos atrás
pai
commit
0293d58bfa
1 ficheiros alterados com 7 adições e 3 exclusões
  1. 7 3
      public/js/app-project-form.js

+ 7 - 3
public/js/app-project-form.js

@@ -209,10 +209,14 @@ function autogenProjectName() {
 	const timeOfDay = $("#time-of-day").find("option:selected").text();
 	const timeOfDay = $("#time-of-day").find("option:selected").text();
 
 
 	const templateWords = templateName.split(" ");
 	const templateWords = templateName.split(" ");
-	const templateWordCount = templateWords.length;
 	const templateInitials = [];
 	const templateInitials = [];
-	for(let i = 0; i < templateWordCount; i++) {
-		templateInitials.push(templateWords[i].charAt(0));
+
+	for(const templateWord of templateWords) {
+		const initial = templateWord.charAt(0);
+		if(initial === "(") {
+			break;
+		}
+		templateInitials.push(templateWord.charAt(0));
 	}
 	}
 
 
 	const templateKeys = getCheckedTemplateKeys();
 	const templateKeys = getCheckedTemplateKeys();