From 9620a0f5faf9cc8e1485e551154e1bf60af49137 Mon Sep 17 00:00:00 2001
From: Robert Goldmann <deadlocker@gmx.de>
Date: Sat, 21 Apr 2018 16:40:50 +0200
Subject: [PATCH] #298 - moved cdn references to macros; added title to header
 macro

---
 src/main/resources/templates/about.ftl           |  7 +++----
 .../resources/templates/accounts/accounts.ftl    |  7 +++----
 .../resources/templates/accounts/newAccount.ftl  |  7 +++----
 .../templates/categories/categories.ftl          |  7 +++----
 .../templates/categories/newCategory.ftl         |  7 +++----
 src/main/resources/templates/emptyPage.ftl       |  9 +++------
 src/main/resources/templates/error/403.ftl       | 13 ++++---------
 src/main/resources/templates/error/404.ftl       |  9 ++-------
 src/main/resources/templates/error/418.ftl       | 16 +++++-----------
 src/main/resources/templates/error/500.ftl       | 16 +++++-----------
 src/main/resources/templates/header.ftl          |  4 ++--
 src/main/resources/templates/index.ftl           |  7 +++----
 src/main/resources/templates/login.ftl           |  9 ++++-----
 .../resources/templates/payments/newPayment.ftl  |  7 +++----
 .../resources/templates/payments/payments.ftl    |  7 +++----
 src/main/resources/templates/scripts.ftl         |  5 +++++
 16 files changed, 54 insertions(+), 83 deletions(-)
 create mode 100644 src/main/resources/templates/scripts.ftl

diff --git a/src/main/resources/templates/about.ftl b/src/main/resources/templates/about.ftl
index bfab9d7a1..5753b500a 100644
--- a/src/main/resources/templates/about.ftl
+++ b/src/main/resources/templates/about.ftl
@@ -1,7 +1,7 @@
 <html>
     <head>
         <#import "header.ftl" as header>
-        <@header.header/>
+        <@header.header "BudgetMaster"/>
         <#assign locale = static["tools.Localization"]>
     </head>
     <body class="budgetmaster-blue-light">
@@ -46,8 +46,7 @@
         </main>
 
         <!--  Scripts-->
-        <script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
-        <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script>
-        <script src="/js/main.js"></script>
+        <#import "scripts.ftl" as scripts>
+        <@scripts.scripts/>
     </body>
 </html>
\ No newline at end of file
diff --git a/src/main/resources/templates/accounts/accounts.ftl b/src/main/resources/templates/accounts/accounts.ftl
index dc63922b2..c7562c089 100644
--- a/src/main/resources/templates/accounts/accounts.ftl
+++ b/src/main/resources/templates/accounts/accounts.ftl
@@ -1,7 +1,7 @@
 <html>
     <head>
         <#import "../header.ftl" as header>
-        <@header.header/>
+        <@header.header "BudgetMaster"/>
         <#assign locale = static["tools.Localization"]>
     </head>
     <body class="budgetmaster-blue-light">
@@ -49,9 +49,8 @@
         </main>
 
         <!--  Scripts-->
-        <script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
-        <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script>
-        <script src="/js/main.js"></script>
+        <#import "../scripts.ftl" as scripts>
+        <@scripts.scripts/>
         <script src="/js/categories.js"></script>
     </body>
 </html>
\ No newline at end of file
diff --git a/src/main/resources/templates/accounts/newAccount.ftl b/src/main/resources/templates/accounts/newAccount.ftl
index a34bdbe00..7087f1a26 100644
--- a/src/main/resources/templates/accounts/newAccount.ftl
+++ b/src/main/resources/templates/accounts/newAccount.ftl
@@ -1,7 +1,7 @@
 <html>
     <head>
         <#import "../header.ftl" as header>
-        <@header.header/>
+        <@header.header "BudgetMaster"/>
         <#assign locale = static["tools.Localization"]>
     </head>
     <body class="budgetmaster-blue-light">
@@ -61,8 +61,7 @@
         </main>
 
         <!-- Scripts-->
