From feca50d272ad205326440277cb4965739e619f06 Mon Sep 17 00:00:00 2001
From: Mic <misvy@vmware.com>
Date: Tue, 22 Jan 2013 09:29:49 +0100
Subject: [PATCH] added jQueryUI

---
 pom.xml                                       |  6 ++
 .../spring/applicationContext-dao.xml         |  4 +-
 .../webapp/WEB-INF/jsp/fragments/headTag.jsp  |  9 +++
 .../jsp/pets/createOrUpdatePetForm.jsp        | 63 +++++++------------
 4 files changed, 40 insertions(+), 42 deletions(-)

diff --git a/pom.xml b/pom.xml
index 9a70783..82da93b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -156,6 +156,12 @@
 		    <version>2.2.1</version>
 		</dependency>
 		
+		<dependency>
+		    <groupId>org.webjars</groupId>
+		    <artifactId>jquery-ui</artifactId>
+		    <version>1.9.1</version>
+		</dependency>
+		
 		<!-- Rome RSS -->
 		<dependency>
 			<groupId>rome</groupId>
diff --git a/src/main/resources/spring/applicationContext-dao.xml b/src/main/resources/spring/applicationContext-dao.xml
index d6aa8dc..af6eb5e 100644
--- a/src/main/resources/spring/applicationContext-dao.xml
+++ b/src/main/resources/spring/applicationContext-dao.xml
@@ -15,7 +15,7 @@
 	<!-- ========================= RESOURCE DEFINITIONS ========================= -->
 
 	<!-- import the dataSource definition -->
-	<import resource="applicationContext-dataSource.xml"/>
+	<import resource="applicationContext-dataSource.xml"/> 
 
 
 	<!-- Configurer that replaces ${...} placeholders with values from a properties file -->
@@ -116,7 +116,7 @@
 			PersistenceExceptions will be auto-translated due to @Repository.
 		-->
 		<context:component-scan base-package="org.springframework.samples.petclinic.repository.jpa"/>
-	
+
 	</beans>
 	
 	<beans profile="spring-data-jpa">
diff --git a/src/main/webapp/WEB-INF/jsp/fragments/headTag.jsp b/src/main/webapp/WEB-INF/jsp/fragments/headTag.jsp
index 22f5034..bfcd938 100644
--- a/src/main/webapp/WEB-INF/jsp/fragments/headTag.jsp
+++ b/src/main/webapp/WEB-INF/jsp/fragments/headTag.jsp
@@ -14,6 +14,15 @@
 	
 	<spring:url value="/resources/css/petclinic.css" var="petclinicCss" />
 	<link href="${petclinicCss}" rel="stylesheet"/>
+	
+	<spring:url value="/webjars/jquery/1.8.2/jquery.js" var="jQuery" />
+	<script src="${jQuery}"></script>
+	
+	<spring:url value="/webjars/jquery-ui/1.9.1/js/jquery-ui-1.9.1.custom.js" var="jQueryUi" />
+	<script src="${jQueryUi}"></script>
+	
+	<spring:url value="/webjars/jquery-ui/1.9.1/css/smoothness/jquery-ui-1.9.1.custom.css" var="jQueryUiCss" />
+	<link href="${jQueryUiCss}" rel="stylesheet"></link>
 </head>
 
 
diff --git a/src/main/webapp/WEB-INF/jsp/pets/createOrUpdatePetForm.jsp b/src/main/webapp/WEB-INF/jsp/pets/createOrUpdatePetForm.jsp
index 1dfe06c..3ee7cae 100644
--- a/src/main/webapp/WEB-INF/jsp/pets/createOrUpdatePetForm.jsp
+++ b/src/main/webapp/WEB-INF/jsp/pets/createOrUpdatePetForm.jsp
@@ -5,55 +5,38 @@
 
 <html lang="en">
 
-<jsp:include page="../fragments/headTag.jsp"/>
 
 <body>
+	<head>
+			<spring:url value="/webjars/jquery/1.8.2/jquery.js" var="jQuery" />
+			<script src="${jQuery}"></script>
+			
+			<spring:url value="/webjars/jquery-ui/1.9.1/js/jquery-ui-1.9.1.custom.js" var="jQueryUi" />
+			<script src="${jQueryUi}"></script>
+			
+			<spring:url value="/webjars/jquery-ui/1.9.1/css/smoothness/jquery-ui-1.9.1.custom.css" var="jQueryUiCss" />
+			<link href="${jQueryUiCss}" rel="stylesheet"></link>
+				
+	
+	</head>
   	<div class="container">
-		<jsp:include page="../fragments/bodyHeader.jsp"/>		
-		<c:choose>
-			<c:when test="${pet['new']}"><c:set var="method" value="post"/></c:when>
-			<c:otherwise><c:set var="method" value="put"/></c:otherwise>
-		</c:choose>
-		
-		<h2><c:if test="${pet['new']}">New </c:if>Pet</h2>
-		
-		<b>Owner:</b> ${pet.owner.firstName} ${pet.owner.lastName}
-		<br/>
-		<form:form modelAttribute="pet" method="${method}" class="form-horizontal">
-			<fieldset>
-					<div class="control-group" id="name">
-						<label class="control-label">Name </label>
-						<div class="controls">
-							<form:input path="name" />
-							<span class="help-inline"><form:errors path="name" /></span>
-						</div>
-					</div>
+			
+<script>
+	        $(function() {
+	            $( "#birthDate" ).datepicker();
+	        });
+	    </script>
+		<form:form modelAttribute="pet" class="form-horizontal">
+			<fieldset>			
 					<div class="control-group" id="birthDate">
-						<label class="control-label">Birth Date (yyyy-MM-dd)</label>
+						<label class="control-label">Birth Date</label>
 						<div class="controls">
-							<form:input path="birthDate" />
-							<span class="help-inline"><form:errors path="birthDate" /></span>
+							<form:input path="birthDate"  />
 						</div>
 					</div>
-					<div class="control-group" id="type">
-						<label class="control-label">Type </label>
-						<form:select path="type" items="${types}"/>
-					</div>
-					<div class="form-actions">
-						<c:choose>
-				          <c:when test="${owner['new']}">
-				            <button type="submit">Add Pet</button>
-				          </c:when>
-				          <c:otherwise>
-				            <button type="submit">Update Pet</button>
-				          </c:otherwise>
-				        </c:choose>
-					</div>
+					
 				</fieldset>	
 			</form:form>	
-			<c:if test="${!pet['new']}">
-			</c:if>    
-			<jsp:include page="../fragments/footer.jsp"/>
   	</div>
 </body>
 
-- 
GitLab