Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates and replaced React.createClass #3

Open
wants to merge 3 commits into
base: 1.10.2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,5 @@ react-meteor-data
jsx
react-template-helper

utilities:meteor-griddle
# utilities:meteor-griddle
# static-html
1 change: 0 additions & 1 deletion .meteor/versions
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ [email protected]
[email protected]
[email protected]
[email protected]
utilities:[email protected]
[email protected]
[email protected]
zimme:[email protected]
7 changes: 6 additions & 1 deletion client/lib/react.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// Temporary file until the new react-runtime does this for us
import React from 'react';
window.React = React;
window.React = React;

//We need this npm package to replace React.createReactClass
//import createReactClass from 'create-react-class';

//console.log("react.js file was loaded 🎉", createReactClass);
4 changes: 3 additions & 1 deletion client/react/admin/components/AdminUserPurchases.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
AdminUserPurchases = React.createClass({
import createReactClass from 'create-react-class';

AdminUserPurchases = createReactClass({
render() {
return <UserPurchases userId={this.props.rowData._id} showTableHeading={false}/>
}
Expand Down
4 changes: 3 additions & 1 deletion client/react/admin/components/CreatedAt.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
CreatedAt = React.createClass({
import createReactClass from 'create-react-class';

CreatedAt = createReactClass({
render: function(){
return (
<span>{moment(this.props.rowData.createdAt).fromNow()}</span>
Expand Down
4 changes: 3 additions & 1 deletion client/react/admin/components/Enrolled.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Enrolled = React.createClass({
import createReactClass from 'create-react-class';

Enrolled = createReactClass({
render: function(){
var user = Meteor.users._transform(this.props.rowData);
if (user.enrollMethod() === "pending") {
Expand Down
4 changes: 3 additions & 1 deletion client/react/admin/components/PurchaseId.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
PurchaseId = React.createClass({
import createReactClass from 'create-react-class';

PurchaseId = createReactClass({
render() {
return (
<a href={FlowRouter.path("adminPurchasePage", this.props.rowData)}>{this.props.rowData._id}</a>
Expand Down
4 changes: 3 additions & 1 deletion client/react/admin/components/UserId.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
UserId = React.createClass({
import createReactClass from 'create-react-class';

UserId = createReactClass({
render() {
return (
<a href={FlowRouter.path("profilePage", this.props.rowData)}>{this.props.rowData._id}</a>
Expand Down
4 changes: 3 additions & 1 deletion client/react/admin/components/Username.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Username = React.createClass({
import createReactClass from 'create-react-class';

Username = createReactClass({
render: function(){
var user = Meteor.users._transform(this.props.rowData);
return <span>{user.getUsername()}</span>
Expand Down
4 changes: 3 additions & 1 deletion client/react/admin/layouts/AdminLayout.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
AdminLayout = React.createClass({
import createReactClass from 'create-react-class';

AdminLayout = createReactClass({

mixins: [ReactMeteorData],

Expand Down
7 changes: 5 additions & 2 deletions client/react/admin/pages/AdminPurchasePage.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
AdminPurchasePage = React.createClass({
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';

AdminPurchasePage = createReactClass({

propTypes: {
purchaseId: React.PropTypes.string.isRequired
purchaseId: PropTypes.string.isRequired
},

mixins: [ReactMeteorData],
Expand Down
6 changes: 5 additions & 1 deletion client/react/admin/pages/AdminPurchasesPage.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
AdminPurchasesPage = React.createClass({
import createReactClass from 'create-react-class';

AdminPurchasesPage = createReactClass({

render() {

Expand Down Expand Up @@ -35,6 +37,7 @@ AdminPurchasesPage = React.createClass({

return (
<AdminLayout>
{/*
<MeteorGriddle
publication="adminPurchases"
collection={Purchases}
Expand All @@ -48,6 +51,7 @@ AdminPurchasesPage = React.createClass({
externalSortColumn="createdAt"
externalSortAscending={false}
/>
*/}
</AdminLayout>
)

Expand Down
6 changes: 5 additions & 1 deletion client/react/admin/pages/AdminUsersPage.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
AdminUsersPage = React.createClass({
import createReactClass from 'create-react-class';

AdminUsersPage = createReactClass({

render() {

Expand Down Expand Up @@ -38,6 +40,7 @@ AdminUsersPage = React.createClass({

return (
<AdminLayout>
{/*
<MeteorGriddle
publication="adminUsers"
collection={Meteor.users}
Expand All @@ -51,6 +54,7 @@ AdminUsersPage = React.createClass({
externalSortColumn="createdAt"
externalSortAscending={false}
/>
*/}
</AdminLayout>
)

Expand Down
4 changes: 3 additions & 1 deletion client/react/app.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
App = React.createClass({
import createReactClass from 'create-react-class';

App = createReactClass({

mixins: [ReactMeteorData],

Expand Down
7 changes: 5 additions & 2 deletions client/react/chapters/components/Chapter.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
Chapter = React.createClass({
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';

Chapter = createReactClass({

propTypes: {
chapter: React.PropTypes.object.isRequired
chapter: PropTypes.object.isRequired
},

getChapterContent() {
Expand Down
7 changes: 5 additions & 2 deletions client/react/chapters/components/ChapterNav.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
ChapterNav = React.createClass({
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';

ChapterNav = createReactClass({

propTypes: {
chapter: React.PropTypes.object.isRequired
chapter: PropTypes.object.isRequired
},

render() {
Expand Down
9 changes: 6 additions & 3 deletions client/react/chapters/components/ChaptersTOC.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
ChaptersTOC = React.createClass({
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';

ChaptersTOC = createReactClass({

propTypes: {
chapter: React.PropTypes.object.isRequired,
chapters: React.PropTypes.array.isRequired
chapter: PropTypes.object.isRequired,
chapters: PropTypes.array.isRequired
},

renderChapter(chapter, index) {
Expand Down
14 changes: 9 additions & 5 deletions client/react/chapters/components/Comments.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
var ReactDisqusThread = require('react-disqus-thread');
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';
//var ReactDisqusThread = require('react-disqus-thread');

var disqus_shortname = 'themeteorbook'; // required: replace example with your forum shortname

Comments = React.createClass({
Comments = createReactClass({

propTypes: {
chapter: React.PropTypes.object.isRequired,
chapters: React.PropTypes.array.isRequired,
vocabularyChapter: React.PropTypes.object
chapter: PropTypes.object.isRequired,
chapters: PropTypes.array.isRequired,
vocabularyChapter: PropTypes.object
},

handleToggleClick(event) {
Expand All @@ -27,12 +29,14 @@ Comments = React.createClass({
<hr/>
<p>Additionally, you can use this area for more general discussion and questions:</p>
</div>
{/*
<ReactDisqusThread
shortname={disqus_shortname}
identifier={this.props.chapter.slug}
title={this.props.chapter.title}
url={Meteor.absoluteUrl() + 'chapters/' + this.props.chapter.slug}
/>
*/}
</div>
</div>
);
Expand Down
9 changes: 6 additions & 3 deletions client/react/chapters/components/Photo.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';

var timeout;

$.easing.easeOutQuad = function (x, t, b, c, d) {
return -c *(t/=d)*(t-2) + b;
}

Photo = React.createClass({
Photo = createReactClass({

propTypes: {
chapter: React.PropTypes.object.isRequired,
chapters: React.PropTypes.array.isRequired
chapter: PropTypes.object.isRequired,
chapters: PropTypes.array.isRequired
},

prevChapter() {
Expand Down
7 changes: 5 additions & 2 deletions client/react/chapters/components/ShareProgress.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';

var getVerb = function (chapterNumber) {
// pick a verb to introduce a bit of diversity in the prompt.
// early chapters have more normal verbs, and it gets more crazy at the end.
Expand All @@ -8,10 +11,10 @@ var getVerb = function (chapterNumber) {
return verbs[vindex];
};

ShareProgress = React.createClass({
ShareProgress = createReactClass({

propTypes: {
chapter: React.PropTypes.object.isRequired
chapter: PropTypes.object.isRequired
},

verb() {
Expand Down
11 changes: 7 additions & 4 deletions client/react/chapters/components/Sidebars.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
Sidebars = React.createClass({
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';

Sidebars = createReactClass({

propTypes: {
chapter: React.PropTypes.object.isRequired,
chapters: React.PropTypes.array.isRequired,
vocabularyChapter: React.PropTypes.object
chapter: PropTypes.object.isRequired,
chapters: PropTypes.array.isRequired,
vocabularyChapter: PropTypes.object
},

render() {
Expand Down
7 changes: 5 additions & 2 deletions client/react/chapters/components/Vocabulary.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
Vocabulary = React.createClass({
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';

Vocabulary = createReactClass({

propTypes: {
vocabularyChapter: React.PropTypes.object.isRequired
vocabularyChapter: PropTypes.object.isRequired
},

getVocabulary() {
Expand Down
4 changes: 3 additions & 1 deletion client/react/chapters/containers/Upgrade.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Upgrade = React.createClass({
import createReactClass from 'create-react-class';

Upgrade = createReactClass({

mixins: [ReactMeteorData],

Expand Down
11 changes: 7 additions & 4 deletions client/react/chapters/layouts/ChapterLayout.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
ChapterLayout = React.createClass({
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';

ChapterLayout = createReactClass({

propTypes: {
chapter: React.PropTypes.object.isRequired,
chapters: React.PropTypes.array.isRequired,
vocabularyChapter: React.PropTypes.object
chapter: PropTypes.object.isRequired,
chapters: PropTypes.array.isRequired,
vocabularyChapter: PropTypes.object
},

render() {
Expand Down
7 changes: 5 additions & 2 deletions client/react/chapters/pages/ChapterPage.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
ChapterPage = React.createClass({
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';

ChapterPage = createReactClass({

propTypes: {
slug: React.PropTypes.string.isRequired
slug: PropTypes.string.isRequired
},

mixins: [ReactMeteorData],
Expand Down
4 changes: 3 additions & 1 deletion client/react/common/components/FormFooter.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FormFooter = React.createClass({
import createReactClass from 'create-react-class';

FormFooter = createReactClass({

render() {
return (
Expand Down
7 changes: 5 additions & 2 deletions client/react/common/components/PhotoBackground.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
PhotoBackground = React.createClass({
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';

PhotoBackground = createReactClass({

propTypes: {
chapter: React.PropTypes.object.isRequired
chapter: PropTypes.object.isRequired
},

componentDidMount() {
Expand Down
15 changes: 9 additions & 6 deletions client/react/common/components/Purchase.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
Purchase = React.createClass({
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';

Purchase = createReactClass({

propTypes: {
product: React.PropTypes.object.isRequired,
level: React.PropTypes.object.isRequired,
user: React.PropTypes.object, // if a user is provided, then we know this is an upgrade
key: React.PropTypes.number,
code: React.PropTypes.string,
product: PropTypes.object.isRequired,
level: PropTypes.object.isRequired,
user: PropTypes.object, // if a user is provided, then we know this is an upgrade
key: PropTypes.number,
code: PropTypes.string,
},

renderPrice(levelKey, index) {
Expand Down
4 changes: 3 additions & 1 deletion client/react/common/layouts/FormLayout.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FormLayout = React.createClass({
import createReactClass from 'create-react-class';

FormLayout = createReactClass({

mixins: [ReactMeteorData],

Expand Down
4 changes: 3 additions & 1 deletion client/react/common/layouts/Layout.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Layout = React.createClass({
import createReactClass from 'create-react-class';

Layout = createReactClass({

render() {
return (
Expand Down
Loading