Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Lukáš Bělaška
Belaska Symfony Cviceni 26
Commits
d59090d2
Commit
d59090d2
authored
4 weeks ago
by
Lukáš Bělaška
Browse files
Options
Download
Email Patches
Plain Diff
dDs
parent
ab559549
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
147 additions
and
4 deletions
+147
-4
src/src/Controller/AdresaController.php
src/src/Controller/AdresaController.php
+97
-0
src/src/Controller/HomepageController.php
src/src/Controller/HomepageController.php
+6
-1
src/templates/Adresa/add.html.twig
src/templates/Adresa/add.html.twig
+12
-0
src/templates/Adresa/detail.html.twig
src/templates/Adresa/detail.html.twig
+12
-0
src/templates/Adresa/info.html.twig
src/templates/Adresa/info.html.twig
+12
-0
src/templates/Homepage/default.html.twig
src/templates/Homepage/default.html.twig
+1
-1
src/templates/base.html.twig
src/templates/base.html.twig
+7
-2
No files found.
src/src/Controller/AdresaController.php
0 → 100644
View file @
d59090d2
<?php
namespace
App\Controller
;
use
App\Entity\Adresa
;
use
App\Form\AdresaFormType
;
use
App\Repository\AddressRepository
;
use
App\Repository\CitiesRepository
;
use
App\Repository\UsersRepository
;
use
Doctrine\Persistence\ManagerRegistry
;
use
Symfony\Component\Asset\UrlPackage
;
use
Symfony\Component\Form\FormBuilder
;
use
Symfony\Component\HttpFoundation\Request
;
use
Symfony\Component\HttpFoundation\Response
;
use
Symfony\Component\Routing\Annotation\Route
;
class
AdresaController
extends
BaseController
{
/**
* @return Response
*/
#[Route('/add', name: 'adresa_add')]
public
function
add
():
Response
{
// preda data do sablony
return
$this
->
render
(
"Adresa/add.html.twig"
,[
'title'
=>
'add'
]);
}
/**
* @return Response
*/
#[Route('/info', name: 'adresa_info')]
public
function
formAgg
(
Request
$request
,
ManagerRegistry
$doctrine
):
Response
{
$adresa
=
new
Adresa
();
$form
=
$this
->
createForm
(
AdresaFormType
::
class
,
$adresa
,
[
'action'
=>
$this
->
generateUrl
(
'adresa_info'
),
'method'
=>
'POST'
])
->
handleRequest
(
$request
);
if
(
$form
->
isSubmitted
()
&&
$form
->
isValid
())
{
$data
=
$form
->
getData
();
$em
=
$doctrine
->
getManager
();
$em
->
persist
(
$data
);
$em
->
flush
();
}
// preda data do sablony
return
$this
->
render
(
"Adresa/info.html.twig"
,[
'title'
=>
'info'
,
'form'
=>
$form
->
createView
()
]);
}
/**
* @return Response
*/
#[Route('/detail', name: 'adresa_detail')]
public
function
detail
():
Response
{
// preda data do sablony
return
$this
->
render
(
"Adresa/detail.html.twig"
,[
'title'
=>
'detail'
]);
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/src/Controller/HomepageController.php
View file @
d59090d2
...
...
@@ -16,8 +16,13 @@ class HomepageController extends BaseController
public
function
default
():
Response
{
// preda data do sablony
return
$this
->
render
(
"Homepage/default.html.twig"
);
return
$this
->
render
(
"Homepage/default.html.twig"
,[
'title'
=>
'homepage'
]);
}
...
...
This diff is collapsed.
Click to expand it.
src/templates/Adresa/add.html.twig
0 → 100644
View file @
d59090d2
{%
extends
'base.html.twig'
%}
{%
block
body
%}
<div
class=
"row"
>
<div
class=
"col-lg-12"
>
<h1>
{{
title
}}
</h1>
</div>
</div>
{%
endblock
%}
{%
block
stylesheets
%}{%
endblock
%}
{%
block
javascripts
%}{%
endblock
%}
This diff is collapsed.
Click to expand it.
src/templates/Adresa/detail.html.twig
0 → 100644
View file @
d59090d2
{%
extends
'base.html.twig'
%}
{%
block
body
%}
<div
class=
"row"
>
<div
class=
"col-lg-12"
>
<h1>
{{
title
}}
</h1>
</div>
</div>
{%
endblock
%}
{%
block
stylesheets
%}{%
endblock
%}
{%
block
javascripts
%}{%
endblock
%}
This diff is collapsed.
Click to expand it.
src/templates/Adresa/info.html.twig
0 → 100644
View file @
d59090d2
{%
extends
'base.html.twig'
%}
{%
block
body
%}
<div
class=
"row"
>
<div
class=
"col-lg-12"
>
{{
form
(
form
)
}}
</div>
</div>
{%
endblock
%}
{%
block
stylesheets
%}{%
endblock
%}
{%
block
javascripts
%}{%
endblock
%}
This diff is collapsed.
Click to expand it.
src/templates/Homepage/default.html.twig
View file @
d59090d2
...
...
@@ -3,7 +3,7 @@
{%
block
body
%}
<div
class=
"row"
>
<div
class=
"col-lg-12"
>
Homepage default
<h1>
{{
title
}}
</h1>
</div>
</div>
{%
endblock
%}
...
...
This diff is collapsed.
Click to expand it.
src/templates/base.html.twig
View file @
d59090d2
<!DOCTYPE html>
<html
lang=
"cs"
>
<html
lang=
"cs"
xmlns=
"http://www.w3.org/1999/html"
>
<head>
<meta
charset=
"utf-8"
>
<title>
Symfony template
</title>
...
...
@@ -8,7 +8,12 @@
</script>
</head>
<body>
<div
class=
"bs-docs-section clearfix"
>
<a
href=
"
{{
path
(
'homepage_default'
)
}}
"
/>
homepage
</a
<a
href="
{{
path
(
'adresa_add'
)
}}
"
>
add
</a>
<a
href=
"
{{
path
(
'adresa_detail'
)
}}
"
>
detail
</a>
<a
href=
"
{{
path
(
'adresa_info'
)
}}
"
>
info
</a>
<div
class=
"bs-docs-section clearfix"
>
{%
block
body
%}
{%
endblock
%}
</div>
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment