From 858f6ee54bb366fbb79d2966d6c2212cc6b01370 Mon Sep 17 00:00:00 2001 From: Sergiu-Lucian Petrica <sergiu@die-lobby.de> Date: Mon, 11 Dec 2017 14:41:35 +0200 Subject: [PATCH] Various jobs corrections --- Classes/Controller/Ajax/JoblistController.php | 10 ++-- Classes/Controller/JoblistController.php | 2 + Classes/Service/FrontendFilterService.php | 2 +- README.md | 5 ++ Resources/Private/Language/de.locallang.xlf | 46 ++++++++++--------- Resources/Private/Language/locallang.xlf | 27 ++++++----- .../Private/Templates/Joblist/ApplyForm.html | 10 +++- Resources/Public/JavaScript/fileAjax.js | 23 ++++++++++ 8 files changed, 84 insertions(+), 41 deletions(-) diff --git a/Classes/Controller/Ajax/JoblistController.php b/Classes/Controller/Ajax/JoblistController.php index 227f5f8f..320a8ee2 100644 --- a/Classes/Controller/Ajax/JoblistController.php +++ b/Classes/Controller/Ajax/JoblistController.php @@ -27,7 +27,6 @@ namespace SGalinski\SgJobs\Controller\Ajax; ***************************************************************/ use SGalinski\SgAjax\Controller\Ajax\AbstractAjaxController; -use SGalinski\SgJobs\Domain\Repository\JobRepository; use SGalinski\SgJobs\Service\BackendService; use SGalinski\SgJobs\Service\FrontendFilterService; use TYPO3\CMS\Core\Resource\ResourceFactory; @@ -70,7 +69,7 @@ class JoblistController extends AbstractAjaxController { $this->view->assign('countries', $this->companyRepository->getAllCountries($siteRootId)); // set all filtered jobs - $this->view->assign('jobs', FrontendFilterService::getJobs($filters,$siteRootId)); + $this->view->assign('jobs', FrontendFilterService::getJobs($filters, $siteRootId)); // set default selected values $this->view->assign('selectedCountry', $filters['country']); @@ -84,13 +83,14 @@ class JoblistController extends AbstractAjaxController { * Delete an uploaded file from temp storage * * @return void + * @throws \TYPO3\CMS\Core\Resource\Exception\InsufficientFileAccessPermissionsException + * @throws \TYPO3\CMS\Core\Resource\Exception\FileOperationErrorException + * @throws \InvalidArgumentException */ public function deleteTempFileAction() { $file = $_POST['file']; $type = $_POST['type']; - $resourceFactory = GeneralUtility::makeInstance( - ResourceFactory::class - ); + $resourceFactory = GeneralUtility::makeInstance(ResourceFactory::class); $storage = $resourceFactory->getStorageObject(1); $fileObject = $storage->getFile('/Extension/temp/' . $GLOBALS['TSFE']->fe_user->id . '/' . $type . '/' . $file); $storage->deleteFile($fileObject); diff --git a/Classes/Controller/JoblistController.php b/Classes/Controller/JoblistController.php index 53d98e88..0165a4d0 100644 --- a/Classes/Controller/JoblistController.php +++ b/Classes/Controller/JoblistController.php @@ -93,6 +93,8 @@ class JoblistController extends ActionController { } $allowedMimeTypes = $this->settings['allowedMimeTypes']; $this->view->assign('allowedMimeTypes', $allowedMimeTypes); + $allowedFileExtensions = $this->settings['allowedFileExtensions']; + $this->view->assign('allowedFileExtensions', $allowedFileExtensions); } /** diff --git a/Classes/Service/FrontendFilterService.php b/Classes/Service/FrontendFilterService.php index ff5fe91a..5f64a69a 100644 --- a/Classes/Service/FrontendFilterService.php +++ b/Classes/Service/FrontendFilterService.php @@ -229,7 +229,7 @@ class FrontendFilterService { 'tx_sgjobs_domain_model_company' ); - $statement = $queryBuilder->select('a.function') + $statement = $queryBuilder->select('a.job_function') ->from('tx_sgjobs_domain_model_job', 'a') ->join( 'a', 'tx_sgjobs_domain_model_company', 'b' diff --git a/README.md b/README.md index a778a9e4..b7ba84b2 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,11 @@ The Backend module is found in the **WEB** section under the name **Job Offers** You can create a new job offer by clicking on the **New Job Offer** button. +## Job form page +When inserting the joblist plugin on a page, make sure to select the page which +contains the application form from +Plugin -> Plugin Options -> Page containing the application form + ## Automated Email Messages The extension uses **sg_mail** to configure email templates for the following email messages: diff --git a/Resources/Private/Language/de.locallang.xlf b/Resources/Private/Language/de.locallang.xlf index 68abb10f..1cfb68b1 100644 --- a/Resources/Private/Language/de.locallang.xlf +++ b/Resources/Private/Language/de.locallang.xlf @@ -123,20 +123,20 @@ <target>Zeugnisse</target> </trans-unit> <trans-unit id="frontend.apply.city" approved="yes"> - <source>City</source> - <target>Ort</target> + <source>City *</source> + <target>Ort *</target> </trans-unit> <trans-unit id="frontend.apply.country" approved="yes"> - <source>Country</source> - <target>Land</target> + <source>Country *</source> + <target>Land *</target> </trans-unit> <trans-unit id="frontend.apply.nationality" approved="yes"> - <source>Nationality</source> - <target>Nationalität</target> + <source>Nationality *</source> + <target>Nationalität *</target> </trans-unit> <trans-unit id="frontend.apply.education" approved="yes"> - <source>Highest achieved education</source> - <target>Höchster Abschluss</target> + <source>Highest achieved education *</source> + <target>Höchster Abschluss *</target> </trans-unit> <trans-unit id="frontend.apply.birthDate" approved="yes"> <source>Birth date</source> @@ -146,21 +146,25 @@ <source>Cover letter</source> <target>Motivationsschreiben</target> </trans-unit> + <trans-unit id="frontend.apply.allowed_file_extensions" approved="yes"> + <source>File types: </source> + <target>Datentypen: </target> + </trans-unit> <trans-unit id="frontend.apply.cv" approved="yes"> <source>CV</source> <target>Lebenslauf</target> </trans-unit> <trans-unit id="frontend.apply.email" approved="yes"> - <source>Email</source> - <target>E-Mail</target> + <source>Email *</source> + <target>E-Mail *</target> </trans-unit> <trans-unit id="frontend.apply.first_name" approved="yes"> - <source>First name</source> - <target>Vorname</target> + <source>First name *</source> + <target>Vorname *</target> </trans-unit> <trans-unit id="frontend.apply.last_name" approved="yes"> - <source>Last name</source> - <target>Nachname</target> + <source>Last name *</source> + <target>Nachname *</target> </trans-unit> <trans-unit id="frontend.apply.message" approved="yes"> <source>Message</source> @@ -171,8 +175,8 @@ <target>Mobil</target> </trans-unit> <trans-unit id="frontend.apply.phone" approved="yes"> - <source>Phone</source> - <target>Telefon</target> + <source>Phone *</source> + <target>Telefon *</target> </trans-unit> <trans-unit id="frontend.apply.salutation" approved="yes"> <source>Salutation</source> @@ -183,16 +187,16 @@ <target>Geschlecht</target> </trans-unit> <trans-unit id="frontend.apply.street" approved="yes"> - <source>Street</source> - <target>Straße</target> + <source>Street *</source> + <target>Straße *</target> </trans-unit> <trans-unit id="frontend.apply.thank_you" approved="yes"> <source>Thank you for your application!</source> <target>Vielen Dank für Ihre Bewerbung!</target> </trans-unit> <trans-unit id="frontend.apply.title" approved="yes"> - <source>Job title</source> - <target>Job-Titel</target> + <source>Job title *</source> + <target>Job-Titel *</target> </trans-unit> <trans-unit id="frontend.apply.zip" approved="yes"> <source>Zip code</source> @@ -207,7 +211,7 @@ <target>Initiativ-Bewerbung</target> </trans-unit> <trans-unit id="frontend.apply_by_mail" approved="yes"> - <source>Appy by mail</source> + <source>Apply by mail</source> <target>Bewerbung per Post</target> </trans-unit> <trans-unit id="frontend.area" approved="yes"> diff --git a/Resources/Private/Language/locallang.xlf b/Resources/Private/Language/locallang.xlf index ea6b463a..0b09d6e1 100644 --- a/Resources/Private/Language/locallang.xlf +++ b/Resources/Private/Language/locallang.xlf @@ -94,16 +94,16 @@ <source>Certificates</source> </trans-unit> <trans-unit id="frontend.apply.city"> - <source>City</source> + <source>City *</source> </trans-unit> <trans-unit id="frontend.apply.country"> - <source>Country</source> + <source>Country *</source> </trans-unit> - <trans-unit id="frontend.apply.country"> - <source>Nationality</source> + <trans-unit id="frontend.apply.nationality"> + <source>Nationality *</source> </trans-unit> <trans-unit id="frontend.apply.education"> - <source>Highest achieved education</source> + <source>Highest achieved education *</source> </trans-unit> <trans-unit id="frontend.apply.birthDate"> <source>Birth date</source> @@ -111,17 +111,20 @@ <trans-unit id="frontend.apply.cover_letter"> <source>Cover letter</source> </trans-unit> + <trans-unit id="frontend.apply.allowed_file_extensions" approved="yes"> + <source>File types: </source> + </trans-unit> <trans-unit id="frontend.apply.cv"> <source>CV</source> </trans-unit> <trans-unit id="frontend.apply.email"> - <source>Email</source> + <source>Email *</source> </trans-unit> <trans-unit id="frontend.apply.first_name"> - <source>First name</source> + <source>First name *</source> </trans-unit> <trans-unit id="frontend.apply.last_name"> - <source>Last name</source> + <source>Last name *</source> </trans-unit> <trans-unit id="frontend.apply.message"> <source>Message</source> @@ -130,7 +133,7 @@ <source>Mobile</source> </trans-unit> <trans-unit id="frontend.apply.phone"> - <source>Phone</source> + <source>Phone *</source> </trans-unit> <trans-unit id="frontend.apply.salutation"> <source>Salutation</source> @@ -139,13 +142,13 @@ <source>Gender</source> </trans-unit> <trans-unit id="frontend.apply.street"> - <source>Street</source> + <source>Street *</source> </trans-unit> <trans-unit id="frontend.apply.thank_you"> <source>Thank you for your application!</source> </trans-unit> <trans-unit id="frontend.apply.title"> - <source>Job title</source> + <source>Job title *</source> </trans-unit> <trans-unit id="frontend.apply.zip"> <source>Zip code</source> @@ -157,7 +160,7 @@ <source>Apply to an unlisted position</source> </trans-unit> <trans-unit id="frontend.apply_by_mail"> - <source>Appy by mail</source> + <source>Apply by mail</source> </trans-unit> <trans-unit id="frontend.area"> <source>Area</source> diff --git a/Resources/Private/Templates/Joblist/ApplyForm.html b/Resources/Private/Templates/Joblist/ApplyForm.html index c405fe93..918cc165 100644 --- a/Resources/Private/Templates/Joblist/ApplyForm.html +++ b/Resources/Private/Templates/Joblist/ApplyForm.html @@ -14,7 +14,7 @@ </f:form.validationResults> <br /> <label for="apply-gender"><f:translate key="frontend.apply.gender" /></label> - <f:form.select property="gender" id="apply-gender" data="{}" class="" options="{None: '', Male: 'Male', Female: 'Female'}" /> + <f:form.select property="gender" id="apply-gender" data="{}" class="" options="{Male: 'Male', Female: 'Female'}" /> <f:form.validationResults for="applyData.gender"> <f:for each="{validationResults.errors}" as="error"> <div class="sg-jobs-validation-error"> @@ -134,7 +134,7 @@ </f:form.validationResults> <br /> <label for="apply-email"><f:translate key="frontend.apply.email" /></label> - <f:form.textfield property="email" id="apply-email" data="{}" class="" /> + <f:form.textfield type="email" property="email" id="apply-email" data="{}" class="" /> <f:form.validationResults for="applyData.email"> <f:for each="{validationResults.errors}" as="error"> <div class="sg-jobs-validation-error"> @@ -144,6 +144,8 @@ </f:form.validationResults> <br /> <label for="apply-cover-letter"><f:translate key="frontend.apply.cover_letter" /></label> + <br/> + <label for="apply-cover-letter"><f:translate key="frontend.apply.allowed_file_extensions" />{allowedFileExtensions}</label> <f:form.upload multiple="true" property="coverLetter" id="apply-cover-letter" additionalAttributes="{accept: '{allowedMimeTypes}'}" /> <f:for each="{uploadedFiles.coverLetter}" as="file"> <div class="sg-jobs-uploaded-file"> @@ -160,6 +162,8 @@ </f:form.validationResults> <br /> <label for="apply-cv"><f:translate key="frontend.apply.cv" /></label> + <br/> + <label for="apply-cover-letter"><f:translate key="frontend.apply.allowed_file_extensions" />{allowedFileExtensions}</label> <f:form.upload multiple="true" property="cv" id="apply-cv" additionalAttributes="{accept: '{allowedMimeTypes}'}" /> <f:for each="{uploadedFiles.cv}" as="file"> <div class="sg-jobs-uploaded-file"> @@ -176,6 +180,8 @@ </f:form.validationResults> <br /> <label for="apply-certificates"><f:translate key="frontend.apply.certificates" /></label> + <br/> + <label for="apply-cover-letter"><f:translate key="frontend.apply.allowed_file_extensions" />{allowedFileExtensions}</label> <f:form.upload multiple="true" property="certificates" id="apply-certificates" additionalAttributes="{accept: '{allowedMimeTypes}'}" /> <f:for each="{uploadedFiles.certificates}" as="file"> <div class="sg-jobs-uploaded-file"> diff --git a/Resources/Public/JavaScript/fileAjax.js b/Resources/Public/JavaScript/fileAjax.js index 9aa544cf..209de4c2 100644 --- a/Resources/Public/JavaScript/fileAjax.js +++ b/Resources/Public/JavaScript/fileAjax.js @@ -12,6 +12,7 @@ export default class FileAjax { */ constructor() { $('.remove-file').on('click', this._removeFile); + $('.sgjobs-select').on('change', this._filterJoblist()); } /** @@ -34,4 +35,26 @@ export default class FileAjax { currentElement.parent().remove(); }); } + + /** + * + * @private + */ + _filterJoblist() { + $.post( + '?eID=sgAjax&extensionName=SgJobs&controller=Ajax%5CJoblist&action=filter&format=html', + { + parameters: { + country: $('#filter-countries').val(), + location: $('#filter-locations').val(), + company: $('#filter-companies').val(), + area: $('#filter-areas').val(), + function: $('#filter-functions').val(), + } + } + ).done(function(result) { + // replace filter & job list with result from ajax controller + $('#sgjobs-joblist').html(result); + }); + } } -- GitLab