couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From garrensmith <...@git.apache.org>
Subject [GitHub] couchdb pull request: Implement bulk deletion for all-docs-listing
Date Mon, 12 May 2014 09:53:00 GMT
Github user garrensmith commented on a diff in the pull request:

    https://github.com/apache/couchdb/pull/221#discussion_r12520699
  
    --- Diff: src/fauxton/app/addons/documents/views.js ---
    @@ -562,6 +563,59 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
           this.params = options.params || {};
           this.expandDocs = true;
           this.perPageDefault = this.docParams.limit || 20;
    +
    +      this.bulkDeleteDocsCollection = options.bulkDeleteDocsCollection;
    +      this.bulkDeleteDocsCollection.fetch({reset: true});
    +    },
    +
    +    removeDocuments: function (ids) {
    +      _.each(ids, function (id) {
    +        this.removeDocument(id);
    +      }, this);
    +    },
    +
    +    removeDocument: function (id) {
    +      this.rows[id].$el.fadeOut(function () {
    +        $(this).remove();
    +      });
    +    },
    +
    +    showError: function (ids) {
    +      if (ids) {
    +        showError('Failed to destroy: ' + ids.join(', '));
    +        return;
    +      }
    +
    +      showError('Failed to destroy your doc!');
    +    },
    +
    +    toggleDocument: function (event) {
    +      this.toggleTrash();
    +
    +      var docId = this.$(event.target).closest('tr').attr('data-id'),
    +          db = this.database.get('id'),
    +          rev = this.collection.get(docId).get('_rev'),
    +          data = {_id: docId, _rev: rev, _deleted: true};
    +
    +      if (this.$(event.target).is(':checked')) {
    +        this.bulkDeleteDocsCollection.add(new Documents.BulkDeleteDoc(data));
    --- End diff --
    
    I don't think you need to do `new Documents.BulkDeleteDoc`, backbone will create the model
for you when adding.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message