├── .npmignore ├── .babelrc ├── .gitignore ├── test ├── .eslintrc ├── setup-jsdom.js ├── test-utils.js ├── components │ ├── EditableField_test.js │ ├── UserForm_test.js │ └── AdminView_test.js ├── actions │ └── notifications_test.js └── reducers │ └── form_test.js ├── formbuilder ├── assets │ └── background.jpg ├── components │ ├── Check.js │ ├── RecordCreated.js │ ├── builder │ │ ├── JsonView.js │ │ ├── TitleField.js │ │ ├── DescriptionField.js │ │ ├── JsonSchemaDownloader.js │ │ ├── Form.js │ │ ├── FormActions.js │ │ ├── FieldListDropdown.js │ │ └── EditableField.js │ ├── CSVDownloader.js │ ├── URLDisplay.js │ ├── Header.js │ ├── NotificationList.js │ ├── FAQ.js │ ├── UserForm.js │ ├── XLSDownloader.js │ ├── Welcome.js │ ├── AdminView.js │ └── FormCreated.js ├── bootswatch.less ├── actions │ ├── dragndrop.js │ ├── notifications.js │ ├── fieldlist.js │ └── server.js ├── reducers │ ├── records.js │ ├── dragndrop.js │ ├── index.js │ ├── notifications.js │ ├── serverStatus.js │ └── form.js ├── index.html ├── store │ └── configureStore.js ├── containers │ ├── RecordCreatedContainer.js │ ├── builder │ │ ├── JsonViewContainer.js │ │ ├── JsonSchemaDownloaderContainer.js │ │ ├── FormEditContainer.js │ │ ├── FormActionsContainer.js │ │ ├── FormEdit.js │ │ └── FormContainer.js │ ├── FormCreatedContainer.js │ ├── WelcomeContainer.js │ ├── NotificationContainer.js │ ├── AdminViewContainer.js │ ├── UserFormContainer.js │ └── App.js ├── app.js ├── index.prod.html ├── utils.js ├── styles.css ├── routes.js └── config.js ├── .travis.yml ├── .eslintrc ├── scalingo.json ├── devServer.js ├── webpack.config.github.js ├── webpack.config.prod.js ├── webpack.config.dev.js ├── package.json └── README.md /.npmignore: -------------------------------------------------------------------------------- 1 | src/ 2 | -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "stage": 0 3 | } 4 | 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | npm-debug.log 2 | node_modules 3 | build 4 | lib 5 | -------------------------------------------------------------------------------- /test/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "mocha": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /formbuilder/assets/background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kinto/formbuilder/HEAD/formbuilder/assets/background.jpg -------------------------------------------------------------------------------- /formbuilder/components/Check.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | export default function Check(props) { 4 | return (
); 5 | } 6 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: 3 | - node_js 4 | node_js: 5 | - "4" 6 | env: 7 | - ACTION=test 8 | - ACTION="run lint" 9 | script: 10 | - npm $ACTION 11 | -------------------------------------------------------------------------------- /formbuilder/bootswatch.less: -------------------------------------------------------------------------------- 1 | @import "~bootstrap/less/bootstrap.less"; 2 | @import "~bootswatch/paper/variables.less"; 3 | @import "~bootswatch/paper/bootswatch.less"; 4 | -------------------------------------------------------------------------------- /formbuilder/actions/dragndrop.js: -------------------------------------------------------------------------------- 1 | export const SET_DRAG_STATUS = "SET_DRAG_STATUS"; 2 | 3 | 4 | export function setDragStatus(status) { 5 | return {type: SET_DRAG_STATUS, status}; 6 | } 7 | -------------------------------------------------------------------------------- /test/setup-jsdom.js: -------------------------------------------------------------------------------- 1 | var jsdom = require("jsdom"); 2 | 3 | // Setup the jsdom environment 4 | // @see https://github.com/facebook/react/issues/5046 5 | if (!global.hasOwnProperty("window")) { 6 | global.document = jsdom.jsdom(""); 7 | global.window = document.defaultView; 8 | global.navigator = global.window.navigator; 9 | } 10 | -------------------------------------------------------------------------------- /formbuilder/reducers/records.js: -------------------------------------------------------------------------------- 1 | import { 2 | RECORDS_RETRIEVAL_DONE, 3 | } from "../actions/server"; 4 | 5 | const INITIAL_STATE = []; 6 | 7 | export default function collections(state = INITIAL_STATE, action) { 8 | switch(action.type) { 9 | 10 | case RECORDS_RETRIEVAL_DONE: 11 | return action.records; 12 | 13 | default: 14 | return state; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /formbuilder/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Formbuilder 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /formbuilder/store/configureStore.js: -------------------------------------------------------------------------------- 1 | import { createStore, applyMiddleware, compose } from "redux"; 2 | import thunk from "redux-thunk"; 3 | import rootReducer from "../reducers"; 4 | 5 | const finalCreateStore = compose( 6 | applyMiddleware(thunk) 7 | )(createStore); 8 | 9 | export default function configureStore(initialState) { 10 | return finalCreateStore(rootReducer, initialState); 11 | } 12 | -------------------------------------------------------------------------------- /formbuilder/containers/RecordCreatedContainer.js: -------------------------------------------------------------------------------- 1 | import { connect } from "react-redux"; 2 | 3 | import RecordCreated from "../components/RecordCreated"; 4 | 5 | 6 | function mapStateToProps(state) { 7 | return { 8 | schema: state.form.schema, 9 | uiSchema: state.form.uiSchema, 10 | formData: state.form.formData, 11 | }; 12 | } 13 | 14 | export default connect( 15 | mapStateToProps, 16 | )(RecordCreated); 17 | -------------------------------------------------------------------------------- /formbuilder/reducers/dragndrop.js: -------------------------------------------------------------------------------- 1 | import { 2 | SET_DRAG_STATUS, 3 | } from "../actions/dragndrop"; 4 | 5 | const INITIAL_STATE = { 6 | dragndropStatus: false 7 | }; 8 | 9 | export default function form(state = INITIAL_STATE, action) { 10 | switch(action.type) { 11 | case SET_DRAG_STATUS: 12 | return { 13 | dragndropStatus: action.status 14 | }; 15 | default: 16 | return state; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /formbuilder/containers/builder/JsonViewContainer.js: -------------------------------------------------------------------------------- 1 | import { connect } from "react-redux"; 2 | 3 | import FormOptions from "../../components/builder/JsonView"; 4 | 5 | 6 | function mapStateToProps(state) { 7 | return { 8 | schema: state.form.schema, 9 | uiSchema: state.form.uiSchema, 10 | formData: state.form.formData, 11 | }; 12 | } 13 | 14 | export default connect( 15 | mapStateToProps, 16 | )(FormOptions); 17 | -------------------------------------------------------------------------------- /formbuilder/components/RecordCreated.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import config from "../config"; 3 | 4 | export default function RecordCreated(props) { 5 | 6 | // Issue #130 - Change title back to project name after submitting the form 7 | document.title = config.projectName; 8 | 9 | return ( 10 |
11 |

