diff --git a/src/main/java/email/configuration/MvcConfiguration.java b/src/main/java/email/configuration/MvcConfiguration.java new file mode 100644 index 0000000..6f12a16 --- /dev/null +++ b/src/main/java/email/configuration/MvcConfiguration.java @@ -0,0 +1,49 @@ +package email.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.LocaleResolver; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +import org.springframework.web.servlet.i18n.CookieLocaleResolver; +import org.springframework.web.servlet.i18n.LocaleChangeInterceptor; + +@Configuration +public class MvcConfiguration implements WebMvcConfigurer { + @Override + public void addViewControllers(ViewControllerRegistry registry) { + registry.addViewController("/{articlename:\\w+}"); + } + + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) { + registry + .addResourceHandler("/webjars/**") + .addResourceLocations("/webjars/"); + } + + @Bean + public LocaleResolver localeResolver() { + return new CookieLocaleResolver(); + } + + @Bean + public LocaleChangeInterceptor localeInterceptor() { + LocaleChangeInterceptor localeInterceptor = new LocaleChangeInterceptor(); + localeInterceptor.setParamName("lang"); + return localeInterceptor; + } + + @Override + public void addInterceptors(InterceptorRegistry registry) { + registry.addInterceptor(localeInterceptor()); + } + + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**"); + } +} diff --git a/src/main/resources/public/img/logo.png b/src/main/resources/public/img/logo.png new file mode 100644 index 0000000..da902fa Binary files /dev/null and b/src/main/resources/public/img/logo.png differ diff --git a/src/main/resources/templates/list.html b/src/main/resources/templates/list.html index 3364366..219643d 100644 --- a/src/main/resources/templates/list.html +++ b/src/main/resources/templates/list.html @@ -89,6 +89,7 @@ --> Отправить другое сообщение +