fix views a bit

This commit is contained in:
Peter Cottle 2015-04-16 19:28:08 +10:00
parent 9a266a3cc4
commit 62b342e665
2 changed files with 11 additions and 6 deletions

View file

@ -48,9 +48,13 @@ var CommandHistoryView = React.createClass({
render: function() { render: function() {
var allCommands = []; var allCommands = [];
this.props.commandCollection.each(function(command) { this.props.commandCollection.each(function(command, index) {
allCommands.push( allCommands.push(
<CommandView command={command} key={command.cid} /> <CommandView
id={'command_' + index}
command={command}
key={command.cid}
/>
); );
}, this); }, this);
return ( return (
@ -61,7 +65,7 @@ var CommandHistoryView = React.createClass({
}, },
scrollDown: function() { scrollDown: function() {
var cD = this.getDOMNode(); var cD = document.getElementById('commandDisplay');
var t = document.getElementById('terminal'); var t = document.getElementById('terminal');
// firefox hack // firefox hack
@ -69,7 +73,7 @@ var CommandHistoryView = React.createClass({
(window.innerHeight < cD.clientHeight); (window.innerHeight < cD.clientHeight);
// ugh sometimes i wish i had toggle class // ugh sometimes i wish i had toggle class
var hasScroll = t.className.match(/shouldScroll/g); var hasScroll = t.className.match(/scrolling/g);
if (shouldScroll && !hasScroll) { if (shouldScroll && !hasScroll) {
t.className += ' scrolling'; t.className += ' scrolling';
} else if (!shouldScroll && hasScroll) { } else if (!shouldScroll && hasScroll) {

View file

@ -13,7 +13,8 @@ var CommandView = React.createClass({
propTypes: { propTypes: {
// the backbone command model // the backbone command model
command: React.PropTypes.object.isRequired command: React.PropTypes.object.isRequired,
id: React.PropTypes.string,
}, },
componentDidMount: function() { componentDidMount: function() {
@ -67,7 +68,7 @@ var CommandView = React.createClass({
]); ]);
return ( return (
<div className="reactCommandView"> <div id={this.props.id} className="reactCommandView">
<p className={commandClass}> <p className={commandClass}>
<span className="prompt">{'$'}</span> <span className="prompt">{'$'}</span>
{' ' + this.state.rawStr} {' ' + this.state.rawStr}