Fixed shopcat setting on detail edit/new recipe

version2
Tim Holloway 2 years ago
parent 8cc60e2fbf
commit f3c28258d1
  1. 9
      pom.xml
  2. 2
      src/main/java/com/mousetech/gourmetj/AdminMainBean.java
  3. 16
      src/main/java/com/mousetech/gourmetj/RecipeDetailBean.java
  4. 1
      src/main/resources/META-INF/resources/detailEdit.xhtml

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

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

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

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

Loading…
Cancel
Save