diff --git a/package.json b/package.json index 53f072c..75cf92b 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,8 @@ "css-loader": "^0.23.1", "extract-text-webpack-plugin": "^1.0.1", "file-loader": "^0.8.5", + "html-loader": "^0.4.3", + "html-webpack-plugin": "^2.15.0", "postcss-loader": "^0.8.2", "style-loader": "^0.13.1", "url-loader": "^0.5.7", diff --git a/src/main/java/com/opengroupe/cloud/saas/Application.java b/src/main/java/com/opengroupe/cloud/saas/Application.java index 4e2ac8f..3d60668 100644 --- a/src/main/java/com/opengroupe/cloud/saas/Application.java +++ b/src/main/java/com/opengroupe/cloud/saas/Application.java @@ -2,7 +2,8 @@ package com.opengroupe.cloud.saas; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso; +import org.springframework.context.annotation.Bean; +import org.thymeleaf.templateresolver.ServletContextTemplateResolver; //@EnableOAuth2Sso @SpringBootApplication @@ -11,4 +12,14 @@ public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } + + @Bean + public ServletContextTemplateResolver templateResolver() { + ServletContextTemplateResolver resolver = new ServletContextTemplateResolver(); + resolver.setPrefix("/templates/"); + resolver.setSuffix(".html"); + resolver.setTemplateMode("LEGACYHTML5"); + resolver.setCacheable(false); + return resolver; + } } diff --git a/src/main/resources/static/js/app.render.jsx b/src/main/resources/static/js/app.render.jsx index 8da2f07..0e1003b 100644 --- a/src/main/resources/static/js/app.render.jsx +++ b/src/main/resources/static/js/app.render.jsx @@ -5,6 +5,7 @@ import React from 'react'; import ReactDOM from 'react-dom'; import ReactDOMServer from 'react-dom/server'; import App from './app.jsx'; +import $ from 'jquery'; require('bootstrap/dist/css/bootstrap.css'); @@ -25,3 +26,6 @@ global.renderServer = function (comments) { ); }; +if( !global.nashorn ) { + renderClient(initialData); +}; \ No newline at end of file diff --git a/src/main/resources/static/js/nashorn-polyfill.js b/src/main/resources/static/js/nashorn-polyfill.js index 0ccc16a..2ae426d 100644 --- a/src/main/resources/static/js/nashorn-polyfill.js +++ b/src/main/resources/static/js/nashorn-polyfill.js @@ -1,5 +1,7 @@ var global = window = this; +global.nashorn = true; + var console = { debug: print, warn: print, diff --git a/src/main/resources/templates/index-template.html b/src/main/resources/templates/index-template.html new file mode 100644 index 0000000..2d5b495 --- /dev/null +++ b/src/main/resources/templates/index-template.html @@ -0,0 +1,20 @@ + + +
+ +