Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

hello

  • Loading branch information...
commit 6b93ae0440968a38d109011b649807b0ae8efcce 1 parent 0060d31
@krav krav authored
Showing with 17 additions and 8 deletions.
  1. +16 −5 web/js/hangover.js
  2. +1 −1  web/lib/lamt
  3. +0 −2  web/tmpl/database.ejs
View
21 web/js/hangover.js
@@ -41,9 +41,11 @@ var sort_fields = function(fields) {
return result.reverse();
}
+
$.Model('db', {
- findAll: "/db",
- findOne: "/db"
+ findAll: "GET /db",
+ findOne: "GET /db",
+ update: "PUT /db/{id}",
}, {});
$.Controller("search", {
@@ -80,9 +82,18 @@ $.route.bind('change', function(ev, attr, how, newval, oldval) {
case "database":
switch(ev['target']['action']) {
case "edit":
- db.findOne({id: ev['target']['id']}, function(result) {
- var r = result[0]; // FIXME sort - extract keys
- $("#content").html($.View("tmpl/database_edit.ejs", {entry: r}));
+ db.findOne({id: ev['target']['id']}, function(result) {
+ var r = result[0];
+ var fields = sort_fields(r.fields)
+ $("#content").html($.View("tmpl/database_edit.ejs", {entry: r.result, fields: fields}));
+ var save_thing = function() {
+ var form = $('#entry').formParams();
+ console.log(r);
+ r.result = form;
+ result.save();
+ return(false);
+ }
+ $("#save").bind("click", save_thing);
});
break; // edit
default:
2  web/lib/lamt
@@ -1 +1 @@
-Subproject commit 6a27728f467734415db8017ae5b2e43a00da09d4
+Subproject commit 1c6f6e3539d45d5064a62cf153579492bcdccff7
View
2  web/tmpl/database.ejs
@@ -21,8 +21,6 @@
<h3>Upload</h3>
<form class="well form-search" method="post" enctype="multipart/form-data" action="/db">
<fieldset>
- <input type="text" id="artist"></input>
- <input type="text" id="title"></input>
<input type="file" name="file" />
<button type="submit" class="btn btn-danger">Upload!</button>
</fieldset>
Please sign in to comment.
Something went wrong with that request. Please try again.