Skip to content

Commit

Permalink
redraw lists on logout and login
Browse files Browse the repository at this point in the history
  • Loading branch information
jchris committed Jul 12, 2010
1 parent c338bf7 commit 483c711
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
7 changes: 6 additions & 1 deletion _attachments/index.html
Expand Up @@ -22,8 +22,13 @@ <h1><a href="index.html">Focus</a>: <span id="nav"></span></h1>
$("#nav").evently("nav", app);
$.evently.connect("#account","#profile", ["loggedIn","loggedOut"]);
$.evently.connect("#account","#nav", ["loggedIn","loggedOut"]);

$("#items").evently("items", app);
$("#account").bind("loggedIn", function() {
$("body").trigger("evently-changes-"+app.db.name);
});
$("#account").bind("loggedOut", function() {
$("body").trigger("evently-changes-"+app.db.name);
});
$.pathbinder.begin("/focus");
});
}, 100); // wish there was a better way to keep the URL bar from showing loading forever on Android
Expand Down
2 changes: 1 addition & 1 deletion evently/items/focus/after.js
@@ -1,7 +1,7 @@
function() {
var widget = $(this), app = $$(widget).app;
$.evently.followChanges(app);
$("body").bind("evently.changes."+app.db.name, function(e, resp) {
$("body").bind("evently-changes-"+app.db.name, function(e, resp) {
$('ul', widget).trigger("_init");
});
};
10 changes: 1 addition & 9 deletions evently/items/team/after.js
@@ -1,17 +1,9 @@
function(e, p) {
// set app to connect to changes with include docs (or support upgrade...)
// filter js is a function to say whether or not you care about an update...
// maybe there is a way to have it interact with startkey - endkey and the view definition?
// autofilter for query json

var ul = $(this), app = $$(ul).app;
$.evently.followChanges(app);
$("body").bind("evently.changes."+app.db.name, function(e, resp) {
$("body").bind("evently-changes-"+app.db.name, function(e, resp) {
$.each(resp.results, function() {
$('li[data-user="'+this.doc.profile.name+'"].user ul', ul).trigger("_init");
});
});
// connect to changes
// parse the ids
// trigger dom elements that match them
};
4 changes: 2 additions & 2 deletions vendor/couchapp/_attachments/jquery.evently.js
Expand Up @@ -108,7 +108,7 @@ function $$(node) {
}

if (app && events._changes) {
$("body").bind("evently.changes."+app.db.name, function() {
$("body").bind("evently-changes-"+app.db.name, function() {
// we want to unbind this function when the element is deleted.
// maybe jquery 1.4.2 has this covered?
// $.log('changes', elem);
Expand Down Expand Up @@ -318,7 +318,7 @@ function $$(node) {
// only start one changes listener per db
function followChanges(app) {
var dbName = app.db.name, changeEvent = function(resp) {
$("body").trigger("evently.changes."+dbName, [resp]);
$("body").trigger("evently-changes-"+dbName, [resp]);
};
if (!$.evently.changesDBs[dbName]) {
if (app.db.changes) {
Expand Down

0 comments on commit 483c711

Please sign in to comment.