Submitted!

12 | Thanks, your data has been submitted! 13 |
14 | ); 15 | } 16 | -------------------------------------------------------------------------------- /formbuilder/containers/builder/JsonSchemaDownloaderContainer.js: -------------------------------------------------------------------------------- 1 | import { connect } from "react-redux"; 2 | 3 | import JsonSchemaDownloader from "../../components/builder/JsonSchemaDownloader"; 4 | 5 | 6 | function mapStateToProps(state) { 7 | return { 8 | schema: state.form.schema, 9 | uiSchema: state.form.uiSchema 10 | }; 11 | } 12 | 13 | export default connect( 14 | mapStateToProps, 15 | )(JsonSchemaDownloader); 16 | -------------------------------------------------------------------------------- /formbuilder/containers/FormCreatedContainer.js: -------------------------------------------------------------------------------- 1 | import { connect } from "react-redux"; 2 | 3 | import FormCreated from "../components/FormCreated"; 4 | 5 | 6 | function mapStateToProps(state) { 7 | return { 8 | schema: state.form.schema, 9 | uiSchema: state.form.uiSchema, 10 | formData: state.form.formData, 11 | publicationStatus: state.publicationStatus 12 | }; 13 | } 14 | 15 | export default connect( 16 | mapStateToProps, 17 | )(FormCreated); 18 | -------------------------------------------------------------------------------- /formbuilder/reducers/index.js: -------------------------------------------------------------------------------- 1 | import { combineReducers } from "redux"; 2 | 3 | import form from "./form"; 4 | import notifications from "./notifications"; 5 | import serverStatus from "./serverStatus"; 6 | import records from "./records"; 7 | import dragndrop from "./dragndrop"; 8 | 9 | 10 | const rootReducer = combineReducers({ 11 | notifications, 12 | form, 13 | serverStatus, 14 | records, 15 | dragndrop 16 | }); 17 | 18 | export default rootReducer; 19 | -------------------------------------------------------------------------------- /formbuilder/reducers/notifications.js: -------------------------------------------------------------------------------- 1 | import { 2 | NOTIFICATION_ADD, 3 | NOTIFICATION_REMOVE, 4 | } from "../actions/notifications"; 5 | 6 | const INITIAL_STATE = []; 7 | 8 | export default function collections(state = INITIAL_STATE, action) { 9 | switch(action.type) { 10 | 11 | case NOTIFICATION_ADD: 12 | return [...state, action.notification]; 13 | 14 | case NOTIFICATION_REMOVE: 15 | return state.filter(({id}) => action.id !== id); 16 | 17 | default: 18 | return state; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /formbuilder/containers/WelcomeContainer.js: -------------------------------------------------------------------------------- 1 | import { bindActionCreators } from "redux"; 2 | import { connect } from "react-redux"; 3 | import Welcome from "../components/Welcome"; 4 | import * as FieldListActions from "../actions/fieldlist"; 5 | 6 | function mapStateToProps(state) { 7 | return {}; 8 | } 9 | 10 | function mapDispatchToProps(dispatch) { 11 | return bindActionCreators(FieldListActions, dispatch); 12 | } 13 | 14 | export default connect( 15 | mapStateToProps, 16 | mapDispatchToProps 17 | )(Welcome); 18 | -------------------------------------------------------------------------------- /formbuilder/containers/builder/FormEditContainer.js: -------------------------------------------------------------------------------- 1 | import { connect } from "react-redux"; 2 | 3 | import FormEdit from "./FormEdit"; 4 | import { bindActionCreators } from "redux"; 5 | import * as ServerActions from "../../actions/server"; 6 | 7 | 8 | function mapDispatchToProps(dispatch) { 9 | return bindActionCreators(ServerActions, dispatch); 10 | } 11 | 12 | function mapStateToProps(state) { 13 | return {}; 14 | } 15 | 16 | export default connect( 17 | mapStateToProps, 18 | mapDispatchToProps 19 | )(FormEdit); 20 | -------------------------------------------------------------------------------- /formbuilder/components/builder/JsonView.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | 4 | export default function JSONView(props) { 5 | return ( 6 |
7 |

JSONSchema

8 |
9 |