shopcat, ENTER key for ingredients
This commit is contained in:
		
							parent
							
								
									7ba345413d
								
							
						
					
					
						commit
						735bf814cf
					
				
							
								
								
									
										15
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								pom.xml
									
									
									
									
									
								
							| 
						 | 
				
			
			@ -82,12 +82,12 @@
 | 
			
		|||
            <artifactId>spring-boot-starter-web</artifactId>
 | 
			
		||||
        </dependency>
 | 
			
		||||
 | 
			
		||||
<dependency>
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>javax.servlet.jsp</groupId>
 | 
			
		||||
            <artifactId>javax.servlet.jsp-api</artifactId>
 | 
			
		||||
            <version>2.3.3</version>
 | 
			
		||||
            <scope>provided</scope>
 | 
			
		||||
</dependency>
 | 
			
		||||
        </dependency>
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>org.apache.tomcat.embed</groupId>
 | 
			
		||||
            <artifactId>tomcat-embed-jasper</artifactId>
 | 
			
		||||
| 
						 | 
				
			
			@ -98,17 +98,6 @@
 | 
			
		|||
            <artifactId>javax.el</artifactId>
 | 
			
		||||
        </dependency>
 | 
			
		||||
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>commons-fileupload</groupId>
 | 
			
		||||
            <artifactId>commons-fileupload</artifactId>
 | 
			
		||||
            <version>1.3</version>
 | 
			
		||||
        </dependency>
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>commons-io</groupId>
 | 
			
		||||
            <artifactId>commons-io</artifactId>
 | 
			
		||||
            <version>2.2</version>
 | 
			
		||||
        </dependency>
 | 
			
		||||
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>org.xerial</groupId>
 | 
			
		||||
            <artifactId>sqlite-jdbc</artifactId>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -65,11 +65,11 @@ public class IngredientDigester {
 | 
			
		|||
			switch (unext.length) {
 | 
			
		||||
			case 1:
 | 
			
		||||
				ing.setUnit(null);
 | 
			
		||||
				ing.setItem(unext[0]);
 | 
			
		||||
				ing.setItem(nonoise(unext[0]));
 | 
			
		||||
				break;
 | 
			
		||||
			case 2:
 | 
			
		||||
				ing.setUnit(unext[0]);
 | 
			
		||||
				ing.setItem(unext[1]);
 | 
			
		||||
				ing.setItem(nonoise(unext[1]));
 | 
			
		||||
				break;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			@ -84,6 +84,22 @@ public class IngredientDigester {
 | 
			
		|||
		return ing;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Remove "noise" from ingredient title. For best results,
 | 
			
		||||
	 * should be adaptable for incoming language.
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @param string Item string with noise
 | 
			
		||||
	 * @return Item string with noise removed
 | 
			
		||||
	 */
 | 
			
		||||
	private static String nonoise(String string) {
 | 
			
		||||
		String xstring = string;
 | 
			
		||||
		if ( xstring.startsWith("of ")) {
 | 
			
		||||
			xstring = xstring.substring(3);
 | 
			
		||||
		}
 | 
			
		||||
		// Todo: remote "optional" from string, if present.
 | 
			
		||||
		return xstring;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Break down ingredients line into 2 parts. First part is
 | 
			
		||||
	 * numeric text representing amount and optional range,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -51,6 +51,9 @@ public class RecipeDetailBean implements Serializable {
 | 
			
		|||
	private static final Logger log =
 | 
			
		||||
			LoggerFactory.getLogger(RecipeDetailBean.class);
 | 
			
		||||
 | 
			
		||||
	// Split lines at 2 or more spaces OR at line terminators.
 | 
			
		||||
	private static final String RE_INGSPLIT = "\\s\\s+|\\r?+\\n";
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Default Constructor.
 | 
			
		||||
	 */
 | 
			
		||||
| 
						 | 
				
			
			@ -359,10 +362,15 @@ public class RecipeDetailBean implements Serializable {
 | 
			
		|||
 | 
			
		||||
	// =====
 | 
			
		||||
	/**
 | 
			
		||||
	 * Handle entry of a single ingredient line into the input
 | 
			
		||||
	 * form.
 | 
			
		||||
	 * Handle entry of ingredient line(s) into text control on
 | 
			
		||||
	 * the input form.
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @param event Unused???
 | 
			
		||||
	 * Note: In the original Tobago port of this app, the input
 | 
			
		||||
	 * was an inputText. In PrimeFaces, this did not preserve
 | 
			
		||||
	 * line separation characters, so an inputTextArea was
 | 
			
		||||
	 * used instead.
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @param event Unused
 | 
			
		||||
	 */
 | 
			
		||||
	public void ajaxAddIngredient(AjaxBehaviorEvent event) {
 | 
			
		||||
		doAddIngredient();
 | 
			
		||||
| 
						 | 
				
			
			@ -442,7 +450,7 @@ public class RecipeDetailBean implements Serializable {
 | 
			
		|||
		}
 | 
			
		||||
 | 
			
		||||
		// Otherwise, try for split.
 | 
			
		||||
		String[] lineArray = ingredientTextLines.split("  ");
 | 
			
		||||
		String[] lineArray = ingredientTextLines.split(RE_INGSPLIT);
 | 
			
		||||
		for (String line : lineArray) {
 | 
			
		||||
			if (line.isBlank()) {
 | 
			
		||||
				continue; // actually should discard any above
 | 
			
		||||
| 
						 | 
				
			
			@ -758,32 +766,21 @@ public class RecipeDetailBean implements Serializable {
 | 
			
		|||
		this.cuisineList = cuisineList;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// ***
 | 
			
		||||
	private String shopcatPartial;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @return the shopcatPartial
 | 
			
		||||
	 */
 | 
			
		||||
	public String getShopcatPartial() {
 | 
			
		||||
		return shopcatPartial;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @param shopcatPartial the shopcatPartial to set
 | 
			
		||||
	 */
 | 
			
		||||
	public void setShopcatPartial(String shopcatPartial) {
 | 
			
		||||
		this.shopcatPartial = shopcatPartial;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	//***
 | 
			
		||||
	// Shopcat for IngredientUI
 | 
			
		||||
	private List<String> shopcatList;
 | 
			
		||||
 | 
			
		||||
	public List<String> getShopcatList() {
 | 
			
		||||
	public List<String> shopcatList(String query) {
 | 
			
		||||
		if (shopcatList == null) {
 | 
			
		||||
			shopcatList = recipeService.findShoppingCategories();
 | 
			
		||||
		}
 | 
			
		||||
		return shopcatList;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void ajaxShopcat(AjaxBehaviorEvent event) {
 | 
			
		||||
		log.warn("SHOPCAT ");
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	// ***
 | 
			
		||||
 | 
			
		||||
	public String editDescription() {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -27,7 +27,7 @@ public class SpringPrimeFacesApplication {
 | 
			
		|||
			public void onStartup(ServletContext servletContext)
 | 
			
		||||
					throws ServletException {
 | 
			
		||||
				servletContext.setInitParameter(
 | 
			
		||||
					"primefaces.THEME", "bluesky");
 | 
			
		||||
					"primefaces.THEME", "afternoon");
 | 
			
		||||
				servletContext.setInitParameter(
 | 
			
		||||
					"javax.faces.FACELETS_SKIP_COMMENTS",
 | 
			
		||||
					"true");
 | 
			
		||||
| 
						 | 
				
			
			@ -39,20 +39,4 @@ public class SpringPrimeFacesApplication {
 | 
			
		|||
			}
 | 
			
		||||
		};
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
//	@Bean
 | 
			
		||||
//	public FilterRegistrationBean FileUploadFilter() {
 | 
			
		||||
//	    FilterRegistrationBean registration = new FilterRegistrationBean();
 | 
			
		||||
//	    registration.setFilter(new org.primefaces.webapp.filter.FileUploadFilter());
 | 
			
		||||
//	    registration.setName("PrimeFaces FileUpload Filter");
 | 
			
		||||
//	    return registration;
 | 
			
		||||
//	}
 | 
			
		||||
	
 | 
			
		||||
//	@Bean
 | 
			
		||||
//	public FilterRegistrationBean hiddenHttpMethodFilterDisabled(
 | 
			
		||||
//	       HiddenHttpMethodFilter filter) { 
 | 
			
		||||
//	    FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(filter);
 | 
			
		||||
//	    filterRegistrationBean.setEnabled(false);
 | 
			
		||||
//	    return filterRegistrationBean;
 | 
			
		||||
//	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,7 +9,7 @@ import org.springframework.stereotype.Repository;
 | 
			
		|||
import com.mousetech.gourmetj.persistence.model.Category;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * JpaRepositort for Categories, which relate ManyToOne to Recipe.
 | 
			
		||||
 * JpaRepository for Categories, which relate ManyToOne to Recipe.
 | 
			
		||||
 * Service method is @see CategoryService
 | 
			
		||||
 * 
 | 
			
		||||
 * @author timh
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,30 @@
 | 
			
		|||
package com.mousetech.gourmetj.persistence.dao;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import org.springframework.data.jpa.repository.JpaRepository;
 | 
			
		||||
import org.springframework.data.jpa.repository.Query;
 | 
			
		||||
import org.springframework.stereotype.Repository;
 | 
			
		||||
 | 
			
		||||
import com.mousetech.gourmetj.persistence.model.Shopcat;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * JpaRepository for Shoppind Categories, which relate ManyToOne to Ingredient.
 | 
			
		||||
 * Service method is @see RecipeService
 | 
			
		||||
 * 
 | 
			
		||||
 * @author timh
 | 
			
		||||
 * @since Dec 28, 2021
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
@Repository
 | 
			
		||||
public interface ShopcatRepository
 | 
			
		||||
		extends JpaRepository<Shopcat, Long> {
 | 
			
		||||
 | 
			
		||||
	final static String SQL_FIND_CATEGORIES =
 | 
			
		||||
			"SELECT DISTINCT shopcategory from shopcats"
 | 
			
		||||
					+ " where shopcategory is not null and shopcategory <> ''"
 | 
			
		||||
					+ " ORDER BY shopcategory ASC";
 | 
			
		||||
 | 
			
		||||
	@Query(value = SQL_FIND_CATEGORIES, nativeQuery = true)
 | 
			
		||||
	public List<String> findDistinctCategoryNative();
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -18,6 +18,7 @@ import org.springframework.transaction.annotation.Transactional;
 | 
			
		|||
import com.mousetech.gourmetj.RecipeDetailBean;
 | 
			
		||||
import com.mousetech.gourmetj.persistence.dao.CategoryRepository;
 | 
			
		||||
import com.mousetech.gourmetj.persistence.dao.RecipeRepository;
 | 
			
		||||
import com.mousetech.gourmetj.persistence.dao.ShopcatRepository;
 | 
			
		||||
import com.mousetech.gourmetj.persistence.model.Category;
 | 
			
		||||
import com.mousetech.gourmetj.persistence.model.Ingredient;
 | 
			
		||||
import com.mousetech.gourmetj.persistence.model.Recipe;
 | 
			
		||||
| 
						 | 
				
			
			@ -75,9 +76,11 @@ public class RecipeService implements Serializable {
 | 
			
		|||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Inject
 | 
			
		||||
	ShopcatRepository shopcatRepository;
 | 
			
		||||
 | 
			
		||||
	public List<String> findShoppingCategories() {
 | 
			
		||||
		// TODO Auto-generated method stub
 | 
			
		||||
		return null;
 | 
			
		||||
		return shopcatRepository.findDistinctCategoryNative();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Inject
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -40,6 +40,7 @@
 | 
			
		|||
                            />
 | 
			
		||||
                            <p:inputText id="rtitle" size="45"
 | 
			
		||||
                                required="true" focus="true"
 | 
			
		||||
                                placeholder="A recipe title is required."
 | 
			
		||||
                                value="#{recipeDetailBean.recipe.title}"
 | 
			
		||||
                            >
 | 
			
		||||
                                <f:ajax execute="rtitle"
 | 
			
		||||
| 
						 | 
				
			
			@ -99,8 +100,7 @@
 | 
			
		|||
                                value="Description"
 | 
			
		||||
                            />
 | 
			
		||||
                            <p:inputTextarea id="description"
 | 
			
		||||
                                rows="10" cols="30"
 | 
			
		||||
                                escape="false"
 | 
			
		||||
                                rows="10" cols="45"
 | 
			
		||||
                                value="#{recipeDetailBean.recipe.description}"
 | 
			
		||||
                            />
 | 
			
		||||
                            <p:panel id="picPanel">
 | 
			
		||||
| 
						 | 
				
			
			@ -131,25 +131,28 @@
 | 
			
		|||
                    <p:tab id="ingredientsTab"
 | 
			
		||||
                        title="Ingredients"
 | 
			
		||||
                    >
 | 
			
		||||
                        <p:panel header="Ingredients">
 | 
			
		||||
                        <p:panel id="pnlIngredients">
 | 
			
		||||
                        <f:facet name="header">Ingredients</f:facet>
 | 
			
		||||
                            <!--  NOTE: disabled doesn't work from AJAX render. Swap images -->
 | 
			
		||||
                            <h:panelGroup id="ingButtons">
 | 
			
		||||
                                <p:button value="Up" id="ctlUp">
 | 
			
		||||
                                    <!-- <f:ajax
 | 
			
		||||
                                listener="recipeDetailBean.ajaxMoveUp"
 | 
			
		||||
                                <p:commandButton value="Up"
 | 
			
		||||
                                    id="ctlUp"
 | 
			
		||||
                                >
 | 
			
		||||
                                    <f:ajax
 | 
			
		||||
                                        listener="#{recipeDetailBean.ajaxMoveUp}"
 | 
			
		||||
                                        execute="ingredientTable"
 | 
			
		||||
                                        render="ingredientTable"
 | 
			
		||||
                            />  -->
 | 
			
		||||
                                </p:button>
 | 
			
		||||
                                <p:button value="Down"
 | 
			
		||||
                                    />
 | 
			
		||||
                                </p:commandButton>
 | 
			
		||||
                                <p:commandButton value="Down"
 | 
			
		||||
                                    id="ctlDown"
 | 
			
		||||
                                >
 | 
			
		||||
                                    <!--  <f:ajax
 | 
			
		||||
                                listener="recipeDetailBean.ajaxMoveDown"
 | 
			
		||||
                                    <f:ajax
 | 
			
		||||
                                        listener="#{recipeDetailBean.ajaxMoveDown}"
 | 
			
		||||
                                        execute="ingredientTable"
 | 
			
		||||
                                        render="ingredientTable"
 | 
			
		||||
                            />  -->
 | 
			
		||||
                                </p:button>
 | 
			
		||||
                                    />
 | 
			
		||||
                                </p:commandButton>
 | 
			
		||||
                                <p:button value="Add Group"
 | 
			
		||||
                                    disabled="true"
 | 
			
		||||
                                />
 | 
			
		||||
| 
						 | 
				
			
			@ -162,17 +165,16 @@
 | 
			
		|||
                                    disabled="true"
 | 
			
		||||
                                />
 | 
			
		||||
                                <p:button value="Paste" />
 | 
			
		||||
                                <p:button value="Delete"
 | 
			
		||||
                                <p:commandButton value="Delete"
 | 
			
		||||
                                    id="ctlDelete"
 | 
			
		||||
                                    immediate="true"
 | 
			
		||||
                                    disabled="not #{recipeDetailBean.selectionActive}"
 | 
			
		||||
                                >
 | 
			
		||||
                                    <!-- <f:ajax
 | 
			
		||||
                                listener="recipeDetailBean.ajaxDeleteItems"
 | 
			
		||||
                                    <f:ajax
 | 
			
		||||
                                        listener="#{recipeDetailBean.ajaxDeleteItems}"
 | 
			
		||||
                                        immediate="true"
 | 
			
		||||
                                        render="ingredientTable"
 | 
			
		||||
                            />  -->
 | 
			
		||||
                                </p:button>
 | 
			
		||||
                                    />
 | 
			
		||||
                                </p:commandButton>
 | 
			
		||||
                            </h:panelGroup>
 | 
			
		||||
                            <h:panelGrid columns="1"
 | 
			
		||||
                                id="ingredientsDiv"
 | 
			
		||||
| 
						 | 
				
			
			@ -197,9 +199,12 @@
 | 
			
		|||
                                    />  -->
 | 
			
		||||
                                        </p:selectBooleanCheckbox>
 | 
			
		||||
                                    </p:column>
 | 
			
		||||
                                    <p:column label="Amt"
 | 
			
		||||
                                        style="width: 4em"
 | 
			
		||||
                                    <p:column
 | 
			
		||||
                                        style="width: 4.4em"
 | 
			
		||||
                                    >
 | 
			
		||||
                                        <f:facet name="header">
 | 
			
		||||
                                    Amt.
 | 
			
		||||
                                    </f:facet>
 | 
			
		||||
                                        <p:inputText id="ingAmt"
 | 
			
		||||
                                            size="5"
 | 
			
		||||
                                            value="#{item.displayAmount}"
 | 
			
		||||
| 
						 | 
				
			
			@ -208,9 +213,10 @@
 | 
			
		|||
                                        >
 | 
			
		||||
                                        </p:inputText>
 | 
			
		||||
                                    </p:column>
 | 
			
		||||
                                    <p:column label="Units"
 | 
			
		||||
                                        style="width: 7em"
 | 
			
		||||
                                    >
 | 
			
		||||
                                    <p:column style="width: 7em">
 | 
			
		||||
                                        <f:facet name="header">
 | 
			
		||||
                                    Units
 | 
			
		||||
                                    </f:facet>
 | 
			
		||||
                                        <p:inputText id="ingUnit"
 | 
			
		||||
                                            value="#{item.unit}"
 | 
			
		||||
                                            size="10"
 | 
			
		||||
| 
						 | 
				
			
			@ -218,11 +224,12 @@
 | 
			
		|||
                                        >
 | 
			
		||||
                                        </p:inputText>
 | 
			
		||||
                                    </p:column>
 | 
			
		||||
                                    <p:column label="Item"
 | 
			
		||||
                                        style="width: 22em"
 | 
			
		||||
                                    >
 | 
			
		||||
                                    <p:column style="width: 26em">
 | 
			
		||||
                                        <f:facet name="header">
 | 
			
		||||
                                    Item
 | 
			
		||||
                                    </f:facet>
 | 
			
		||||
                                        <p:inputText id="ingItem"
 | 
			
		||||
                                            size="35"
 | 
			
		||||
                                            size="42"
 | 
			
		||||
                                            value="#{item.item}"
 | 
			
		||||
                                        >
 | 
			
		||||
                                        </p:inputText>
 | 
			
		||||
| 
						 | 
				
			
			@ -231,51 +238,69 @@
 | 
			
		|||
                                        align="center"
 | 
			
		||||
                                        styleClass="ingSel"
 | 
			
		||||
                                    >
 | 
			
		||||
                                        <f:facet name="header">
 | 
			
		||||
                                    Opt.
 | 
			
		||||
                                    </f:facet>
 | 
			
		||||
                                        <p:selectBooleanCheckbox
 | 
			
		||||
                                            id="ingOpt"
 | 
			
		||||
                                            value="#{item.optionalCB}"
 | 
			
		||||
                                            rendered="#{not item.ingGroup}"
 | 
			
		||||
                                        />
 | 
			
		||||
                                    </p:column>
 | 
			
		||||
                                    <p:column label="Key">
 | 
			
		||||
                                    <p:column style="width: 13em">
 | 
			
		||||
                                        <f:facet name="header">
 | 
			
		||||
                                    Ing. Key
 | 
			
		||||
                                    </f:facet>
 | 
			
		||||
                                        <p:inputText id="ingKey"
 | 
			
		||||
                                            value="#{item.ingkey}"
 | 
			
		||||
                                            size="20"
 | 
			
		||||
                                            rendered="#{not item.ingGroup}"
 | 
			
		||||
                                        />
 | 
			
		||||
                                    </p:column>
 | 
			
		||||
                                    <p:column
 | 
			
		||||
                                        label="Shopping Category"
 | 
			
		||||
                                    >
 | 
			
		||||
                                        <p:inputText id="shopCat"
 | 
			
		||||
                                    <p:column>
 | 
			
		||||
                                        <f:facet name="header">
 | 
			
		||||
                                    Shop. Cat.
 | 
			
		||||
                                    </f:facet>
 | 
			
		||||
                                        <p:autoComplete
 | 
			
		||||
                                            id="shopCat"
 | 
			
		||||
                                            value="#{item.shopCat}"
 | 
			
		||||
                                            rendered="#{not item.ingGroup}"
 | 
			
		||||
                                            tip="Note that changing Shopping category for an ingredient key changes it for all users of that key."
 | 
			
		||||
                                        >
 | 
			
		||||
                                            <p:autoComplete
 | 
			
		||||
                                                minimumCharacters="1"
 | 
			
		||||
                                                completeMethod="#{recipeDetailBean.shopcatPartial}"
 | 
			
		||||
                                            editable="true"
 | 
			
		||||
                                            forceSelection="false"
 | 
			
		||||
                                            autoSelection="false"
 | 
			
		||||
                                            dropdown="true"
 | 
			
		||||
                                            cache="true"
 | 
			
		||||
                                            title="Note that changing Shopping category for an ingredient key changes it for all users of that key."
 | 
			
		||||
                                            completeMethod="#{recipeDetailBean.shopcatList}"
 | 
			
		||||
                                        >
 | 
			
		||||
                                            <p:ajax event="blur"
 | 
			
		||||
                                                listener="#{recipeDetailBean.ajaxShopcat}"
 | 
			
		||||
                                            />
 | 
			
		||||
                                        </p:autoComplete>
 | 
			
		||||
                                        </p:inputText>
 | 
			
		||||
                                    </p:column>
 | 
			
		||||
                                </p:dataTable>
 | 
			
		||||
                            </h:panelGrid>
 | 
			
		||||
                            <h:panelGroup id="addIng">
 | 
			
		||||
                                <p:inputText
 | 
			
		||||
                                    label="Add Ingredient: "
 | 
			
		||||
                                    id="ctlAddIng" focus="true"
 | 
			
		||||
                                    value="#{recipeDetailBean.ingredientText}"
 | 
			
		||||
                                    tip="You can paste in multiple ingredients here!"
 | 
			
		||||
                            <h:panelGroup id="pnlIng">
 | 
			
		||||
                            <p:remoteCommand name="ingButton"
 | 
			
		||||
                                action="#{recipeDetailBean.doAddIngredient}"
 | 
			
		||||
                                process="@this ctlAddIngTxt"
 | 
			
		||||
                                update="pnlIngredients"
 | 
			
		||||
                                />
 | 
			
		||||
                                <p:button value="+ Add"
 | 
			
		||||
                                    defaultCommand="true"
 | 
			
		||||
                                <p:outputLabel for="@next"
 | 
			
		||||
                                    value="Add Ingredient: "
 | 
			
		||||
                                />
 | 
			
		||||
                                <p:inputTextarea id="ctlAddIngTxt"
 | 
			
		||||
                                    focus="true" rows="1"
 | 
			
		||||
                                    cols="65"
 | 
			
		||||
                                    value="#{recipeDetailBean.ingredientText}"
 | 
			
		||||
                                    title="You can paste in multiple ingredients here!"
 | 
			
		||||
                                    onkeydown="if (event.keyCode === 13) { ingButton(); this.focus(); return false; }"
 | 
			
		||||
                                />
 | 
			
		||||
                                <p:commandButton id="ctlAddIng" 
 | 
			
		||||
                                    value="+ Add"
 | 
			
		||||
                                    onclick="ingButton(); return false;"
 | 
			
		||||
                                >
 | 
			
		||||
                                    <!-- <f:ajax execute="ctlAddIng"
 | 
			
		||||
                                render="ingredientTable ctlAddIng"
 | 
			
		||||
                                listener="recipeDetailBean.ajaxAddIngredient"
 | 
			
		||||
                            />  -->
 | 
			
		||||
                                </p:button>
 | 
			
		||||
                                </p:commandButton>
 | 
			
		||||
                            </h:panelGroup>
 | 
			
		||||
                        </p:panel>
 | 
			
		||||
                    </p:tab>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user