Skip to content

Commit

Permalink
working index page
Browse files Browse the repository at this point in the history
  • Loading branch information
prenagha committed Aug 15, 2024
1 parent 665c519 commit 0959ece
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 18 deletions.
13 changes: 13 additions & 0 deletions .run/TodoApplication.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="TodoApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
<option name="ACTIVE_PROFILES" value="dev" />
<option name="FRAME_DEACTIVATION_UPDATE_POLICY" value="UpdateClassesAndResources" />
<module name="todo-app.app.main" />
<option name="SPRING_BOOT_MAIN_CLASS" value="com.renaghan.todo.TodoApplication" />
<option name="UPDATE_ACTION_UPDATE_POLICY" value="UpdateClassesAndResources" />
<option name="WORKING_DIRECTORY" value="file://app" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ dependencies {
//implementation("org.springframework.boot:spring-boot-starter-security")
//implementation("org.springframework.boot:spring-boot-starter-oauth2-client")
//implementation("software.amazon.awssdk:cognitoidentityprovider")
//implementation("org.thymeleaf.extras:thymeleaf-extras-springsecurity6")

// web stuff
implementation("org.springframework.boot:spring-boot-starter-thymeleaf")
implementation("org.thymeleaf.extras:thymeleaf-extras-springsecurity6")
implementation("nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect")
implementation("org.webjars:webjars-locator-core")
implementation("org.webjars:bootstrap:4.6.1")
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/com/renaghan/todo/IndexController.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.renaghan.todo;

import java.security.Principal;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
Expand All @@ -10,7 +11,7 @@ public class IndexController {
public IndexController() {}

@RequestMapping(method = RequestMethod.GET, path = "/")
public String getIndex() {
public String getIndex(Principal principal) {
return "index";
}
}
4 changes: 2 additions & 2 deletions app/src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ spring:
log-request-details: true

logging:
level:
web: debug
pattern:
console: "%d{HH:mm:ss.S} %-5level %-40.40logger{39} %message%n%rootException{full}"

management:
cloudwatch:
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>

<springProfile name="dev">
<root level="DEBUG">
<root level="INFO">
<appender-ref ref="CONSOLE"/>
</root>
</springProfile>
Expand Down
7 changes: 3 additions & 4 deletions app/src/main/resources/templates/fragments/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
<footer th:fragment="footer">
<div class="container d-flex flex-wrap justify-content-between align-items-center pt-3 my-4 border-top">
<ul class="nav col-md-2 justify-content-start">
<li class="nav-item"><a href="https://stratospheric.dev" class="nav-link px-2 text-muted">&copy; Stratospheric</a></li>
<li class="nav-item"><a href="https://renaghan.com/" class="nav-link px-2 text-muted">&copy; Padraic Renaghan</a></li>
</ul>

<p class="col-md-8 d-flex align-items-center justify-content-center mb-3 mb-md-0 me-md-auto text-muted">
Java: [[${@environment.getProperty('java.version')}]] - Spring Boot: [[${T(org.springframework.boot.SpringBootVersion).getVersion}]] -
[[${@gitProperties.getBranch()}]] -&nbsp;<a class="text-muted" th:href="@{https://github.com/stratospheric-dev/stratospheric/commit/{id}(id=${@gitProperties.getCommitId()})}">[[${@gitProperties.getShortCommitId()}]]</a> &nbsp;-
[[${@gitProperties.getCommitTime().toString()}]]
Java: [[${@environment.getProperty('java.version')}]]
- Spring Boot: [[${T(org.springframework.boot.SpringBootVersion).getVersion}]]
</p>

<ul class="nav col-md-2 justify-content-end">
Expand Down
10 changes: 6 additions & 4 deletions app/src/main/resources/templates/index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<html lang="en"
xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
layout:decorate="~{layout/layout}"
th:with="activeMenuItem='start', headline='Welcome to the Todo Application!'">
<head>
<title>Start</title>
</head>
<body>
<section class="section" >
<section class="section" layout:fragment="page-content">
<div class="container">
<p>There's not much to see here (yet).</p>
</div>
</section>
</body>
</html>
12 changes: 7 additions & 5 deletions app/src/main/resources/templates/layout/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,20 @@
</head>
<body>
<div>
<div th:replace="fragments/header :: header"></div>
<!--
<div th:replace="~{fragments/header :: header}"></div>
-->

<div th:replace="fragments/toast :: toast"></div>
<div th:replace="~{fragments/toast :: toast}"></div>

<div class="container has-text-centered">
<h1 th:text="${headline}" class="title text-center"></h1>
<div th:replace="fragments/messages :: messages"></div>
<div th:replace="~{fragments/messages :: messages}"></div>
<div layout:fragment="page-content"></div>
</div>

<div th:replace="fragments/modals :: confirmDeletionModal"></div>
<div th:replace="fragments/footer :: footer"></div>
<div th:replace="~{fragments/modals :: confirmDeletionModal}"></div>
<div th:replace="~{fragments/footer :: footer}"></div>
</div>
</body>
</html>

0 comments on commit 0959ece

Please sign in to comment.