Skip to content

Commit

Permalink
Fix spring-projects#78 Migrate to Bootstrap 3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
arey committed Apr 4, 2016
1 parent 482eeb1 commit 7dcf82a
Show file tree
Hide file tree
Showing 830 changed files with 10,350 additions and 122,960 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
language: java
jdk: oraclejdk8
script: mvn package
7 changes: 2 additions & 5 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
{
"name": "spring-petclinic",
"authors": [
"[email protected]"
],
"dependencies": {
"bootstrap": "~2.3.0",
"jquery": "~2.0.3",
"bootstrap": "3.3.6",
"jquery": "~2.0.3",
"jquery-ui": "~1.10.3"
}
}
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -402,11 +402,12 @@
<profiles>
<profile>
<id>bower-install</id>
<build>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.4.0</version>
<executions>
<execution>
<phase>generate-sources</phase>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/spring/mvc-core-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<mvc:annotation-driven conversion-service="conversionService"/>

<!-- all resources inside folder src/main/webapp/resources are mapped so they can be refered to inside JSP files
(see staticFiles.jsp for more details) -->
(see htmlHeader.jsp for more details) -->
<mvc:resources mapping="/resources/**" location="/resources/"/>
<mvc:resources mapping="/vendors/**" location="/vendors/"/>

Expand Down
11 changes: 5 additions & 6 deletions src/main/webapp/WEB-INF/jsp/exception.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
<%@ page session="false" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %>

<html lang="en">
<jsp:include page="fragments/staticFiles.jsp"/>
<jsp:include page="fragments/htmlHeader.jsp"/>

<body>
<<petclinic:bodyHeader menuName="error"/>
<div class="container">
<jsp:include page="fragments/bodyHeader.jsp"/>

<spring:url value="/resources/images/pets.png" var="petsImage"/>
<img src="${petsImage}"/>

Expand All @@ -22,11 +24,8 @@
${stackTrace}
</c:forEach>
-->


<jsp:include page="fragments/footer.jsp"/>

</div>
<jsp:include page="fragments/footer.jsp"/>
</body>

</html>
22 changes: 0 additions & 22 deletions src/main/webapp/WEB-INF/jsp/fragments/bodyHeader.jsp

This file was deleted.

28 changes: 21 additions & 7 deletions src/main/webapp/WEB-INF/jsp/fragments/footer.jsp
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>

<table class="footer">
<tr>
<td width="70%"></td>
<td align="right"><img src="<spring:url value="/resources/images/spring-pivotal-logo.png" htmlEscape="true" />"
alt="Sponsored by Pivotal"/></td>
</tr>
</table>
<div class="container">
<div class="row">
<div class="col-12 text-center"><img src="<spring:url value="/resources/images/spring-pivotal-logo.png" htmlEscape="true" />"
alt="Sponsored by Pivotal"/></div>
</div>
</div>

<%-- Placed at the end of the document so the pages load faster --%>
<spring:url value="/vendors/jquery/jquery.min.js" var="jQuery"/>
<script src="${jQuery}"></script>

<%-- jquery-ui.js file is really big so we only load what we need instead of loading everything --%>
<spring:url value="/vendors/jquery-ui/ui/jquery.ui.core.js" var="jQueryUiCore"/>
<script src="${jQueryUiCore}"></script>

<spring:url value="/vendors/jquery-ui/ui/jquery.ui.datepicker.js" var="jQueryUiDatePicker"/>
<script src="${jQueryUiDatePicker}"></script>


<%-- Bootstrap --%>
<spring:url value="/vendors/bootstrap/dist/js/bootstrap.min.js" var="bootstrapJs"/>
<script src="${bootstrapJs}"></script>

44 changes: 44 additions & 0 deletions src/main/webapp/WEB-INF/jsp/fragments/htmlHeader.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>

<%--
PetClinic :: a Spring Framework demonstration
--%>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<%-- The above 4 meta tags *must* come first in the head; any other head content must come *after* these tags --%>

