Skip to content
Snippets Groups Projects
Commit 1f0fbba7 authored by ALGLAVE Ivan's avatar ALGLAVE Ivan
Browse files

Recipes.php now links to RecipeList with all lists as parameter

parent 9e5b65ac
No related branches found
No related tags found
No related merge requests found
...@@ -28,20 +28,22 @@ ...@@ -28,20 +28,22 @@
{ {
$re = explode(':', $recipesIds[$i]); $re = explode(':', $recipesIds[$i]);
echo '<li>'; echo '<li><div class="container">';
echo '<img class="toggleFavourite" src="images/favourite.png" >';
echo '<div class="listElement" onclick="showRecipe(' . intval($re[0]) . ');">'; echo '<div class="listElement" onclick="showRecipe(' . intval($re[0]) . ');">';
$recipe = $Recettes[intval($re[0])]; $recipe = $Recettes[intval($re[0])];
$image_url = getRecipeImage($recipe['titre']); $image_url = getRecipeImage($recipe['titre']);
$image_url = '' . 'Photos/' . $image_url; $image_url = '' . 'Photos/' . $image_url;
if(file_exists($image_url)) echo '<img src="' . $image_url . '"></img>'; if(file_exists($image_url)) echo '<img class="cocktailImg" src="' . $image_url . '"></img>';
else echo '<img src="images/missing.jfif"></img>'; else echo '<img class="cocktailImg" src="images/missing.jfif"></img>';
echo '<h1>' . $recipe['titre'] . '</h1>'; echo '<h1>' . $recipe['titre'] . '</h1>';
echo '</div>'; echo '</div>';
echo '</li>'; echo '</div></li>';
} }
} }
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
<body> <body>
<img class="toggleFavourite" src="images/favourite.png" >
<?php <?php
include "scripts/Functions.php"; include "scripts/Functions.php";
include "Donnees.inc.php"; include "Donnees.inc.php";
...@@ -22,7 +23,7 @@ ...@@ -22,7 +23,7 @@
?> ?>
<div> <div>
<img src=<?php echo "\"" . $image_url . "\"" ?> width="128" height="128"; ?> <img src=<?php echo "\"" . $image_url . "\"" ?> width="256" height="256"; ?>
<span> <span>
<h1> <h1>
<?php echo $r_name; ?> <?php echo $r_name; ?>
......
...@@ -4,37 +4,22 @@ ...@@ -4,37 +4,22 @@
<title>Drinkpedia</title> <title>Drinkpedia</title>
<meta charset="UTF-8"> <meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="css/Recipes.css"> <link rel="stylesheet" type="text/css" href="css/Recipes.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
</head> </head>
<body> <body>
<h1>Cocktails</h1> <script src="scripts/DataQuery.js"></script>
<ul>
<?php
include "Donnees.inc.php";
$ar = $Recettes;
for($i = 0; $i < count($ar); $i++)
{
echo '<li onclick="notifyParent(' . $i . ');" hint="Voir">' . $ar[$i]['titre'] . '</li>';
}
?>
</ul>
<script> <script>
function notifyParent(e) // Send a message to the parent window, asking to display the recipe #e getRecipes([], [], 0, true, true, function(e) {
{
var data = { var data = {
event: 'recipeselect', event: 'recipelist',
value: Number(e) value: e
}; };
window.top.postMessage(data, [data.event, data.value]); window.top.postMessage(data, [data.event, data.value]);
} });
</script> </script>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -29,19 +29,34 @@ ul li:last-child { ...@@ -29,19 +29,34 @@ ul li:last-child {
border-bottom-right-radius: 15px; border-bottom-right-radius: 15px;
} }
.container {
width: 100%;
overflow: hidden;
}
.listElement { .listElement {
float: left;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: left; justify-content: left;
align-items: center; align-items: center;
} }
.listElement img { .cocktailImg {
border-radius: 7px; border-radius: 7px;
background-color: white;
border-color: black; border-color: black;
border-width: 2px; border-width: 2px;
border-style: solid; border-style: solid;
width: 64px; width: 64px;
height: 64px; height: 64px;
margin-right: 15px; margin-right: 15px;
} object-fit: contain;
\ No newline at end of file }
.toggleFavourite {
float: right;
vertical-align: middle;
width: 32px;
height: auto;
}
\ No newline at end of file
...@@ -2,4 +2,17 @@ body { ...@@ -2,4 +2,17 @@ body {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
}
img {
background-color: white;
object-fit: contain;
}
.toggleFavourite {
position: absolute;
top: 0px;
right: 0px;
width: 32px;
height: 32px;
} }
\ No newline at end of file
images/favourite.png

26.7 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment