Skip to content

Commit a082548

Browse files
committed
Now uses react-validatorjs-strategy
1 parent 9d687c3 commit a082548

File tree

6 files changed

+6
-154
lines changed

6 files changed

+6
-154
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ On the browser, `components/server.js` is `require`d, after the `node-jsx` modul
1818

1919
## Validation
2020

21-
There is also client-side and server-side validation which again is isomorphic. This uses `react-validation-mixin` for React from which the rules are defined by `validatorjs`. These are connected using a "strategy" defined in `components/strategy.js` where more information can be found. The schemas are defined in `components/schemas.js`.
21+
There is also client-side and server-side validation which again is isomorphic. This uses `react-validation-mixin` for React from which the rules are defined by `validatorjs`. These are connected using a [react-validatorjs-strategy](https://github.com/TheChech/react-validatorjs-strategy). The schemas are defined in `components/schemas.js`.
2222

2323
Extra functionality has been added to `components/templates.jsx` and `components/components.js` to handle the validation and server-side to the `/api/comments` POST end point in `server.js`.
2424

components/components.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ var React = require('react');
1515
var marked = require('marked');
1616
var validation = require('react-validation-mixin');
1717
var $ = require('jquery');
18+
var strategy = require('react-validatorjs-strategy');
1819

1920
var templates = require('./templates.jsx');
20-
var strategy = require('./strategy');
2121
var schemas = require('./schemas');
2222

2323
var Comment = React.createClass({

components/schemas.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var strategy = require('./strategy');
1+
var strategy = require('react-validatorjs-strategy');
22

33
module.exports = {
44
commentForm: strategy.createInactiveSchema(

components/strategy.js

Lines changed: 0 additions & 148 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"react": "^0.14.7",
1515
"react-dom": "^0.14.7",
1616
"react-validation-mixin": "^5.3.4",
17+
"react-validatorjs-strategy": "^0.1.4",
1718
"swig": "^1.4.2",
1819
"validatorjs": "^2.0.2"
1920
},

server.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@ var path = require('path');
1515
var express = require('express');
1616
var bodyParser = require('body-parser');
1717
var swig = require('swig');
18+
var strategy = require('react-validatorjs-strategy');
19+
var schemas = require('./components/schemas');
1820

1921
require('node-jsx').install();
2022
var components = require('./components/server');
2123

22-
var strategy = require('./components/strategy');
23-
var schemas = require('./components/schemas');
24-
2524
var app = express();
2625

2726
app.engine('html', swig.renderFile);

0 commit comments

Comments
 (0)