1
0
mirror of https://github.com/aclindsa/moneygo.git synced 2025-07-01 20:08:39 -04:00

Reorganization around building JavaScript differently

This commit is contained in:
2016-02-13 17:02:22 -05:00
parent d6ddf0f65f
commit c5bca50113
14 changed files with 13 additions and 6 deletions

39
js/AccountCombobox.js Normal file
View File

@ -0,0 +1,39 @@
var React = require('react');
var Combobox = require('react-widgets').Combobox;
var getAccountDisplayList = require('./utils.js').getAccountDisplayList;
module.exports = React.createClass({
displayName: "AccountCombobox",
getDefaultProps: function() {
return {
includeRoot: true,
rootName: "New Top-level Account"
};
},
handleAccountChange: function(account) {
if (this.props.onChange != null &&
account.hasOwnProperty('AccountId') &&
(this.props.account_map.hasOwnProperty([account.AccountId]) ||
account.AccountId == -1)) {
this.props.onChange(account)
}
},
render: function() {
var accounts = getAccountDisplayList(this.props.accounts, this.props.includeRoot, this.props.rootName);
var className = "";
if (this.props.className)
className = this.props.className;
return (
<Combobox
data={accounts}
valueField='AccountId'
textField='Name'
defaultValue={this.props.value}
onChange={this.handleAccountChange}
ref="account"
className={className} />
);
}
});