<spring:url value="/resources/images/favicon.png" var="favicon"/>
<link rel="shortcut icon" type="image/x-icon" href="${favicon}">

<title>PetClinic :: a Spring Framework demonstration</title>

<%-- Bootstrap CSS --%>
<spring:url value="/vendors/bootstrap/dist/css/bootstrap.min.css" var="bootstrapCss"/>
<link href="${bootstrapCss}" rel="stylesheet">
<spring:url value="/vendors/bootstrap/dist/css/bootstrap-theme.min.css" var="bootstrapThemeCss"/>
<link href="${bootstrapThemeCss}" rel="stylesheet">


<%-- Custom styles for Petclinic --%>
<spring:url value="/resources/css/petclinic.css" var="petclinicCss"/>
<link href="${petclinicCss}" rel="stylesheet"/>


<%-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --%>
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->

<!-- Only datepicker is used -->
<spring:url value="/vendors/jquery-ui/themes/base/minified/jquery-ui.min.css" var="jQueryUiCss"/>
<link href="${jQueryUiCss}" rel="stylesheet"/>
<spring:url value="/vendors/jquery-ui/themes/base/minified/jquery.ui.theme.min.css" var="jQueryUiThemeCss"/>
<link href="${jQueryUiThemeCss}" rel="stylesheet"/>
<spring:url value="/vendors/jquery-ui/themes/base/minified/jquery.ui.datepicker.min.css" var="jQueryUiDatePickerCss"/>
<link href="${jQueryUiDatePickerCss}" rel="stylesheet"/>
</head>
31 changes: 0 additions & 31 deletions src/main/webapp/WEB-INF/jsp/fragments/staticFiles.jsp

This file was deleted.

38 changes: 20 additions & 18 deletions src/main/webapp/WEB-INF/jsp/owners/createOrUpdateOwnerForm.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,33 @@

<html lang="en">

<jsp:include page="../fragments/staticFiles.jsp"/>
<jsp:include page="../fragments/htmlHeader.jsp"/>

<body>
<petclinic:bodyHeader menuName="owners"/>
<div class="container">
<jsp:include page="../fragments/bodyHeader.jsp"/>

<h2>
<c:if test="${owner['new']}">New </c:if> Owner
</h2>
<form:form modelAttribute="owner" class="form-horizontal" id="add-owner-form">
<petclinic:inputField label="First Name" name="firstName"/>
<petclinic:inputField label="Last Name" name="lastName"/>
<petclinic:inputField label="Address" name="address"/>
<petclinic:inputField label="City" name="city"/>
<petclinic:inputField label="Telephone" name="telephone"/>

<div class="form-actions">
<c:choose>
<c:when test="${owner['new']}">
<button type="submit">Add Owner</button>
</c:when>
<c:otherwise>
<button type="submit">Update Owner</button>
</c:otherwise>
</c:choose>
<div class="form-group has-feedback">
<petclinic:inputField label="First Name" name="firstName"/>
<petclinic:inputField label="Last Name" name="lastName"/>
<petclinic:inputField label="Address" name="address"/>
<petclinic:inputField label="City" name="city"/>
<petclinic:inputField label="Telephone" name="telephone"/>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<c:choose>
<c:when test="${owner['new']}">
<button class="btn btn-primary" type="submit">Add Owner</button>
</c:when>
<c:otherwise>
<button class="btn btn-primary" type="submit">Update Owner</button>
</c:otherwise>
</c:choose>
</div>
</div>
</form:form>
</div>
Expand Down
31 changes: 18 additions & 13 deletions src/main/webapp/WEB-INF/jsp/owners/findOwners.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,43 @@
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %>

<html lang="en">

<jsp:include page="../fragments/staticFiles.jsp"/>
<jsp:include page="../fragments/htmlHeader.jsp"/>

<body>
<petclinic:bodyHeader menuName="owners"/>
<div class="container">
<jsp:include page="../fragments/bodyHeader.jsp"/>

<h2>Find Owners</h2>

