5 lab start

This commit is contained in:
parap 2023-05-01 01:23:12 +04:00
parent 651d1a95f4
commit efd20a1796
21 changed files with 274 additions and 5 deletions

View File

@ -14,11 +14,20 @@ repositories {
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-devtools'
implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect'
implementation 'org.webjars:bootstrap:5.1.3'
implementation 'org.webjars:jquery:3.6.0'
implementation 'org.webjars:font-awesome:6.1.0'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'com.h2database:h2:2.1.210'
implementation group: 'org.springdoc', name: 'springdoc-openapi-ui', version: '1.6.5'
implementation 'org.hibernate.validator:hibernate-validator'
implementation 'org.springdoc:springdoc-openapi-ui:1.6.5'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

Binary file not shown.

View File

@ -1,6 +1,5 @@
.banner-block {
width: 90%;
}
.banner-card {

View File

@ -2,12 +2,27 @@ package ru.ip.labs.labs;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebConfiguration implements WebMvcConfigurer {
public static final String REST_API = "/api";
@Override
public void addViewControllers(ViewControllerRegistry registry) {
WebMvcConfigurer.super.addViewControllers(registry);
registry.addViewController("films");
registry.addViewController("contacts");
registry.addViewController("catalogs");
}
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**").allowedMethods("*");
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/static/css/**").addResourceLocations("/static/css/");
}
}

View File

@ -1,6 +1,7 @@
package ru.ip.labs.labs.films.controller;
import org.springframework.web.bind.annotation.*;
import ru.ip.labs.labs.WebConfiguration;
import ru.ip.labs.labs.films.dto.ActorDTO;
import ru.ip.labs.labs.films.service.ActorService;
@ -8,7 +9,7 @@ import javax.validation.Valid;
import java.util.List;
@RestController
@RequestMapping("/actors")
@RequestMapping(WebConfiguration.REST_API + "/actors")
public class ActorController {
private final ActorService actorService;

View File

@ -1,6 +1,7 @@
package ru.ip.labs.labs.films.controller;
import org.springframework.web.bind.annotation.*;
import ru.ip.labs.labs.WebConfiguration;
import ru.ip.labs.labs.films.dto.FilmDTO;
import ru.ip.labs.labs.films.models.Film;
import ru.ip.labs.labs.films.models.Genre;
@ -11,7 +12,7 @@ import java.util.Iterator;
import java.util.List;
@RestController
@RequestMapping("/films")
@RequestMapping(WebConfiguration.REST_API + "/films")
public class FilmController {
private final FilmsService filmService;

View File

@ -1,6 +1,7 @@
package ru.ip.labs.labs.films.controller;
import org.springframework.web.bind.annotation.*;
import ru.ip.labs.labs.WebConfiguration;
import ru.ip.labs.labs.films.dto.FilmDTO;
import ru.ip.labs.labs.films.dto.GenreDTO;
import ru.ip.labs.labs.films.models.Film;
@ -12,7 +13,7 @@ import javax.validation.Valid;
import java.util.List;
@RestController
@RequestMapping("/genres")
@RequestMapping(WebConfiguration.REST_API + "/genres")
public class GenreController {
private final GenreService genreService;

View File

@ -0,0 +1,23 @@
.banner-block {
width: 90%;
}
.banner-card {
width: 0;
height: 0;
overflow: hidden;
opacity: 0.2;
transition: 0.5s opacity ease;
}
.banner-card.active {
width: 100%;
height: auto;
opacity: 1;
margin: 0 auto;
}
.banner-card.active img {
height: 75vh;
}

View File

@ -0,0 +1,5 @@
.map__frame {
width: 90%;
height: 500px;
margin-bottom: 30px;
}

View File

@ -0,0 +1,21 @@
.navbar__logo {
text-decoration: none;
margin-left: 30px;
}
.navbar__logo-text {
font-size: 30px;
text-decoration: none;
color: white;
}
.navbar__logo-text_first {
color: yellow;
}
body {
margin: 0;
background: linear-gradient(135deg, #8bf292, #a5ebb1) fixed;
min-height: 100vh;
position: relative;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

View File

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
layout:decorate="~{default}">
<head>
</head>
<body>
<div layout:fragment="content">
<a href="/filmsCatalog" class="btn btn-success mt-1">фильмы</a>
<a href="/genresCatalog" class="btn btn-success mt-1">жанры</a>
<a href="/actorsCatalog" class="btn btn-success mt-1">актеры</a>
</div>
</body>
</html>

View File

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
layout:decorate="~{default}">
<head>
<link rel="stylesheet" href="/css/Contacts.css">
</head>
<body>
<div layout:fragment="content">
<h2 class="text-white">Контакты</h2>
<iframe class="map__frame" title="map" src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d158855.07580070102!2d-0.2470504135400737!3d51.52953198005434!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x47d8a00baf21de75%3A0x52963a5addd52a99!2z0JvQvtC90LTQvtC9LCDQktC10LvQuNC60L7QsdGA0LjRgtCw0L3QuNGP!5e0!3m2!1sru!2sru!4v1664443841067!5m2!1sru!2sru" loading="lazy"/>
</div>
</body>
</html>

View File

@ -0,0 +1,54 @@
<!DOCTYPE html>
<html lang="ru"
xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout">
<head>
<meta charset="UTF-8"/>
<title>lumer</title>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="icon" href="/favicon.svg">
<link rel="stylesheet" href="/css/Header.css">
<script type="text/javascript" src="/webjars/bootstrap/5.1.3/js/bootstrap.bundle.min.js"></script>
<link rel="stylesheet" href="/webjars/bootstrap/5.1.3/css/bootstrap.min.css"/>
<link rel="stylesheet" href="/webjars/font-awesome/6.1.0/css/all.min.css"/>
</head>
<body>
<nav class="navbar navbar-dark navbar-expand-lg bg-success">
<div class="container-fluid">
<a class="navbar-brand" href="/">
<span class="navbar__logo-text navbar__logo-text_first">L</span><span class="navbar__logo-text navbar__logo-text_second">umer</span>
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Переключатель навигации">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav" th:with="activeLink=${#request.requestURI}">
<li class="nav-item">
<a class="nav-link btn btn-success" aria-current="page" href="/"
th:classappend="${#strings.equals(activeLink, '/')} ? 'active' : ''">Главная</a>
</li>
<li class="nav-item">
<a class="nav-link btn btn-success" aria-current="page" href="/films"
th:classappend="${#strings.equals(activeLink, '/films')} ? 'active' : ''">Фильмы</a>
</li>
<li class="nav-item">
<a class="nav-link btn btn-success" aria-current="page" href="/contacts"
th:classappend="${#strings.equals(activeLink, '/contacts')} ? 'active' : ''">Контакты</a>
</li>
<li class="nav-item">
<a class="nav-link btn btn-success" aria-current="page" href="/catalogs"
th:classappend="${#strings.equals(activeLink, '/catalogs')} ? 'active' : ''">Каталог</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="container-fluid">
<div layout:fragment="content">
</div>
</div>
</body>
<th:block layout:fragment="scripts">
</th:block>
</html>

View File

@ -0,0 +1,61 @@
<!DOCTYPE html>
<html lang="en"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
layout:decorate="~{default}" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" href="/css/Banner.css">
</head>
<body>
<div layout:fragment="content">
<section class="categories">
<h2 class="text-white">Категории</h2>
<div class="btn-group">
<button class="btn btn-success">Комедии</button>
<button class="btn btn-success">Драмы</button>
<button class="btn btn-success">Трилер</button>
</div>
</section>
<section class="banner">
<h2 class="text-white">Все фильмы</h2>
<div class="banner-block" id="banner">
<div class="banner-card active">
<a href="/film">
<img src="/img/1.jpg"/>
</a>
</div>
<div class="banner-card">
<a href="/film">
<img src="/img/2.jpg"/>
</a>
</div>
<div class="banner-card">
<a href="/film">
<img src="/img/3.jpg"/>
</a>
</div>
<div class="banner-card">
<a href="/film">
<img src="/img/4.jpg"/>
</a>
</div>
<div class="banner-card">
<a href="/film">
<img src="/img/5.jpg"/>
</a>
</div>
</div>
</section>
</div>
<th:block layout:fragment="scripts">
<script>
let active = 0;
let banner = document.getElementById("banner")
setInterval(() => {
active += active == 4 ? -4 : 1;
document.querySelector(".banner-card.active").classList.remove("active");
banner.children[active].classList.add("active");
}, 3000);
</script>
</th:block>
</body>
</html>

View File

@ -0,0 +1,51 @@
<!DOCTYPE html>
<html lang="en"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
layout:decorate="~{default}" xmlns:th="http://www.w3.org/1999/html">
<head>
<link rel="stylesheet" href="/css/Banner.css">
</head>
<body>
<div layout:fragment="content">
<h2 class="text-white">Популярные</h2>
<div class="banner-block" id="banner">
<div class="banner-card active">
<a href="/film">
<img src="/img/1.jpg"/>
</a>
</div>
<div class="banner-card">
<a href="/film">
<img src="/img/2.jpg"/>
</a>
</div>
<div class="banner-card">
<a href="/film">
<img src="/img/3.jpg"/>
</a>
</div>
<div class="banner-card">
<a href="/film">
<img src="/img/4.jpg"/>
</a>
</div>
<div class="banner-card">
<a href="/film">
<img src="/img/5.jpg"/>
</a>
</div>
</div>
</div>
<th:block layout:fragment="scripts">
<script>
let active = 0;
let banner = document.getElementById("banner")
setInterval(() => {
active += active == 4 ? -4 : 1;
document.querySelector(".banner-card.active").classList.remove("active");
banner.children[active].classList.add("active");
}, 3000);
</script>
</th:block>
</body>
</html>