Skip to content

Commit

Permalink
Remove static references in thymeleaf templates
Browse files Browse the repository at this point in the history
  • Loading branch information
j0rdanit0 committed Sep 24, 2023
1 parent 5b47e4d commit 17382d9
Show file tree
Hide file tree
Showing 15 changed files with 110 additions and 128 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ 11, 12, 13, 14 ]
java: [ 11, 17, 21 ]
name: Java ${{ matrix.java }} compile
steps:
- uses: actions/checkout@master
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<description></description>

<properties>
<java.version>1.8</java.version>
<java.version>11</java.version>
</properties>

<dependencies>
Expand Down
17 changes: 0 additions & 17 deletions src/main/java/org/elpuentesearcy/configuration/Properties.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@
import lombok.NoArgsConstructor;
import org.elpuentesearcy.ElPuenteBoot;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -55,20 +52,6 @@ public class Properties
private List<Employee> board;
private List<Employee> staff;

private static Properties instance;

@PostConstruct
@Order( Ordered.HIGHEST_PRECEDENCE )
public void postConstruct()
{
instance = this;
}

public static Properties get()
{
return instance;
}

@Data
public static class Google
{
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/templates/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<html th:lang="${#locale.language}"
xmlns:th="http://www.thymeleaf.org" xmlns="http://www.w3.org/1999/xhtml"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
th:with="properties=${T(org.elpuentesearcy.configuration.Properties).get()}, uri=${T(org.elpuentesearcy.controller.AboutController).URL_BASE}">
th:with="uri=${@aboutController.URL_BASE}">
<head>
<th:block th:include="fragments/includes::head(${uri})"></th:block>

<title th:text="#{about.title}">About Us</title>
<!--<meta property="og:url" content="">-->
<meta property="og:title" th:content="#{about.title}">
<meta property="og:description" th:content="#{about.aboutUs.content}">
<link rel="stylesheet" th:href="@{'/css/about.css?v='+__${properties.version}__}">
<link rel="stylesheet" th:href="@{'/css/about.css?v='+__${@properties.version}__}">
</head>
<body>
<i th:replace="fragments/navbar::header(#{about.navlink})"></i>
Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/templates/changes.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
xmlns:th="http://www.thymeleaf.org"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
th:with="properties=${T(org.elpuentesearcy.configuration.Properties).get()}, uri=${T(org.elpuentesearcy.controller.ChangesController).URL_BASE}">
th:with="uri=${@changesController.URL_BASE}">
<head>
<th:block th:include="fragments/includes::head(${uri})"></th:block>

<title th:text="#{changes.title}">Title</title>
<link rel="stylesheet" th:href="@{'/css/changes.css?v='+__${properties.version}__}">
<link rel="stylesheet" th:href="@{'/css/changes.css?v='+__${@properties.version}__}">
</head>
<body>
<i th:replace="fragments/navbar::header(#{changes.navlink})"></i>
<main role="main">
<i th:replace="fragments/sectionHeader::header(#{changes.changes}+' ('+${properties.version}+')')"></i>
<i th:replace="fragments/sectionHeader::header(#{changes.changes}+' ('+${@properties.version}+')')"></i>

<div class="container">
<th:block th:if="${#lists.isEmpty(trelloCards)}">
Expand Down Expand Up @@ -47,6 +47,6 @@
</main>

<!--/*/ <th:block th:include="fragments/includes::scripts"></th:block> /*/-->
<script th:src="@{'/js/changes.js?v='+__${properties.version}__}"></script>
<script th:src="@{'/js/changes.js?v='+__${@properties.version}__}"></script>
<script src="https://p.trellocdn.com/embed.min.js"></script>
</body>
50 changes: 25 additions & 25 deletions src/main/resources/templates/contact.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
<html th:lang="${#locale.language}"
xmlns:th="http://www.thymeleaf.org" xmlns="http://www.w3.org/1999/xhtml"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
th:with="properties=${T(org.elpuentesearcy.configuration.Properties).get()}, uri=${T(org.elpuentesearcy.controller.ContactController).URL_BASE}">
th:with="uri=${@contactController.URL_BASE}">
<head>
<th:block th:include="fragments/includes::head(${uri})"></th:block>
<link rel="stylesheet" th:href="@{'/css/contact.css?v='+__${properties.version}__}">
<link rel="stylesheet" th:href="@{'/css/contact.css?v='+__${@properties.version}__}">

<title th:text="#{contact.title}">Title</title>
<!--<meta property="og:url" content="">-->
<meta property="og:title" th:content="#{contact.title}">
<meta property="og:description" th:content="#{contact.contactUs}">
</head>
<body>
<th:block th:if="${!#strings.isEmpty( properties.facebookUrl )}">
<th:block th:if="${!#strings.isEmpty( @properties.facebookUrl )}">
<div id="fb-root"></div>
<script async defer crossorigin="anonymous" th:src="'https://connect.facebook.net/'+${#locale.language + (#locale.language == 'es' ? '_LA' : '_US' )}+'/sdk.js#xfbml=1&version=v3.3'"></script>
</th:block>
Expand All @@ -26,10 +26,10 @@
<div class="col-12 col-md-6 mb-3">
<div layout:insert="~{layouts/info::card}">
<div layout:fragment="content" th:remove="tag">
<th:block th:if="${!#lists.isEmpty(properties.physicalAddress)}">
<th:block th:if="${!#lists.isEmpty(@properties.physicalAddress)}">
<div layout:insert="~{layouts/info::icon('fa-map-marker-alt')}" class="hoverPointer" th:attr="addressUrlLine=${addressUrlLine}" onclick="mapsSelector( this )">
<span layout:fragment="label" class="text-dark">
<th:block th:each="line:${properties.physicalAddress}">
<th:block th:each="line:${@properties.physicalAddress}">
<strong th:text="${line}">Line</strong>
<br/>
</th:block>
Expand All @@ -39,46 +39,46 @@
</span>
</div>
</th:block>
<th:block th:if="${!#lists.isEmpty(properties.mailingAddress)}">
<hr th:if="${!#lists.isEmpty(properties.physicalAddress)}"/>
<th:block th:if="${!#lists.isEmpty(@properties.mailingAddress)}">
<hr th:if="${!#lists.isEmpty(@properties.physicalAddress)}"/>
<div layout:insert="~{layouts/info::icon('fa-envelope-square')}">
<strong layout:fragment="label" class="text-dark">
<th:block th:each="line:${properties.mailingAddress}">
<th:block th:each="line:${@properties.mailingAddress}">
<span th:text="${line}">Line</span>
<br/>
</th:block>
</strong>
</div>
</th:block>
<th:block th:if="${!#strings.isEmpty(properties.phone)}">
<th:block th:if="${!#strings.isEmpty(@properties.phone)}">
<hr/>
<div layout:insert="~{layouts/info::icon('fa-phone-square')}" th:with="href=${ 'tel:'+properties.phone }">
<div layout:insert="~{layouts/info::icon('fa-phone-square')}" th:with="href=${ 'tel:'+@properties.phone }">
<strong layout:fragment="label" class="text-dark">
<span th:text="#{contact.phone}+':'" class="text-capitalize">
Phone:
</span>
<br/>
<span th:text="${properties.formattedPhone}">
<span th:text="${@properties.formattedPhone}">
(123) 456-7890
</span>
</strong>
</div>
</th:block>
<th:block th:if="${!#strings.isEmpty(properties.email)}">
<th:block th:if="${!#strings.isEmpty(@properties.email)}">
<hr/>
<div layout:insert="~{layouts/info::icon('fa-at')}" th:with="href=${ 'mailto:'+properties.email }">
<div layout:insert="~{layouts/info::icon('fa-at')}" th:with="href=${ 'mailto:'+@properties.email }">
<strong layout:fragment="label" class="text-dark">
<span th:text="#{contact.email}+':'" class="text-capitalize">
Email:
</span>
<br/>
<span th:text="${properties.email}">
<span th:text="${@properties.email}">
test@abc.com
</span>
</strong>
</div>
</th:block>
<th:block th:if="${!#lists.isEmpty(properties.physicalAddress)}">
<th:block th:if="${!#lists.isEmpty(@properties.physicalAddress)}">
<hr/>
<div layout:insert="~{layouts/info::icon('fa-clock')}">
<span layout:fragment="label" class="text-dark">
Expand All @@ -90,14 +90,14 @@
Call before you come
</small>
<br/>
<th:block th:if="${!#strings.isEmpty(properties.officeHoursWeekday)}">
<th:block th:if="${!#strings.isEmpty(@properties.officeHoursWeekday)}">
<small th:text="#{contact.hours.weekday}+':'">M-F</small>
<strong class="float-right" th:text="${properties.officeHoursWeekday}">9:00am - 11:00pm</strong>
<strong class="float-right" th:text="${@properties.officeHoursWeekday}">9:00am - 11:00pm</strong>
<br/>
</th:block>
<th:block th:if="${!#strings.isEmpty(properties.officeHoursWeekend)}">
<th:block th:if="${!#strings.isEmpty(@properties.officeHoursWeekend)}">
<small th:text="#{contact.hours.weekend}+':'">Saturday</small>
<strong class="float-right" th:text="${properties.officeHoursWeekend}">9:00am - 11:00pm</strong>
<strong class="float-right" th:text="${@properties.officeHoursWeekend}">9:00am - 11:00pm</strong>
<br/>
</th:block>
</span>
Expand All @@ -107,9 +107,9 @@
</div>
</div>
<div class="col-12 col-md-6 mb-3">
<div th:if="${!#strings.isEmpty( properties.facebookUrl )}" class="fb-page d-block" th:attr="data-href=${properties.facebookUrl}" data-tabs="messages" data-width="" data-height="500" data-small-header="true" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="true">
<blockquote th:cite="${properties.facebookUrl}" class="fb-xfbml-parse-ignore">
<a th:href="${properties.facebookUrl}">
<div th:if="${!#strings.isEmpty( @properties.facebookUrl )}" class="fb-page d-block" th:attr="data-href=${@properties.facebookUrl}" data-tabs="messages" data-width="" data-height="500" data-small-header="true" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="true">
<blockquote th:cite="${@properties.facebookUrl}" class="fb-xfbml-parse-ignore">
<a th:href="${@properties.facebookUrl}">
El Puente Hispanic Services Center
</a>
</blockquote>
Expand All @@ -118,7 +118,7 @@
</div>

<iframe th:if="${!#strings.isEmpty(addressUrlLine)}"
th:src="'https://www.google.com/maps/embed/v1/place?q='+${addressUrlLine}+'&key='+${properties.google.maps.apiKey}+'&language='+${#locale.language}"
th:src="'https://www.google.com/maps/embed/v1/place?q='+${addressUrlLine}+'&key='+${@properties.google.maps.apiKey}+'&language='+${#locale.language}"
class="mx-auto d-block border-0 mb-3"
width="100%"
allowfullscreen>
Expand All @@ -129,7 +129,7 @@
</main>

<!--/*/ <th:block th:include="fragments/includes::scripts"></th:block> /*/-->
<script th:src="@{'/js/contact.js?v='+__${properties.version}__}"></script>
<script th:src="@{'/js/facebookEmbed.js?v='+__${properties.version}__}"></script>
<script th:src="@{'/js/contact.js?v='+__${@properties.version}__}"></script>
<script th:src="@{'/js/facebookEmbed.js?v='+__${@properties.version}__}"></script>
</body>
</html>
4 changes: 2 additions & 2 deletions src/main/resources/templates/events.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<html th:lang="${#locale.language}"
xmlns:th="http://www.thymeleaf.org" xmlns="http://www.w3.org/1999/xhtml"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
th:with="properties=${T(org.elpuentesearcy.configuration.Properties).get()}, uri=${T(org.elpuentesearcy.controller.EventsController).URL_BASE}">
th:with="uri=${@eventsController.URL_BASE}">
<head>
<th:block th:include="fragments/includes::head(${uri})"></th:block>
<link rel="stylesheet" th:href="@{'/css/cardColumns.css?v='+__${properties.version}__}">
<link rel="stylesheet" th:href="@{'/css/cardColumns.css?v='+__${@properties.version}__}">

<title th:text="#{events.title}">Title</title>
<!--<meta property="og:url" content="">-->
Expand Down
32 changes: 16 additions & 16 deletions src/main/resources/templates/fragments/includes.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:fragment="head(currentURI)" th:with="properties=${T(org.elpuentesearcy.configuration.Properties).get()}">
<head th:fragment="head(currentURI)">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="content-language" th:content="${#locale.language}">

<th:block th:if="${!#strings.isEmpty(properties.google.analytics.trackingId)}" th:with="trackingId=${properties.google.analytics.trackingId}">
<th:block th:if="${!#strings.isEmpty(@properties.google.analytics.trackingId)}" th:with="trackingId=${@properties.google.analytics.trackingId}">
<script async th:src="'https://www.googletagmanager.com/gtag/js?id='+${trackingId}"></script>
<script th:inline="javascript">
/*<![CDATA[*/
Expand All @@ -25,7 +25,7 @@
<script async src='https://www.google-analytics.com/analytics.js'></script>
</th:block>

<th:block th:unless="${properties.testMode}">
<th:block th:unless="${@properties.testMode}">
<link rel="apple-touch-icon" sizes="57x57" href="/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="/apple-icon-72x72.png">
Expand All @@ -40,41 +40,41 @@
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png">
<link rel="manifest" href="/manifest.json">
<link rel="canonical" th:href="'https://'+${properties.domain + currentURI}">
<link rel="alternate" th:href="'https://'+${properties.domain + currentURI}" hreflang="x-default">
<link rel="canonical" th:href="'https://'+${@properties.domain + currentURI}">
<link rel="alternate" th:href="'https://'+${@properties.domain + currentURI}" hreflang="x-default">
<th:block th:each="language:${T(org.elpuentesearcy.configuration.UrlLocaleResolver.ElPuenteLanguage).values()}">
<link rel="alternate" th:hreflang="${language.subdomain}" th:href="'https://'+${language.subdomain +'.'+ properties.domain + currentURI}">
<link rel="alternate" th:hreflang="${language.subdomain}" th:href="'https://'+${language.subdomain +'.'+ @properties.domain + currentURI}">
</th:block>
</th:block>
<th:block th:if="${properties.testMode}">
<th:block th:if="${@properties.testMode}">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-icon-beta-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="/android-icon-beta-192x192.png">
<link rel="manifest" href="/manifest-beta.json">
</th:block>

<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#6ba6cb">
<meta name="apple-mobile-web-app-capable" content="no">
<meta name="apple-mobile-web-app-title" th:content="'El Puente'+${properties.testMode?' BETA':''}">
<meta name="application-name" th:content="'El Puente'+${properties.testMode?' BETA':''}">
<meta name="apple-mobile-web-app-title" th:content="'El Puente'+${@properties.testMode?' BETA':''}">
<meta name="application-name" th:content="'El Puente'+${@properties.testMode?' BETA':''}">
<meta name="msapplication-config" content="browserconfig.xml">
<meta name="msapplication-TileColor" th:content="'#'+${properties.testMode?'E07F52':'6ba6cb'}">
<meta name="msapplication-TileColor" th:content="'#'+${@properties.testMode?'E07F52':'6ba6cb'}">
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff">

<meta property="og:type" content="website">
<meta property="og:image" th:content="'http://'+${properties.domain}+'/apple-icon-180x180.png'">
<meta property="og:site_name" th:content="${properties.domain}">
<meta property="og:image" th:content="'http://'+${@properties.domain}+'/apple-icon-180x180.png'">
<meta property="og:site_name" th:content="${@properties.domain}">
<!-- <meta property="fb:app_id" content="">-->

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<link rel="stylesheet" th:href="@{'/css/bootstrap-overrides.css?v='+__${properties.version}__}">
<link rel="stylesheet" th:href="@{'/css/common.css?v='+__${properties.version}__}">
<link rel="stylesheet" th:href="@{'/css/bootstrap-overrides.css?v='+__${@properties.version}__}">
<link rel="stylesheet" th:href="@{'/css/common.css?v='+__${@properties.version}__}">
</head>
<body th:fragment="scripts" th:with="properties=${T(org.elpuentesearcy.configuration.Properties).get()}">
<body th:fragment="scripts">
<script src="/webjars/jquery/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>
<script th:src="@{'/js/common.js?v='+__${properties.version}__}"></script>
<script th:src="@{'/js/common.js?v='+__${@properties.version}__}"></script>
</body>
</html>
Loading

0 comments on commit 17382d9

Please sign in to comment.