Updated with latest version of react boilerplate

This commit is contained in:
Christian Alfoni
2014-11-10 21:15:14 +01:00
parent e2c81b975b
commit e160286d01
44 changed files with 32386 additions and 4168 deletions

View File

@@ -1,60 +0,0 @@
var flux = require('flux-react');
var actions = require('./../actions.js');
var CheckboxStore = flux.createStore({
getInitialState: function () {
return {
checkboxes: [{
color: 'red',
checked: false
}, {
color: 'blue',
checked: false
}, {
color: 'green',
checked: false
}]
};
},
actions: [
actions.checkAll,
actions.uncheckAll,
actions.check
],
checkAll: function () {
this.state.checkboxes.forEach(function (checkbox) {
checkbox.checked = true;
});
this.emitChange();
},
uncheckAll: function () {
this.state.checkboxes.forEach(function (checkbox) {
checkbox.checked = false;
});
this.emitChange();
},
check: function (color) {
this.state.checkboxes.forEach(function (checkbox) {
if (checkbox.color === color) {
checkbox.checked = !checkbox.checked;
}
});
this.emitChange();
},
exports: {
getCheckboxes: function () {
return this.checkboxes;
},
getColors: function () {
return this.checkboxes.map(function (checkbox) {
if (checkbox.checked) {
return checkbox.color;
} else {
return 'black';
}
});
}
}
});
module.exports = CheckboxStore;