Skip to content

Commit

Permalink
2.62.1 CLE 'About' message is now customisable - thanks [Joachim] for…
Browse files Browse the repository at this point in the history
… the suggestion.
  • Loading branch information
classaxe committed Dec 20, 2023
1 parent fd613b9 commit ad02cc4
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/Controller/Web/Cle/Cle.php
Expand Up @@ -102,6 +102,7 @@ public function controller(

$options = [
'id' => $id,
'about' => html_entity_decode($cle->getAbout()),
'additional' => html_entity_decode($cle->getAdditional()),
'dateEnd' => ($cle->getDateEnd() ? new DateTime($cle->getDateEnd()->format('Y-m-d')) : null),
'dateStart' => ($cle->getDateStart() ? new DateTime($cle->getDateStart()->format('Y-m-d')) : null),
Expand All @@ -116,6 +117,7 @@ public function controller(
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$data = $form->getData();
$cle->setAbout($data['about']);
$cle->setAdditional($data['additional']);
$cle->setDateStart($data['dateStart']);
$cle->setDateEnd($data['dateEnd']);
Expand Down
19 changes: 19 additions & 0 deletions src/Entity/Cle.php
Expand Up @@ -57,6 +57,13 @@ class Cle
*/
private $scope = '';

/**
* @var string|null
*
* @ORM\Column(name="about", type="text", length=65535, nullable=true)
*/
private $about = '';

/**
* @var string|null
*
Expand Down Expand Up @@ -493,6 +500,18 @@ public function setScope(?string $scope): self
return $this;
}

public function getAbout(): ?string
{
return $this->about;
}

public function setAbout(?string $about): self
{
$this->about = $about;

return $this;
}

public function getAdditional(): ?string
{
return $this->additional;
Expand Down
10 changes: 10 additions & 0 deletions src/Form/Cle/Cle.php
Expand Up @@ -97,6 +97,16 @@ public function buildForm(FormBuilderInterface $formBuilder, array $options)
'required' => false
]
)
->add(
'about',
TextareaType::class,
[
'data' => $options['about'],
'empty_data' => '',
'label' => 'About',
'required' => false
]
)
->add(
'worldRange1Low',
TextType::class,
Expand Down
31 changes: 31 additions & 0 deletions src/Migrations/Version20231220121057.php
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

namespace App\Migrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20231220121057 extends AbstractMigration
{
public function getDescription(): string
{
return 'Remove unneeded Donor name, now we are linking on IDs';
}

public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE `donations` DROP `name`');
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE `donations` ADD `name` VARCHAR(50) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`');
}
}
37 changes: 37 additions & 0 deletions src/Migrations/Version20231220122754.php
@@ -0,0 +1,37 @@
<?php

declare(strict_types=1);

namespace App\Migrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20231220122754 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add new field "about" for CLE definition';
}

public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE cle ADD `about` TEXT DEFAULT NULL');
$this->addSql('UPDATE cle SET `about` =
"Co-ordinated Listening Events (or CLEs) take place several times a year and provide opportunities
for listeners of all levels of experience to practice our hobby and learn more about it.<br>\n
To find out more about the %URL1%, or to join (it\'s free!), visit %URL2%"
LIMIT 1000'
);
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE cle DROP `about`');
}
}
3 changes: 2 additions & 1 deletion templates/cle/form.html.twig
Expand Up @@ -3,8 +3,9 @@
<div class="controlPanel cle_editor">
<div class="header">{% trans %}CLE Configuration{% endtrans %}</div>
<div class="content">
<div class="textarea">{{ form_row(form.about) }}<br></div>
<div class="cleForm">
{{ form_row(form.id) }}
{{ form_row(form.id) }}
<fieldset id="group_event_overview">
<legend>{% trans %}Event Overview{% endtrans %}</legend>

Expand Down

0 comments on commit ad02cc4

Please sign in to comment.