You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2019/12/12 17:56:47 UTC

[isis] 03/03: ISIS-2201: adds thymeleaf, and adds an example templates/error.html. SB will use this automatically (see BasicErrorController).

This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git

commit bc37df1f677ddf4cfc2b3f9f96d0e243a2c60dbc
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Thu Dec 12 17:21:20 2019 +0000

    ISIS-2201: adds thymeleaf, and adds an example templates/error.html.  SB will use this automatically (see BasicErrorController).
    
    also factors out page.css from index.html, for common look-n-feel.
---
 core/webapp/pom.xml                                |  5 +++
 .../demo/src/main/resources/static/css/page.css    | 45 ++++++++++++++++++++++
 examples/demo/src/main/resources/static/index.html | 30 +--------------
 .../demo/src/main/resources/templates/error.html   | 20 ++++++++++
 4 files changed, 71 insertions(+), 29 deletions(-)

diff --git a/core/webapp/pom.xml b/core/webapp/pom.xml
index a3505ba..e630adb 100644
--- a/core/webapp/pom.xml
+++ b/core/webapp/pom.xml
@@ -74,6 +74,11 @@
             <artifactId>spring-boot-actuator</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-thymeleaf</artifactId>
+        </dependency>
+
         <!-- TESTING -->
 
 		<dependency>
diff --git a/examples/demo/src/main/resources/static/css/page.css b/examples/demo/src/main/resources/static/css/page.css
new file mode 100644
index 0000000..77c24b7
--- /dev/null
+++ b/examples/demo/src/main/resources/static/css/page.css
@@ -0,0 +1,45 @@
+/*
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+ */
+body {
+    background-color: #1A467B;
+    font-family: Verdana, Helvetica, Arial, serif;
+    font-size: 90%;
+}
+
+li {
+    margin-top: 6px;
+    margin-bottom: 6px;
+}
+table {
+    border-collapse: collapse;
+}
+table, th, td {
+    border: 1px;
+    border-style: solid;
+    border-color: lightgray;
+}
+th, td {
+    padding: 10px;
+}
+#wrapper {
+    background-color: #ffffff;
+    width: 900px;
+    margin: 8px auto;
+    padding: 12px;
+}
diff --git a/examples/demo/src/main/resources/static/index.html b/examples/demo/src/main/resources/static/index.html
index e0a7d9f..248d3a4 100644
--- a/examples/demo/src/main/resources/static/index.html
+++ b/examples/demo/src/main/resources/static/index.html
@@ -21,36 +21,8 @@
     <head>
         <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
         <title>Apache Isis&trade; v2 Demo</title>
-        
-        <style type="text/css">
-body {
-    background-color: #1A467B;
-    font-family: Verdana, Helvetica, Arial, serif;
-    font-size: 90%;
-}
 
-li {
-    margin-top: 6px;
-    margin-bottom: 6px;
-}
-table {
-    border-collapse: collapse;
-}
-table, th, td {
-    border: 1px;
-    border-style: solid;
-    border-color: lightgray;
-}
-th, td {
-    padding: 10px;
-}
-#wrapper {
-    background-color: #ffffff;
-    width: 900px;
-    margin: 8px auto;
-    padding: 12px;
-}
-        </style>
+        <link rel="stylesheet" type="text/css" href="css/page.css">
     </head>
     <body>
         <div id="wrapper">
diff --git a/examples/demo/src/main/resources/templates/error.html b/examples/demo/src/main/resources/templates/error.html
new file mode 100644
index 0000000..d60df7c
--- /dev/null
+++ b/examples/demo/src/main/resources/templates/error.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html xmlns:th="http://www.thymeleaf.org">
+    <head>
+        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+        <title>Apache Isis&trade; HelloWorld</title>
+
+        <link rel="stylesheet" type="text/css" th:href="@{/css/page.css}">
+    </head>
+    <body>
+        <div id="wrapper">
+            <img alt="Isis Logo" th:src="@{/images/apache-isis/logo.png}" />
+             
+            <p>
+                Our apologies - an error occurred.
+            </p>
+
+            <p>You can access the app <a th:href="@{/wicket/}">here</a>
+        </div>
+    </body>
+</html>