show details of offer

This commit is contained in:
Jannis Portmann 2021-05-01 15:33:45 +02:00
parent eba1194686
commit 23c3a24672
9 changed files with 125 additions and 4 deletions

View file

@ -12,6 +12,7 @@
"doctrine/doctrine-migrations-bundle": "^3.1", "doctrine/doctrine-migrations-bundle": "^3.1",
"doctrine/orm": "^2.8", "doctrine/orm": "^2.8",
"easycorp/easyadmin-bundle": "^3", "easycorp/easyadmin-bundle": "^3",
"sensio/framework-extra-bundle": "^6.1",
"symfony/asset": "5.2.*", "symfony/asset": "5.2.*",
"symfony/console": "5.2.*", "symfony/console": "5.2.*",
"symfony/dotenv": "5.2.*", "symfony/dotenv": "5.2.*",

80
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "7e3415cd572563dce33ca898646a1227", "content-hash": "4e8e54f0634c09e272233b3cc1fcf27c",
"packages": [ "packages": [
{ {
"name": "composer/package-versions-deprecated", "name": "composer/package-versions-deprecated",
@ -2217,6 +2217,84 @@
}, },
"time": "2020-03-23T09:12:05+00:00" "time": "2020-03-23T09:12:05+00:00"
}, },
{
"name": "sensio/framework-extra-bundle",
"version": "v6.1.2",
"source": {
"type": "git",
"url": "https://github.com/sensiolabs/SensioFrameworkExtraBundle.git",
"reference": "676262b7a65a1033befbcf59e180d072df7504b6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sensiolabs/SensioFrameworkExtraBundle/zipball/676262b7a65a1033befbcf59e180d072df7504b6",
"reference": "676262b7a65a1033befbcf59e180d072df7504b6",
"shasum": ""
},
"require": {
"doctrine/annotations": "^1.0",
"php": ">=7.2.5",
"symfony/config": "^4.4|^5.0",
"symfony/dependency-injection": "^4.4|^5.0",
"symfony/framework-bundle": "^4.4|^5.0",
"symfony/http-kernel": "^4.4|^5.0"
},
"conflict": {
"doctrine/doctrine-cache-bundle": "<1.3.1",
"doctrine/persistence": "<1.3"
},
"require-dev": {
"doctrine/dbal": "^2.10|^3.0",
"doctrine/doctrine-bundle": "^1.11|^2.0",
"doctrine/orm": "^2.5",
"symfony/browser-kit": "^4.4|^5.0",
"symfony/doctrine-bridge": "^4.4|^5.0",
"symfony/dom-crawler": "^4.4|^5.0",
"symfony/expression-language": "^4.4|^5.0",
"symfony/finder": "^4.4|^5.0",
"symfony/monolog-bridge": "^4.0|^5.0",
"symfony/monolog-bundle": "^3.2",
"symfony/phpunit-bridge": "^4.4.9|^5.0.9",
"symfony/security-bundle": "^4.4|^5.0",
"symfony/twig-bundle": "^4.4|^5.0",
"symfony/yaml": "^4.4|^5.0",
"twig/twig": "^1.34|^2.4|^3.0"
},
"type": "symfony-bundle",
"extra": {
"branch-alias": {
"dev-master": "6.1.x-dev"
}
},
"autoload": {
"psr-4": {
"Sensio\\Bundle\\FrameworkExtraBundle\\": "src/"
},
"exclude-from-classmap": [
"/tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
}
],
"description": "This bundle provides a way to configure your controllers with annotations",
"keywords": [
"annotations",
"controllers"
],
"support": {
"issues": "https://github.com/sensiolabs/SensioFrameworkExtraBundle/issues",
"source": "https://github.com/sensiolabs/SensioFrameworkExtraBundle/tree/v6.1.2"
},
"time": "2021-04-09T16:14:11+00:00"
},
{ {
"name": "symfony/asset", "name": "symfony/asset",
"version": "v5.2.4", "version": "v5.2.4",

View file

@ -14,4 +14,5 @@ return [
SymfonyCasts\Bundle\VerifyEmail\SymfonyCastsVerifyEmailBundle::class => ['all' => true], SymfonyCasts\Bundle\VerifyEmail\SymfonyCastsVerifyEmailBundle::class => ['all' => true],
EasyCorp\Bundle\EasyAdminBundle\EasyAdminBundle::class => ['all' => true], EasyCorp\Bundle\EasyAdminBundle\EasyAdminBundle::class => ['all' => true],
Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true], Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
]; ];

View file

@ -0,0 +1,3 @@
sensio_framework_extra:
router:
annotations: false

View file

@ -77,10 +77,10 @@ class AppController extends AbstractController
} }
#[Route('/offer/{id}', name: 'show_offer')] #[Route('/offer/{id}', name: 'show_offer')]
public function offer(): Response public function show_offer(Offering $offering): Response
{ {
return $this->render('app/offer.html.twig', [ return $this->render('app/offer.html.twig', [
'offer' => $this->getOffering(), 'offer' => $offering,
]); ]);
} }
} }

View file

@ -127,4 +127,9 @@ class Offering
return $this; return $this;
} }
public function __toString(): string
{
return (string) $this-getTitle();
}
} }

View file

@ -124,6 +124,18 @@
"psr/log": { "psr/log": {
"version": "1.1.3" "version": "1.1.3"
}, },
"sensio/framework-extra-bundle": {
"version": "5.2",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "5.2",
"ref": "fb7e19da7f013d0d422fa9bce16f5c510e27609b"
},
"files": [
"config/packages/sensio_framework_extra.yaml"
]
},
"symfony/asset": { "symfony/asset": {
"version": "v5.2.4" "version": "v5.2.4"
}, },

View file

@ -12,7 +12,7 @@
{% if offerings|length > 0 %} {% if offerings|length > 0 %}
<div class="card-deck d-flex justify-content-around"> <div class="card-deck d-flex justify-content-around">
{% for offering in offerings %} {% for offering in offerings %}
<a href="#" class="mb-5"> <a href="./offer/{{ offering.id }}" class="mb-5">
<div class="card offering h-100"> <div class="card offering h-100">
{% if offering.photoFilename %} {% if offering.photoFilename %}
<img class="card-img-top" src="{{ asset('uploads/photos/' ~ offering.photofilename) }}" /> <img class="card-img-top" src="{{ asset('uploads/photos/' ~ offering.photofilename) }}" />

View file

@ -0,0 +1,21 @@
{% extends 'base.html.twig' %}
{% block body %}
<h1 class="mb-3">{{ offer.title }}</h1>
<div class="media">
<img class="mr-3 w-25 rounded" alt="Generic placeholder image" src="{{ asset('uploads/photos/' ~ offer.photofilename) }}">
<div class="media-body">
<h3>
Description
</h3>
<p>
{{ offer.description }}
</p>
<h3>
From
</h3>
<p>{{ offer.byUser }} in {{ offer.zipCode }}</p>
</div>
</div>
{% endblock %}