diff --git a/src/main/java/fr/unistra/sil/erp/back/WebMvcConfig.java b/src/main/java/fr/unistra/sil/erp/back/WebMvcConfig.java index ac9009ffcf60bfddcbcece01e3f0161d44bda6ed..73cfdc592a1767f9d7558dcd639c1fa341bf35f1 100644 --- a/src/main/java/fr/unistra/sil/erp/back/WebMvcConfig.java +++ b/src/main/java/fr/unistra/sil/erp/back/WebMvcConfig.java @@ -10,8 +10,6 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; import org.springframework.context.annotation.PropertySources; import org.springframework.core.env.Environment; -import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; -import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @@ -20,7 +18,6 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; * @author BEAUVAIS ANTOINE */ @Configuration -@EnableWebMvc @PropertySources( @PropertySource("/apikey.properties") ) @@ -76,14 +73,6 @@ public class WebMvcConfig implements WebMvcConfigurer { */ public static final String MAPPING_LOGIN = "/login"; - /* - // TODO: Define default servlet. - @Override - public void configureDefaultServletHandling( - DefaultServletHandlerConfigurer configurer) { - configurer.enable(); - }*/ - /** * Adds interceptors to the application. * diff --git a/src/main/java/fr/unistra/sil/erp/back/controller/web/LoginController.java b/src/main/java/fr/unistra/sil/erp/back/controller/web/LoginController.java index fc1e5e7c63a3335853c98efd230b1839ae42b93a..14afb704ad0199af8abc49a682bbeb39ece90d65 100644 --- a/src/main/java/fr/unistra/sil/erp/back/controller/web/LoginController.java +++ b/src/main/java/fr/unistra/sil/erp/back/controller/web/LoginController.java @@ -23,10 +23,12 @@ public class LoginController { * Logic for handling login. * * TODO: Actual implementation. + * @return the name of the template to use. */ @GetMapping(MAPPING_LOGIN) - public void login() + public String login() { + return "login"; } } diff --git a/src/main/java/fr/unistra/sil/erp/back/controller/web/RootController.java b/src/main/java/fr/unistra/sil/erp/back/controller/web/RootController.java new file mode 100644 index 0000000000000000000000000000000000000000..464340fec02e27e4f71b3bffc21886c42edfa052 --- /dev/null +++ b/src/main/java/fr/unistra/sil/erp/back/controller/web/RootController.java @@ -0,0 +1,19 @@ +/* + * CONTRAT DE LICENCE DE LOGICIEL LIBRE CeCILL-B + * https://cecill.info/licences/Licence_CeCILL-B_V1-fr.html + */ +package fr.unistra.sil.erp.back.controller.web; + +/** + * Controller for the root page. + * + * The root page will typically redirect to the + * main interface. + * + * @author BEAUVAIS ANTOINE + */ +public class RootController { + + + +} diff --git a/src/main/java/fr/unistra/sil/erp/back/package-info.java b/src/main/java/fr/unistra/sil/erp/back/package-info.java index 0cf38f54e5aeced7751fa16b68512a3ee3b397be..447066541339d6ecbe84b576c95af022e3dd7d45 100644 --- a/src/main/java/fr/unistra/sil/erp/back/package-info.java +++ b/src/main/java/fr/unistra/sil/erp/back/package-info.java @@ -10,7 +10,8 @@ * <li>Web interface for regular Human-Machine Interface (HMI) interactions. * </ul> * - * Notice: Only the API is currently implemented (partially) for now. + * Currently, the RESTful API is partly implemented and the Web interface + * has only just been started. * * @version 0.0.1 * @author BEAUVAIS ANTOINE diff --git a/src/main/java/overview.html b/src/main/java/overview.html index 276c8557170ec5367a03a1187c2d9d999648cf23..8979b4c978a723fbc6daee6bf54e9c1e6bd4ea08 100644 --- a/src/main/java/overview.html +++ b/src/main/java/overview.html @@ -15,5 +15,6 @@ https://cecill.info/licences/Licence_CeCILL-B_V1-fr.html <li>a Web interface for managing the software and data.</li> </ul> - <p>Currently, only the RESTful API is partially implemented.</p> + <p>Currently, the RESTful API is partly implemented and the Web interface + has only just been started.</p> </body> \ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 8b137891791fe96927ad78e64b0aad7bded08bdc..6e04b84a87e587ea91d1e7e41859a7b8b534a0fe 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1 +1 @@ - +spring.mvc.static-path-pattern=/static/** diff --git a/src/main/resources/messages.properties b/src/main/resources/messages.properties index 3969e04c46cdf7b0149c7424531744b17233e07f..3e26a4b42ea1d5f702ce68a6642f0436ca50d082 100644 --- a/src/main/resources/messages.properties +++ b/src/main/resources/messages.properties @@ -8,3 +8,11 @@ web.ui.login.username=Username web.ui.login.password=Password #Login page: Button's label. web.ui.login.submit=Log in +#Product. +web.ui.product=Product +#Products (plural). +web.ui.products=Products +#Financial registry. +web.ui.registry=Registry +#Documents. +web.ui.property.documents=Documents diff --git a/src/main/resources/messages_en.properties b/src/main/resources/messages_en.properties index 3969e04c46cdf7b0149c7424531744b17233e07f..3e26a4b42ea1d5f702ce68a6642f0436ca50d082 100644 --- a/src/main/resources/messages_en.properties +++ b/src/main/resources/messages_en.properties @@ -8,3 +8,11 @@ web.ui.login.username=Username web.ui.login.password=Password #Login page: Button's label. web.ui.login.submit=Log in +#Product. +web.ui.product=Product +#Products (plural). +web.ui.products=Products +#Financial registry. +web.ui.registry=Registry +#Documents. +web.ui.property.documents=Documents diff --git a/src/main/resources/messages_fr.properties b/src/main/resources/messages_fr.properties index 362c0b6dfd6238c200b0799ca998a66fab3ae5f8..7f43ca254f06caa9097ebd40fa95cac03ee5599f 100644 --- a/src/main/resources/messages_fr.properties +++ b/src/main/resources/messages_fr.properties @@ -8,3 +8,11 @@ web.ui.login.username=Nom d'utilisateur web.ui.login.password=Mot de passe #Login page: Button's label. web.ui.login.submit=Se connecter +#Product. +web.ui.product=Produit +#Products (plural). +web.ui.products=Produits +#Financial registry. +web.ui.registry=Registre +#Documents. +web.ui.property.documents=Documents diff --git a/src/main/resources/static/main.css b/src/main/resources/static/main.css new file mode 100644 index 0000000000000000000000000000000000000000..4426b73005d251ce7748af760c583c5e2a9f2b2f --- /dev/null +++ b/src/main/resources/static/main.css @@ -0,0 +1,57 @@ + /* Add a black background color to the top navigation */ + .topnav { + background-color: #333; + overflow: hidden; +} + +/* Style the links inside the navigation bar */ +.topnav a { + float: left; + display: block; + color: #f2f2f2; + text-align: center; + padding: 14px 16px; + text-decoration: none; + font-size: 17px; +} + +/* Change the color of links on hover */ +.topnav a:hover { + background-color: #ddd; + color: black; +} + +/* Add an active class to highlight the current page */ +.topnav a.active { + background-color: #04AA6D; + color: white; +} + +/* Hide the link that should open and close the topnav on small screens */ +.topnav .icon { + display: none; +} + +/* When the screen is less than 600 pixels wide, hide all links, except for the first one ("Home"). Show the link that contains should open and close the topnav (.icon) */ +@media screen and (max-width: 600px) { + .topnav a:not(:first-child) {display: none;} + .topnav a.icon { + float: right; + display: block; + } +} + +/* The "responsive" class is added to the topnav with JavaScript when the user clicks on the icon. This class makes the topnav look good on small screens (display the links vertically instead of horizontally) */ +@media screen and (max-width: 600px) { + .topnav.responsive {position: relative;} + .topnav.responsive a.icon { + position: absolute; + right: 0; + top: 0; + } + .topnav.responsive a { + float: none; + display: block; + text-align: left; + } +} \ No newline at end of file diff --git a/src/main/resources/templates/fragments/head.html b/src/main/resources/templates/fragments/head.html new file mode 100644 index 0000000000000000000000000000000000000000..e88d520116bff1b7da8a29fb67decaf53552da16 --- /dev/null +++ b/src/main/resources/templates/fragments/head.html @@ -0,0 +1,12 @@ +<!DOCTYPE html> +<html xmlns:th="http://www.thymeleaf.org"> +<head th:fragment="sharedHead (pageName)"> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> + <link rel="stylesheet" href="/static/main.css"> + <title th:text="${pageName} + ' - ' + #{application.name}"></title> +</head> + +<body> + +</body> +</html> diff --git a/src/main/resources/templates/fragments/navbar.html b/src/main/resources/templates/fragments/navbar.html new file mode 100644 index 0000000000000000000000000000000000000000..d20413256f6a2e7abfea867f96a0866df5fee078 --- /dev/null +++ b/src/main/resources/templates/fragments/navbar.html @@ -0,0 +1,13 @@ +<!DOCTYPE html> +<html xmlns:th="http://www.thymeleaf.org"> +<head></head> +<body> + <div class="topnav" id="topNavBar" th:fragment="topNavBar"> + <a href="/" th:text="#{application.name}"></a> + <a href="#products" class="active" th:text="#{web.ui.products}"></a> + <a href="#registry" th:text="#{web.ui.registry}"></a> + <a href="#documents" th:text="#{web.ui.documents}"></a> + <a href="javascript:void(0);" class="icon" onclick="toggleNavBar()">☰</a> + </div> +</body> +</html> \ No newline at end of file diff --git a/src/main/resources/templates/fragments/navbarGuest.html b/src/main/resources/templates/fragments/navbarGuest.html new file mode 100644 index 0000000000000000000000000000000000000000..54b81e974f694b2edad6b03888667929a91e82ec --- /dev/null +++ b/src/main/resources/templates/fragments/navbarGuest.html @@ -0,0 +1,10 @@ +<!DOCTYPE html> +<html xmlns:th="http://www.thymeleaf.org"> +<head></head> +<body> + <div class="topnav" id="topNavBar" th:fragment="topNavBar"> + <a href="/" th:text="#{application.name}"></a> + <a href="javascript:void(0);" class="icon" onclick="toggleNavBar()">☰</a> + </div> +</body> +</html> \ No newline at end of file diff --git a/src/main/resources/templates/items.html b/src/main/resources/templates/items.html new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/main/resources/templates/login.html b/src/main/resources/templates/login.html index 887851e61df9cfaa32c7b0b70a8f9b0b518ba840..2ee83ed1cabbdf2b17b4d9e65a6777ddd0d2a152 100644 --- a/src/main/resources/templates/login.html +++ b/src/main/resources/templates/login.html @@ -1,11 +1,10 @@ <!DOCTYPE html> -<html lang="fr" xmlns:th="http://www.thymeleaf.org"> - <head> - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> - <title th:text="#{web.ui.login.login} + ' - ' + #{application.name}"></title> +<html xmlns:th="http://www.thymeleaf.org"> + <head th:replace="fragments/head :: sharedHead (pageName=#{web.ui.login.login})"> </head> <body> + <div th:replace="fragments/navbarGuest :: topNavBar"></div> <h1 th:text="#{web.ui.login.login}"></h1> <p>TODO</p> </body>