Getting ready to organize again.
authorSteve Sutton <steve@gaslightmedia.com>
Thu, 24 Aug 2017 16:08:42 +0000 (12:08 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Thu, 24 Aug 2017 20:55:02 +0000 (16:55 -0400)
Saving these changes as this part is working. Will be re-organizing the
files for each needed model, collection and view for the app.

js/models/account.js [new file with mode: 0644]
js/models/eventRegistrant.js
js/views/app.js
views/front/registrations/registration.html

diff --git a/js/models/account.js b/js/models/account.js
new file mode 100644 (file)
index 0000000..3117d2b
--- /dev/null
@@ -0,0 +1,42 @@
+// 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!';
+        }
+    },
+});
index b6006f2..d618b55 100644 (file)
@@ -13,7 +13,7 @@ app.EventRegistrant = Backbone.Model.extend({
 
     initialize: function(){
         this.on( 'invalid', function( model, error ){
-            console.log(error);
+            console.log( error );
         });
     },
 
index d48e687..f5656e3 100644 (file)
@@ -13,14 +13,11 @@ app.AppView = Backbone.View.extend({
         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: {
index 647c025..547b526 100644 (file)
@@ -1,3 +1,6 @@
+<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}