#1 -- add config for db

This commit is contained in:
Anton Romanov 2022-03-08 21:21:08 +04:00
parent c2257739ef
commit fda151baff
8 changed files with 26 additions and 10 deletions

View File

@ -37,7 +37,11 @@ dependencies {
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-thymeleaf'
implementation group: 'org.slf4j', name: 'slf4j-api', version: versionSLF4J
implementation group: 'nz.net.ultraq.thymeleaf', name: 'thymeleaf-layout-dialect'
implementation group: 'org.javassist', name: 'javassist', version: '3.25.0-GA'
implementation group: 'org.springframework.boot', name:'spring-boot-starter-data-jpa'
implementation group: 'com.h2database', name:'h2'
implementation group: 'javax.xml.bind', name:'jaxb-api'
implementation group: 'org.javassist', name:'javassist'
implementation group: 'org.eclipse.jetty', name: 'jetty-servlet', version: versionJetty
implementation group: 'org.webjars', name: 'jquery', version: '3.6.0'

BIN
data/db.mv.db Normal file

Binary file not shown.

View File

@ -22,7 +22,15 @@ public class IndexController {
model.addAttribute("news", List.of(new News("Открытие семинара", new GregorianCalendar(2022, 4, 1).getTime(),
"На кафере \"Информационные системы\" Ульяновского государственного технического университета состоится открытие постоянно действующего семинара \"Анализ данных и процессов\". Семинар планируется проводить ежемесячно."),
new News("Открытие семинара", new GregorianCalendar(2022, 4, 1).getTime(),
"На кафере \"Информационные системы\" Ульяновского государственного технического университета состоится открытие постоянно действующего семинара \"Анализ данных и процессов\". Семинар планируется проводить ежемесячно.")));
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec laoreet enim dolor, vitae imperdiet mi consectetur et. Etiam posuere massa sed arcu pulvinar, eu tincidunt nunc vehicula. Integer interdum magna et orci eleifend convallis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam interdum nulla eget lacus ultricies sagittis. Duis a lacus lacinia, pulvinar augue ultrices, vulputate arcu. Etiam facilisis justo nec ex tincidunt, sit amet tempus ante iaculis. Praesent non accumsan odio. Nunc faucibus mattis elit elementum lacinia. Sed orci augue, iaculis sed efficitur ac, faucibus nec orci. Vivamus sed tempor lectus. Mauris non nisi lobortis, varius tortor id, cursus orci. Sed gravida, est nec placerat ornare, mi metus mattis eros, vitae finibus lectus turpis ut felis. Mauris faucibus lorem orci, tempor bibendum leo varius et.\n" +
"\n" +
"Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Suspendisse ut vulputate enim, nec rutrum magna. Ut finibus dignissim arcu, gravida gravida eros vulputate a. Nulla dapibus eleifend egestas. Pellentesque malesuada venenatis fermentum. Proin suscipit mi enim, eu cursus neque luctus id. Sed nec sodales libero, vel finibus sem. Maecenas tincidunt sagittis risus a posuere. Donec quis velit lorem. Curabitur viverra libero quis nibh molestie, id suscipit lorem ultrices. Donec egestas lectus at justo tempus, et pulvinar magna dignissim. Donec eleifend pretium ante in maximus. Maecenas in malesuada ante. Donec euismod tincidunt tempus.\n" +
"\n" +
"Integer convallis euismod nibh non ornare. Sed sed sagittis enim, id tempus libero. Sed interdum dui ut orci ultrices efficitur. Aenean a tristique odio. Duis nec lacus sit amet metus fringilla posuere. Donec nisi felis, congue ut lorem in, efficitur dapibus leo. Sed vel urna porta, mollis nunc in, aliquam quam. Sed rhoncus justo nisi, vitae volutpat nibh feugiat at. Phasellus laoreet justo et elit aliquet, non tincidunt mauris sagittis. Nunc in quam velit. Aliquam lobortis turpis elit, ut aliquam dolor sagittis sed. Duis pellentesque eu turpis quis ullamcorper. Nullam in ullamcorper metus. Vestibulum sit amet tellus at nulla pretium commodo. Nulla eleifend lacus ex, ac sodales odio pellentesque in. Cras nec metus elit.\n" +
"\n" +
"Cras feugiat gravida magna, nec faucibus eros eleifend nec. Donec sodales ligula ut ante lacinia eleifend. Pellentesque bibendum nunc vel nulla luctus, ut vulputate turpis semper. Aenean quis massa bibendum, vehicula lorem et, fringilla arcu. Morbi nisi elit, pellentesque ac tincidunt quis, volutpat et felis. Duis ullamcorper velit mauris, sit amet egestas sem euismod ac. Proin sodales urna in libero scelerisque mollis.\n" +
"\n" +
"Curabitur sed massa tempus, ullamcorper nisl non, posuere mi. Integer nisl quam, venenatis ut dapibus vehicula, tempor nec metus. Suspendisse ultrices maximus lorem quis accumsan. Donec ac orci et dolor tincidunt pellentesque. In at tempor ligula. Nulla mi risus, malesuada tincidunt ante vel, rhoncus posuere massa. Pellentesque feugiat urna id arcu gravida euismod. Maecenas vulputate et lorem vitae molestie. Maecenas et nibh nec nisl facilisis faucibus. Vestibulum sed lacus elementum, interdum erat non, euismod odio. Proin ac lorem vel nibh efficitur egestas ac et nibh. Integer at enim.")));
return "index";
}
}

View File

@ -3,7 +3,7 @@ package ru.ulstu.model;
import java.util.Date;
public class News {
private final static int MAX_NEWS_TEXT_PREVIEW_LENGTH = 200;
private final static int MAX_NEWS_TEXT_PREVIEW_LENGTH = 800;
private final String title;
private final Date date;
private final String text;

View File

@ -8,3 +8,11 @@ spring.main.banner-mode=off
logging.level.tech.athene=DEBUG
server.port=8080
spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false
# go to http://localhost:8080/h2-console
spring.datasource.url=jdbc:h2:file:./data/db
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=password
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.h2.console.enabled=true
spring.jpa.hibernate.ddl-auto=update

View File

@ -9,16 +9,12 @@
}
.news-item {
margin: 20px;
position: relative;
text-align: justify;
}
.news-date {
font-size: 10px;
position: absolute;
bottom: 0;
right: 25px;
text-align: right;
}
.news-image {

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

View File

@ -21,10 +21,10 @@
<div class="col-md-8">
<h5 th:text="${n.title}"/>
<div th:text="${n.preview}" class="news-item"></div>
<div th:text="${'Опубликовано: ' + #calendars.format(n.date, 'dd.MM.yyyy HH:mm')}"
class="news-date"></div>
</div>
</div>
<div th:text="${'Опубликовано: ' + #calendars.format(n.date, 'dd.MM.yyyy HH:mm')}"
class="news-date"></div>
<hr/>
</div>
</div>