Compare commits
7 Commits
07c4c49cf0
...
6ef6930766
| Author | SHA1 | Date | |
|---|---|---|---|
| 6ef6930766 | |||
| f1bebeee48 | |||
| 9a66bb2b6f | |||
| 69f47cdc42 | |||
| ec6f7bcabd | |||
| 15f3b42d84 | |||
| d846de0182 |
@ -74,8 +74,11 @@ the_header(
|
||||
</div>
|
||||
</div>
|
||||
<div class="small-btns">
|
||||
<button id="favorite-btn" class="btn btn-secondary btn-small hover-anim <?= $context['recipe']->is_in_favorite ? 'active' : '' ?>" title="Add To Favorites">
|
||||
<i class="<?= $context['recipe']->is_in_favorite ? 'fa-solid' : 'fa-regular' ?> fa-heart"></i>
|
||||
<button id="favorite-btn"
|
||||
class="btn btn-secondary btn-small hover-anim <?= $context['recipe']->is_in_favorite ? 'active' : '' ?>"
|
||||
title="Add To Favorites">
|
||||
<i
|
||||
class="<?= $context['recipe']->is_in_favorite ? 'fa-solid' : 'fa-regular' ?> fa-heart"></i>
|
||||
</button>
|
||||
<a class="btn btn-secondary btn-small hover-anim"
|
||||
href="<?php the_permalink('recipes:export-pdf', [$context['recipe']->get_id()]); ?>"
|
||||
@ -124,6 +127,66 @@ the_header(
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="single-recipe-reviews">
|
||||
<h2 class="title">Reviews</h2>
|
||||
<h3 class="rating">Average Rating: 4.5 <i class="fa-regular fa-star"></i></h3>
|
||||
<div class="reviews">
|
||||
<div class="review-list">
|
||||
<h4 class="subtitle">All Reviews</h4>
|
||||
<div class="review">
|
||||
<span class="review-title"> <i class="fa-solid fa-star"></i> 5 Divine disc of
|
||||
deliciousness!</span>
|
||||
<div class="review-body">
|
||||
Blessings of Aqua-sama upon you, fellow foodies! As a proud and very sane member of the Axis
|
||||
Cult, I recently partook in a holy culinary experience that rivaled even the sacred waters
|
||||
of the Blue Lake: a homemade pepperoni and mushroom pizza!
|
||||
The moment I laid eyes on that glorious golden crust, I knew—Aqua-sama herself must have
|
||||
guided my ovens temperature dial! The cheese was melted with such heavenly grace,
|
||||
stretching with every bite like the ribbons of our goddesss divine garments. The pepperoni?
|
||||
Spicy circles of salvation! And the mushrooms—earthy little blessings sent straight from the
|
||||
soil Aqua purifies daily!
|
||||
The crust had the perfect balance of crispy edge and fluffy soul. It crackled like the
|
||||
laughter of a cultist pranking a stubborn Eris follower (teehee~). Each bite sang praises in
|
||||
my mouth: “Axis! Axis! AXIS!!”
|
||||
Would I recommend this pizza? Of course! Id even offer it as tribute at the next festival
|
||||
in Aquas honor. Try it yourself and bask in the savory enlightenment. And remember: if it
|
||||
tastes weird, just pour holy water on it. Or beer. Aqua would approve either way.
|
||||
Rating: 5 out of 5 Axis Blessings!(Any lower would be heresy.)
|
||||
</div>
|
||||
<div class="single-review-meta">
|
||||
<div class="review-meta__user meta">
|
||||
<i class="fa-regular fa-user"></i> GreenDavid004
|
||||
</div>
|
||||
<div class="review-meta__date meta"><?= date("d.m.Y"); ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="review-form">
|
||||
<h4 class="subtitle">Your Review</h4>
|
||||
<form id="review-form" class="review-form__form" method="post" action="#">
|
||||
<div class="rating-selection">
|
||||
<label for="rating-select">Choose rating: </label>
|
||||
<select name="rating-select" id="rating select">
|
||||
<option value="0">Rating</option>
|
||||
<option value="1">1 Star</option>
|
||||
<option value="2">2 Star </option>
|
||||
<option value="3">3 Star</option>
|
||||
<option value="4">4 Star</option>
|
||||
<option value="5">5 Star</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input">
|
||||
<input type="text" name="review-title" id="review-title-input" placeholder="Review Title"
|
||||
required>
|
||||
</div>
|
||||
<textarea name="review-body-input" id="review-body-input" placeholder="Write your review here"></textarea>
|
||||
|
||||
<button type="submit" class="btn btn-primary hover-anim">Submit</button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -876,6 +876,10 @@ input[type="checkbox"]{
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.single-recipe-info__details {
|
||||
min-width: 400px;
|
||||
}
|
||||
|
||||
.single-recipe-info__image {
|
||||
width: 350px;
|
||||
height: 260px;
|
||||
@ -1041,7 +1045,7 @@ input[type="checkbox"]{
|
||||
align-items: flex-start;
|
||||
margin-top: 30px;
|
||||
gap: 40px;
|
||||
/* flex-wrap: wrap; */
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.single-instructions {
|
||||
@ -1119,6 +1123,102 @@ label {
|
||||
row-gap: 40px;
|
||||
}
|
||||
|
||||
.single-recipe-reviews{
|
||||
margin-bottom: 46px;
|
||||
}
|
||||
|
||||
.single-recipe-reviews .title{
|
||||
text-align: start;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.single-recipe-reviews .rating{
|
||||
font-size: 20px;
|
||||
color: var(--common-text);
|
||||
font-family: var(--title-font);
|
||||
font-weight: 400;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.reviews{
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
gap: 40px;
|
||||
margin-top: 40px;
|
||||
}
|
||||
|
||||
.review-list{
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.review-form{
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.subtitle{
|
||||
font-family: var(--title-font);
|
||||
font-size: 16px;
|
||||
color: var(--common-font);
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.review-title{
|
||||
font-family: var(--title-font);
|
||||
font-size: 16px;
|
||||
color: var(--title-color);
|
||||
margin-bottom: 10px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.review-body{
|
||||
font-size: 16px;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.single-review-meta{
|
||||
font-size: 14px;
|
||||
margin-top: 15px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.review-meta__user{
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.review-meta__date{
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.rating-select{
|
||||
color: var(--title-color);
|
||||
}
|
||||
|
||||
.rating-selection{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
height: 70px;
|
||||
}
|
||||
|
||||
.rating-selection select{
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.review-form textarea{
|
||||
width: 100%;
|
||||
height: 150px;
|
||||
margin-bottom: 10px;
|
||||
font-family: var(--common-font);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@media (max-width: 768px) {
|
||||
|
||||
.catalog-items {
|
||||
|
||||
@ -252,4 +252,54 @@ function send_email(string $subject, string $body, string $altBody, string $to_a
|
||||
|
||||
$mail->send();
|
||||
}
|
||||
?>
|
||||
|
||||
/**
|
||||
* Collects related objects for each origin object based on a given foreign key.
|
||||
*
|
||||
* Returns an array in the following format:
|
||||
* [
|
||||
* [
|
||||
* 'origin' => $object, // the origin object
|
||||
* 'relations' => $objects // related objects from the target model
|
||||
* ],
|
||||
* ...
|
||||
* ]
|
||||
*
|
||||
* @param array $objects Array of origin objects (their IDs will be used for matching)
|
||||
* @param string $model_name_format Target model name in "app:model" format to fetch related objects from
|
||||
* @param string $field_key Foreign key in the related model that refers to the origin object ID
|
||||
* @return array An array of relation mappings between origin and related objects
|
||||
*/
|
||||
function prefetch_related(array $objects, string $model_name_format, string $field_key)
|
||||
{
|
||||
[$app, $model] = explode(':', $model_name_format);
|
||||
$model_name = "Lycoreco\Apps\\" . $app . "\Models\\" . $model;
|
||||
|
||||
if (!class_exists($model_name)) {
|
||||
throw new InvalidArgumentException("Model class $model_name does not exist.");
|
||||
}
|
||||
|
||||
$keys = $keys = array_map(fn($obj) => $obj->get_id(), $objects);
|
||||
|
||||
if (empty($keys))
|
||||
return [];
|
||||
|
||||
$related_objects = $model_name::filter(array(
|
||||
[
|
||||
'name' => 'obj.' . $field_key,
|
||||
'type' => 'IN',
|
||||
'value' => $keys
|
||||
]
|
||||
));
|
||||
|
||||
return array_map(function ($object) use ($related_objects, $field_key) {
|
||||
$rels = array_filter($related_objects, function ($rel) use ($object, $field_key) {
|
||||
return $rel->{'field_' . $field_key} == $object->get_id();
|
||||
});
|
||||
|
||||
return [
|
||||
'origin' => $object,
|
||||
'relations' => array_values($rels)
|
||||
];
|
||||
}, $objects);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user