Skip to content

Commit fdee71a

Browse files
committed
Initial commit
0 parents  commit fdee71a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+7453
-0
lines changed

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*.iml
2+
.idea
3+
.DS_Store
4+
node_modules
5+
settings.production.json

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
For details, please see http://ics-software-engineering.github.io/meteor-example-form-react/

_config.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
title: meteor-example-form-react
2+
description: How to implement forms in Meteor using Uniforms
3+
google_analytics:
4+
show_downloads: true
5+
theme: jekyll-theme-cayman
6+
7+
gems:
8+
- jekyll-mentions

app/.eslintrc

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"parser": "babel-eslint",
3+
"parserOptions": {
4+
"ecmaVersion": 2017,
5+
"sourceType": "module",
6+
"ecmaFeatures": {
7+
"jsx": true
8+
}
9+
},
10+
"plugins": [
11+
"meteor",
12+
"react"
13+
],
14+
"settings": {
15+
"react": {
16+
"createClass": "createReactClass",
17+
"pragma": "React", // Pragma to use, default to "React"
18+
"version": "15.0", // React version, default to the latest React stable release
19+
"flowVersion": "0.53" // Flow version
20+
},
21+
"propWrapperFunctions": [ "forbidExtraProps" ]
22+
},
23+
"extends": [
24+
"airbnb/base",
25+
"plugin:meteor/recommended",
26+
"plugin:react/recommended"
27+
],
28+
"rules": {
29+
"arrow-parens": "off",
30+
"camelcase": "off",
31+
"class-methods-use-this": "off",
32+
"func-names": "off",
33+
"import/no-absolute-path": "off",
34+
"import/no-unresolved": "off",
35+
"import/extensions": "off",
36+
"import/imports-first": "off",
37+
"import/prefer-default-export": "off",
38+
"import/no-extraneous-dependencies": "off",
39+
"linebreak-style": "off",
40+
"max-len": ["error", 120],
41+
"meteor/eventmap-params": [2, { "eventParamName": "event", "templateInstanceParamName": "instance" } ],
42+
"meteor/template-names": "off",
43+
"no-confusing-arrow": ["error", {"allowParens": true}],
44+
"no-plusplus": "off",
45+
"no-underscore-dangle": "off",
46+
"object-curly-newline": "off",
47+
"object-property-newline": "off",
48+
"object-shorthand": "off",
49+
"operator-linebreak": "off",
50+
"padded-blocks": "off",
51+
"indent": ["error", 2],
52+
"prefer-arrow-callback": "off",
53+
"prefer-destructuring": "off",
54+
"prefer-promise-reject-errors": "off"
55+
},
56+
"globals": {
57+
"Assets": true // Meteor disallows importing of Assets, see https://docs.meteor.com/api/assets.html
58+
}
59+
}

app/.gitattributes

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*.eot binary
2+
*.ttf binary
3+
*.woff binary
4+
*.woff2 binary

app/.meteor/.finished-upgraders

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# This file contains information which helps Meteor properly upgrade your
2+
# app when you run 'meteor update'. You should check it into version control
3+
# with your project.
4+
5+
notices-for-0.9.0
6+
notices-for-0.9.1
7+
0.9.4-platform-file
8+
notices-for-facebook-graph-api-2
9+
1.2.0-standard-minifiers-package
10+
1.2.0-meteor-platform-split
11+
1.2.0-cordova-changes
12+
1.2.0-breaking-changes
13+
1.3.0-split-minifiers-package
14+
1.4.0-remove-old-dev-bundle-link
15+
1.4.1-add-shell-server-package
16+
1.4.3-split-account-service-packages
17+
1.5-add-dynamic-import-package
18+
1.7-split-underscore-from-meteor-base
19+
1.8.3-split-jquery-from-blaze

app/.meteor/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
local

app/.meteor/.id

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This file contains a token that is unique to your project.
2+
# Check it into your repository along with the rest of this directory.
3+
# It can be used for purposes such as:
4+
# - ensuring you don't accidentally deploy one app on top of another
5+
# - providing package authors with aggregated statistics
6+
7+
1b0i1u976u6dkek239x

