Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Fluid files and add FlashMessage after job creation #9

Merged
merged 5 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions Classes/Controller/JobController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace FGTCLB\AcademicJobs\Controller;

use FGTCLB\AcademicJobs\DateTime\IsoDateTime;
use FGTCLB\AcademicJobs\Domain\Model\Contact;
use FGTCLB\AcademicJobs\Domain\Model\Job;
use FGTCLB\AcademicJobs\Domain\Repository\ContactRepository;
use FGTCLB\AcademicJobs\Domain\Repository\JobRepository;
Expand All @@ -19,7 +18,9 @@
use TYPO3\CMS\Extbase\Property\TypeConverter\DateTimeConverter;
use TYPO3\CMS\Core\MetaTag\MetaTagManagerRegistry;
use TYPO3\CMS\Extbase\Service\ImageService;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
use TYPO3\CMS\Backend\Routing\UriBuilder as BackendUriBuilder;
use TYPO3\CMS\Core\Messaging\FlashMessage;

class JobController extends ActionController
{
Expand Down Expand Up @@ -109,9 +110,9 @@ public function listAction(): ResponseInterface
}

$this->view->assign('jobs', $jobs);
$this->view->render();
return $this->htmlResponse();
}

public function initializeSaveJobAction(): void
{
if ($this->request->hasArgument('job')) {
Expand Down Expand Up @@ -156,11 +157,18 @@ public function initializeSaveJobAction(): void

public function saveJobAction(Job $job): void
{

$job->setHidden((int)self::JOB_HIDDEN);
$this->jobRepository->add($job);
$this->persistenceManager->persistAll();

$successMessageTitle = LocalizationUtility::translate('tx_academicjobs.fe.alert.job_created.title', 'AcademicJobs');
$successMessageBody = LocalizationUtility::translate('tx_academicjobs.fe.alert.job_created.body', 'AcademicJobs');
$this->addFlashMessage(
(string)$successMessageBody,
(string)$successMessageTitle,
FlashMessage::OK,
true
);

$afterSaveJobEvent = new AfterSaveJobEvent($job);
$this->eventDispatcher->dispatch($afterSaveJobEvent);
Expand All @@ -181,6 +189,7 @@ public function sendEmail(int $recordId): void
$mail->text('A new job has been posted. Please check the TYPO3 backend: ' . $url);
$mail->send();
}

public function buildUrl(int $recordId): string
{
$path = $this->backendUriBuilder
Expand Down
8 changes: 8 additions & 0 deletions Resources/Private/Language/de.locallang.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,14 @@
<source>Submit</source>
<target>Absenden</target>
</trans-unit>
<trans-unit id="tx_academicjobs.fe.alert.job_created.title">
<source>The job advertisement has been sent.</source>
<target>Die Stellenanzeige wurde gesendet.</target>
</trans-unit>
<trans-unit id="tx_academicjobs.fe.alert.job_created.body">
<source>Your application has been sent. After a review, your job advertisement will be activated.</source>
<target>Ihre Eingaben wurden versandt. Nach einer Prüfung wird Ihre Stellenanzeige freigeschaltet.</target>
</trans-unit>
</body>
</file>
</xliff>
6 changes: 6 additions & 0 deletions Resources/Private/Language/locallang.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,12 @@
<trans-unit id="tx_academicjobs.fe.form.text.submit">
<source>Submit</source>
</trans-unit>
<trans-unit id="tx_academicjobs.fe.alert.job_created.title">
<source>The job advertisement has been sent.</source>
</trans-unit>
<trans-unit id="tx_academicjobs.fe.alert.job_created.body">
<source>Your application has been sent. After a review, your job advertisement will be activated.</source>
</trans-unit>
</body>
</file>
</xliff>
33 changes: 20 additions & 13 deletions Resources/Private/Partials/FormErrors.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<f:form.validationResults>
<html
xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
data-namespace-typo3-fluid="true"
>
<f:form.validationResults>
<f:if condition="{validationResults.flattenedErrors}">
<ul class="alert alert-danger" role="alert">
<f:for each="{validationResults.flattenedErrors}" key="propertyPath" as="errors">
<li>
{propertyPath}:
<ul>
<f:for each="{errors}" as="error"><li>{error}</li></f:for>
</ul>
</li>
</f:for>
</ul>
<ul class="alert alert-danger" role="alert">
<f:for
each="{validationResults.flattenedErrors}"
key="propertyPath"
as="errors"
>
<li>
{propertyPath}:
<ul>
<f:for each="{errors}" as="error"><li>{error}</li></f:for>
</ul>
</li>
</f:for>
</ul>
</f:if>
</f:form.validationResults>
</f:form.validationResults>
</html>
94 changes: 50 additions & 44 deletions Resources/Private/Partials/Job/Show/Contact.html
Original file line number Diff line number Diff line change
@@ -1,46 +1,52 @@
<html data-namespace-typo3-fluid="true" xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers">
<f:if condition="{contact}">
<h3>
<f:translate key="tx_academicjobs.fe.list.text.contact" />
</h3>
<div class="job-detail-contact">
<ul class="job-detail-contact-list">
<f:if condition="{contact.name}">
<li>
<span class="job-detail-contact-list-label">
<f:translate key="tx_academicjobs.fe.list.text.contact.name" />
</span>
<span class="job-detail-contact-list-value">{contact.name}</span>
</li>
</f:if>
<f:if condition="{contact.email}">
<li>
<span class="job-detail-contact-list-label">
<f:translate key="tx_academicjobs.fe.list.text.contact.email" />
</span>
<f:link.email email="{contact.email}">
{contact.email}
</f:link.email>
</li>
</f:if>
<f:if condition="{contact.phone}">
<li>
<span class="job-detail-contact-list-label">
<f:translate key="tx_academicjobs.fe.list.text.contact.phone" />
</span>
<a href="tel:{contact.phone}">
{contact.phone}
</a>
</li>
</f:if>
<f:if condition="{contact.additionalInformation}">
<li>
<p class="job-detail-contact-list-text">{contact.additionalInformation}</p>
</li>
</f:if>
</ul>
<hr class="dividier">
<html
data-namespace-typo3-fluid="true"
xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers"
>
<f:if condition="{contact}">
<h3>
<f:translate key="tx_academicjobs.fe.list.text.contact" />
</h3>
<div class="job-detail-contact">
<ul class="job-detail-contact-list">
<f:if condition="{contact.name}">
<li>
<span class="job-detail-contact-list-label">
<f:translate key="tx_academicjobs.fe.list.text.contact.name" />
</span>
<span class="job-detail-contact-list-value">{contact.name}</span>
</li>
</f:if>

</div>
</f:if>
<f:if condition="{contact.email}">
<li>
<span class="job-detail-contact-list-label">
<f:translate key="tx_academicjobs.fe.list.text.contact.email" />
</span>
<f:link.email email="{contact.email}">
{contact.email}
</f:link.email>
</li>
</f:if>

<f:if condition="{contact.phone}">
<li>
<span class="job-detail-contact-list-label">
<f:translate key="tx_academicjobs.fe.list.text.contact.phone" />
</span>
<a href="tel:{contact.phone}">
{contact.phone}
</a>
</li>
</f:if>

<f:if condition="{contact.additionalInformation}">
<li>
<p class="job-detail-contact-list-text">{contact.additionalInformation}</p>
</li>
</f:if>
</ul>

<hr class="dividier">
</div>
</f:if>
</html>
22 changes: 13 additions & 9 deletions Resources/Private/Partials/Job/Show/Details.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
<html data-namespace-typo3-fluid="true" xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers">
<div class="job-detail-content">
<h3>
<f:translate key="tx_academicjobs.fe.list.text.description" />
</h3>
<f:if condition="{job.description}">
<f:format.raw>{job.description}</f:format.raw>
</f:if>
</div>
<html
data-namespace-typo3-fluid="true"
xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers"
>
<div class="job-detail-content">
<h3>
<f:translate key="tx_academicjobs.fe.list.text.description" />
</h3>

<f:if condition="{job.description}">
<f:format.raw>{job.description}</f:format.raw>
</f:if>
</div>
</html>
27 changes: 15 additions & 12 deletions Resources/Private/Partials/Job/Show/Header.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
<html data-namespace-typo3-fluid="true" xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers">
<div class="job-detail-header">
<div class="job-detail-header-left">
<f:if condition="{job.title}">
<h2 class="mb-0">{job.title}</h2>
</f:if>
</div>
<html
data-namespace-typo3-fluid="true"
xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers"
>
<div class="job-detail-header">
<div class="job-detail-header-left">
<f:if condition="{job.title}">
<h2 class="mb-0">{job.title}</h2>
</f:if>
</div>

<div class="job-detail-header-right">
<f:link.action action="list">
<f:translate key="tx_academicjobs.fe.list.text.back" />
</f:link.action>
</div>
<div class="job-detail-header-right">
<f:link.action action="list">
<f:translate key="tx_academicjobs.fe.list.text.back" />
</f:link.action>
</div>
</div>
</html>
Loading
Loading