Commit 391cf5dc authored by Mat's avatar Mat

today: affichage des légumes triés

parent 3c9f0a3a
......@@ -43,12 +43,15 @@ class MembreController extends MasterController
$offreOne = $this->getDoctrine()->getManager()
->getRepository('PotageBundle:Offre')
->findOneByReference($tokenInside['offre_ref']);
$legumesSorted = $this->getOffreLegumesSorted($offreOne);
} else {
$token = null;
$tokenInside =null;
$offreOne = null;
$legumesSorted = null;
}
......@@ -58,6 +61,7 @@ class MembreController extends MasterController
'token' => $token,
'tokenInside' => $tokenInside,
'offreOne' => $offreOne,
'legumesSorted' => $legumesSorted,
));
}
......@@ -82,6 +86,8 @@ class MembreController extends MasterController
$offreOne = $this->getDoctrine()->getManager()
->getRepository('PotageBundle:Offre')
->findOneByReference($offre_ref);
$legumesSorted = $this->getOffreLegumesSorted($offreOne);
if ($offreOne === null) {
return $this->redirectToRoute('potage_today');
......@@ -93,6 +99,7 @@ class MembreController extends MasterController
'token' => null,
'tokenInside' => null,
'offreOne' => $offreOne,
'legumesSorted' => $legumesSorted,
));
}
......@@ -137,5 +144,27 @@ class MembreController extends MasterController
return $groupes;
}
/**
* Retourne un tableau d'objets OffreLégumes triés
*
* @param Offre $offre
* @return array
*/
private function getOffreLegumesSorted(Offre $offre)
{
$sort = explode(",", $offre->getSorted());
foreach ($sort as $k => $v)
{
foreach ($offre->getOffreLegumes() as $legume)
{
if ($legume->getId() === intval($v))
{
$legumesSorted[$k] = $legume;
}
}
}
return $legumesSorted;
}
}
......@@ -87,7 +87,7 @@
{% elseif is_granted('ROLE_ADMIN') %}
Maraîcher
{% else %}
Membre
Mangeur
{% endif %}
</span>
</a>
......
......@@ -30,7 +30,7 @@
<h3>Expire le {{ offreOne.endedAt|date('d M Y à H:i A') }}</h3>
<div id="offre" class="grid">
{% for legume in offreOne.offreLegumes %}
{% for legume in legumesSorted %}
<div class="item image legume"
data-legume-id="{{ legume.id }}"
style="background-image: url('{{ asset('uploads/images/legumes/') }}{{ legume.image }}');">
......
......@@ -334,30 +334,28 @@ span.posted:first-letter {
text-align: center;
}
/**/
body#today,
body#today_one,
/*
* Background photo
*/
body[id^='today'],
body#homepage {
background-image: url("img/serre_bg.jpg");
background-position: center;
background-size: cover;
background-attachment: fixed;
}
body#today .bloc,
body#today_one .bloc,
body[id^='today'] .bloc,
body#homepage .bloc {
background-color: #ffffffad;
padding: 1em 2em;
}
body#today .bloc.welcome,
body#today_one .bloc.welcome,
body[id^='today'] .bloc.welcome,
body#homepage .bloc.welcome {
background-color: #000000ad;
color: white;
margin-top: 21em;
}
body#today footer#footer .footer,
body#today_one footer#footer .footer,
body[id^='today'] footer#footer .footer,
body#homepage footer#footer .footer {
background-color: white;
}
......@@ -365,15 +363,12 @@ body#homepage footer#footer .footer {
/*
* La page today
*/
body#today_one {
}
body#today_one #offre.grid {
body[id^='today'] #offre.grid {
display: flex;
flex-flow: row wrap;
margin: 2em -2em;
}
#today_one #offre.grid div.item {
body[id^='today'] #offre.grid div.item {
flex: 1 0 10%;
position: relative;
min-width: 175px;
......@@ -382,12 +377,12 @@ body#today_one #offre.grid {
background-size: cover;
background-color: #242424;
}
#today_one #offre.grid div.item:hover {
body[id^='today'] #offre.grid div.item:hover {
z-index: 1;
box-shadow: 0 0 30px 0 black;
}
#today_one #offre.grid div.item .overlay {
body[id^='today'] #offre.grid div.item .overlay {
position: absolute;
top: 0; bottom: 0; left: 0; right: 0;
padding: 1em;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment