Permalink
Browse files

added a bunch of customer functionality

  • Loading branch information...
jbass86 committed Dec 2, 2013
1 parent 6cc26eb commit 9553fd3fd32199f5f871375d12d9440241d80d95
Showing with 524 additions and 175 deletions.
  1. +3 −93 app.js
  2. +22 −0 public/javascripts/plugins/CustomerSection/model/CustomerDeleteDialogModel.coffee
  3. +20 −0 public/javascripts/plugins/CustomerSection/model/CustomerDeleteDialogModel.js
  4. +1 −0 public/javascripts/plugins/CustomerSection/model/CustomerUpdatePanelModel.coffee
  5. +3 −1 public/javascripts/plugins/CustomerSection/model/CustomerUpdatePanelModel.js
  6. +62 −0 public/javascripts/plugins/CustomerSection/view/CustomerDeleteDialogView.coffee
  7. +57 −0 public/javascripts/plugins/CustomerSection/view/CustomerDeleteDialogView.js
  8. +54 −9 public/javascripts/plugins/CustomerSection/view/CustomerSectionView.coffee
  9. +59 −16 public/javascripts/plugins/CustomerSection/view/CustomerSectionView.js
  10. +42 −12 public/javascripts/plugins/CustomerSection/view/CustomerUpdatePanelView.coffee
  11. +46 −14 public/javascripts/plugins/CustomerSection/view/CustomerUpdatePanelView.js
  12. +52 −2 public/javascripts/plugins/CustomerSection/view/Templates.js
  13. +15 −0 public/javascripts/plugins/CustomerSection/view/res/css/customerDeleteDialog.css
  14. +5 −0 public/javascripts/plugins/CustomerSection/view/res/css/customerSection.css
  15. +3 −2 public/javascripts/plugins/CustomerSection/view/res/css/customerUpdatePanel.css
  16. +10 −0 public/javascripts/plugins/CustomerSection/view/res/templates/customerDeleteDialog.html
  17. +17 −2 public/javascripts/plugins/CustomerSection/view/res/templates/customerRowTemplate.html
  18. +12 −9 public/javascripts/plugins/CustomerSection/view/res/templates/customerSection.html
  19. +41 −15 routes/user.js
View
96 app.js
@@ -13,98 +13,6 @@ var express = require('express')
var nano = require('nano')('http://localhost:5984');
-nano.db.get('users', function(){
-
-
-
- var users = nano.use('users');
-
- users.insert ( { name: 'kankamol', country: 'thailand'}, 'kate', function(err, body, header) {
- if (err){
- console.log("there was an error");
- }
- console.log("we inserted");
- console.log(body);
- });
-
-
-
- console.log(users)
-
- users.list(function(err, body){
-
- console.log("seach users");
- console.log(err);
- console.log(body);
-
- body.rows.forEach(function(row){
-
- console.log(row.value)
-
- });
-
-
- })
-
- users.view('get_users', 'sort_by_last_name', function(err, body){
-
- console.log("i called view");
- console.log("key: " + body.key);
- console.log("value: " + body.value);
- console.log(body.rows);
- console.log("******")
- })
-
-});
-
-// nano.db.get('inventory', function() {
-
-// var inventory = nano.use('inventory');
-// inventory.insert ( { name: 'kankamol', country: 'thailand'}, 'kate', function(err, body, header) {
-// if (err){
-// console.log("there was an error");
-// }
-// console.log("we inserted");
-// console.log(body);
-// });
-
- // inventory.insert ( { name: 'josh', country: 'usa'}, 'josh', function(err, body, header) {
- // if (err){
- // console.log("there was an error");
- // console.log(err)
- // }
- // console.log("we inserted");
- // console.log(body);
- // });
-
- // inventory.get('josh', function(err, body, header){
-
- // console.log("got something out of inventory");
- // console.log(body.name);
-
- // });
-
-// });
-
-// // clean up the database we created previously
-// nano.db.destroy('alice', function() {
-// // create a new database
-// nano.db.create('alice', function() {
-// // specify the database we are going to use
-// var alice = nano.use('alice');
-// // and insert a document in it
-// alice.insert({ crazy: true }, 'rabbit', function(err, body, header) {
-// if (err) {
-// console.log('[alice.insert] ', err.message);
-// return;
-// }
-// console.log('you have inserted the rabbit.')
-// console.log(body);
-// });
-// });
-// });
-
-
var app = express();
app.configure(function(){
@@ -125,8 +33,10 @@ app.configure('development', function(){
app.get('/', routes.index);
app.get('/users_by_last_name', user.users_by_last_name);
+
app.post('/update_user', user.update_user);
-//app.get('/inventory', routes.inventory);
+app.post('/delete_user', user.delete_user);
+app.post('/test_post', user.test_post);
http.createServer(app).listen(app.get('port'), function(){
console.log("Express server listening on port " + app.get('port'));
@@ -0,0 +1,22 @@
+###*
+* @author Josh Bass
+*###
+
+define(["vendor/backbone"]
+
+(Backbone, Math2) ->
+
+ customerDeleteDialogModel = Backbone.Model.extend(
+
+
+ ###*
+ * initialize a new model, will automatically initialize a new
+ * search
+ * @method initialize
+ *
+ *###
+ initialize: (options) ->
+
+ );
+
+);

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -16,6 +16,7 @@ define(["vendor/backbone"]
*
*###
initialize: (options) ->
+ @set("customerViewModel", options.customerViewModel);
);

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -0,0 +1,62 @@
+###
+CustomerSectionBarView
+@author Josh Bass
+###
+define(["vendor/backbone",
+ "plugins/CustomerSection/view/Templates",
+ 'css!plugins/CustomerSection/view/res/css/customerDeleteDialog.css'],
+
+(Backbone, Templates, CSS) ->
+
+ Backbone.View.extend(
+
+ className: "customerDeleteDialog",
+
+ events: {"click .dialogYes" : "confirm", \
+ "click .dialogNo" : "cancel"},
+
+
+ initialize: (model) ->
+
+
+ ###
+ Create the Dialog and return its element
+ @method render
+ ###
+ render: () ->
+ @$el.html(Templates.customerDeleteDialog({}));
+ return @$el
+
+ ###
+ Called after Dialog has been appended, this will set up the prog search
+ list with all known searches
+ @method realized
+ ###
+ realized: () ->
+ @$el.css("display", "none");
+ @$el.find(".dialogYes").button();
+ @$el.find(".dialogNo").button();
+
+
+ confirmDelete: (deleteAction) ->
+
+ @$el.dialog({title: "Customer Delete Confirm", \
+ close: () =>
+ console.log("I was closed...");
+ if (@model.get("actionConfirmed"))
+ console.log("I Was confirmed!! :)");
+ deleteAction();
+
+ @model.set("actionConfirmed", false);
+ });
+
+ confirm: () ->
+
+ @model.set("actionConfirmed", true);
+ @$el.dialog("close");
+
+ cancel: () ->
+ @$el.dialog("close");
+
+ )
+)

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 9553fd3

Please sign in to comment.