-        <script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
-        <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script>
-        <script src="/js/main.js"></script>
+        <#import "../scripts.ftl" as scripts>
+        <@scripts.scripts/>
     </body>
 </html>
\ No newline at end of file
diff --git a/src/main/resources/templates/categories/categories.ftl b/src/main/resources/templates/categories/categories.ftl
index e07b4b307..f1bc836e7 100644
--- a/src/main/resources/templates/categories/categories.ftl
+++ b/src/main/resources/templates/categories/categories.ftl
@@ -1,7 +1,7 @@
 <html>
     <head>
         <#import "../header.ftl" as header>
-        <@header.header/>
+        <@header.header "BudgetMaster"/>
         <link type="text/css" rel="stylesheet" href="/css/categories.css"/>
         <#assign locale = static["tools.Localization"]>
     </head>
@@ -59,9 +59,8 @@
         </main>
 
         <!--  Scripts-->
-        <script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
-        <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script>
-        <script src="/js/main.js"></script>
+        <#import "../scripts.ftl" as scripts>
+        <@scripts.scripts/>
         <script src="/js/categories.js"></script>
     </body>
 </html>
\ No newline at end of file
diff --git a/src/main/resources/templates/categories/newCategory.ftl b/src/main/resources/templates/categories/newCategory.ftl
index ad1b80308..a0994f464 100644
--- a/src/main/resources/templates/categories/newCategory.ftl
+++ b/src/main/resources/templates/categories/newCategory.ftl
@@ -1,7 +1,7 @@
 <html>
     <head>
         <#import "../header.ftl" as header>
-        <@header.header/>
+        <@header.header "BudgetMaster"/>
         <link type="text/css" rel="stylesheet" href="/css/spectrum.css"/>
         <link type="text/css" rel="stylesheet" href="/css/categories.css"/>
         <#assign locale = static["tools.Localization"]>
@@ -89,9 +89,8 @@
         </main>
 
         <!-- Scripts-->
-        <script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
-        <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script>
-        <script src="/js/main.js"></script>
+        <#import "../scripts.ftl" as scripts>
+        <@scripts.scripts/>
         <script src="/js/spectrum.js"></script>
         <script src="/js/categories.js"></script>
     </body>
diff --git a/src/main/resources/templates/emptyPage.ftl b/src/main/resources/templates/emptyPage.ftl
index 76c4182eb..7ccc7abc3 100644
--- a/src/main/resources/templates/emptyPage.ftl
+++ b/src/main/resources/templates/emptyPage.ftl
@@ -1,18 +1,15 @@
 <html>
     <head>
         <#import "header.ftl" as header>
-        <@header.header/>
+        <@header.header "BudgetMaster"/>
         <#assign locale = static["tools.Localization"]>
     </head>
     <body class="budgetmaster-blue-light">
         <#import "navbar.ftl" as navbar>
         <@navbar.navbar active/>
 
-
-
         <!--  Scripts-->
-        <script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
-        <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script>
-        <script src="/js/main.js"></script>
+         <#import "scripts.ftl" as scripts>
+        <@scripts.scripts/>
     </body>
 </html>
\ No newline at end of file
diff --git a/src/main/resources/templates/error/403.ftl b/src/main/resources/templates/error/403.ftl
index cefacac2c..58254fee3 100644
--- a/src/main/resources/templates/error/403.ftl
+++ b/src/main/resources/templates/error/403.ftl
@@ -1,14 +1,9 @@
 <html>
     <head>
-        <title>BudgetMaster - 403</title>
-        <meta charset="UTF-8"/>
-        <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
-        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.css">
-        <link type="text/css" rel="stylesheet" href="/css/style.css"/>
-        <link type="text/css" rel="stylesheet" href="/css/login.css"/>
-
-        <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
-        <#assign locale = static["tools.Localization"]>
+            <#import "../header.ftl" as header>
+            <@header.header "BudgetMaster - 403"/>
+            <link type="text/css" rel="stylesheet" href="/css/login.css"/>
+            <#assign locale = static["tools.Localization"]>
     </head>
     <body class="budgetmaster-blue-light">
         <main>
