diff --git a/cookbook/serializer.py b/cookbook/serializer.py index 5160add3f..37b43afaf 100644 --- a/cookbook/serializer.py +++ b/cookbook/serializer.py @@ -548,7 +548,7 @@ class RecipeBookEntrySerializer(serializers.ModelSerializer): return RecipeBookSerializer(context={'request': self.context['request']}).to_representation(obj.book) def get_recipe_content(self, obj): - return RecipeOverviewSerializer(context={'request': self.context['request']}).to_representation(obj.recipe) + return RecipeSerializer(context={'request': self.context['request']}).to_representation(obj.recipe) def create(self, validated_data): book = validated_data['book'] diff --git a/cookbook/static/assets/book.svg b/cookbook/static/assets/book.svg new file mode 100644 index 000000000..4d11aaaed --- /dev/null +++ b/cookbook/static/assets/book.svg @@ -0,0 +1,127 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cookbook/templates/books.html b/cookbook/templates/books.html index f38c33623..ee7996600 100644 --- a/cookbook/templates/books.html +++ b/cookbook/templates/books.html @@ -1,81 +1,34 @@ {% extends "base.html" %} -{% load custom_tags %} +{% load render_bundle from webpack_loader %} +{% load static %} {% load i18n %} +{% load l10n %} {% block title %}{% trans 'Recipe Books' %}{% endblock %} +{% block content_fluid %} -{% block content %} -
-
-

{% trans 'Recipe Books' %}

-
-
- {% trans 'New Book' %} -
+
+
-
-
- {% for b in book_list %} -
-
-
-
-
{% if b.book.icon %}{{ b.book.icon }} {% endif %}{{ b.book.name }}
-
{% if b.book.created_by != request.user %} - {% trans 'by' %} {{ b.book.created_by.get_user_name }} - {% endif %}
- {% if b.book.description %} -

{{ b.book.description }}

- {% endif %} - - {% if b.book.created_by == request.user or request.user.is_superuser %} - {% trans 'Edit' %} - {% trans 'Delete' %} - {% endif %} -
-
- {% if b.recipes %} -
    - {% for r in b.recipes %} -
  • -
    -
    - {% recipe_last r.recipe request.user as last_cooked %} - {{ r.recipe.name }} - {% recipe_rating r.recipe request.user as rating %} - {{ rating|safe }} - {% if last_cooked %} -   - {% trans 'Last cooked' %} {{ last_cooked|date }} - {% endif %} -
    - {% if b.book.created_by == request.user or request.user.is_superuser %} -
    - -
    - {% endif %} -
    -
  • - {% endfor %} -
- {% else %} -
-

- {% trans 'There are no recipes in this book yet.' %} -

-
- {% endif %} -
-
-
-
- {% endfor %} +{% endblock %} + +{% block script %} + {% if debug %} + + {% else %} + + {% endif %} + + + + {% render_bundle 'cookbook_view' %} {% endblock %} \ No newline at end of file diff --git a/cookbook/views/views.py b/cookbook/views/views.py index 0ea171655..ca8a60037 100644 --- a/cookbook/views/views.py +++ b/cookbook/views/views.py @@ -213,20 +213,7 @@ def recipe_view(request, pk, share=None): @group_required('user') def books(request): - book_list = [] - - recipe_books = RecipeBook.objects.filter(Q(created_by=request.user) | Q(shared=request.user), - space=request.space).distinct().all() - - for b in recipe_books: - book_list.append( - { - 'book': b, - 'recipes': RecipeBookEntry.objects.filter(book=b).all() - } - ) - - return render(request, 'books.html', {'book_list': book_list}) + return render(request, 'books.html', {}) @group_required('user') diff --git a/vue/package.json b/vue/package.json index bd983e93a..9c1537e80 100644 --- a/vue/package.json +++ b/vue/package.json @@ -25,6 +25,7 @@ "vue-multiselect": "^2.1.6", "vue-property-decorator": "^9.1.2", "vue-template-compiler": "^2.6.14", + "vue2-touch-events": "^3.2.2", "vuedraggable": "^2.24.3", "vuex": "^3.6.0", "workbox-webpack-plugin": "^6.1.5" diff --git a/vue/src/apps/CookbookView/CookbookView.vue b/vue/src/apps/CookbookView/CookbookView.vue new file mode 100644 index 000000000..a66de2c1c --- /dev/null +++ b/vue/src/apps/CookbookView/CookbookView.vue @@ -0,0 +1,114 @@ + + + + + diff --git a/vue/src/apps/CookbookView/main.js b/vue/src/apps/CookbookView/main.js new file mode 100644 index 000000000..e0766d6e7 --- /dev/null +++ b/vue/src/apps/CookbookView/main.js @@ -0,0 +1,10 @@ +import Vue from 'vue' +import App from './CookbookView.vue' +import i18n from '@/i18n' + +Vue.config.productionTip = false + +new Vue({ + i18n, + render: h => h(App), +}).$mount('#app') diff --git a/vue/src/components/AddRecipeToBook.vue b/vue/src/components/AddRecipeToBook.vue index 67cd8e377..b24b33344 100644 --- a/vue/src/components/AddRecipeToBook.vue +++ b/vue/src/components/AddRecipeToBook.vue @@ -3,15 +3,11 @@
- - - - - - -
- - {{ be.book_content.name }}
+
    +
  • + {{ be.book_content.name }} +
  • +
+ + +
{{ book_copy.icon }} {{ book_copy.name }} +
+
+ +
+ + +
+
+ + + +
+
+ + +
+ + {{ book_copy.description }} + +
+
+ + + + + + \ No newline at end of file diff --git a/vue/src/components/CookbookSlider.vue b/vue/src/components/CookbookSlider.vue new file mode 100644 index 000000000..f541b5dc6 --- /dev/null +++ b/vue/src/components/CookbookSlider.vue @@ -0,0 +1,220 @@ + + + + + \ No newline at end of file diff --git a/vue/src/components/CookbookToc.vue b/vue/src/components/CookbookToc.vue new file mode 100644 index 000000000..2d052c68f --- /dev/null +++ b/vue/src/components/CookbookToc.vue @@ -0,0 +1,44 @@ + + + + + \ No newline at end of file diff --git a/vue/src/components/Ingredient.vue b/vue/src/components/Ingredient.vue index 97759f8af..0ee0c4711 100644 --- a/vue/src/components/Ingredient.vue +++ b/vue/src/components/Ingredient.vue @@ -2,41 +2,41 @@ - + @@ -51,6 +51,10 @@ export default { ingredient_factor: { type: Number, default: 1, + }, + detailed: { + type: Boolean, + default: true } }, mixins: [ diff --git a/vue/src/components/Keywords.vue b/vue/src/components/Keywords.vue index 6be8e260f..eff7fb1a3 100644 --- a/vue/src/components/Keywords.vue +++ b/vue/src/components/Keywords.vue @@ -1,7 +1,7 @@ diff --git a/vue/src/components/LastCooked.vue b/vue/src/components/LastCooked.vue index bac08de74..84f8c73df 100644 --- a/vue/src/components/LastCooked.vue +++ b/vue/src/components/LastCooked.vue @@ -1,6 +1,6 @@