--- /dev/null
+// js/models/account.js
+
+var app = app || {};
+
+// Account Model
+app.account = Backbone.Model.extend({
+
+ // Default account values
+ defaults: {
+ active: true,
+ registered_by: 0,
+ fname: '',
+ lname: '',
+ org: '',
+ title: '',
+ addr1: '',
+ addr2: '',
+ city: '',
+ state: '',
+ zip: '',
+ phone: '',
+ email: '',
+ },
+
+ initialize: function(){
+ this.on('invalid', function( model, error ){
+ console.log( error );
+ });
+ },
+
+ validate: function(){
+ if ( attribs.fname === undefined || attribs.fname === '' ) {
+ return 'First name empty!';
+ }
+ if ( attribs.lname === undefined || attribs.lname === '' ) {
+ return 'Last name empty!';
+ }
+ if ( attribs.email === undefined || attribs.email === '' ) {
+ return 'Need an email address!';
+ }
+ },
+});
initialize: function(){
this.on( 'invalid', function( model, error ){
- console.log(error);
+ console.log( error );
});
},
this.listenTo( app.EventRegistrants, 'add', this.addOne );
this.listenTo( app.EventRegistrants, 'reset', this.addAll );
app.EventRegistrants.fetch();
- //this.collection.bind('add', this.onModelAdded, this);
- //this.render();
},
deleteOne: function( el ){
console.log( el );
console.log( 'deleteOne called on listView' );
- //app.EventRegistrants.fetch();
},
events: {
+<div class="glm-reg-account">
+ <a class="glm-reg-account-login">Login</a>
+</div>
{* Event Registration App - Backbone.js *}
<div id="eventapp"></div>
{* Underscore Templates for the Event Registration App *}
<input type="submit" class="saveRegistrant" value="Save">
</div>
</script>
+<script type="text/template" id="eventReg-account-login">
+ <input class="email">
+ <input class="password">
+ <input type="submit" class="accountLogin" value="Login">
+</script>
+<script class="text/template" id="eventReg-account">
+ <div class="eventReg-account-name"><%= fname %><%= lname %></div>
+ <div class="eventReg-account-email"><%= email %></div>
+</script>
{/literal}
<div class="glm-reg-event-list">
{$event = $entry.reg_event}