app/.meteor/packages

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Meteor packages used by this project, one per line.
2+
# Check this file (and the other files in this directory) into your repository.
3+
#
4+
# 'meteor add' and 'meteor remove' will edit this file for you,
5+
# but you can also edit it by hand.
6+
7+
# Core packages for Meteor/React/Semantic UI
8+
meteor-base@1.5.1 # Packages every Meteor app needs to have
9+
mobile-experience@1.1.0 # Packages for a great mobile UX
10+
mongo@1.14.6 # The database Meteor supports right now
11+
reactive-var@1.0.11 # Reactive variable for tracker
12+
13+
standard-minifier-css@1.8.1 # CSS minifier run for production mode
14+
standard-minifier-js@2.8.0
15+
es5-shim@4.8.0 # ECMAScript 5 compatibility for older browsers
16+
ecmascript@0.16.2 # Enable ECMAScript2015+ syntax in app code
17+
# typescript@3.7.6 # Enable TypeScript syntax in .ts and .tsx modules
18+
shell-server@0.5.0 # Server-side component of the `meteor shell` command
19+
20+
# autopublish@1.0.7 # Publish all data to the clients (for prototyping)
21+
insecure@1.0.7 # Allow all DB writes from clients (for prototyping)
22+
static-html@1.3.2 # Define static page content in .html files
23+
react-meteor-data # React higher-order component for reactively tracking Meteor data
24+
25+
# reactive-dict@1.3.0 # Object form of reactive variable.
26+
# tracker@1.2.0 # Meteor's client-side reactive programming library
27+
28+
# Accounts
29+
accounts-password@2.3.1
30+
alanning:roles # support roles like 'admin'
31+
32+
# Collection support
33+
aldeed:collection2
34+
aldeed:schema-index # Support index: true and unique: true in schema definitions.
35+
36+
# Utilities
37+
underscore@1.0.10 # http://underscorejs.org/
38+
ejson@1.1.2 # https://docs.meteor.com/api/ejson.html
39+
40+
# Application Performance Monitoring
41+
montiapm:agent # see http://montiapm.com
42+
zodern:hide-production-sourcemaps

app/.meteor/platforms

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
server
2+
browser

app/.meteor/release

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
METEOR@2.7.1

app/.meteor/versions

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
accounts-base@2.2.2
2+
accounts-password@2.3.1
3+
alanning:roles@3.4.0
4+
aldeed:collection2@3.5.0
5+
aldeed:schema-index@3.0.0
6+
allow-deny@1.1.1
7+
autoupdate@1.8.0
8+
babel-compiler@7.9.0
9+
babel-runtime@1.5.0
10+
base64@1.0.12
11+
binary-heap@1.0.11
12+
blaze-tools@1.1.2
13+
boilerplate-generator@1.7.1
14+
caching-compiler@1.2.2
15+
caching-html-compiler@1.2.1
16+
callback-hook@1.4.0
17+
check@1.3.1
18+
ddp@1.4.0
19+
ddp-client@2.5.0
20+
ddp-common@1.4.0
21+
ddp-rate-limiter@1.1.0
22+
ddp-server@2.5.0
23+
diff-sequence@1.1.1
24+
dynamic-import@0.7.2
25+
ecmascript@0.16.2
26+
ecmascript-runtime@0.8.0
27+
ecmascript-runtime-client@0.12.1
28+
ecmascript-runtime-server@0.11.0
29+
ejson@1.1.2
30+
email@2.2.1
31+
es5-shim@4.8.0
32+
fetch@0.1.1
33+
geojson-utils@1.0.10
34+
hot-code-push@1.0.4
35+
html-tools@1.1.2
36+
htmljs@1.1.1
37+
id-map@1.1.1
38+
insecure@1.0.7
39+
inter-process-messaging@0.1.1
40+
launch-screen@1.3.0
41+
localstorage@1.2.0
42+
logging@1.3.1
43+
meteor@1.10.0
44+
meteor-base@1.5.1
45+
minifier-css@1.6.0
46+
minifier-js@2.7.4
47+
minimongo@1.8.0
48+
mobile-experience@1.1.0
49+
mobile-status-bar@1.1.0
50+
modern-browsers@0.1.7
51+
modules@0.18.0
52+
modules-runtime@0.13.0
53+
mongo@1.14.6
54+
mongo-decimal@0.1.2
55+
mongo-dev-server@1.1.0
56+
mongo-id@1.0.8
57+
montiapm:agent@2.45.0
58+
montiapm:meteorx@2.2.0
59+
npm-mongo@4.3.1
60+
ordered-dict@1.1.0
61+
promise@0.12.0
62+
raix:eventemitter@1.0.0
63+
random@1.2.0
64+
rate-limit@1.0.9
65+
react-fast-refresh@0.2.3
66+
react-meteor-data@2.4.0
67+
reactive-var@1.0.11
68+
reload@1.3.1
69+
retry@1.1.0
70+
routepolicy@1.1.1
71+
service-configuration@1.3.0
72+
sha@1.0.9
73+
shell-server@0.5.0
74+
socket-stream-client@0.4.0
75+
spacebars-compiler@1.3.0
76+
standard-minifier-css@1.8.1
77+
standard-minifier-js@2.8.0
78+
static-html@1.3.2
79+
templating-tools@1.2.1
80+
tmeasday:check-npm-versions@1.0.2
81+
tracker@1.2.0
82+
typescript@4.5.4
83+
underscore@1.0.10
84+
url@1.3.2
85+
webapp@1.13.1
86+
webapp-hashing@1.1.0
87+
zodern:hide-production-sourcemaps@1.2.0
88+
zodern:meteor-package-versions@0.2.1