diff --git a/src/main/resources/templates/error/404.ftl b/src/main/resources/templates/error/404.ftl
index 2eeb00b88..be8bfa8f0 100644
--- a/src/main/resources/templates/error/404.ftl
+++ b/src/main/resources/templates/error/404.ftl
@@ -1,13 +1,8 @@
 <html>
     <head>
-        <title>BudgetMaster - 404</title>
-        <meta charset="UTF-8"/>
-        <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
-        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.css">
-        <link type="text/css" rel="stylesheet" href="/css/style.css"/>
+        <#import "../header.ftl" as header>
+        <@header.header "BudgetMaster - 404"/>
         <link type="text/css" rel="stylesheet" href="/css/login.css"/>
-
-        <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
         <#assign locale = static["tools.Localization"]>
     </head>
     <body class="budgetmaster-blue-light">
diff --git a/src/main/resources/templates/error/418.ftl b/src/main/resources/templates/error/418.ftl
index 4d323d4c7..f85deb1b6 100644
--- a/src/main/resources/templates/error/418.ftl
+++ b/src/main/resources/templates/error/418.ftl
@@ -1,13 +1,8 @@
 <html>
     <head>
-        <title>BudgetMaster - 418</title>
-        <meta charset="UTF-8"/>
-        <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
-        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.css">
-        <link type="text/css" rel="stylesheet" href="/css/style.css"/>
+        <#import "../header.ftl" as header>
+        <@header.header "BudgetMaster - 418">
         <link type="text/css" rel="stylesheet" href="/css/login.css"/>
-
-        <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
         <#assign locale = static["tools.Localization"]>
     </head>
     <body class="budgetmaster-blue-light">
@@ -36,9 +31,8 @@
             </div>
         </main>
 
-    <!--  Scripts-->
-    <script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
-    <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script>
-    <script src="/js/main.js"></script>
+        <!--  Scripts-->
+        <#import "../scripts.ftl" as scripts>
+        <@scripts.scripts/>
     </body>
 </html>
\ No newline at end of file
diff --git a/src/main/resources/templates/error/500.ftl b/src/main/resources/templates/error/500.ftl
index 47e4c823d..fac409b8b 100644
--- a/src/main/resources/templates/error/500.ftl
+++ b/src/main/resources/templates/error/500.ftl
@@ -1,13 +1,8 @@
 <html>
     <head>
-        <title>BudgetMaster - 500</title>
-        <meta charset="UTF-8"/>
-        <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
-        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.css">
-        <link type="text/css" rel="stylesheet" href="/css/style.css"/>
+        <#import "../header.ftl" as header>
+        <@header.header "BudgetMaster - 500"/>
         <link type="text/css" rel="stylesheet" href="/css/login.css"/>
-
-        <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
         <#assign locale = static["tools.Localization"]>
     </head>
     <body class="budgetmaster-blue-light">
@@ -34,9 +29,8 @@
             </div>
         </main>
 
-    <!--  Scripts-->
-    <script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
-    <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script>
-    <script src="/js/main.js"></script>
+        <!--  Scripts-->
+        <#import "../scripts.ftl" as scripts>
+        <@scripts.scripts/>
     </body>
 </html>
\ No newline at end of file
diff --git a/src/main/resources/templates/header.ftl b/src/main/resources/templates/header.ftl
index ac41e140d..15eaa2eb8 100644
--- a/src/main/resources/templates/header.ftl
+++ b/src/main/resources/templates/header.ftl
@@ -1,5 +1,5 @@
-<#macro header>
-        <title>BudgetMaster</title>
+<#macro header title>
+        <title>${title}</title>
         <meta charset="UTF-8"/>
         <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
         <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.css">
