Skip to content
This repository has been archived by the owner on Feb 15, 2021. It is now read-only.

Commit

Permalink
enyo app now using web socket to delete docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mborho committed Aug 17, 2012
1 parent 532d335 commit f97113f
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions lib/static/app/build/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2695,31 +2695,32 @@ loadSource: function(e, t) {
return this.isNarrow() && this.$.contentPanel.setIndex(1), this.loadSourceInfo(t), this.$.mainline.loadSource(t), !0;
},
deleteItems: function(e, t) {
return this.$.mainline.handleSpinner(!0), this.connector.deleteDocs(t).response(this, "docsDeleted"), !0;
return this.$.mainline.handleSpinner(!0), this.socket.emit("removeDocs", {
docs: t,
all: !1
}), !0;
},
deleteSingleItem: function(e, t) {
return this.$.mainline.handleSpinner(!0), this.connector.deleteDocs(t).response(this, "singleDocDeleted"), !0;
return this.$.mainline.handleSpinner(!0), this.socket.emit("removeDoc", {
_id: t._id,
_rev: t._rev,
source: t._source
}), !0;
},
setSocket: function(e) {
this.socket = e;
var t = this;
this.socket.on("news", function(e) {
t.$.mainline.addPushedItem(e.doc), t.$.toc.addPushed(e.doc);
}), this.socket.on("removeDocsResult", function(e) {
e.success !== !0 && t.log("deleting failed"), t.log("pushed: removeDocsResult"), e.all === !0 ? t.log("chek next") : (t.log("hide docs"), t.log(e.deleted));
e.success !== !0 && t.error("deleting failed"), e.all !== !0 && (t.$.mainline.reload(), t.$.toc.removeDocs(e.deleted), t.$.mainline.changeSourceSum(-e.deleted.length));
}), this.socket.on("removeDocResult", function(e) {
t.log("pushed: removeDocResult"), e.success == 1 ? t.log("hide docs") : t.log("deleting failed");
e.success == 1 ? (t.$.toc.removeDocs([ e.doc ]), t.$.mainline.changeSourceSum(-1), t.$.mainline.handleSpinner(!1)) : t.error("deleting failed");
});
},
loadSourceInfo: function(e) {
this.connector.loadSourceInfo(e.skey).response(this.$.mainline, "gotSourceInfo");
},
docsDeleted: function(e, t) {
t.success == 1 && (this.$.mainline.reload(), this.$.toc.removeDocs(t.deleted), this.$.mainline.changeSourceSum(-t.deleted.length));
},
singleDocDeleted: function(e, t) {
t.success == 1 && (this.$.toc.removeDocs(t.deleted), this.$.mainline.changeSourceSum(-1), this.$.mainline.handleSpinner(!1));
},
checkSession: function() {
(new enyo.Ajax({
url: this.getApiEndpoint() + "/api/me"
Expand Down Expand Up @@ -3049,12 +3050,12 @@ _deleted: !0
}), this.doDeleteItems(n);
},
deleteItem: function(e, t) {
var n = this.lineActionIndex, r = this.results[n], i = [ {
var n = this.lineActionIndex, r = this.results[n], i = {
_id: r.doc_id,
_rev: r.rev,
source: r.skey,
_deleted: !0
} ];
};
return this.results[n].deleted = !0, this.$.list.setCount(this.results.length), this.doDeleteSingleItem(i), this.hideLineAction(), !0;
},
setSourceSum: function(e, t) {
Expand Down

0 comments on commit f97113f

Please sign in to comment.