-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new: Allow to create and list the organizations
- Loading branch information
Showing
29 changed files
with
813 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* This file is part of Bileto. */ | ||
/* Copyright 2022 Probesys */ | ||
/* SPDX-License-Identifier: AGPL-3.0-or-later */ | ||
|
||
a { | ||
color: var(--color-primary11); | ||
} | ||
|
||
.anchor--action { | ||
display: inline-block; | ||
padding: 0.5rem 1.75rem; | ||
|
||
text-decoration: none; | ||
|
||
background-color: var(--color-primary3); | ||
border: 0.25rem solid currentcolor; | ||
border-radius: 0.5rem; | ||
|
||
transition: background-color 0.2s ease-in-out; | ||
} | ||
|
||
.anchor--action:hover, | ||
.anchor--action:focus { | ||
background-color: var(--color-primary4); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* This file is part of Bileto. */ | ||
/* Copyright 2022 Probesys */ | ||
/* SPDX-License-Identifier: AGPL-3.0-or-later */ | ||
|
||
.card { | ||
overflow: hidden; | ||
|
||
padding: 1rem; | ||
|
||
background-color: var(--color-grey4); | ||
box-shadow: 0 1px 2px var(--color-grey8); | ||
border-radius: 0.5rem; | ||
} | ||
|
||
.card__title { | ||
font-weight: bold; | ||
overflow-wrap: anywhere; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* This file is part of Bileto. */ | ||
/* Copyright 2022 Probesys */ | ||
/* SPDX-License-Identifier: AGPL-3.0-or-later */ | ||
|
||
.grid { | ||
display: grid; | ||
|
||
grid-gap: 2rem; | ||
} | ||
|
||
.grid > * { | ||
min-width: 0; | ||
} | ||
|
||
@media (min-width: 800px) { | ||
.grid--cols2 { | ||
grid-template-columns: repeat(2, 1fr); | ||
} | ||
|
||
.grid--cols3 { | ||
grid-template-columns: repeat(3, 1fr); | ||
} | ||
|
||
.grid--cols4 { | ||
grid-template-columns: repeat(4, 1fr); | ||
} | ||
|
||
.grid--cols5 { | ||
grid-template-columns: repeat(5, 1fr); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* This file is part of Bileto. */ | ||
/* Copyright 2022 Probesys */ | ||
/* SPDX-License-Identifier: AGPL-3.0-or-later */ | ||
|
||
.text--secondary { | ||
color: var(--color-grey11); | ||
} | ||
|
||
.text--center { | ||
text-align: center; | ||
} | ||
|
||
.text--big { | ||
font-size: 1.2em; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,9 @@ | |
|
||
twig: | ||
default_path: '%kernel.project_dir%/templates' | ||
globals: | ||
errors: [] | ||
error: null | ||
|
||
when@test: | ||
twig: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
// This file is part of Bileto. | ||
// Copyright 2022 Probesys | ||
// SPDX-License-Identifier: AGPL-3.0-or-later | ||
|
||
declare(strict_types=1); | ||
|
||
namespace DoctrineMigrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\AbstractMigration; | ||
|
||
final class Version20221014081029CreateOrganization extends AbstractMigration | ||
{ | ||
public function getDescription(): string | ||
{ | ||
return 'Create the table organization'; | ||
} | ||
|
||
public function up(Schema $schema): void | ||
{ | ||
$dbPlatform = $this->connection->getDatabasePlatform()->getName(); | ||
if ($dbPlatform === 'postgresql') { | ||
$this->addSql('CREATE SEQUENCE organization_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); | ||
$this->addSql(<<<SQL | ||
CREATE TABLE organization ( | ||
id INT NOT NULL, | ||
name VARCHAR(255) NOT NULL, | ||
PRIMARY KEY(id) | ||
) | ||
SQL); | ||
$this->addSql('CREATE UNIQUE INDEX UNIQ_C1EE637C5E237E06 ON "organization" (name)'); | ||
} elseif ($dbPlatform === 'mysql') { | ||
$this->addSql(<<<SQL | ||
CREATE TABLE organization ( | ||
id INT AUTO_INCREMENT NOT NULL, | ||
name VARCHAR(255) NOT NULL, | ||
PRIMARY KEY(id) | ||
) | ||
DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB | ||
SQL); | ||
$this->addSql('CREATE UNIQUE INDEX UNIQ_C1EE637C5E237E06 ON organization (name)'); | ||
} | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
$dbPlatform = $this->connection->getDatabasePlatform()->getName(); | ||
if ($dbPlatform === 'postgresql') { | ||
$this->addSql('DROP INDEX UNIQ_C1EE637C5E237E06'); | ||
$this->addSql('DROP SEQUENCE organization_id_seq CASCADE'); | ||
$this->addSql('DROP TABLE organization'); | ||
} elseif ($dbPlatform === 'mysql') { | ||
$this->addSql('DROP INDEX UNIQ_C1EE637C5E237E06 on `organization`'); | ||
$this->addSql('DROP TABLE organization'); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
// This file is part of Bileto. | ||
// Copyright 2022 Probesys | ||
// SPDX-License-Identifier: AGPL-3.0-or-later | ||
|
||
namespace App\Controller; | ||
|
||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | ||
use Symfony\Component\HttpFoundation\Response; | ||
use Symfony\Component\Translation\TranslatableMessage; | ||
use Symfony\Component\Validator\ConstraintViolationListInterface; | ||
|
||
class BaseController extends AbstractController | ||
{ | ||
/** | ||
* @param mixed[] $parameters | ||
*/ | ||
protected function renderBadRequest(string $view, array $parameters = [], Response $response = null): Response | ||
{ | ||
if ($response === null) { | ||
$response = new Response('', Response::HTTP_BAD_REQUEST); | ||
} else { | ||
$response->setStatusCode(Response::HTTP_BAD_REQUEST); | ||
} | ||
|
||
return $this->render($view, $parameters, $response); | ||
} | ||
|
||
protected function csrfError(): string | ||
{ | ||
return new TranslatableMessage('Invalid CSRF token.', [], 'security'); | ||
} | ||
|
||
/** | ||
* @return array<string, string> | ||
*/ | ||
protected function formatErrors(ConstraintViolationListInterface $errors): array | ||
{ | ||
$formattedErrors = []; | ||
foreach ($errors as $error) { | ||
$property = $error->getPropertyPath(); | ||
if (isset($formattedErrors[$property])) { | ||
$formattedErrors[$property] = implode( | ||
' ', | ||
[$formattedErrors[$property], $error->getMessage()], | ||
); | ||
} else { | ||
$formattedErrors[$property] = $error->getMessage(); | ||
} | ||
} | ||
return $formattedErrors; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.