From f6349a615b2af1d82a1eb8b3e413e5534cb11e69 Mon Sep 17 00:00:00 2001 From: Sebastian Fey Date: Sat, 16 Jan 2021 15:39:42 +0100 Subject: [PATCH 1/6] Created recipe-list component Signed-off-by: Sebastian Fey --- src/components/RecipeList.vue | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/components/RecipeList.vue diff --git a/src/components/RecipeList.vue b/src/components/RecipeList.vue new file mode 100644 index 000000000..8c926a67f --- /dev/null +++ b/src/components/RecipeList.vue @@ -0,0 +1,20 @@ + + + + + From 2e0d61fe47afcf876efc7092d812a31e82d2c676 Mon Sep 17 00:00:00 2001 From: Sebastian Fey Date: Sat, 16 Jan 2021 21:23:15 +0100 Subject: [PATCH 2/6] Added handling of keywords and recipes Signed-off-by: Sebastian Fey --- src/components/RecipeList.vue | 271 +++++++++++++++++++++++++++++++++- 1 file changed, 268 insertions(+), 3 deletions(-) diff --git a/src/components/RecipeList.vue b/src/components/RecipeList.vue index 8c926a67f..7ce90fa13 100644 --- a/src/components/RecipeList.vue +++ b/src/components/RecipeList.vue @@ -1,20 +1,285 @@ From d431b164d43ed6ca026ba38e941e6f8b4707c9b9 Mon Sep 17 00:00:00 2001 From: Sebastian Fey Date: Sat, 16 Jan 2021 21:24:19 +0100 Subject: [PATCH 3/6] Using recipe-list component in recipe index Signed-off-by: Sebastian Fey --- src/components/AppIndex.vue | 255 +----------------------------------- 1 file changed, 6 insertions(+), 249 deletions(-) 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 @@ - - From 761974f9c6a1b08d2039c77a4767fd2cd208fc2f Mon Sep 17 00:00:00 2001 From: Sebastian Fey Date: Sat, 16 Jan 2021 21:26:59 +0100 Subject: [PATCH 4/6] Using recipe-list component in search results and categories Signed-off-by: Sebastian Fey --- src/components/SearchResults.vue | 201 ++----------------------------- 1 file changed, 7 insertions(+), 194 deletions(-) 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 @@ - - From 9ea5ad19129f2d66de3e8fdb8fdad117675fcfb9 Mon Sep 17 00:00:00 2001 From: Sebastian Fey Date: Sat, 16 Jan 2021 23:16:15 +0100 Subject: [PATCH 5/6] Attaching keywords to recipe results for keyword searches Signed-off-by: Sebastian Fey --- lib/Db/RecipeDb.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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); } /** From 1c8759017f7daa45822ec69903e2a5965b98ebc5 Mon Sep 17 00:00:00 2001 From: Sebastian Fey Date: Sat, 16 Jan 2021 23:17:44 +0100 Subject: [PATCH 6/6] Updated CHANGELOG Signed-off-by: Sebastian Fey --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) 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