From 2431232416bbe053e7498997689377eb7a0f5143 Mon Sep 17 00:00:00 2001
From: Torsten Oppermann <torsten@sgalinski.de>
Date: Wed, 25 Apr 2018 14:39:49 +0200
Subject: [PATCH] [TASK] Review feedback

---
 Resources/Private/Language/de.locallang.xlf        |  2 +-
 Resources/Private/Language/locallang.xlf           |  2 +-
 Resources/Private/Language/zh.locallang.xlf        |  4 ++--
 Resources/Private/Templates/Joblist/ApplyForm.html |  2 ++
 Resources/Public/JavaScript/sgJobs.js              | 13 +++++++++----
 5 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/Resources/Private/Language/de.locallang.xlf b/Resources/Private/Language/de.locallang.xlf
index 080121a3..9d4e0732 100644
--- a/Resources/Private/Language/de.locallang.xlf
+++ b/Resources/Private/Language/de.locallang.xlf
@@ -139,7 +139,7 @@
 			<target>Bitte wählen Sie eine der folgenden Seiten aus:</target>
 		</trans-unit>
 		<trans-unit id="error.maxFileSizeMessage" approved="yes">
-			<source>The selected File is too big!</source>
+			<source>The selected file exceeds the maximum filesize</source>
 			<target>Die ausgewählte Datei ist zu groß!</target>
 		</trans-unit>
 		<trans-unit id="frontend.allVacancies" approved="yes">
diff --git a/Resources/Private/Language/locallang.xlf b/Resources/Private/Language/locallang.xlf
index 18639fe8..a28b09f6 100644
--- a/Resources/Private/Language/locallang.xlf
+++ b/Resources/Private/Language/locallang.xlf
@@ -106,7 +106,7 @@
 			<source>Please select one of the following pages:</source>
 		</trans-unit>
 		<trans-unit id="error.maxFileSizeMessage">
-			<source>The selected File is too big!</source>
+			<source>The selected file exceeds the maximum filesize</source>
 		</trans-unit>
 		<trans-unit id="frontend.allVacancies">
 			<source>All vacancies</source>
diff --git a/Resources/Private/Language/zh.locallang.xlf b/Resources/Private/Language/zh.locallang.xlf
index e7b12a6b..f804284f 100644
--- a/Resources/Private/Language/zh.locallang.xlf
+++ b/Resources/Private/Language/zh.locallang.xlf
@@ -62,8 +62,8 @@
 			<target>邮编</target>
 		</trans-unit>
 		<trans-unit id="error.maxFileSizeMessage" approved="yes">
-			<source>The selected File is too big!</source>
-			<target>The selected File is too big!</target>
+			<source>The selected file exceeds the maximum filesize</source>
+			<target>The selected file exceeds the maximum filesize</target>
 		</trans-unit>
 		<trans-unit id="frontend.allVacancies" approved="yes">
 			<source>All vacancies</source>
diff --git a/Resources/Private/Templates/Joblist/ApplyForm.html b/Resources/Private/Templates/Joblist/ApplyForm.html
index bb438f45..eb0929ba 100644
--- a/Resources/Private/Templates/Joblist/ApplyForm.html
+++ b/Resources/Private/Templates/Joblist/ApplyForm.html
@@ -14,6 +14,8 @@
 		</f:if>
 	</div>
 	<div class="default-content-element">
+		<input id="maxFileSize" type="hidden" data-maxFileSize="{maxFileSize}" />
+		<input id="maxFileSizeMessage" type="hidden" data-maxFileSizeMessage="{maxFileSizeMessage}" />
 		<f:form action="apply" controller="Joblist" method="post" name="applyData" object="{applyData}" enctype="multipart/form-data">
 			<f:if condition="{job}">
 				<f:then>
diff --git a/Resources/Public/JavaScript/sgJobs.js b/Resources/Public/JavaScript/sgJobs.js
index 28040eb7..a1868594 100644
--- a/Resources/Public/JavaScript/sgJobs.js
+++ b/Resources/Public/JavaScript/sgJobs.js
@@ -44,14 +44,19 @@ export default class SgJobs {
 	 *
 	 * @private
 	 */
-	_filterJoblist() {
+	static _filterJoblist() {
 		$('#sgjobs-filter').submit();
 	}
 
-	_checkFileSize() {
-		if (this.files[0].size > document.querySelector('#maxFileSize').getAttribute('data-maxFilesize') * 1000) {
+	/**
+	 * Check the file size of the upload fields
+	 *
+	 * @private
+	 */
+	_checkFileSize(event) {
+		if (event.currentTarget.files[0].size > document.querySelector('#maxFileSize').getAttribute('data-maxFilesize') * 1000) {
 			alert(document.querySelector('#maxFileSizeMessage').getAttribute('data-maxFileSizeMessage'));
 			this.value = "";
-		};
+		}
 	}
 }
-- 
GitLab