Merge pull request #106 from mewtaylor/feature/project-count-from-api

Get project count from api when logged out
This commit is contained in:
Matthew Taylor 2015-10-21 14:17:03 -04:00
commit 20a3efcbf4
2 changed files with 11 additions and 0 deletions

View file

@ -3,6 +3,7 @@ var React = require('react');
var ReactIntl = require('react-intl');
var FormattedMessage = ReactIntl.FormattedMessage;
var FormattedHTMLMessage = ReactIntl.FormattedHTMLMessage;
var Modal = require('../modal/modal.jsx');
require('./intro.scss');

View file

@ -52,6 +52,7 @@ var Splash = injectIntl(React.createClass({
this.getNews();
} else {
this.setState({featuredCustom: []});
this.getProjectCount();
}
}
},
@ -61,6 +62,8 @@ var Splash = injectIntl(React.createClass({
this.getActivity();
this.getCustomHomepageRows();
this.getNews();
} else {
this.getProjectCount();
}
},
getNews: function () {
@ -77,6 +80,13 @@ var Splash = injectIntl(React.createClass({
if (!err) this.setState({'activity': body});
}.bind(this));
},
getProjectCount: function () {
this.api({
uri: '/projects/count/all'
}, function (err, body) {
if (!err) this.setState({projectCount: body.count});
}.bind(this));
},
renderHomepageRows: function () {
var formatMessage = this.props.intl.formatMessage;
var rows = [