create a public user page
This commit is contained in:
parent
e0ec9807a3
commit
428baa749c
6 changed files with 92 additions and 43 deletions
|
@ -6,7 +6,7 @@ $primary: darken(#005035, 20%);
|
||||||
// the ~ allows you to reference things in node_modules
|
// the ~ allows you to reference things in node_modules
|
||||||
@import "~bootstrap/scss/bootstrap";
|
@import "~bootstrap/scss/bootstrap";
|
||||||
|
|
||||||
.offer > img {
|
.offer-img {
|
||||||
height: 15rem;
|
height: 15rem;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
}
|
}
|
||||||
|
@ -40,4 +40,12 @@ $primary: darken(#005035, 20%);
|
||||||
|
|
||||||
.offer-footer {
|
.offer-footer {
|
||||||
color: #555;
|
color: #555;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-link {
|
||||||
|
color: #555;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-link:hover {
|
||||||
|
color: #000;
|
||||||
}
|
}
|
BIN
public/placeholder.jpg
Normal file
BIN
public/placeholder.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 34 KiB |
|
@ -52,12 +52,13 @@ class UserController extends AbstractController
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Route('/user/{id}', name: 'public_wishlist')]
|
#[Route('/user/{id}', name: 'user_public')]
|
||||||
public function show_user(User $user, WishRepository $wishRepository): Response
|
public function show_user(User $user, OfferingRepository $offeringRepository, WishRepository $wishRepository): Response
|
||||||
{
|
{
|
||||||
return $this->render('user/public_wishlist.html.twig', [
|
return $this->render('user/public.html.twig', [
|
||||||
'username' => $user->getUsername(),
|
'username' => $user->getUsername(),
|
||||||
'wishes' => $wishRepository->findByUser($user),
|
'wishes' => $wishRepository->findByUser($user),
|
||||||
|
'offers' => $offeringRepository->findByUser($user),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,21 +12,27 @@
|
||||||
{% if offers|length > 0 %}
|
{% if offers|length > 0 %}
|
||||||
<div class="card-deck d-flex justify-content-around justify-content-sm-around justify-content-md-between flex-wrap">
|
<div class="card-deck d-flex justify-content-around justify-content-sm-around justify-content-md-between flex-wrap">
|
||||||
{% for offer in offers %}
|
{% for offer in offers %}
|
||||||
<a href="{{ path('show_offer', {'id': offer.id}) }}" class="mb-5">
|
<div class="mb-5">
|
||||||
<div class="card offer h-100">
|
<div class="card offer h-100">
|
||||||
{% if offer.photoFilename %}
|
<a href="{{ path('show_offer', {'id': offer.id }) }}">
|
||||||
<img class="card-img-top" src="{{ asset('uploads/photos/' ~ offer.photofilename) }}" />
|
{% if offer.photoFilename %}
|
||||||
{% endif %}
|
<img class="card-img-top offer-img" src="{{ asset('uploads/photos/' ~ offer.photofilename) }}" />
|
||||||
<div class="card-body">
|
{% else %}
|
||||||
<h5 class="card-title">{{ offer.title }}</h5>
|
<img class="card-img-top offer-img" src="{{ asset('placeholder.jpg') }}" />
|
||||||
<p class="card-text">{{ offer.description }}</p>
|
{% endif %}
|
||||||
</div>
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">{{ offer.title }}</h5>
|
||||||
|
<p class="card-text">{{ offer.description }}</p>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
<div class="card-footer offer-footer">
|
<div class="card-footer offer-footer">
|
||||||
<p class="username"><i class="fas fa-user mt-3"></i> {{ offer.byUser }}</p>
|
<a class="user-link" href="{{ path('user_public', { 'id': offer.byuser.id }) }}">
|
||||||
|
<p class="username"><i class="fas fa-user mt-3"></i> {{ offer.byUser }}</p>
|
||||||
|
</a>
|
||||||
<p class="zip"><i class="fas fa-map-marker-alt mt-3"></i> {{ offer.zipCode }}</p>
|
<p class="zip"><i class="fas fa-map-marker-alt mt-3"></i> {{ offer.zipCode }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
63
templates/user/public.html.twig
Normal file
63
templates/user/public.html.twig
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
|
{% block title %}Whishlist{% endblock %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
{% for message in app.flashes('success') %}
|
||||||
|
<div class="alert alert-success" role="alert">
|
||||||
|
{{ message }}
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<h1>{{ username }}'s Wishlist</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-4">
|
||||||
|
{% if wishes == [] %}
|
||||||
|
<div class="alert alert-warning" role="alert">
|
||||||
|
There are currently no wishes!
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
|
<ul class="list-group">
|
||||||
|
{% for wish in wishes %}
|
||||||
|
<li class="list-group-item"> {{ wish.title }}</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<div class="mb-3">
|
||||||
|
<h1>{{ username }}'s Offers</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% if offers|length > 0 %}
|
||||||
|
<div class="card-deck d-flex justify-content-around justify-content-sm-around justify-content-md-between flex-wrap">
|
||||||
|
{% for offer in offers %}
|
||||||
|
<div class="mb-5">
|
||||||
|
<div class="card offer h-100">
|
||||||
|
<a href="{{ path('show_offer', {'id': offer.id }) }}">
|
||||||
|
{% if offer.photoFilename %}
|
||||||
|
<img class="card-img-top offer-img" src="{{ asset('uploads/photos/' ~ offer.photofilename) }}" />
|
||||||
|
{% else %}
|
||||||
|
<img class="card-img-top offer-img" src="{{ asset('placeholder.jpg') }}" />
|
||||||
|
{% endif %}
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">{{ offer.title }}</h5>
|
||||||
|
<p class="card-text">{{ offer.description }}</p>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
<div class="card-footer offer-footer">
|
||||||
|
<a class="user-link" href="{{ path('user_public', { 'id': offer.byuser.id }) }}">
|
||||||
|
<p class="username"><i class="fas fa-user mt-3"></i> {{ offer.byUser }}</p>
|
||||||
|
</a>
|
||||||
|
<p class="zip"><i class="fas fa-map-marker-alt mt-3"></i> {{ offer.zipCode }}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
|
<div class="alert alert-warning" role="alert">There are currently no active offers.</div>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
|
@ -1,29 +0,0 @@
|
||||||
{% extends 'base.html.twig' %}
|
|
||||||
|
|
||||||
{% block title %}Whishlist{% endblock %}
|
|
||||||
|
|
||||||
{% block body %}
|
|
||||||
{% for message in app.flashes('success') %}
|
|
||||||
<div class="alert alert-success" role="alert">
|
|
||||||
{{ message }}
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
<div class="mb-3">
|
|
||||||
<h1>{{ username }}'s' Wishlist</h1>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mb-3">
|
|
||||||
{% if wishes == [] %}
|
|
||||||
<div class="alert alert-warning" role="alert">
|
|
||||||
There are currently no wishes!
|
|
||||||
</div>
|
|
||||||
{% else %}
|
|
||||||
<ul class="list-group">
|
|
||||||
{% for wish in wishes %}
|
|
||||||
<li class="list-group-item"> {{ wish.title }}</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
Reference in a new issue