app/client/main.html

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<head>
2+
<meta charset="utf-8">
3+
<link rel="shortcut icon" href="/favicon.ico">
4+
<meta name="viewport" content="width=device-width, initial-scale=1">
5+
<title>meteor-example-form-react</title>
6+
</head>
7+
8+
<body>
9+
<div id="root"></div>
10+
</body>

app/client/main.js

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import '../imports/startup/client/Startup';
2+
import './style.css';

app/client/style.css

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { Mongo } from 'meteor/mongo';
2+
import SimpleSchema from 'simpl-schema';
3+
import { Tracker } from 'meteor/tracker';
4+
5+
/** Define a Mongo collection to hold the data. */
6+
const EnrollmentData = new Mongo.Collection('EnrollmentData');
7+
8+
/** Define a schema to specify the structure of each document in the collection. */
9+
const EnrollmentDataSchema = new SimpleSchema({
10+
email: String,
11+
enrolled: Date,
12+
}, { tracker: Tracker });
13+
14+
/** Attach the schema to the collection. */
15+
EnrollmentData.attachSchema(EnrollmentDataSchema);
16+
17+
/** Make these objects available to others. */
18+
export { EnrollmentData, EnrollmentDataSchema };
+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { Mongo } from 'meteor/mongo';
2+
import SimpleSchema from 'simpl-schema';
3+
import { Tracker } from 'meteor/tracker';
4+
5+
/** Define a Mongo collection to hold the data. */
6+
const StudentData = new Mongo.Collection('StudentData');
7+
8+
const StudentDataValues = {
9+
hobbies: ['Surfing', 'Running', 'Biking', 'Paddling'],
10+
levels: ['Freshman', 'Sophomore', 'Junior', 'Senior'],
11+
majors: ['Physics', 'Math', 'Chemistry', 'Computer Science'],
12+
};
13+
14+
/** Define a schema to specify the structure of each document in the collection. */
15+
const StudentDataSchema = new SimpleSchema({
16+
name: String,
17+
email: String,
18+
bio: { type: String, optional: true, defaultValue: '' },
19+
hobbies: { type: Array, optional: true },
20+
'hobbies.$': { type: String, allowedValues: StudentDataValues.hobbies },
21+
level: { type: String, allowedValues: StudentDataValues.levels },
22+
gpa: Number,
23+
major: String,
24+
}, { tracker: Tracker });
25+
26+
/** Attach the schema to the collection. */
27+
StudentData.attachSchema(StudentDataSchema);
28+
29+
/** Make these objects available to others. */
30+
export { StudentDataValues, StudentData, StudentDataSchema };
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from 'react';
2+
import { render } from 'react-dom';
3+
import { Meteor } from 'meteor/meteor';
4+
import App from '../../ui/layouts/App.jsx';
5+
6+
/** Startup the application by rendering the App layout component. */
7+
Meteor.startup(() => {
8+
render(<App />, document.getElementById('root')); // eslint-disable-line
9+
});
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { Meteor } from 'meteor/meteor';
2+
import { StudentData } from '../../api/studentdata/StudentData.js';
3+
import { EnrollmentData } from '../../api/enrollmentdata/EnrollmentData.js';
4+
5+
Meteor.publish('StudentData', function publishStudentData() {
6+
return StudentData.find();
7+
});
8+
9+
Meteor.publish('EnrollmentData', function publishEnrollmentData() {
10+
return EnrollmentData.find();
11+
});

