Update food views
This commit is contained in:
parent
ab2c050ae6
commit
4b35667623
@ -8,11 +8,18 @@ document.addEventListener('DOMContentLoaded', rate_init);
|
|||||||
*/
|
*/
|
||||||
function rate_init() {
|
function rate_init() {
|
||||||
add_Stars();
|
add_Stars();
|
||||||
$('.star').on("mouseenter mouseleave", function () {
|
$('.star').on("mouseenter", function () {
|
||||||
showRating(this);
|
showRating(this);
|
||||||
}).on("click", function () {
|
}).on("click", function () {
|
||||||
console.log('Click');
|
console.log('Click');
|
||||||
sendRating(this);
|
sendRating(this);
|
||||||
|
}).on("mouseleave", function () {
|
||||||
|
var rating = $(this).parent().parent().parent().parent().parent().data('rating');
|
||||||
|
var food_id = $(this).attr('class').split(' ')[0].split('-')[2];
|
||||||
|
buildRating(food_id, rating);
|
||||||
|
console.log("leaved");
|
||||||
|
console.log("rating" + $(this).parent().parent().parent().parent().parent().data('rating'));
|
||||||
|
console.log("food_id" + food_id);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -18,5 +18,4 @@
|
|||||||
{{ macros.happy_hours(happy_hours=happy_hours) }}
|
{{ macros.happy_hours(happy_hours=happy_hours) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@ -59,7 +59,6 @@
|
|||||||
{% for single_food in menu %}
|
{% for single_food in menu %}
|
||||||
<li data-food="{{ single_food.id }}" data-rating="{{ single_food.rating }}" class="food-item media mb-2">
|
<li data-food="{{ single_food.id }}" data-rating="{{ single_food.rating }}" class="food-item media mb-2">
|
||||||
<div class="mr-2 media-left media-middle">
|
<div class="mr-2 media-left media-middle">
|
||||||
{# TODO: without many to many #}
|
|
||||||
{% if single_food.image %}
|
{% if single_food.image %}
|
||||||
<a href="{{ single_food.image.image.url }}" data-lightbox="{{ title }}"
|
<a href="{{ single_food.image.image.url }}" data-lightbox="{{ title }}"
|
||||||
data-title="{{ single_food.name }}">
|
data-title="{{ single_food.name }}">
|
||||||
|
|||||||
Reference in New Issue
Block a user