Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

simplify

  • Loading branch information...
commit 805bbdaf3ea6a5a6908cd4658362c97f77114490 1 parent b6a9c56
@jchris jchris authored
Showing with 11 additions and 22 deletions.
  1. +0 −6 _attachments/index.html
  2. +11 −16 _attachments/script/app.js
View
6 _attachments/index.html
@@ -16,11 +16,6 @@ <h1 id="site_header"><img src="images/icon.png" />Grocery List</h1>
<div style="clear:left;"></div>
</div>
<div id="content"></div>
-
- <div id="sidebar">
- <h2>Remember the what?!</h2>
- <p>When you remember it, add it here, and sync it with your CouchDB enabled phone.</p>
- </div>
</body>
<script src="script/sha1.js"></script>
<script src="script/json2.js"></script>
@@ -42,7 +37,6 @@ <h1 id="site_header"><img src="images/icon.png" />Grocery List</h1>
{{/items}}
</ul>
<p><em>Protip:</em> If you setup continuous replication between this database and a remote one, this list will reflect remote changes in near real-time.</p>
- <p>This would be a good place to add pagination.</p>
</script>
<script src="script/app.js"></script>
</html>
View
27 _attachments/script/app.js
@@ -22,7 +22,7 @@ $(function() {
$("li input").live("click", function(e) {
var li = $(this).parents("li")
var docid = li.attr("id");
- li.toggleClass("checked")
+ li.toggleClass("checked");
db.openDoc(docid, {success : function(doc) {
doc.check = e.currentTarget.checked
db.saveDoc(doc)
@@ -38,21 +38,16 @@ $(function() {
changeHandler.onChange(drawItems);
}
}
- $("#account").couchLogin({
- loggedIn : function(r) {
- $("#pleaselogin").remove();
- $("#create-message").couchForm({
- beforeSave : function(doc) {
- doc._id = $("li:first")[0].id+Math.random();
- doc.created_at = new Date();
- doc.check = false;
- return doc;
- }
- });
- $("#create-message").find("input").focus();
- },
- loggedOut : function() {
- $("#profile").append('<p id="pleaselogin">Please log in to create items.</p>');
+
+ $("#create-message").couchForm({
+ beforeSave : function(doc) {
+ var top = $("li:first")[0];
+ var newid = top ? top.id : '3';
+ doc._id = newid.substr(0,40) + Math.random();
+ doc.created_at = new Date();
+ doc.check = false;
+ return doc;
}
});
+ $("#create-message").find("input").focus();
});
Please sign in to comment.
Something went wrong with that request. Please try again.