diff --git a/config/packages/fos_rest.yaml b/config/packages/fos_rest.yaml index a0189fd..cfe9d4f 100644 --- a/config/packages/fos_rest.yaml +++ b/config/packages/fos_rest.yaml @@ -11,4 +11,6 @@ fos_rest: enabled: true rules: - { path: ^/api, prefer_extension: false, fallback_format: json, priorities: [ json, xml ] } - - { path: ^/, prefer_extension: true, fallback_format: html, priorities: [ html, '*/*'] } \ No newline at end of file + - { path: ^/, prefer_extension: true, fallback_format: html, priorities: [ html, '*/*'] } + zone: + - { path: ^/api/* } \ No newline at end of file diff --git a/config/packages/security.yaml b/config/packages/security.yaml index 73ba0a4..dbb930a 100644 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -28,6 +28,8 @@ security: form_login: login_path: users_login check_path: users_login + logout: + path: users_logout # Easy way to control access for large sections of your site # Note: Only the *first* access control that matches will be used diff --git a/public/images/icon.png b/public/images/icon.png new file mode 100644 index 0000000..f7f32ad Binary files /dev/null and b/public/images/icon.png differ diff --git a/public/styles/edit_chart.css b/public/styles/edit_chart.css index 293fcff..c562c75 100755 --- a/public/styles/edit_chart.css +++ b/public/styles/edit_chart.css @@ -1,27 +1,44 @@ /* Styles for the main content area */ -main { - display: block; +main form { + display: flex; + flex-direction: column; + width: 100%; + align-items: stretch; } /* Styles for the main container div */ #mainDiv { - width: 100%; + flex-basis: 60%; + width: auto; display: flex; - padding: 10px; + align-items: stretch; + margin: 1rem; } /* Styles for the chart container div */ #chartDiv { flex-basis: 75%; - height: 400px; } /* Styles for the settings container div */ #settings_div { text-align: center; + overflow: scroll; flex-basis: 25%; } +#settings_div h1{ + margin: 0.5rem; +} + +#settings_div label{ + margin-right: 0.3rem; +} + +#chart_metadata > div{ + margin: 0.3rem +} + /* Styles for submenu label */ .submenuLabel+div { display: none; @@ -41,7 +58,7 @@ div[id^="chart_metadata_group"] { .submenuLabel::after { content: " "; border: solid black; - border-width: 0 2px 2px 0; + border-width: 0 0.2rem 0.2rem 0; display: inline-block; padding: 0.2rem; margin-left: 0.5rem; @@ -70,8 +87,10 @@ div[id^="chart_metadata_group"] { /* Styles for secondary div */ #secondaryDiv { + flex-basis: 40%; + width: auto; display: flex; - /* Use flexbox layout */ + margin: 1rem; } /* Styles for table elements */ @@ -129,22 +148,22 @@ div[id^="chart_metadata_group"] { position: absolute; background-color: white; border: 1px solid lightgrey; - box-shadow: 2px 2px 2px gray; + box-shadow: 0.2rem 0.2rem 0.2rem gray; display: none; margin: 0; - width: 180px; + width: 10rem; } #rcMenu ul { list-style-type: none; padding-left: 10px; - width: 180px; + width: 10rem; } #rcMenu a { text-decoration: none; border-bottom: 1px solid lightgrey; - width: 160px; + width: 9rem; display: block; } diff --git a/public/styles/web_style.css b/public/styles/web_style.css index 0cdf98c..3164043 100755 --- a/public/styles/web_style.css +++ b/public/styles/web_style.css @@ -17,7 +17,7 @@ body { padding: 0; } -button { +button, #createChart { background-color: var(--main-dark); border: none; color: white; @@ -52,6 +52,10 @@ header nav { justify-content: flex-end; } +header #homepageLink:hover, header #chartsLink:hover { + background-color: var(--main-highlight); +} + header #user { flex-basis: 10%; display: flex; @@ -108,11 +112,23 @@ h2 { .loginDiv { min-width: 300px; width: 60%; - margin: 50px auto; + margin: 2rem auto; + padding: 2rem; text-align: center; background-color: var(--main); } +.loginDiv form { + display: flex; + flex-direction: column; +} + +.loginDiv #user div, .loginDiv form > div { + width: auto; + display: flex; + flex-direction: column; +} + .loginDiv .msg { color: red; } @@ -121,60 +137,66 @@ h2 { color: red; } -#myGraphs { - width: 50%; - height: calc(100vh - 4.2em); - margin: 0; +#myCharts { + height: 100%; + width: 100%; + margin: 0.5rem; text-align: center; background-color: var(--main); - display: inline-block; + display: block; } -#myGraphs #createGraphBtn { - color: limegreen; +#myCharts #createChart { + color: var(--dark); + background-color: green; + padding: 1rem; + transition: 300ms; } -#myGraphList div, #sharedGraphList div{ +#myCharts #createChart:hover { + background-color: darkgreen; +} + +#myChartList { + display: flex; + flex-direction: column; +} + +#myChartList span{ width: 80%; margin: 10px 10%; - border: 1px solid var(--main-dark); - padding: 5px; - text-align: left; + /*border: 1px solid var(--main-dark);*/ + background-color: var(--main-dark); + display: flex; } -#myGraphList div a, #sharedGraphList div a{ +#myChartList span a{ text-decoration: none; display: inline-block; height: 100%; - width: 75%; - padding: 5px; + padding: 2rem; } -#myGraphList div button{ - color: red; - display: inline-block; - float: right; - margin: 0; - padding: 5px; +#myChartList #editChart { + flex-basis: 90%; + text-align: left; + transition: 300ms; } -#myGraphList div button:hover{ - background-color: var(--side); - color: red; - display: flex; - transition: 300ms; +#myChartList #editChart:hover { + background-color: var(--main-highlight); } -#sharedGraphs { - width: 50%; - height: calc(100vh - 4.2em); - margin: 0; - text-align: center; - background-color: var(--side); +#myChartList #removeChart{ + color: red; display: inline-block; + text-align: middle; + flex-basis: 10%; + transition: 300ms; } -#sharedGraphs h1{ - color: var(--dark); - padding-bottom: 52px; -} \ No newline at end of file +#myChartList #removeChart:hover{ + background-color: var(--main-highlight); + color: red; + transition: 300ms; +} diff --git a/src/Api/Controller/ChartRestController.php b/src/Api/Controller/ChartRestController.php index 5c5d4d3..f9e6f9a 100644 --- a/src/Api/Controller/ChartRestController.php +++ b/src/Api/Controller/ChartRestController.php @@ -38,7 +38,6 @@ class ChartRestController extends AbstractRestController $data = json_decode($request->getContent()); $chart = new Chart(); $chart->setName($data->name); - $chart->setCode($data->code); $chart->setMetadata($data->metadata); $chart->setTable($data->table); diff --git a/src/Api/Model/ChartInput.php b/src/Api/Model/ChartInput.php index 342146b..47636ee 100644 --- a/src/Api/Model/ChartInput.php +++ b/src/Api/Model/ChartInput.php @@ -13,9 +13,6 @@ class ChartInput #[Assert\NotBlank()] public string $name, - #[Assert\Type('string')] - #[Assert\NotBlank()] - public string $code, public array $metadata, public array $table, ) { @@ -24,10 +21,7 @@ class ChartInput public function toEntity(): Chart { $chart = new Chart(); - //$chart->setId(); $chart->setName($this->name); - //$chart->setName("name"); - $chart->setCode($this->code); $chart->setMetadata($this->metadata); $chart->setTable($this->table); diff --git a/src/Api/Model/ChartOutput.php b/src/Api/Model/ChartOutput.php index 226810f..3e43d9d 100644 --- a/src/Api/Model/ChartOutput.php +++ b/src/Api/Model/ChartOutput.php @@ -9,7 +9,6 @@ class ChartOutput public function __construct( public ?string $id, public ?string $name, - public ?string $code, public ?array $metadata, public ?array $table, ) { @@ -20,7 +19,6 @@ class ChartOutput return new self( $entity->getId(), $entity->getName(), - $entity->getCode(), $entity->getMetadata(), $entity->getTable(), ); diff --git a/src/Controller/ChartController.php b/src/Controller/ChartController.php index 24c260f..cab716d 100644 --- a/src/Controller/ChartController.php +++ b/src/Controller/ChartController.php @@ -11,19 +11,20 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Redirect; use Symfony\Component\Routing\Annotation\Route; -#[Route(path: '/charts', name: 'charts')] +#[Route(path: '/charts', name: 'charts_')] class ChartController extends AbstractController { - #[Route('/', name: '_list')] + #[Route('/', name: 'list')] public function list(DocumentManager $dm, Request $request) : Response { - $charts = $dm->getRepository(Chart::class)->findAll(); - return $this->render('list.html.twig', [ + //$charts = $dm->getRepository(Chart::class)->findAll(); + $charts = $this->getUser()->getCharts(); + return $this->render('chart/list.html.twig', [ 'charts' => $charts ]); } - #[Route('/{id}/edit', name: '_edit')] + #[Route('/{id}/edit', name: 'edit')] public function editAction(DocumentManager $dm, Request $request, Chart $chart) : Response { $form = $this->createForm(ChartType::class, $chart); @@ -34,32 +35,39 @@ class ChartController extends AbstractController $dm->persist($chart); $dm->flush(); - - //return $this->redirect('/'); } - return $this->render('edit.html.twig', [ + return $this->render('chart/edit.html.twig', [ 'chartForm' => $form, 'id' => $chart->getId(), ]); } - #[Route('/{id}', name: '_display')] + #[Route('/create', name: 'create')] + public function createAction(DocumentManager $dm) : Response + { + $chart = new Chart(); + $dm->persist($chart); + $this->getUser()->addChart($chart); + $dm->flush(); + + return $this->redirectToRoute('charts_edit', ['id' => $chart->getId()]); + } + + #[Route('/{id}', name: 'display')] public function displayAction(DocumentManager $dm, Chart $chart) : Response { - return $this->render('chart.html.twig', [ + return $this->render('chart/display.html.twig', [ 'id' => $chart->getId() ]); } - /*private function findOrFail(DocumentManager $dm, int $id): Chart + #[Route('/{id}/remove', name: 'remove')] + public function removeAction(DocumentManager $dm, Chart $chart) : Response { - $chart = $dm->getRepository(Chart::class)->findOneBy(['code' => $id]); - //$chart = $dm->getRepository(Chart::class)->findAll(); - if ($chart === null) { - throw $this->createNotFoundException(); - } - - return $chart; - }*/ + $dm->remove($chart); + //$this->getUser()->removeChart($chart); + $dm->flush(); + return $this->redirectToRoute('charts_list'); + } } diff --git a/src/Controller/UserController.php b/src/Controller/UserController.php index fb7cd9d..341d03c 100644 --- a/src/Controller/UserController.php +++ b/src/Controller/UserController.php @@ -7,24 +7,22 @@ use App\Form\Type\UserType; use App\Form\Type\LoginType; use Doctrine\ODM\MongoDB\DocumentManager; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; use Symfony\Component\Security\Http\Authentication\AuthenticationUtils; use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Redirect; +use Symfony\Bundle\SecurityBundle\Security; use Symfony\Component\Routing\Annotation\Route; #[Route(path: '/users', name: 'users_')] class UserController extends AbstractController { - - #[Route('/create', name: 'create', defaults: ['id' => null])] - #[Route('/{id}/edit', name: 'edit')] - public function editAction(DocumentManager $dm, Request $request, UserPasswordHasherInterface $passwordHasher, ?string $id) + #[Route('/create', name: 'create')] + public function createAction(DocumentManager $dm, Request $request, UserPasswordHasherInterface $passwordHasher, Security $security) { - $user = $dm->getRepository(User::class)->find($id); - if ($user == null) - $user == new User(); + $user = new User(); $form = $this->createForm(UserType::class, $user); $form->handleRequest($request); @@ -38,10 +36,12 @@ class UserController extends AbstractController $dm->persist($user); $dm->flush(); + $security->login($user); + return $this->redirect('/'); } - return $this->render('register.html.twig', [ + return $this->render('user/register.html.twig', [ 'form' => $form->createView() ]); } @@ -49,23 +49,38 @@ class UserController extends AbstractController #[Route('/login', name: 'login')] public function login(AuthenticationUtils $authenticationUtils): Response { - return $this->render('login.html.twig', [ + return $this->render('user/login.html.twig', [ 'last_email' => $authenticationUtils->getLastUsername(), 'error' => $authenticationUtils->getLastAuthenticationError(), ]); } + #[Route('/logout', name: 'logout')] + public function logout(Security $security): Response + { + $response = $security->logout(); + return $response; + } - /*#[Route('/{id}', name: 'detail', requirements: ['id' => '\d+'])] - public function detail(DocumentManager $dm, Request $request, User $user): Response + #[Route('/{id}/edit', name: 'edit')] + public function editAction(DocumentManager $dm, Request $request, UserPasswordHasherInterface $passwordHasher, User $user) { - if ($user === null) - throw $this->createNotFoundException('Uživatel nenalezen!'); + $form = $this->createForm(UserType::class, $user); + + $form->handleRequest($request); + + if ($form->isSubmitted() && $form->isValid()) { + $user = $form->getData(); + + $hashedPassword = $passwordHasher->hashPassword($user, $user->getPassword()); + $user->setPassword($hashedPassword); - //$this->denyAccessUnlessGranted(UserVoter::VIEW, $user); + $dm->persist($user); + $dm->flush(); + } - return $this->render('users/detail.html.twig', [ - 'user' => $user, + return $this->render('user/edit.html.twig', [ + 'form' => $form->createView() ]); - }*/ + } } diff --git a/src/Document/Chart.php b/src/Document/Chart.php index dcbb47c..77d7ae9 100644 --- a/src/Document/Chart.php +++ b/src/Document/Chart.php @@ -8,33 +8,52 @@ use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB; use Symfony\Component\Validator\Constraints as Assert; #[MongoDB\Document(collection: 'charts')] -#[MongoDB\Unique(fields: 'code')] class Chart { /** * @MongoDB\Id */ #[MongoDB\Id] - protected string $id; + protected ?string $id = null; - //#[MongoDB\ReferenceOne(targetDocument: User::class, inversedBy: "charts")] - //protected $user; + #[MongoDB\ReferenceOne(targetDocument: User::class, inversedBy: "charts")] + protected $user; - #[MongoDB\Field(type: 'string')] + #[MongoDB\Field(type: 'string', options: ['default' => "Graf"])] #[Assert\NotBlank] - protected ?string $name = null; - - #[MongoDB\Field(type: 'string')] - #[Assert\NotBlank] - protected ?string $code = null; + protected string $name = "Graf"; #[MongoDB\Field(type: 'raw')] #[Assert\NotBlank] - protected $metadata = null; + protected $metadata = [ + "type" => "line", + "margin" => 40, + "xLabel" => "x", + "yLabel" => "y", + "displayLegend" => true, + "displayPoints" => true, + "displaySupport" => true, + "backgroundColor" => "#f6f5f4", + "title" => "Nadpis", + "displayTitle" => true, + "yStep" => 1, + "displaySupportLines" => true, + "displayAxisValues" => true, + "pointSize" => 15, + "titleFont" => ["font" => 'Courier New', "size" => 25], + "labelFont" => ["font" => 'Georgia', "size" => 15], + "legendFont" => ["font" => 'Arial', "size" => 10], + "pointBorderSize" => 2, + "pointBorderColor" => "#241f31", + "horizontalZoom" => true + ]; #[MongoDB\Field(type: 'hash')] - //#[Assert\NotBlank] - protected ?array $table = null; + #[Assert\NotBlank] + protected array $table = [ + ['col_name' => 'sloupec 1','values' => [1,6,3, 2],'color' => '#ff0000'], + ['col_name' => 'sloupec 2','values' => [4,2.5,-1, 1],'color' => '#57e389'] + ]; public function getId(): string { @@ -46,20 +65,20 @@ class Chart * * @return User */ - //public function getUser(): ?User - //{ - /// return $this->user; - //} + public function getUser(): ?User + { + return $this->user; + } /** * Set the user associated with the chart. * * @param User $user The user to set */ - //public function setUser(?User $user): void - //{ - // $this->user = $user; - //} + public function setUser(?User $user): void + { + $this->user = $user; + } public function getName(): ?string { @@ -71,16 +90,6 @@ class Chart $this->name = $name; } - public function getCode(): ?string - { - return $this->code; - } - - public function setCode(?string $code): void - { - $this->code = $code; - } - public function getMetadata() { return $this->metadata; @@ -93,11 +102,6 @@ class Chart public function getTable(): ?array { - /*$decoded = []; - foreach ($this->table as $key => $value) { - $decoded += json_decode($value); - } - return $decoded;*/ return $this->table; } diff --git a/src/Document/User.php b/src/Document/User.php index 4432159..74fb619 100644 --- a/src/Document/User.php +++ b/src/Document/User.php @@ -32,8 +32,8 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface #[MongoDB\Field(type: 'collection')] private array $roles = ['ROLE_USER']; - //#[MongoDB\ReferenceMany(targetDocument: Chart::class, mappedBy: "user")] - //protected $charts; + #[MongoDB\ReferenceMany(targetDocument: Chart::class, mappedBy: "user")] + protected $charts; public function getId(): string { @@ -66,26 +66,26 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface /** * @return Collection */ - //public function getCharts(): Collection - //{ - // return $this->charts; - //} + public function getCharts(): Collection + { + return $this->charts; + } /** * Adds a chart to the user. * * @param Chart $chart The chart to add */ - //public function addChart(Chart $chart): void - //{ + public function addChart(Chart $chart): void + { // Check if the chart already exists in the collection - // if (!$this->charts->contains($chart)) { + if (!$this->charts->contains($chart)) { // Add the chart to the collection - // $this->charts->add($chart); + $this->charts->add($chart); // Set the user reference in the chart entity - // $chart->setUser($this); - // } - //} + $chart->setUser($this); + } + } public function getRoles(): array { diff --git a/src/Form/Type/ChartType.php b/src/Form/Type/ChartType.php index 28c5463..2742060 100644 --- a/src/Form/Type/ChartType.php +++ b/src/Form/Type/ChartType.php @@ -15,11 +15,14 @@ class ChartType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { $builder - ->add('name', TextType::class) - ->add('code', TextType::class) - ->add('metadata', MetadataType::class); + ->add('name', TextType::class, [ + 'label' => 'Jméno grafu' + ]) + ->add('metadata', MetadataType::class, [ + 'label' => false + ]); - if (sizeof($options['data']->getTable()[0]['values']) <= 1000) + if (array_key_exists('data', $options) && sizeof($options['data']->getTable()[0]['values']) <= 1000) $builder ->add('table', CollectionType::class, [ 'entry_type' => ColumnType::class, diff --git a/src/Form/Type/FontType.php b/src/Form/Type/FontType.php index 7ff4352..193a242 100644 --- a/src/Form/Type/FontType.php +++ b/src/Form/Type/FontType.php @@ -17,6 +17,7 @@ class FontType extends AbstractType $builder ->add('font', ChoiceType::class, [ + 'label' => 'Font', 'choices' => [ 'Arial' => 'Arial', 'Verdana' => 'Verdana', diff --git a/src/Form/Type/LoginType.php b/src/Form/Type/LoginType.php index 6a151bd..c822efe 100644 --- a/src/Form/Type/LoginType.php +++ b/src/Form/Type/LoginType.php @@ -16,8 +16,10 @@ class LoginType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { $builder - ->add('email', EmailType::class) - ->add('password', PasswordType::class); + ->add('email', EmailType::class, [ + 'label' => 'Email']) + ->add('password', PasswordType::class, [ + 'label' => 'Heslo']); } public function configureOptions(OptionsResolver $resolver) diff --git a/src/Form/Type/MetadataType.php b/src/Form/Type/MetadataType.php index 4a5a2ae..e672fc4 100644 --- a/src/Form/Type/MetadataType.php +++ b/src/Form/Type/MetadataType.php @@ -26,26 +26,26 @@ class MetadataType extends AbstractType $builder ->add('type', ChoiceType::class, [ 'choices' => [ - 'Point' => 'point', - 'Line' => 'line', - 'Smooth line' => 'smoothline', - 'Area' => 'area', - 'Smooth Area' => 'smootharea', - 'Pie' => 'pie', - 'Donut' => 'donut', - 'Bar' => 'bar', - 'Stacked' => 'stacked', + 'Bodový' => 'point', + 'Spojnicový' => 'line', + 'Hladký spojnicový' => 'smoothline', + 'Plošný' => 'area', + 'Hladký plošný' => 'smootharea', + 'Koláčový' => 'pie', + 'Prstencový' => 'donut', + 'Sloupcový' => 'bar', + 'Skládáný sloupcový' => 'stacked', ], - 'label' => 'Chart type', + 'label' => 'Druh grafu', ]) ->add( $builder->create('group0', FormType::class, [ 'inherit_data' => true, - 'label' => 'Margin settings', + 'label' => 'Nastavení odsazení', 'label_attr' => ['class' => 'submenuLabel arrow-down'] ]) ->add('margin', IntegerType::class, [ - 'label' => 'Margin', + 'label' => 'Odsazení', 'required' => false, 'constraints' => [ new Assert\PositiveOrZero() @@ -56,20 +56,20 @@ class MetadataType extends AbstractType ->add( $builder->create('group1', FormType::class, [ 'inherit_data' => true, - 'label' => 'Title settings', + 'label' => 'Nastavení nadpisu', 'label_attr' => ['class' => 'submenuLabel arrow-down'] ]) ->add('title', TextType::class, [ - 'label' => 'Title', + 'label' => 'Nadpis', 'required' => false, 'empty_data' => '' ]) ->add('displayTitle', CheckboxType::class, [ - 'label' => 'Display title', + 'label' => 'Zobrazit nadpis', 'required' => false, ]) ->add('titleFont', FontType::class, [ - 'label' => 'Title font', + 'label' => false, 'required' => false, ]) ) @@ -77,34 +77,34 @@ class MetadataType extends AbstractType ->add( $builder->create('group2', FormType::class, [ 'inherit_data' => true, - 'label' => 'Labels', + 'label' => 'Nastavení popisků os', 'label_attr' => ['class' => 'submenuLabel arrow-down'] ]) ->add('xLabel', TextType::class, [ - 'label' => 'X label', + 'label' => 'Popisek osy X', 'required' => false, ]) ->add('yLabel', TextType::class, [ - 'label' => 'Y label', + 'label' => 'Popisek osy Y', 'required' => false, ]) ->add('yStep', NumberType::class, [ - 'label' => 'Y step', + 'label' => 'Krokování hodnot na Y', 'required' => false, 'constraints' => [ new Assert\PositiveOrZero() ], ]) ->add('displayAxisValues', CheckboxType::class, [ - 'label' => 'Display axis values', + 'label' => 'Zobrazit hodnoty', 'required' => false, ]) ->add('displaySupportLines', CheckboxType::class, [ - 'label' => 'Display support lines', + 'label' => 'Zobrazit pomocné čáry', 'required' => false, ]) ->add('labelFont', FontType::class, [ - 'label' => 'Label font', + 'label' => false, 'required' => false, ]) ) @@ -112,15 +112,15 @@ class MetadataType extends AbstractType ->add( $builder->create('group3', FormType::class, [ 'inherit_data' => true, - 'label' => 'Legend settings', + 'label' => 'Nastavení legendy', 'label_attr' => ['class' => 'submenuLabel arrow-down'] ]) ->add('displayLegend', CheckboxType::class, [ - 'label' => 'Display legend', + 'label' => 'Zobrazit legendu', 'required' => false, ]) ->add('legendFont', FontType::class, [ - 'label' => 'Legend font', + 'label' => false, 'required' => false, ]) ) @@ -128,29 +128,29 @@ class MetadataType extends AbstractType ->add( $builder->create('group4', FormType::class, [ 'inherit_data' => true, - 'label' => 'Point Settings', + 'label' => 'Nastavení bodů', 'label_attr' => ['class' => 'submenuLabel arrow-down'] ]) ->add('displayPoints', CheckboxType::class, [ - 'label' => 'Display points', + 'label' => 'Zobrazit body', 'required' => false, ]) ->add('pointSize', IntegerType::class, [ - 'label' => 'Point size', + 'label' => 'Velikost bodů', 'required' => false, 'constraints' => [ new Assert\PositiveOrZero() ], ]) ->add('pointBorderSize', IntegerType::class, [ - 'label' => 'Point border size', + 'label' => 'Šířka ohraničení bodů', 'required' => false, 'constraints' => [ new Assert\PositiveOrZero() ], ]) ->add('pointBorderColor', ColorType::class, [ - 'label' => 'Point border color', + 'label' => 'Barva ohraničení', 'required' => false, ]) ) @@ -158,22 +158,30 @@ class MetadataType extends AbstractType ->add( $builder->create('group5', FormType::class, [ 'inherit_data' => true, - 'label' => 'Zoom Settings', + 'label' => 'Nastavení přiblížení', 'label_attr' => ['class' => 'submenuLabel arrow-down'] ]) ->add('horizontalZoom', CheckboxType::class, [ - 'label' => 'Enable horizontal zoom', + 'label' => 'Zapnout horizontální přibližování', 'required' => false, ]) ->add('verticalZoom', CheckboxType::class, [ - 'label' => 'Enable vertical zoom', + 'label' => 'Zapnout vertikální přibližování', + 'required' => false, + ]) + ) + // Background settings + ->add( + $builder->create('group5', FormType::class, [ + 'inherit_data' => true, + 'label' => 'Nastavení pozadí', + 'label_attr' => ['class' => 'submenuLabel arrow-down'] + ]) + ->add('backgroundColor', ColorType::class, [ + 'label' => 'Barva pozadí', 'required' => false, ]) ) - ->add('backgroundColor', ColorType::class, [ - 'label' => 'Background color', - 'required' => false, - ]) ->add('submit', SubmitType::class, ['label' => 'Uložit a vykreslit']); } diff --git a/src/Form/Type/UserType.php b/src/Form/Type/UserType.php index 07c7af6..b2b4071 100644 --- a/src/Form/Type/UserType.php +++ b/src/Form/Type/UserType.php @@ -15,11 +15,14 @@ class UserType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) { - $builder->add('email', EmailType::class); + $builder->add('email', EmailType::class, [ + 'label' => 'Email']); $builder->add('password', RepeatedType::class, [ 'first_name' => 'password', 'second_name' => 'confirm', - 'type' => PasswordType::class + 'type' => PasswordType::class, + 'first_options' => ['label' => 'Heslo'], + 'second_options' => ['label' => 'Heslo znovu'] ]); } diff --git a/templates/base.html.twig b/templates/base.html.twig index 2c7023e..443a915 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -3,7 +3,7 @@ {% block title %}Welcome!{% endblock %} - + {% block stylesheets %} {{ encore_entry_link_tags('app') }} diff --git a/templates/bundles/TwigBundle/Exception/error.html.twig b/templates/bundles/TwigBundle/Exception/error.html.twig new file mode 100644 index 0000000..f73efff --- /dev/null +++ b/templates/bundles/TwigBundle/Exception/error.html.twig @@ -0,0 +1,131 @@ + + + + + Chyba! + + + +
+ + +
+

Chyba!

+
+

+ Hledanou stránku nebylo možné najít. Zkontrolujte URL nebo se vraťe na + domovskou stránku. +

+
+ diff --git a/templates/chart.html.twig b/templates/chart/display.html.twig similarity index 100% rename from templates/chart.html.twig rename to templates/chart/display.html.twig diff --git a/templates/edit.html.twig b/templates/chart/edit.html.twig similarity index 94% rename from templates/edit.html.twig rename to templates/chart/edit.html.twig index b60c6b6..d8e4dab 100644 --- a/templates/edit.html.twig +++ b/templates/chart/edit.html.twig @@ -34,13 +34,13 @@ {{ form_start(chartForm) }}
+

Nastavení grafu

{{ form_row(chartForm.name) }} - {{ form_row(chartForm.code) }} {{ form_row(chartForm.metadata) }}
- +
diff --git a/templates/chart/list.html.twig b/templates/chart/list.html.twig new file mode 100644 index 0000000..24e0f4c --- /dev/null +++ b/templates/chart/list.html.twig @@ -0,0 +1,23 @@ +{% extends 'base.html.twig' %} + +{% block title %} + List +{% endblock %} + +{% block body %} + {{ parent() }} +
+
+

Grafy

+ Vytvořit nový graf +
+ {% for chart in charts %} + + {{ chart.name }} + Smazat + + {% endfor %} +
+
+
+{% endblock %} diff --git a/templates/header.html.twig b/templates/header.html.twig index dbe4a28..0e38e7a 100644 --- a/templates/header.html.twig +++ b/templates/header.html.twig @@ -1,11 +1,15 @@
- Login + {% if app.user %} + {{ app.user.email }} + {% else %} + Přihlásit + {% endif %}
diff --git a/templates/list.html.twig b/templates/list.html.twig deleted file mode 100644 index 9a102d9..0000000 --- a/templates/list.html.twig +++ /dev/null @@ -1,16 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block title %} - List -{% endblock %} - -{% block body %} - {{ parent() }} -
- -
-{% endblock %} diff --git a/templates/user/edit.html.twig b/templates/user/edit.html.twig new file mode 100644 index 0000000..81d3845 --- /dev/null +++ b/templates/user/edit.html.twig @@ -0,0 +1,20 @@ +{% extends 'base.html.twig' %} + +{% block title %} + Upravit profil +{% endblock %} + +{% block body %} + {{ parent() }} +
+
+

Uživatel: {{ app.user.email }}

+ {{ form_start(form) }} + {{ form_row(form.password) }} + + + {{ form_end(form, {'render_rest': false}) }} + Odhlásit se +
+
+{% endblock %} diff --git a/templates/login.html.twig b/templates/user/login.html.twig similarity index 92% rename from templates/login.html.twig rename to templates/user/login.html.twig index 37c7174..108c5e3 100644 --- a/templates/login.html.twig +++ b/templates/user/login.html.twig @@ -24,6 +24,7 @@ + Registrovat se
{% endblock %} diff --git a/templates/register.html.twig b/templates/user/register.html.twig similarity index 79% rename from templates/register.html.twig rename to templates/user/register.html.twig index 3ec74fc..b3cc7b3 100644 --- a/templates/register.html.twig +++ b/templates/user/register.html.twig @@ -1,7 +1,7 @@ {% extends 'base.html.twig' %} {% block title %} - Register + Registrovat {% endblock %} {% block body %} @@ -11,7 +11,7 @@ {{ form_start(form) }} {{ form_widget(form) }} - + {{ form_end(form) }}
diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 056715e..36ff08d 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -15,10 +15,10 @@ return array( 'App\\Controller\\UserController' => $baseDir . '/src/Controller/UserController.php', 'App\\Document\\Chart' => $baseDir . '/src/Document/Chart.php', 'App\\Document\\User' => $baseDir . '/src/Document/User.php', - 'App\\Form\\Type\\CellType' => $baseDir . '/src/Form/Type/CellType.php', 'App\\Form\\Type\\ChartType' => $baseDir . '/src/Form/Type/ChartType.php', 'App\\Form\\Type\\ColumnType' => $baseDir . '/src/Form/Type/ColumnType.php', 'App\\Form\\Type\\FontType' => $baseDir . '/src/Form/Type/FontType.php', + 'App\\Form\\Type\\LoginType' => $baseDir . '/src/Form/Type/LoginType.php', 'App\\Form\\Type\\MetadataType' => $baseDir . '/src/Form/Type/MetadataType.php', 'App\\Form\\Type\\UserType' => $baseDir . '/src/Form/Type/UserType.php', 'App\\Kernel' => $baseDir . '/src/Kernel.php', diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 2a421e9..8fa005e 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -659,10 +659,10 @@ class ComposerStaticInit51f3c6df917af85305ff4843868663eb 'App\\Controller\\UserController' => __DIR__ . '/../..' . '/src/Controller/UserController.php', 'App\\Document\\Chart' => __DIR__ . '/../..' . '/src/Document/Chart.php', 'App\\Document\\User' => __DIR__ . '/../..' . '/src/Document/User.php', - 'App\\Form\\Type\\CellType' => __DIR__ . '/../..' . '/src/Form/Type/CellType.php', 'App\\Form\\Type\\ChartType' => __DIR__ . '/../..' . '/src/Form/Type/ChartType.php', 'App\\Form\\Type\\ColumnType' => __DIR__ . '/../..' . '/src/Form/Type/ColumnType.php', 'App\\Form\\Type\\FontType' => __DIR__ . '/../..' . '/src/Form/Type/FontType.php', + 'App\\Form\\Type\\LoginType' => __DIR__ . '/../..' . '/src/Form/Type/LoginType.php', 'App\\Form\\Type\\MetadataType' => __DIR__ . '/../..' . '/src/Form/Type/MetadataType.php', 'App\\Form\\Type\\UserType' => __DIR__ . '/../..' . '/src/Form/Type/UserType.php', 'App\\Kernel' => __DIR__ . '/../..' . '/src/Kernel.php', diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 21eaa96..bea439e 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -1,9 +1,9 @@ array( 'name' => '__root__', - 'pretty_version' => '1.0.0+no-version-set', - 'version' => '1.0.0.0', - 'reference' => NULL, + 'pretty_version' => 'dev-main', + 'version' => 'dev-main', + 'reference' => '5350952bd30de2a1c645d2096e994343eb5144b3', 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -11,9 +11,9 @@ ), 'versions' => array( '__root__' => array( - 'pretty_version' => '1.0.0+no-version-set', - 'version' => '1.0.0.0', - 'reference' => NULL, + 'pretty_version' => 'dev-main', + 'version' => 'dev-main', + 'reference' => '5350952bd30de2a1c645d2096e994343eb5144b3', 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(),