diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9cce1309e..0639b5268 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,8 @@
### Changed
- Using computed property in recipe view
[#522](https://github.com/nextcloud/cookbook/pull/522/) @seyfeb
+- Split off list/grid of recipes to separate Vue component
+ [#526](https://github.com/nextcloud/cookbook/pull/526/) @seyfeb
## 0.7.10 - 2021-01-16
diff --git a/lib/Db/RecipeDb.php b/lib/Db/RecipeDb.php
index ca222ad3f..d81620106 100755
--- a/lib/Db/RecipeDb.php
+++ b/lib/Db/RecipeDb.php
@@ -263,7 +263,7 @@ public function getRecipesByKeywords(string $keywords, string $user_id) {
$qb = $this->db->getQueryBuilder();
- $qb->select(['r.recipe_id', 'r.name'])
+ $qb->select(['r.recipe_id', 'r.name', 'kk.name AS keywords'])
->from(self::DB_TABLE_KEYWORDS, 'k')
->where('k.name IN (:keywords)')
->andWhere('k.user_id = :user')
@@ -272,14 +272,18 @@ public function getRecipesByKeywords(string $keywords, string $user_id) {
->setParameter('keywords', $keywords_arr, IQueryBuilder::PARAM_STR_ARRAY)
->setParameter('keywordsCount', sizeof($keywords_arr), TYPE::INTEGER);
$qb->join('k', self::DB_TABLE_RECIPES, 'r', 'k.recipe_id = r.recipe_id');
- $qb->groupBy(['r.name', 'r.recipe_id']);
+ $qb->join('r', self::DB_TABLE_KEYWORDS, 'kk', 'kk.recipe_id = r.recipe_id');
+ $qb->groupBy(['r.name', 'r.recipe_id', 'kk.name']);
$qb->orderBy('r.name');
$cursor = $qb->execute();
$result = $cursor->fetchAll();
$cursor->closeCursor();
- return $this->unique($result);
+ // group recipes, convert keywords to comma-separated list
+ $recipesGroupedTags = $this->groupKeywordInResult($result);
+
+ return $this->unique($recipesGroupedTags);
}
/**
diff --git a/src/components/AppIndex.vue b/src/components/AppIndex.vue
index cc77e6d76..b8b58b014 100644
--- a/src/components/AppIndex.vue
+++ b/src/components/AppIndex.vue
@@ -1,198 +1,24 @@
-
-
-
-
-
-
-
-
-
-
- -
-
-
- {{ recipeObj.recipe.name }}
-
-
-
-
+
-
-
diff --git a/src/components/RecipeList.vue b/src/components/RecipeList.vue
new file mode 100644
index 000000000..7ce90fa13
--- /dev/null
+++ b/src/components/RecipeList.vue
@@ -0,0 +1,285 @@
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+ {{ recipeObj.recipe.name }}
+
+
+
+
+
+
+
+
+
diff --git a/src/components/SearchResults.vue b/src/components/SearchResults.vue
index f974e6e09..d44f31200 100644
--- a/src/components/SearchResults.vue
+++ b/src/components/SearchResults.vue
@@ -1,133 +1,37 @@
-
-
-
-
-
-
- -
-
-
-
- {{ result.name }}
-
-
-
+
-
-