app/imports/ui/components/Footer.jsx

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import React from 'react';
2+
3+
/** The Footer appears at the bottom of every page. Rendered by the App Layout component. */
4+
class Footer extends React.Component {
5+
render() {
6+
const divStyle = { paddingTop: '15px' };
7+
return (
8+
<footer>
9+
<div style={divStyle} className="ui center aligned container">
10+
<hr />
11+
Department of Information and Computer Sciences <br />
12+
University of Hawaii<br />
13+
Honolulu, HI 96822 <br />
14+
<a href="http://ics-software-engineering.github.io/meteor-example-form-react">Template Home Page</a>
15+
</div>
16+
</footer>
17+
);
18+
}
19+
}
20+
21+
export default Footer;

app/imports/ui/components/NavBar.jsx

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import React from 'react';
2+
import { withRouter, NavLink } from 'react-router-dom';
3+
import { Menu, Header } from 'semantic-ui-react';
4+
5+
/** The NavBar appears at the top of every page. Rendered by the App Layout component. */
6+
class NavBar extends React.Component {
7+
render() {
8+
const menuStyle = { marginBottom: '10px' };
9+
return (
10+
<Menu style={menuStyle} attached="top" borderless inverted>
11+
<Menu.Item as={NavLink} activeClassName="" exact to="/">
12+
<Header inverted as='h1'>meteor-example-form-react</Header>
13+
</Menu.Item>
14+
</Menu>
15+
);
16+
}
17+
}
18+
19+
/** Enable ReactRouter for this component. https://reacttraining.com/react-router/web/api/withRouter */
20+
export default withRouter(NavBar);
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import SimpleSchema from 'simpl-schema';
2+
import { StudentDataValues as DataValues } from '../../api/studentdata/StudentData';
3+
4+
const gpaValues = ['0.0-0.9', '1.0-1.9', '2.0-2.9', '3.0-3.9', '4.0+'];
5+
6+
const gpa2String = (num) => gpaValues[num];
7+
const gpa2Number = (string) => gpaValues.indexOf(string);
8+
9+
const StudentFormSchema = new SimpleSchema({
10+
name: { label: 'Name', type: String },
11+
email: { label: 'Email', type: String },
12+
bio: { label: 'Biographical Statement', type: String, optional: true, defaultValue: '' },
13+
hobbies: { label: 'Hobbies', type: Array, optional: true },
14+
'hobbies.$': { type: String, allowedValues: DataValues.hobbies },
15+
level: { label: 'Level', type: String, allowedValues: DataValues.levels, defaultValue: DataValues.levels[0] },
16+
gpa: { label: 'GPA', type: String, allowedValues: gpaValues },
17+
major: { label: 'Major', type: String, allowedValues: DataValues.majors },
18+
enrolled: { label: 'Date Enrolled', type: Date, defaultValue: new Date() },
19+
});
20+
21+
export { StudentFormSchema, gpa2String, gpa2Number };

0 commit comments

Comments
 (0)