From 4e5bb4f361ca0aabfddcbccff484a64b431078ce Mon Sep 17 00:00:00 2001 From: fecaille Date: Thu, 10 Mar 2016 13:38:02 +0100 Subject: [PATCH] Generated JS and CSS to the target/classes/static folder --- pom.xml | 28 +----- src/main/resources/templates/index.html | 12 +-- src/main/webapp/css/comments.css | 7 -- src/main/webapp/js/app.jsx | 123 ------------------------ src/main/webapp/js/app.render.jsx | 4 - 5 files changed, 10 insertions(+), 164 deletions(-) delete mode 100644 src/main/webapp/css/comments.css delete mode 100644 src/main/webapp/js/app.jsx delete mode 100644 src/main/webapp/js/app.render.jsx diff --git a/pom.xml b/pom.xml index 838df83..3b45de9 100644 --- a/pom.xml +++ b/pom.xml @@ -171,26 +171,6 @@ - - org.apache.maven.plugins - maven-antrun-plugin - - - clean - - run - - - - - - - - - - - - maven-resources-plugin @@ -231,7 +211,7 @@ ${project.basedir}/src/main/resources/static/js - ${project.basedir}/src/main/resources/static/js/jsx + ${project.build.directory}/classes/static/js @@ -267,8 +247,8 @@ ro.isdc.wro.maven.plugin.manager.factory.ConfigurableWroManagerFactory - ${project.basedir}/src/main/resources/static/css/bundle - ${project.basedir}/src/main/resources/static/js/bundle + ${project.build.directory}/classes/static/css + ${project.build.directory}/classes/static/js ${project.build.directory}/wro/wro.xml ${project.basedir}/src/main/wro/wro.properties @@ -316,7 +296,7 @@ /webjars/jquery.mockjax.js ${project.basedir}/src/test/resources/jasmine/config.js - ${project.basedir}/src/main/resources/static/js + ${project.build.directory}/classes/static/js **/*.js diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index 02cc8c3..f6ed107 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -3,8 +3,8 @@ Comments channel - - + + @@ -16,9 +16,9 @@
- - - - + + + + \ No newline at end of file diff --git a/src/main/webapp/css/comments.css b/src/main/webapp/css/comments.css deleted file mode 100644 index 87650bb..0000000 --- a/src/main/webapp/css/comments.css +++ /dev/null @@ -1,7 +0,0 @@ -.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.jsx b/src/main/webapp/js/app.jsx deleted file mode 100644 index f4dc3da..0000000 --- a/src/main/webapp/js/app.jsx +++ /dev/null @@ -1,123 +0,0 @@ -'use strict'; - -var Comment = React.createClass({ - rawMarkup: function() { - var rawMarkup = marked(this.props.children.toString(), {sanitize: true}); - return { __html: rawMarkup }; - }, - render: function() { - return ( -
-

- {this.props.author} -

- -
- ); - } -}); - -var CommentForm = React.createClass({ - getInitialState: function() { - return {author: '', text: ''}; - }, - handleAuthorChange: function(e) { - this.setState({author: e.target.value}); - }, - handleTextChange: function(e) { - this.setState({text: e.target.value}); - }, - handleSubmit: function(e) { - e.preventDefault(); - var author = this.state.author.trim(); - var text = this.state.text.trim(); - if( !text || !author ) { - return; - } - this.props.onCommentSubmit({author: author, text: text}) - this.setState({author: '', text: ''}); - }, - render: function() { - return ( -
- - - -
- ); - } -}); -var CommentBox = React.createClass({ - getInitialState: function() { - return {data: []}; - }, - loadCommentsFromServer: function() { - $.ajax({ - url: this.props.url, - dataType: 'json', - cache: false, - success: function(data) { - this.setState({data: data}); - }.bind(this), - error: function(xhr, status, err) { - console.error(this.props.url, status, err.toString()); - }.bind(this) - }); - }, - handleCommentSubmit: function(comment) { - var comments = this.state.data; - comment.id = Date.now(); - var newComments = comments.concat([comment]); - this.setState({data: newComments}); - $.ajax({ - url: this.props.url, - method: 'POST', - dataType: 'json', - data: comment, - success: function(data) { - this.setState({data: data}); - }.bind(this), - error: function(xhr, status, err) { - this.setState({data: comments}); - console.error(this.props.url, status, err.toString()); - }.bind(this) - }); - }, - componentDidMount: function() { - this.loadCommentsFromServer(); - setInterval(this.loadCommentsFromServer, this.props.pollInterval); - }, - render: function() { - return ( -
-

Comments

- - -
- ); - } -}); -var CommentList = React.createClass({ - render: function() { - var commentNodes = this.props.data.map( function(comment) { - return ( - {comment.text} - ); - }); - return ( -
- {commentNodes} -
- ) - } -}); \ No newline at end of file diff --git a/src/main/webapp/js/app.render.jsx b/src/main/webapp/js/app.render.jsx deleted file mode 100644 index 9709ace..0000000 --- a/src/main/webapp/js/app.render.jsx +++ /dev/null @@ -1,4 +0,0 @@ -ReactDOM.render( - , - document.getElementById('content') -); \ No newline at end of file