Github user benkeen commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/204#discussion_r22266659
  
    --- Diff: app/addons/documents/views-doceditor.js ---
    @@ -398,77 +307,88 @@ function (app, FauxtonAPI, Components, Documents, 
Databases, prettify) {
                 msg: 'Save failed: ' + responseText,
                 type: 'error',
                 fade: false,
    -            clear: true,
    -            selector: '#doc .errors-container'
    +            clear: true
               });
             });
           } else if(this.model.validationError && this.model.validationError 
=== 'Cannot change a documents id.') {
    -          FauxtonAPI.addNotification({
    -            msg: 'Cannot save: ' + 'Cannot change a documents _id, try 
Duplicate doc instead!',
    -            type: 'error',
    -            selector: '#doc .errors-container',
    -            clear:  true
    -          });
    +        FauxtonAPI.addNotification({
    +          msg: 'Cannot save. Cannot change a documents _id, try Clone 
Document instead!',
    +          type: 'error',
    +          clear:  true
    +        });
             delete this.model.validationError;
           } else {
             FauxtonAPI.addNotification({
    -          msg: 'Please fix the JSON errors and try again.',
    +          msg: 'Please fix the JSON errors and try saving again.',
               type: 'error',
    -          selector: '#doc .errors-container',
               clear:  true
             });
           }
         },
     
         getDocFromEditor: function () {
    -      var json;
    -
           if (!this.hasValidCode()) {
             return false;
           }
    -
    -      json = JSON.parse(this.editor.getValue());
    -
    +      var json = JSON.parse(this.editor.getValue());
           this.model.clear().set(json, {validate: true});
           if (this.model.validationError) {
             return false;
           }
    -
           return this.model;
         },
     
    -    hasValidCode: function () {
    -      var errors = this.editor.getAnnotations();
    -      return errors.length === 0;
    +    beforeRender: function () {
    +      var that = this;
    +
    +      this.uploadModal = this.setView('#upload-modal', new 
this.components.uploadModal({ model: this.model }));
    +      this.duplicateModal = this.setView('#duplicate-modal', new 
this.components.duplicateDocModal({ model: this.model }));
    +      this.confirmDeleteModal = this.setView('#delete-doc-modal', new 
this.components.confirmModal({
    +        text: 'Are you sure you want to delete this document?',
    +        action: that.deleteDocument
    --- End diff --
    
    Hmm seems like this should work, but I still get errors. For now I'll add 
the _.bindAll back in, because it's the only method I've found that works. 
Let's talk in the new year.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to