Login fixes

main
František Špaček 2 years ago
parent 5350952bd3
commit b02b80c612

@ -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, '*/*'] }
- { path: ^/, prefer_extension: true, fallback_format: html, priorities: [ html, '*/*'] }
zone:
- { path: ^/api/* }

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 950 B

@ -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;
}

@ -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;
}
#myChartList #removeChart:hover{
background-color: var(--main-highlight);
color: red;
transition: 300ms;
}

@ -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);

@ -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);

@ -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(),
);

@ -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');
}
}

@ -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()
]);
}*/
}
}

@ -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;
}

@ -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<int, Chart>
*/
//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
{

@ -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,

@ -17,6 +17,7 @@ class FontType extends AbstractType
$builder
->add('font', ChoiceType::class, [
'label' => 'Font',
'choices' => [
'Arial' => 'Arial',
'Verdana' => 'Verdana',

@ -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)

@ -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']);
}

@ -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']
]);
}

@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<title>{% block title %}Welcome!{% endblock %}</title>
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text y=%221.2em%22 font-size=%2296%22>⚫️</text></svg>">
<link rel="icon" href="{{ asset('images/icon.png') }}">
{% block stylesheets %}
{{ encore_entry_link_tags('app') }}
<link href="{{ asset('styles/web_style.css') }}" rel="stylesheet"/>

@ -0,0 +1,131 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Chyba!</title>
<style>:root
{
--dark: #1E1B18;
--light: #E3E7F1;
--side: #E3E7F1;
--main: #7391C8;
--main-dark: #52688F;
--main-highlight: #31476d;
}
* {
font-family: 'Open Sans', sans-serif;
color: var(--dark);
}
body {
margin: 0;
padding: 0;
}
button {
background-color: var(--main-dark);
border: none;
color: white;
padding: 10px 15px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 5px;
}
button:hover {
background-color: var(--main-highlight);
cursor: pointer;
}
header {
display: flex;
background-color: var(--main-dark);
margin: 0;
}
header #logo {
text-align: center;
flex-basis: 20%;
display: flex;
}
header nav {
display: flex;
flex-basis: 70%;
justify-content: flex-end;
}
header #user {
flex-basis: 10%;
display: flex;
}
header #user a {
flex-basis: 100%;
text-align: center;
background-color: var(--main);
color: var(--dark);
}
header #user a:hover {
background-color: var(--main-dark);
}
header a {
text-decoration: none;
color: var(--light);
font-weight: 600;
font-size: 1em;
line-height: 1.4em;
padding: 1.4em 2em;
transition: 300ms;
}
header a:hover {
background-color: var(--main-dark);
}
body {
background-color: var(--light);
}
main {
height: calc(100vh - 4.2em);
width: 100%;
display: flex;
padding: 0;
}
h1 {
color: var(--light);
font-size: 1.6em;
margin: 2em 0 0;
flex-basis: 100%;
}
h2 {
color: var(--side);
font-size: 1.2em;
}
</style>
</head>
<body>
<header id="mainHeader">
<div id="logo">
<a href="/">EasyCharts</a>
</div>
<div id="user">
<a href="/users/login">Přihlásit</a>
</div>
</header>
<h1>Chyba!</h1>
<section>
<p>
Hledanou stránku nebylo možné najít. Zkontrolujte URL nebo se vraťe na
<a href="/">domovskou stránku</a>.
</p>
</section>
</body></html>

@ -34,13 +34,13 @@
{{ form_start(chartForm) }}
<div id="mainDiv">
<div id="settings_div">
<h1>Nastavení grafu</h1>
{{ form_row(chartForm.name) }}
{{ form_row(chartForm.code) }}
{{ form_row(chartForm.metadata) }}
<!--<button id="saveBtn">Save</button>
<button id="drawBtn">Draw</button>-->
</div>
<iframe id="chartDiv" src={{ "https://spacek.blue/charts/" ~ id }}></iframe>
<iframe id="chartDiv" src={{ path('charts_display', {'id': id}) }}></iframe>
</div>
<div id="secondaryDiv">
<div id="tableDiv">

@ -0,0 +1,23 @@
{% extends 'base.html.twig' %}
{% block title %}
List
{% endblock %}
{% block body %}
{{ parent() }}
<main>
<div id="myCharts">
<h1>Grafy</h1>
<a href="{{ path('charts_create') }}" id="createChart">Vytvořit nový graf</a>
<div id="myChartList">
{% for chart in charts %}
<span>
<a href={{ chart.id ~ "/edit" }} id="editChart">{{ chart.name }}</a>
<a href={{ chart.id ~ "/remove" }} id="removeChart">Smazat</a>
</span>
{% endfor %}
</div>
</div>
</main>
{% endblock %}

@ -1,11 +1,15 @@
<header id="mainHeader">
<div id="logo">
<a href={{ path('homepage') }}>EasyCharts</a>
<a href={{ path('homepage') }} id="homepageLink">Index</a>
</div>
<nav>
<a href={{ path('charts_list') }}>Charts</a>
<a href={{ path('charts_list') }} id="chartsLink">Charts</a>
</nav>
<div id="user">
<a href={{ path('users_create') }}>Login</a>
{% if app.user %}
<a href={{ path('users_edit', {id: app.user.id} ) }}>{{ app.user.email }}</a>
{% else %}
<a href={{ path('users_login') }}>Přihlásit</a>
{% endif %}
</div>
</header>

@ -1,16 +0,0 @@
{% extends 'base.html.twig' %}
{% block title %}
List
{% endblock %}
{% block body %}
{{ parent() }}
<main>
<ul>
{% for chart in charts %}
<li><a href={{ chart.id ~ "/edit" }}>{{ chart.name }}</a></li>
{% endfor %}
</ul>
</main>
{% endblock %}

@ -0,0 +1,20 @@
{% extends 'base.html.twig' %}
{% block title %}
Upravit profil
{% endblock %}
{% block body %}
{{ parent() }}
<main>
<div class="loginDiv">
<h1>Uživatel: <strong>{{ app.user.email }}</strong></h1>
{{ form_start(form) }}
{{ form_row(form.password) }}
<button type="submit">Změnit heslo</button>
{{ form_end(form, {'render_rest': false}) }}
<a id="logoutBtn" href="{{ path('users_logout') }}">Odhlásit se</a>
</div>
</main>
{% endblock %}

@ -24,6 +24,7 @@
<button type="submit">Přihlásit se</button>
</form>
<a href="{{ path('users_create') }}">Registrovat se</a>
</div>
</main>
{% endblock %}

@ -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) }}
<input type="submit"/>
<button type="submit">Registrovat se</button>
{{ form_end(form) }}
</div>
</main>

@ -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',

@ -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',

@ -1,9 +1,9 @@
<?php return array(
'root' => 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(),

Loading…
Cancel
Save

Powered by TurnKey Linux.