소스 검색

Add sorting to recipes display

Lee Morgan 6 년 전
부모
커밋
9448b18898
2개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 0 1
      views/merchantSetupPage/controller.js
  2. 2 0
      views/recipesPage/recipes.js

+ 0 - 1
views/merchantSetupPage/controller.js

@@ -1,7 +1,6 @@
 let controller = {
     data: {},  //For storing all data from user to pass to backend
 
-    //Component divs
     basicInfoStrand: document.querySelector("#basicInfoStrand"),
     addIngredientsStrand: document.querySelector("#addIngredientsStrand"),
     createIngredientsStrand: document.querySelector("#createIngredientsStrand"),

+ 2 - 0
views/recipesPage/recipes.js

@@ -17,6 +17,8 @@ let recipesObj = {
         while(body.children.length > 0){
             body.removeChild(body.firstChild);
         }
+
+        merchant.recipes.sort((a, b) => (a.name > b.name)? 1 : -1);
         
         for(let recipe of merchant.recipes){
             let recipeDiv = document.createElement("div");