From 953d975e5d6c4297657a423b7640b3fd93f8a544 Mon Sep 17 00:00:00 2001 From: Michael Kessler <michael.kessler@sgalinski.de> Date: Wed, 11 Nov 2020 14:05:25 +0100 Subject: [PATCH] [FEATURE] Add remote filter --- Classes/Controller/JoblistController.php | 1 + Classes/Domain/Repository/JobRepository.php | 4 ++++ Resources/Private/Language/de.locallang.xlf | 4 ++++ Resources/Private/Language/locallang.xlf | 3 +++ Resources/Private/Language/zh.locallang.xlf | 4 ++++ Resources/Private/Partials/Filter.html | 16 ++++++++++++++++ Resources/Private/Templates/Joblist/Index.html | 4 +++- Resources/Public/Sass/_sg-jobs.scss | 13 +++++++++++++ 8 files changed, 48 insertions(+), 1 deletion(-) diff --git a/Classes/Controller/JoblistController.php b/Classes/Controller/JoblistController.php index 9d1a29d9..19418c43 100644 --- a/Classes/Controller/JoblistController.php +++ b/Classes/Controller/JoblistController.php @@ -139,6 +139,7 @@ class JoblistController extends ActionController { $this->view->assign('selectedDepartment', $filters['filterDepartment']); $this->view->assign('selectedExperienceLevel', $filters['filterExperienceLevel']); $this->view->assign('selectedFunction', $filters['filterFunction']); + $this->view->assign('selectedRemote', $filters['filterRemote']); } $storagePid = (int) $this->configurationManager->getConfiguration( diff --git a/Classes/Domain/Repository/JobRepository.php b/Classes/Domain/Repository/JobRepository.php index 5908210c..cda7e430 100644 --- a/Classes/Domain/Repository/JobRepository.php +++ b/Classes/Domain/Repository/JobRepository.php @@ -222,6 +222,10 @@ class JobRepository extends Repository { $constraints[] = $query->equals('company.country', $filters['filterCountry']); } + if ($filters['filterRemote'] !== '' && $filters['filterRemote'] !== NULL) { + $constraints[] = $query->equals('telecommutePossible', TRUE); + } + if ($filters['filterLocation'] !== '0' && $filters['filterLocation'] !== NULL) { $constraints[] = $query->equals('company.city', $filters['filterLocation']); } diff --git a/Resources/Private/Language/de.locallang.xlf b/Resources/Private/Language/de.locallang.xlf index fb81d5f7..41029ee5 100644 --- a/Resources/Private/Language/de.locallang.xlf +++ b/Resources/Private/Language/de.locallang.xlf @@ -366,6 +366,10 @@ <source><![CDATA[Location]]></source> <target><![CDATA[Standort]]></target> </trans-unit> + <trans-unit id="frontend.filter.remote" approved="yes"> + <source><![CDATA[Show only jobs that can be executed remotely.]]></source> + <target><![CDATA[Zeige nur Stellen an, die remote ausgeführt werden können.]]></target> + </trans-unit> <trans-unit id="frontend.filter.selections.all" approved="yes"> <source><![CDATA[All]]></source> <target><![CDATA[Alle]]></target> diff --git a/Resources/Private/Language/locallang.xlf b/Resources/Private/Language/locallang.xlf index e94e3d70..8fb1f562 100644 --- a/Resources/Private/Language/locallang.xlf +++ b/Resources/Private/Language/locallang.xlf @@ -276,6 +276,9 @@ <trans-unit id="frontend.filter.locations"> <source><![CDATA[Location]]></source> </trans-unit> + <trans-unit id="frontend.filter.remote"> + <source><![CDATA[Show only jobs that can be executed remotely.]]></source> + </trans-unit> <trans-unit id="frontend.filter.selections.all"> <source><![CDATA[All]]></source> </trans-unit> diff --git a/Resources/Private/Language/zh.locallang.xlf b/Resources/Private/Language/zh.locallang.xlf index ce92a164..a25adf0e 100644 --- a/Resources/Private/Language/zh.locallang.xlf +++ b/Resources/Private/Language/zh.locallang.xlf @@ -213,6 +213,10 @@ <source><![CDATA[Location]]></source> <target><![CDATA[地点]]></target> </trans-unit> + <trans-unit id="frontend.filter.remote" approved="yes"> + <source><![CDATA[Show only jobs that can be executed remotely.]]></source> + <target><![CDATA[]]></target> + </trans-unit> <trans-unit id="frontend.filter.selections.all" approved="yes"> <source><![CDATA[All]]></source> <target><![CDATA[]]></target> diff --git a/Resources/Private/Partials/Filter.html b/Resources/Private/Partials/Filter.html index fdb69611..9c00602d 100644 --- a/Resources/Private/Partials/Filter.html +++ b/Resources/Private/Partials/Filter.html @@ -82,6 +82,22 @@ </div> </div> + <div class="row default-content-element"> + <div class="col-md-6 col-sm-6 col-cs-12"> + <div class="sgjobs-filter-checkbox-form-control"> + <f:form.checkbox + class="sgjobs-checkbox form-control" + property="filterRemote" + id="filter-remote" + value="remote" + checked="{selectedRemote}"/> + <label for="filter-remote"> + <f:translate key="frontend.filter.remote"/> + </label> + </div> + </div> + </div> + <div class="row default-content-element"> <div class="col-md-12 col-sm-12 col-cs-12"> <f:form.submit class="btn btn-md btn-primary" value="{f:translate(key:'frontend.filter.submit')}"/> diff --git a/Resources/Private/Templates/Joblist/Index.html b/Resources/Private/Templates/Joblist/Index.html index 8f189368..e3b830aa 100644 --- a/Resources/Private/Templates/Joblist/Index.html +++ b/Resources/Private/Templates/Joblist/Index.html @@ -8,7 +8,9 @@ partial="Filter" arguments="{recordPageId: recordPageId, filters: filters, countries: countries, cities: cities, companies: companies, departments: departments, experienceLevels: experienceLevels, functions: functions, selectedCountry: selectedCountry, selectedCompany: selectedCompany, - selectedLocation: selectedLocation, selectedDepartment: selectedDepartment, selectedExperienceLevel: selectedExperienceLevel, selectedFunction: selectedFunction, limit: limit}" + selectedLocation: selectedLocation, selectedDepartment: selectedDepartment, + selectedExperienceLevel: selectedExperienceLevel, selectedFunction: selectedFunction, selectedRemote: selectedRemote, + limit: limit }" /> <div class="row default-content-element equal-height-columns stretch-first-child"> diff --git a/Resources/Public/Sass/_sg-jobs.scss b/Resources/Public/Sass/_sg-jobs.scss index 72c8e622..033e4b02 100644 --- a/Resources/Public/Sass/_sg-jobs.scss +++ b/Resources/Public/Sass/_sg-jobs.scss @@ -150,3 +150,16 @@ } } } + +.sgjobs-filter-checkbox-form-control { + > label { + margin-left: 5px; + } +} + +.sgjobs-checkbox { + width: auto; + box-shadow: none; + display: inline; + height: 13px; +} -- GitLab