Update food views

This commit is contained in:
michigg 2018-03-28 14:47:47 +02:00
parent ab2c050ae6
commit 4b35667623
3 changed files with 8 additions and 3 deletions

View File

@ -8,11 +8,18 @@ document.addEventListener('DOMContentLoaded', rate_init);
*/
function rate_init() {
add_Stars();
$('.star').on("mouseenter mouseleave", function () {
$('.star').on("mouseenter", function () {
showRating(this);
}).on("click", function () {
console.log('Click');
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);
})
}

View File

@ -18,5 +18,4 @@
{{ macros.happy_hours(happy_hours=happy_hours) }}
</div>
</div>
{% endblock %}

View File

@ -59,7 +59,6 @@
{% for single_food in menu %}
<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">
{# TODO: without many to many #}
{% if single_food.image %}
<a href="{{ single_food.image.image.url }}" data-lightbox="{{ title }}"
data-title="{{ single_food.name }}">