1
0
mirror of https://github.com/aclindsa/moneygo.git synced 2024-12-27 07:52:28 -05:00

Move models.js to browserify/require() format

This commit is contained in:
Aaron Lindsay 2016-02-13 16:31:12 -05:00
parent 5b5fd6ef78
commit da7fbeecaf
8 changed files with 65 additions and 11 deletions

View File

@ -23,6 +23,16 @@ var Glyphicon = ReactBootstrap.Glyphicon;
var DateTimePicker = require('react-widgets').DateTimePicker; var DateTimePicker = require('react-widgets').DateTimePicker;
var Combobox = require('react-widgets').Combobox; var Combobox = require('react-widgets').Combobox;
var models = require('./models.js');
var Security = models.Security;
var Account = models.Account;
var Split = models.Split;
var Transaction = models.Transaction;
var TransactionStatus = models.TransactionStatus;
var TransactionStatusList = models.TransactionStatusList;
var TransactionStatusMap = models.TransactionStatusMap;
var Error = models.Error;
var AccountCombobox = require('./AccountCombobox.js'); var AccountCombobox = require('./AccountCombobox.js');
const TransactionRow = React.createClass({ const TransactionRow = React.createClass({

View File

@ -1,9 +1,14 @@
var React = require('react'); var React = require('react');
var Modal = require('react-bootstrap').Modal; var ReactBootstrap = require('react-bootstrap');
var Button = require('react-bootstrap').Button; var Modal = ReactBootstrap.Modal;
var ButtonGroup = require('react-bootstrap').ButtonGroup; var Button = ReactBootstrap.Button;
var Input = require('react-bootstrap').Input; var ButtonGroup = ReactBootstrap.ButtonGroup;
var Input = ReactBootstrap.Input;
var models = require('./models.js');
var User = models.User;
var Error = models.Error;
module.exports = React.createClass({ module.exports = React.createClass({
displayName: "AccountSettingsModal", displayName: "AccountSettingsModal",
@ -12,10 +17,10 @@ module.exports = React.createClass({
name: props.user.Name, name: props.user.Name,
username: props.user.Username, username: props.user.Username,
email: props.user.Email, email: props.user.Email,
password: BogusPassword, password: models.BogusPassword,
confirm_password: BogusPassword, confirm_password: models.BogusPassword,
passwordChanged: false, passwordChanged: false,
initial_password: BogusPassword}; initial_password: models.BogusPassword};
}, },
getInitialState: function() { getInitialState: function() {
return this._getInitialState(this.props); return this._getInitialState(this.props);
@ -74,7 +79,7 @@ module.exports = React.createClass({
return; return;
} }
} else { } else {
u.Password = BogusPassword; u.Password = models.BogusPassword;
} }
this.handleSaveSettings(u); this.handleSaveSettings(u);

View File

@ -18,6 +18,11 @@ var Collapse = ReactBootstrap.Collapse;
var Combobox = require('react-widgets').Combobox; var Combobox = require('react-widgets').Combobox;
var models = require('./models.js');
var Security = models.Security;
var Account = models.Account;
var AccountTypeList = models.AccountTypeList;
var AccountCombobox = require('./AccountCombobox.js'); var AccountCombobox = require('./AccountCombobox.js');
var AccountRegister = require('./AccountRegister.js'); var AccountRegister = require('./AccountRegister.js');

View File

@ -6,6 +6,13 @@ var Tabs = ReactBootstrap.Tabs;
var Tab = ReactBootstrap.Tab; var Tab = ReactBootstrap.Tab;
var Modal = ReactBootstrap.Modal; var Modal = ReactBootstrap.Modal;
var models = require('./models.js');
var User = models.User;
var Session = models.Session;
var Security = models.Security;
var Account = models.Account;
var Error = models.Error;
var TopBar = require('./TopBar.js'); var TopBar = require('./TopBar.js');
var NewUserForm = require('./NewUserForm.js'); var NewUserForm = require('./NewUserForm.js');
var AccountSettingsModal = require('./AccountSettingsModal.js'); var AccountSettingsModal = require('./AccountSettingsModal.js');

View File

@ -5,6 +5,10 @@ var Input = require('react-bootstrap').Input;
var Button = require('react-bootstrap').Button; var Button = require('react-bootstrap').Button;
var ButtonGroup = require('react-bootstrap').ButtonGroup; var ButtonGroup = require('react-bootstrap').ButtonGroup;
var models = require('./models.js');
var User = models.User;
var Error = models.Error;
module.exports = React.createClass({ module.exports = React.createClass({
getInitialState: function() { getInitialState: function() {
return {error: "", return {error: "",

View File

@ -9,6 +9,8 @@ var MenuItem = ReactBootstrap.MenuItem;
var Row = ReactBootstrap.Row; var Row = ReactBootstrap.Row;
var Col = ReactBootstrap.Col; var Col = ReactBootstrap.Col;
var User = require('./models.js').User;
const LoginBar = React.createClass({ const LoginBar = React.createClass({
getInitialState: function() { getInitialState: function() {
return {username: '', password: ''}; return {username: '', password: ''};

View File

@ -12,7 +12,6 @@
<script src="static/external/classnames/index.js"></script> <script src="static/external/classnames/index.js"></script>
<script type="text/javascript" src="static/utils.js"></script> <script type="text/javascript" src="static/utils.js"></script>
<script type="text/javascript" src="static/models.js"></script>
<script type="text/javascript" src="static/bundle.js"></script> <script type="text/javascript" src="static/bundle.js"></script>
</head> </head>

View File

@ -16,8 +16,6 @@ function User() {
this.Email = ""; this.Email = "";
} }
const BogusPassword = "password";
User.prototype.toJSON = function() { User.prototype.toJSON = function() {
var json_obj = {}; var json_obj = {};
json_obj.UserId = this.UserId; json_obj.UserId = this.UserId;
@ -385,3 +383,27 @@ Error.prototype.isError = function() {
return this.ErrorId != empty_error.ErrorId || return this.ErrorId != empty_error.ErrorId ||
this.ErrorString != empty_error.ErrorString; this.ErrorString != empty_error.ErrorString;
} }
module.exports = models = {
// Classes
User: User,
Session: Session,
Security: Security,
Account: Account,
Split: Split,
Transaction: Transaction,
Error: Error,
// Enums, Lists
AccountType: AccountType,
AccountTypeList: AccountTypeList,
SecurityType: SecurityType,
SecurityTypeList: SecurityTypeList,
TransactionStatus: TransactionStatus,
TransactionStatusList: TransactionStatusList,
TransactionStatusMap: TransactionStatusMap,
// Constants
BogusPassword: "password"
};