From 918f8fb20f731c273a87751f0410aa76823793d7 Mon Sep 17 00:00:00 2001 From: fecaille Date: Thu, 10 Mar 2016 12:59:44 +0100 Subject: [PATCH] Adds Bootstrap and ThymeLeaf managment --- pom.xml | 57 ++++++++++++++++--- .../saas/config/WebMvcConfiguration.java | 37 ++++++++++++ .../cloud/saas/config/WebSecurityConfig.java | 15 +++++ .../resources/templates/fragments/footer.html | 13 +++++ .../resources/templates/fragments/header.html | 39 +++++++++++++ src/main/resources/templates/index.html | 35 +++++++----- src/main/webapp/css/comments.css | 7 +++ .../js/{app.render.js => app.render.jsx} | 0 src/main/wro/wro.properties | 8 +-- src/main/wro/wro.xml | 5 +- 10 files changed, 190 insertions(+), 26 deletions(-) create mode 100644 src/main/java/com/opengroupe/cloud/saas/config/WebMvcConfiguration.java create mode 100644 src/main/java/com/opengroupe/cloud/saas/config/WebSecurityConfig.java create mode 100644 src/main/resources/templates/fragments/footer.html create mode 100644 src/main/resources/templates/fragments/header.html create mode 100644 src/main/webapp/css/comments.css rename src/main/webapp/js/{app.render.js => app.render.jsx} (100%) diff --git a/pom.xml b/pom.xml index f236f08..838df83 100644 --- a/pom.xml +++ b/pom.xml @@ -17,6 +17,7 @@ 1.8 + 2.4.1 3.2.0 @@ -38,7 +39,37 @@ org.springframework.boot spring-boot-starter-thymeleaf - + + + org.springframework.boot + spring-boot-starter-security + + + org.thymeleaf.extras + thymeleaf-extras-springsecurity4 + + + + org.springframework + spring-jdbc + + + org.springframework + spring-tx + + + org.springframework + spring-orm + + + org.hibernate + hibernate-entitymanager + + + org.hsqldb + hsqldb + + org.springframework.boot spring-boot-starter-test @@ -118,7 +149,17 @@ - src/main/webapp/js + + src/main/resources/static/js/bundle + src/main/resources/static/js/jsx + + false + src/main/resources/static/js + + + src/main/resources/static/css/bundle + false + src/main/resources/static/css src/main/wro @@ -141,7 +182,9 @@ - + + + @@ -185,10 +228,10 @@ jsx - ${project.basedir}/src/main/webapp/js + ${project.basedir}/src/main/resources/static/js - ${project.basedir}/src/main/resources/static/js + ${project.basedir}/src/main/resources/static/js/jsx @@ -224,8 +267,8 @@ ro.isdc.wro.maven.plugin.manager.factory.ConfigurableWroManagerFactory - ${project.basedir}/src/main/resources/static/css - ${project.basedir}/src/main/resources/static/js + ${project.basedir}/src/main/resources/static/css/bundle + ${project.basedir}/src/main/resources/static/js/bundle ${project.build.directory}/wro/wro.xml ${project.basedir}/src/main/wro/wro.properties diff --git a/src/main/java/com/opengroupe/cloud/saas/config/WebMvcConfiguration.java b/src/main/java/com/opengroupe/cloud/saas/config/WebMvcConfiguration.java new file mode 100644 index 0000000..152f34d --- /dev/null +++ b/src/main/java/com/opengroupe/cloud/saas/config/WebMvcConfiguration.java @@ -0,0 +1,37 @@ +package com.opengroupe.cloud.saas.config; + +import org.springframework.context.annotation.Bean; +import org.thymeleaf.extras.springsecurity4.dialect.SpringSecurityDialect; +import org.thymeleaf.spring4.SpringTemplateEngine; +import org.thymeleaf.spring4.view.ThymeleafViewResolver; +import org.thymeleaf.templateresolver.ServletContextTemplateResolver; +import org.thymeleaf.templateresolver.TemplateResolver; +import org.thymeleaf.templateresolver.UrlTemplateResolver; + +@org.springframework.context.annotation.Configuration +public class WebMvcConfiguration { + +// @Bean +// public TemplateResolver templateResolver() { +// TemplateResolver templateResolver = new ThymeleafViewResolver().; +// templateResolver.setPrefix("/resources/templates"); +// templateResolver.setSuffix(".html"); +// templateResolver.setTemplateMode("HTML5"); +// templateResolver.setCacheable(false); +// return templateResolver; +// } + +// @Bean +// public UrlTemplateResolver urlTemplateResolver() { +// return new UrlTemplateResolver(); +// } + +// @Bean +// public SpringTemplateEngine templateEngine() { +// SpringTemplateEngine templateEngine = new SpringTemplateEngine(); +//// templateEngine.addTemplateResolver(templateResolver()); +// templateEngine.addTemplateResolver(urlTemplateResolver()); +// templateEngine.addDialect(new SpringSecurityDialect()); +// return templateEngine; +// } +} diff --git a/src/main/java/com/opengroupe/cloud/saas/config/WebSecurityConfig.java b/src/main/java/com/opengroupe/cloud/saas/config/WebSecurityConfig.java new file mode 100644 index 0000000..7cf2cab --- /dev/null +++ b/src/main/java/com/opengroupe/cloud/saas/config/WebSecurityConfig.java @@ -0,0 +1,15 @@ +package com.opengroupe.cloud.saas.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; + +@Configuration +@EnableWebSecurity +public class WebSecurityConfig extends WebSecurityConfigurerAdapter { + @Override + protected void configure(HttpSecurity http) throws Exception { + http.authorizeRequests().anyRequest().permitAll(); + } +} diff --git a/src/main/resources/templates/fragments/footer.html b/src/main/resources/templates/fragments/footer.html new file mode 100644 index 0000000..733ad21 --- /dev/null +++ b/src/main/resources/templates/fragments/footer.html @@ -0,0 +1,13 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/fragments/header.html b/src/main/resources/templates/fragments/header.html new file mode 100644 index 0000000..8ebe728 --- /dev/null +++ b/src/main/resources/templates/fragments/header.html @@ -0,0 +1,39 @@ + + + + + + +
+
+ +
+
+ + \ No newline at end of file diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index 60b0e80..02cc8c3 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -1,17 +1,24 @@ - - - ReactJS - - - - -
- - - - - - + + +Comments channel + + + + + +
+ +
+
+
+ +
+ + + + + + \ No newline at end of file diff --git a/src/main/webapp/css/comments.css b/src/main/webapp/css/comments.css new file mode 100644 index 0000000..87650bb --- /dev/null +++ b/src/main/webapp/css/comments.css @@ -0,0 +1,7 @@ +.footer { + position: absolute; + bottom: 0; + width: 100%; + height: 60px; + background-color: #f5f5f5; +} \ No newline at end of file diff --git a/src/main/webapp/js/app.render.js b/src/main/webapp/js/app.render.jsx similarity index 100% rename from src/main/webapp/js/app.render.js rename to src/main/webapp/js/app.render.jsx diff --git a/src/main/wro/wro.properties b/src/main/wro/wro.properties index e82ffed..c7ff362 100644 --- a/src/main/wro/wro.properties +++ b/src/main/wro/wro.properties @@ -1,8 +1,8 @@ debug=true # Available processors : http://wro4j.readthedocs.org/en/stable/AvailableProcessors/ -preProcessors=lessCssImport -postProcessors=less4j,cssMin +#preProcessors=lessCssImport +#postProcessors=less4j,cssMin # explicitly invalidates the cache each 5 seconds -cacheUpdatePeriod=5 +cacheUpdatePeriod=1 # check for changes each 5 seconds and invalidates the cache only when a change is detected -resourceWatcherUpdatePeriod=5 \ No newline at end of file +resourceWatcherUpdatePeriod=1 \ No newline at end of file diff --git a/src/main/wro/wro.xml b/src/main/wro/wro.xml index 1cff1a3..8872c38 100644 --- a/src/main/wro/wro.xml +++ b/src/main/wro/wro.xml @@ -2,12 +2,15 @@ webjar:bootstrap/@bootstrap.version@/css/bootstrap.css + webjar:jquery/@jquery.version@/jquery.js webjar:react/@react.version@/react-with-addons.js webjar:react/@react.version@/react-dom.js - + + file:src/main/resources/static/css/comments.css + webjar:marked/@marked-lib.version@/marked.js \ No newline at end of file