1
0
mirror of https://github.com/stolksdorf/homebrewery.git synced 2025-12-12 22:15:55 +00:00

Fixing a distributing problem

This commit is contained in:
Scott Tolksdorf
2016-04-05 23:07:29 -04:00
parent cb5b63429e
commit 62b9400df1
6 changed files with 27 additions and 20 deletions

View File

@@ -8,7 +8,7 @@ var Box = React.createClass({
mixins : [utils],
getDefaultProps: function() {
return {
name : 'box',
//name : 'box',
defaultData : {},
id : '',

View File

@@ -41,13 +41,11 @@ var Skill = React.createClass({
val : e.target.value
})
},
renderExpert : function(){
if(this.props.showExpert){
return <input type="radio" className='expertToggle' onChange={this.handleToggleExpert} checked={this.data().expert} />
}
},
render : function(){
return <div className='skill'>
{this.renderExpert()}

View File

@@ -16,14 +16,18 @@ module.exports = {
updateData : function(val){
if(typeof this.props.onChange !== 'function') throw "No onChange handler set";
if(_.isObject(val)){
var newVal = val;
//Clone the data if it's an object to avoid mutation bugs
if(_.isObject(val)) newVal = _.extend({}, this.data(), val);
if(this.id()){
this.props.onChange({
[this.id()] : _.extend({}, this.data(), val)
[this.id()] : newVal
});
}else{
this.props.onChange({
[this.id()] : val
});
//If the box has no id, don't add it to the chain
this.props.onChange(newVal)
}
}
}

View File

@@ -33,7 +33,6 @@ var SheetRenderer = React.createClass({
})
},
renderSheet : function(){
try{
var nodes = jsx2json(this.props.code);
nodes = _.map(nodes, (node)=>{
@@ -43,8 +42,6 @@ var SheetRenderer = React.createClass({
}
return node
})
return this.renderChildren(nodes);
}catch(e){
return <div>Error bruh {e.toString()}</div>

View File

@@ -16,13 +16,7 @@ var SplatSheet = React.createClass({
getInitialState: function() {
return {
sheetCode: '',
characterData : {
playerInfo : {
name : 'scott',
race : 'human',
class : 'coder'
}
}
characterData : {}
};
},

View File

@@ -187,7 +187,18 @@ var parser = function(tokens){
/*
var test1 = `
<div test="hey there champ" more_cool=false size=0>
<span>
@@ -205,7 +216,10 @@ var test2 = "<div cool=0 same>Hey there!</div>"
var tokens = tokenizer(test1);
console.log(test1, '\n---\n', tokens, '---\n', JSON.stringify(parser(tokens), null, ' '));
*/
module.exports = function(input){
return parser(tokenizer(input));