diff static/add.js @ 5:f8c4c7ce5f4a

lots of href additions: add/edit, nav fixes Ignore-this: 863335c4680ac9bcc6a7fc5867638d61
author Drew Perttula <drewp@bigasterisk.com>
date Thu, 21 Feb 2013 01:39:01 -0800
parents 409da49c148d
children e054949143e9
line wrap: on
line diff
--- a/static/add.js	Sun Feb 17 21:12:53 2013 -0800
+++ b/static/add.js	Thu Feb 21 01:39:01 2013 -0800
@@ -1,5 +1,9 @@
 var model = {
-    href: ko.observable("starter"),
+    href: ko.observable(""),
+    description: ko.observable(""),
+    tag: ko.observable(""),
+    extended: ko.observable(""),
+    submitLabel: ko.observable("Add"),
 };
 
 ko.computed(function() {
@@ -7,8 +11,15 @@
         return;
     }
 
-    $.getJSON("proposal", {uri: model.href()}, function (data) {
+    $.getJSON("addLink/proposedUri", {uri: model.href()}, function (data) {
+        // these could arrive after the user has started typing in the fields!
+        
+        model.description(data.description);
+        model.tag(data.tag);
+        model.extended(data.extended);
 
+        model.submitLabel(data.existed ? "Update existing" : "Add");
+        
     });
     
 });