diff --git a/src/main/resources/templates/index.ftl b/src/main/resources/templates/index.ftl
index 7949d22b1..6aa963159 100644
--- a/src/main/resources/templates/index.ftl
+++ b/src/main/resources/templates/index.ftl
@@ -1,7 +1,7 @@
 <html>
     <head>
         <#import "header.ftl" as header>
-        <@header.header/>
+        <@header.header "BudgetMaster"/>
     </head>
     <body class="budgetmaster-blue-light">
         <#import "navbar.ftl" as navbar>
@@ -55,9 +55,8 @@
         </main>
 
         <!--  Scripts-->
-        <script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
-        <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script>
-        <script src="/js/main.js"></script>
+        <#import "scripts.ftl" as scripts>
+        <@scripts.scripts/>
         <script src="/js/datePicker.js"></script>
     </body>
 </html>
\ No newline at end of file
diff --git a/src/main/resources/templates/login.ftl b/src/main/resources/templates/login.ftl
index 5e0d09a90..3dd3d36e1 100644
--- a/src/main/resources/templates/login.ftl
+++ b/src/main/resources/templates/login.ftl
@@ -1,7 +1,7 @@
 <html>
     <head>
         <#import "header.ftl" as header>
-        <@header.header/>
+        <@header.header "BudgetMaster"/>
         <link type="text/css" rel="stylesheet" href="/css/login.css"/>
 
         <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
@@ -30,9 +30,8 @@
             </div>
         </main>
 
-    <!--  Scripts-->
-    <script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
-    <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script>
-    <script src="/js/main.js"></script>
+        <!--  Scripts-->
+        <#import "scripts.ftl" as scripts>
+        <@scripts.scripts/>
     </body>
 </html>
\ No newline at end of file
diff --git a/src/main/resources/templates/payments/newPayment.ftl b/src/main/resources/templates/payments/newPayment.ftl
index a459b91ee..bc1864dc5 100644
--- a/src/main/resources/templates/payments/newPayment.ftl
+++ b/src/main/resources/templates/payments/newPayment.ftl
@@ -1,7 +1,7 @@
 <html>
     <head>
         <#import "../header.ftl" as header>
-        <@header.header/>
+        <@header.header "BudgetMaster"/>
         <#assign locale = static["tools.Localization"]>
     </head>
     <body class="budgetmaster-blue-light">
@@ -177,9 +177,8 @@
         </script>
 
         <!-- Scripts-->
-        <script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
-        <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script>
-        <script src="/js/main.js"></script>
+        <#import "../scripts.ftl" as scripts>
+        <@scripts.scripts/>
         <script src="/js/spectrum.js"></script>
         <script src="/js/payments.js"></script>
     </body>
diff --git a/src/main/resources/templates/payments/payments.ftl b/src/main/resources/templates/payments/payments.ftl
index 08a703793..a7a721cfe 100644
--- a/src/main/resources/templates/payments/payments.ftl
+++ b/src/main/resources/templates/payments/payments.ftl
@@ -1,7 +1,7 @@
 <html>
     <head>
         <#import "../header.ftl" as header>
-        <@header.header/>
+        <@header.header "BudgetMaster"/>
         <link type="text/css" rel="stylesheet" href="/css/categories.css"/>
         <#assign locale = static["tools.Localization"]>
     </head>
@@ -72,9 +72,8 @@
         </main>
 
         <!--  Scripts-->
-        <script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
-        <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script>
-        <script src="/js/main.js"></script>
+        <#import "../scripts.ftl" as scripts>
+        <@scripts.scripts/>
         <script src="/js/payments.js"></script>
         <script src="/js/datePicker.js"></script>
         <script>document.cookie = "currentDate=${helpers.getDateString(currentDate)}";</script>
diff --git a/src/main/resources/templates/scripts.ftl b/src/main/resources/templates/scripts.ftl
new file mode 100644
index 000000000..eb9d7698f
--- /dev/null
+++ b/src/main/resources/templates/scripts.ftl
@@ -0,0 +1,5 @@
+<#macro scripts>
+<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
+<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script>
+<script src="/js/main.js"></script>
+</#macro>
\ No newline at end of file
-- 
GitLab