Skip to content

Commit

Permalink
Fixing a distributing problem
Browse files Browse the repository at this point in the history
  • Loading branch information
stolksdorf committed Apr 6, 2016
1 parent cb5b634 commit 62b9400
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 20 deletions.
2 changes: 1 addition & 1 deletion client/splatsheet/sheetRenderer/parts/box/box.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var Box = React.createClass({
mixins : [utils],
getDefaultProps: function() {
return {
name : 'box',
//name : 'box',
defaultData : {},

id : '',
Expand Down
2 changes: 0 additions & 2 deletions client/splatsheet/sheetRenderer/parts/skill/skill.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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()}
Expand Down
14 changes: 9 additions & 5 deletions client/splatsheet/sheetRenderer/parts/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
3 changes: 0 additions & 3 deletions client/splatsheet/sheetRenderer/sheetRenderer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ var SheetRenderer = React.createClass({
})
},
renderSheet : function(){

try{
var nodes = jsx2json(this.props.code);
nodes = _.map(nodes, (node)=>{
Expand All @@ -43,8 +42,6 @@ var SheetRenderer = React.createClass({
}
return node
})


return this.renderChildren(nodes);
}catch(e){
return <div>Error bruh {e.toString()}</div>
Expand Down
8 changes: 1 addition & 7 deletions client/splatsheet/splatsheet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,7 @@ var SplatSheet = React.createClass({
getInitialState: function() {
return {
sheetCode: '',
characterData : {
playerInfo : {
name : 'scott',
race : 'human',
class : 'coder'
}
}
characterData : {}
};
},

Expand Down
18 changes: 16 additions & 2 deletions shared/jsx-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,18 @@ var parser = function(tokens){



/*












var test1 = `
<div test="hey there champ" more_cool=false size=0>
<span>
Expand All @@ -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));
Expand Down

0 comments on commit 62b9400

Please sign in to comment.