Permalink
Browse files

Hide stuff when it changes.

  • Loading branch information...
1 parent ea069a3 commit 9a1f0f545ce35a94b083d7f363aab765f877f979 @dustin dustin committed Aug 30, 2011
Showing with 7 additions and 4 deletions.
  1. +3 −1 _attachments/js/readme.js
  2. +1 −1 evently/items/_changes/mustache.html
  3. +1 −1 templates/item.html
  4. +2 −1 updates/set_state.js
@@ -10,7 +10,9 @@ function rm_init_update_links(app) {
data: 'new_state=' + encodeURIComponent(parts[0]),
dataType: "json",
complete: function(res) {
- console.log("Result", res);
+ if (res.responseText === 'change') {
+ $('#item-' + parts[1]).hide('fast');
+ }
}});
return false;
@@ -1,7 +1,7 @@
<h1>Recent Messages</h1>
<ul id="items">
{{#items}}
- <li>
+ <li id="item-{{_id}}">
<div class="header">
<img src="{{rm_favicon}}" alt="favicon" />
[<a href="#" class="statechange" id="done-{{_id}}"
View
@@ -1,4 +1,4 @@
-<li>
+<li id='item-{{_id}}'>
<div class="header">
<img src="{{rm_favicon}}" alt="favicon" />
[<a href="#" class="statechange" id="done-{{_id}}"
View
@@ -1,4 +1,5 @@
function(doc, req) {
+ var old_state = doc['rm_state'];
doc['rm_state'] = req.form.new_state;
- return [doc, 'State set to ' + doc['rm_state']];
+ return [doc, (old_state === req.form.new_state) ? "nochange" : "change"];
}

0 comments on commit 9a1f0f5

Please sign in to comment.