Skip to content

Commit

Permalink
Small tweaks: i18n’ize error message, pass terms to posts list
Browse files Browse the repository at this point in the history
  • Loading branch information
SachaG committed Feb 6, 2017
1 parent b11188e commit 8bc6aac
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions packages/nova-base-components/lib/common/Vote.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Components, registerComponent, withMessages } from 'meteor/nova:core';
import React, { PropTypes, Component } from 'react';
import classNames from 'classnames';
import { withVote, hasUpvoted, hasDownvoted } from 'meteor/nova:voting';
import { FormattedMessage, intlShape } from 'react-intl';

class Vote extends Component {

Expand Down Expand Up @@ -42,7 +43,7 @@ class Vote extends Component {
const user = this.props.currentUser;

if(!user){
this.props.flash("Please log in first");
this.props.flash(this.context.intl.formatMessage({id: 'users.please_log_in'}));
// this.stopLoading();
} else {
const voteType = hasUpvoted(user, document) ? "cancelUpvote" : "upvote";
Expand Down Expand Up @@ -90,8 +91,7 @@ Vote.propTypes = {
};

Vote.contextTypes = {
actions: React.PropTypes.object,
events: React.PropTypes.object,
intl: intlShape
};

registerComponent('Vote', Vote, withMessages, withVote);
1 change: 1 addition & 0 deletions packages/nova-base-components/lib/posts/PostsItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class PostsItem extends Component {
PostsItem.propTypes = {
currentUser: React.PropTypes.object,
post: React.PropTypes.object.isRequired,
terms: React.PropTypes.object,
};

registerComponent('PostsItem', PostsItem);
4 changes: 2 additions & 2 deletions packages/nova-base-components/lib/posts/PostsList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Alert } from 'react-bootstrap';

const PostsList = (props) => {

const {results, loading, count, totalCount, loadMore, showHeader = true, networkStatus, currentUser, error} = props;
const {results, loading, count, totalCount, loadMore, showHeader = true, networkStatus, currentUser, error, terms} = props;

const loadingMore = networkStatus === 2;

Expand All @@ -27,7 +27,7 @@ const PostsList = (props) => {
<div className="posts-list">
{showHeader ? <Components.PostsListHeader/> : null}
<div className="posts-list-content">
{results.map(post => <Components.PostsItem post={post} key={post._id} currentUser={currentUser} />)}
{results.map(post => <Components.PostsItem post={post} key={post._id} currentUser={currentUser} terms={terms} />)}
</div>
{hasMore ? (loadingMore ? <Components.PostsLoading/> : <Components.PostsLoadMore loadMore={loadMore} count={count} totalCount={totalCount} />) : <Components.PostsNoMore/>}
</div>
Expand Down
1 change: 1 addition & 0 deletions packages/nova-i18n-en-us/lib/en_US.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ addStrings('en', {
"users.edit_account": "Edit Account",
"users.edit_success": "User “{name}” edited",
"users.log_in": "Log In",
"users.sign_up": "Sign Up",
"users.log_out": "Log Out",
"users.bio": "Bio",
"users.displayName": "Display Name",
Expand Down

0 comments on commit 8bc6aac

Please sign in to comment.