Commit ea04658b authored by Ray Schamp's avatar Ray Schamp

Merge pull request #387 from rschamp/feature/scratchr2#2937-student-nav

Add "My Class" to student nav
parents 0fa50bfd 74d23d05
...@@ -2,7 +2,6 @@ var classNames = require('classnames'); ...@@ -2,7 +2,6 @@ var classNames = require('classnames');
var connect = require('react-redux').connect; var connect = require('react-redux').connect;
var React = require('react'); var React = require('react');
var ReactIntl = require('react-intl'); var ReactIntl = require('react-intl');
var defineMessages = ReactIntl.defineMessages;
var FormattedMessage = ReactIntl.FormattedMessage; var FormattedMessage = ReactIntl.FormattedMessage;
var injectIntl = ReactIntl.injectIntl; var injectIntl = ReactIntl.injectIntl;
...@@ -21,21 +20,6 @@ require('./navigation.scss'); ...@@ -21,21 +20,6 @@ require('./navigation.scss');
Modal.setAppElement(document.getElementById('view')); Modal.setAppElement(document.getElementById('view'));
var defaultMessages = defineMessages({
messages: {
id: 'general.messages',
defaultMessage: 'Messages'
},
myStuff: {
id: 'general.myStuff',
defaultMessage: 'My Stuff'
},
search: {
id: 'general.search',
defaultMessage: 'Search'
}
});
var Navigation = React.createClass({ var Navigation = React.createClass({
type: 'Navigation', type: 'Navigation',
mixins: [ mixins: [
...@@ -205,37 +189,27 @@ var Navigation = React.createClass({ ...@@ -205,37 +189,27 @@ var Navigation = React.createClass({
<li className="link create"> <li className="link create">
<a href={createLink}> <a href={createLink}>
<FormattedMessage <FormattedMessage id="general.create" />
id="general.create"
defaultMessage={'Create'} />
</a> </a>
</li> </li>
<li className="link explore"> <li className="link explore">
<a href="/explore?date=this_month"> <a href="/explore?date=this_month">
<FormattedMessage <FormattedMessage id="general.explore" />
id="general.explore"
defaultMessage={'Explore'} />
</a> </a>
</li> </li>
<li className="link discuss"> <li className="link discuss">
<a href="/discuss"> <a href="/discuss">
<FormattedMessage <FormattedMessage id="general.discuss" />
id="general.discuss"
defaultMessage={'Discuss'} />
</a> </a>
</li> </li>
<li className="link about"> <li className="link about">
<a href="/about"> <a href="/about">
<FormattedMessage <FormattedMessage id="general.about" />
id="general.about"
defaultMessage={'About'} />
</a> </a>
</li> </li>
<li className="link help"> <li className="link help">
<a href="/help"> <a href="/help">
<FormattedMessage <FormattedMessage id="general.help" />
id="general.help"
defaultMessage={'Help'} />
</a> </a>
</li> </li>
...@@ -243,8 +217,8 @@ var Navigation = React.createClass({ ...@@ -243,8 +217,8 @@ var Navigation = React.createClass({
<form action="/search/google_results" method="get"> <form action="/search/google_results" method="get">
<Input type="submit" value="" /> <Input type="submit" value="" />
<Input type="text" <Input type="text"
aria-label={formatMessage(defaultMessages.search)} aria-label={formatMessage({id: 'general.search'})}
placeholder={formatMessage(defaultMessages.search)} placeholder={formatMessage({id: 'general.search'})}
name="q" /> name="q" />
<Input type="hidden" name="date" value="anytime" /> <Input type="hidden" name="date" value="anytime" />
<Input type="hidden" name="sort_by" value="datetime_shared" /> <Input type="hidden" name="sort_by" value="datetime_shared" />
...@@ -254,18 +228,18 @@ var Navigation = React.createClass({ ...@@ -254,18 +228,18 @@ var Navigation = React.createClass({
<li className="link right messages" key="messages"> <li className="link right messages" key="messages">
<a <a
href="/messages/" href="/messages/"
title={formatMessage(defaultMessages.messages)}> title={formatMessage({id: 'general.messages'})}>
<span className={messageClasses}>{this.state.unreadMessageCount}</span> <span className={messageClasses}>{this.state.unreadMessageCount}</span>
<FormattedMessage {...defaultMessages.messages} /> <FormattedMessage id="general.messages" />
</a> </a>
</li>, </li>,
<li className="link right mystuff" key="mystuff"> <li className="link right mystuff" key="mystuff">
<a <a
href="/mystuff/" href="/mystuff/"
title={formatMessage(defaultMessages.myStuff)}> title={formatMessage({id: 'general.myStuff'})}>
<FormattedMessage {...defaultMessages.myStuff} /> <FormattedMessage id="general.myStuff" />
</a> </a>
</li>, </li>,
<li className="link right account-nav" key="account-nav"> <li className="link right account-nav" key="account-nav">
...@@ -279,37 +253,36 @@ var Navigation = React.createClass({ ...@@ -279,37 +253,36 @@ var Navigation = React.createClass({
onRequestClose={this.closeAccountNav}> onRequestClose={this.closeAccountNav}>
<li> <li>
<a href={this.getProfileUrl()}> <a href={this.getProfileUrl()}>
<FormattedMessage <FormattedMessage id="general.profile" />
id='general.profile'
defaultMessage={'Profile'} />
</a> </a>
</li> </li>
<li> <li>
<a href="/mystuff/"> <a href="/mystuff/">
<FormattedMessage {...defaultMessages.myStuff} /> <FormattedMessage id="general.myStuff" />
</a> </a>
</li> </li>
{this.props.session.permissions.educator ? [ {this.props.session.permissions.educator ? [
<li> <li>
<a href="/educators/classes/"> <a href="/educators/classes/">
<FormattedMessage <FormattedMessage id="general.myClasses" />
id='general.myClasses' </a>
defaultMessage={'My Classes'} /> </li>
] : []}
{this.state.session.permissions.student ? [
<li>
<a href={'/classes/' + this.state.session.user.classroomId + '/'}>
<FormattedMessage id="general.myClass" />
</a> </a>
</li> </li>
] : []} ] : []}
<li> <li>
<a href="/accounts/settings/"> <a href="/accounts/settings/">
<FormattedMessage <FormattedMessage id="general.accountSettings" />
id='general.accountSettings'
defaultMessage={'Account settings'} />
</a> </a>
</li> </li>
<li className="divider"> <li className="divider">
<a href="#" onClick={this.handleLogOut}> <a href="#" onClick={this.handleLogOut}>
<FormattedMessage <FormattedMessage id="navigation.signOut" />
id='navigation.signOut'
defaultMessage={'Sign out'} />
</a> </a>
</li> </li>
</Dropdown> </Dropdown>
...@@ -317,9 +290,7 @@ var Navigation = React.createClass({ ...@@ -317,9 +290,7 @@ var Navigation = React.createClass({
] : [ ] : [
<li className="link right join" key="join"> <li className="link right join" key="join">
<a href="#" onClick={this.handleJoinClick}> <a href="#" onClick={this.handleJoinClick}>
<FormattedMessage <FormattedMessage id="general.joinScratch" />
id='general.joinScratch'
defaultMessage={'Join Scratch'} />
</a> </a>
</li>, </li>,
<Registration <Registration
...@@ -333,9 +304,7 @@ var Navigation = React.createClass({ ...@@ -333,9 +304,7 @@ var Navigation = React.createClass({
onClick={this.handleLoginClick} onClick={this.handleLoginClick}
className="ignore-react-onclickoutside" className="ignore-react-onclickoutside"
key="login-link"> key="login-link">
<FormattedMessage <FormattedMessage id="general.signIn" />
id='general.signIn'
defaultMessage={'Sign In'} />
</a> </a>
<Dropdown <Dropdown
className="login-dropdown with-arrow" className="login-dropdown with-arrow"
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
"general.legal": "Legal", "general.legal": "Legal",
"general.learnMore": "Learn More", "general.learnMore": "Learn More",
"general.messages": "Messages", "general.messages": "Messages",
"general.myClass": "My Class",
"general.myClasses": "My Classes", "general.myClasses": "My Classes",
"general.myStuff": "My Stuff", "general.myStuff": "My Stuff",
"general.offlineEditor": "Offline Editor", "general.offlineEditor": "Offline Editor",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment