Fixed shopcat setting on detail edit/new recipe

This commit is contained in:
Tim Holloway 2022-01-17 16:24:12 -05:00
parent 8cc60e2fbf
commit f3c28258d1
4 changed files with 23 additions and 5 deletions

View File

@ -63,6 +63,10 @@
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
@ -120,6 +124,11 @@
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>

View File

@ -223,7 +223,7 @@ public class AdminMainBean implements Serializable {
* maint.)
*/
public String doMore() {
return "shoppingList.jsf";
return "shoppingList.jsf?redirect=true";
}
/**

View File

@ -649,6 +649,13 @@ public class RecipeDetailBean implements Serializable {
log.info("Ingredient line: \"" + ingredientText + "\"");
Ingredient ing =
IngredientDigester.digest(ingredientText);
String ingkey = ing.getIngkey();
if (!StringUtils.isEmpty(ingkey)) {
Shopcat scat = this.recipeService
.findShopcatForIngredientKey(ingkey);
ing.setShopCat(scat);
}
// get ing list size, set ing position, append
List<IngredientUI> ingredients = getWrappedIngredients();
int lsize = ingredients.size();
@ -970,25 +977,26 @@ public class RecipeDetailBean implements Serializable {
}
// ***
// Editor pages are secured (redirect=true)
public String editDescription() {
this.setDetailTab(0);
return "detailEdit";
return "detailEdit?faces-redirect=true";
}
public String editIngredients() {
this.setDetailTab(1);
return "detailEdit";
return "detailEdit?faces-redirect=true";
}
public String editInstructions() {
this.setDetailTab(2);
return "detailEdit";
return "detailEdit?faces-redirect=true";
}
public String editNotes() {
this.setDetailTab(3);
return "detailEdit";
return "detailEdit?faces-redirect=true";
}
private void setDetailTab(int i) {

View File

@ -308,6 +308,7 @@
id="eShopcat"
value="E"
action="#{recipeDetailBean.ajaxEditShopcat(item)}"
immediate="true"
update="editShopcatDlg"
oncomplete="PF('editShopcatDlg').show()"
title="Edit the shopping category for ing. key"