<spring:url value="/owners.html" var="formUrl"/>
<form:form modelAttribute="owner" action="${fn:escapeXml(formUrl)}" method="get" class="form-horizontal"
id="search-owner-form">
<fieldset>
<div class="form-group">
<div class="control-group" id="lastName">
<label class="control-label">Last name </label>
<form:input path="lastName" size="30" maxlength="80"/>
<span class="help-inline"><form:errors path="*"/></span>
<label class="col-sm-2 control-label">Last name </label>
<div class="col-sm-10">
<form:input class="form-control" path="lastName" size="30" maxlength="80"/>
<span class="help-inline"><form:errors path="*"/></span>
</div>
</div>
<div class="form-actions">
<button type="submit">Find Owner</button>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary">Find Owner</button>
</div>
</fieldset>
</div>

</form:form>

<br/>
<a href='<spring:url value="/owners/new" htmlEscape="true"/>'>Add Owner</a>

<jsp:include page="../fragments/footer.jsp"/>

<a class="btn btn-default" href='<spring:url value="/owners/new" htmlEscape="true"/>'>Add Owner</a>
</div>

<jsp:include page="../fragments/footer.jsp"/>
</body>

</html>
45 changes: 24 additions & 21 deletions src/main/webapp/WEB-INF/jsp/owners/ownerDetails.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,20 @@
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="joda" uri="http://www.joda.org/joda/time/tags" %>
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %>

<html lang="en">

<jsp:include page="../fragments/staticFiles.jsp"/>
<jsp:include page="../fragments/htmlHeader.jsp"/>

<body>
<petclinic:bodyHeader menuName="owners"/>
<div class="container">
<jsp:include page="../fragments/bodyHeader.jsp"/>

<h2>Owner Information</h2>

<table class="table table-striped" style="width:600px;">

<table class="table table-striped">
<tr>
<th>Name</th>
<td><b><c:out value="${owner.firstName} ${owner.lastName}"/></b></td>
Expand All @@ -34,26 +36,26 @@
<th>Telephone</th>
<td><c:out value="${owner.telephone}"/></td>
</tr>
<tr>
<td>
<spring:url value="{ownerId}/edit.html" var="editUrl">
<spring:param name="ownerId" value="${owner.id}"/>
</spring:url>
<a href="${fn:escapeXml(editUrl)}" class="btn btn-info">Edit Owner</a></td>
<td>
<spring:url value="{ownerId}/pets/new.html" var="addUrl">
<spring:param name="ownerId" value="${owner.id}"/>
</spring:url>
<a href="${fn:escapeXml(addUrl)}" class="btn btn-success">Add New Pet</a></td>
</tr>
</table>

<spring:url value="{ownerId}/edit.html" var="editUrl">
<spring:param name="ownerId" value="${owner.id}"/>
</spring:url>
<a href="${fn:escapeXml(editUrl)}" class="btn btn-default">Edit Owner</a>

<spring:url value="{ownerId}/pets/new.html" var="addUrl">
<spring:param name="ownerId" value="${owner.id}"/>
</spring:url>
<a href="${fn:escapeXml(addUrl)}" class="btn btn-primary">Add New Pet</a>


<h2>Pets and Visits</h2>

<c:forEach var="pet" items="${owner.pets}">
<table class="table" style="width:600px;">
<table class="table table-striped">
<c:forEach var="pet" items="${owner.pets}">

<tr>
<td valign="top" style="width: 120px;">
<td valign="top">
<dl class="dl-horizontal">
<dt>Name</dt>
<dd><c:out value="${pet.name}"/></dd>
Expand Down Expand Up @@ -96,13 +98,14 @@
</table>
</td>
</tr>
</table>
</c:forEach>

<jsp:include page="../fragments/footer.jsp"/>
</c:forEach>
</table>

</div>

<jsp:include page="../fragments/footer.jsp"/>

</body>

</html>
Loading

0 comments on commit 7dcf82a

Please sign in to comment.