Skip to content

Commit

Permalink
Clear sidebar input in SidebarMenu, not Sidebar (elements have moved)
Browse files Browse the repository at this point in the history
  • Loading branch information
bluefuton committed Dec 2, 2015
1 parent 0452fb2 commit 9368db8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
1 change: 1 addition & 0 deletions client/reader/sidebar/menu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ const SidebarMenu = React.createClass( {
if ( event.keyCode === 13 ) {
event.preventDefault();
this.props.onAddSubmit( inputValue );
React.findDOMNode( this.refs.menuAddInput ).value = '';
}
},

Expand Down
22 changes: 5 additions & 17 deletions client/reader/sidebar/sidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const assign = require( 'lodash/object/assign' ),
React = require( 'react' ),
page = require( 'page' ),
url = require( 'url' ),
classNames = require( 'classnames' );
classnames = require( 'classnames' );

/**
* Internal Dependencies
Expand All @@ -26,8 +26,6 @@ const layoutFocus = require( 'lib/layout-focus' ),
stats = require( 'reader/stats' ),
Gridicon = require( 'components/gridicon' ),
discoverHelper = require( 'reader/discover/helper' ),
Button = require( 'components/button' ),
Count = require( 'components/count' ),
config = require( 'config' ),
SidebarMenu = require( './menu' );

Expand Down Expand Up @@ -141,15 +139,13 @@ module.exports = React.createClass( {
highlightNewList: function( list ) {
list = ListStore.get( list.owner, list.slug );
window.location.href = url.resolve( 'https://wordpress.com', url.resolve( list.URL, 'edit' ) );
React.findDOMNode( this.refs.menuAddInput ).value = '';
},

highlightNewTag: function( tag ) {
process.nextTick( function() {
page( '/tag/' + tag.slug );
window.scrollTo( 0, 0 );
} );
React.findDOMNode( this.refs.menuAddInput ).value = '';
},

createList: function( list ) {
Expand All @@ -175,7 +171,7 @@ module.exports = React.createClass( {
renderLists: function() {
if ( ! this.state.lists ) {
return (
[ <li className="sidebar-menu__empty">{ this.translate( 'Collect sites together by adding a\xa0list.' ) }</li> ]
[ <li key="empty" className="sidebar-menu__empty">{ this.translate( 'Collect sites together by adding a\xa0list.' ) }</li> ]
);
}

Expand Down Expand Up @@ -214,7 +210,7 @@ module.exports = React.createClass( {
renderTags: function() {
if ( ! this.state.tags || this.state.tags.length === 0 ) {
return (
[ <li className="sidebar-menu__empty">{ this.translate( 'Finds relevant posts by adding a\xa0tag.' ) }</li> ]
[ <li key="empty" className="sidebar-menu__empty">{ this.translate( 'Finds relevant posts by adding a\xa0tag.' ) }</li> ]
);
}

Expand Down Expand Up @@ -270,16 +266,8 @@ module.exports = React.createClass( {
render: function() {
let followingEditLink = this.getFollowingEditLink();

var tagCount = 0,
listCount = 0;

if ( typeof this.state.tags !== 'undefined' && this.state.tags !== null && this.state.tags.length > 0 ) {
tagCount = this.state.tags.length;
}

if ( typeof this.state.lists !== 'undefined' && this.state.lists !== null && this.state.lists.length > 0 ) {
listCount = this.state.lists.length;
}
const tagCount = this.state.tags ? this.state.tags.length : 0,
listCount = this.state.lists ? this.state.lists.length : 0;

return (
<ul className="wpcom-sidebar sidebar reader-sidebar" onClick={ this.handleClick }>
Expand Down

0 comments on commit 9368db8

Please sign in to comment.