0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-31 21:42:44 +00:00

So much polish

This commit is contained in:
Scott Tolksdorf
2016-01-04 17:02:55 -05:00
parent b1b69437ea
commit fb8ddfe9fa
16 changed files with 146 additions and 62 deletions

View File

@@ -11,8 +11,6 @@ var request = require("superagent");
var EditPage = React.createClass({
getDefaultProps: function() {
return {
//text : "",
pending : false,
id : null,
entry : {
text : "",
@@ -27,10 +25,19 @@ var EditPage = React.createClass({
getInitialState: function() {
return {
text: this.props.entry.text,
pending : false
pending : false,
lastUpdated : this.props.entry.updatedAt
};
},
componentDidMount: function() {
var self = this;
window.onbeforeunload = function(){
if(!self.state.pending) return;
return "You have unsaved changes!";
}
},
handleTextChange : function(text){
this.setState({
text : text,
@@ -45,17 +52,18 @@ var EditPage = React.createClass({
.send({text : this.state.text})
.end((err, res) => {
this.setState({
pending : false
pending : false,
lastUpdated : res.body.updatedAt
})
})
}, 1500),
render : function(){
return <div className='editPage'>
<Statusbar
editId={this.props.entry.editId}
shareId={this.props.entry.shareId}
lastUpdated={this.state.lastUpdated}
isPending={this.state.pending} />
<div className='paneSplit'>
@@ -66,9 +74,6 @@ var EditPage = React.createClass({
<PHB text={this.state.text} />
</div>
</div>
</div>
}
});

View File

@@ -1,24 +1,5 @@
.editPage{
.paneSplit{
width : 100%;
max-height: 100%;
.leftPane, .rightPane{
display: inline-block;
vertical-align: top;
position: relative;
min-height: 100%;
}
.leftPane{
width : 40%;
}
.rightPane{
width : 60%;
overflow-y: scroll;
}
}
}