couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertkowalski <...@git.apache.org>
Subject [GitHub] couchdb pull request: Some work on Config
Date Thu, 13 Mar 2014 17:10:39 GMT
Github user robertkowalski commented on a diff in the pull request:

    https://github.com/apache/couchdb/pull/174#discussion_r10574623
  
    --- Diff: src/fauxton/app/addons/config/resources.js ---
    @@ -97,22 +98,42 @@ function (app, FauxtonAPI) {
         },
     
         editValue: function (event) {
    -      this.$(".js-show-value").hide();
    -      this.$(".js-edit-value-form").show();
    +      this.$(".js-show-value").addClass("js-hidden");
    +      this.$(".js-edit-value-form").removeClass("js-hidden");
    +      this.$(".js-value-input").focus();
    +    },
    +
    +    processKeyEvents: function (event) {
    +      // Enter key
    +      if (event.keyCode === 13) {
    +        return this.saveAndRender();
    +      }
    +      // Esc key
    +      if (event.keyCode === 27) {
    +        return this.discardValue();
    +      }
         },
     
         saveValue: function (event) {
    --- End diff --
    
    Sorry for my late answer, I was busy @ work
    
    There is a reason for that: `saveValue` takes the event as parameter and if you want to
handle an event, like with `.stopPropagtion()` you could do it at this place. 
    
    After a possible eventhandling we are delegating to `this.saveAndRender()` which does
not need an event and does not know anything about eventhandling and can be safely called
programatically.
    
    A good example is at https://github.com/robertkowalski/couchdb/blob/config-rebased/src/fauxton/app/addons/config/resources.js#L109
where some special eventhandling happens.
    
    It's not used yet, but if someone wants to do things with the click-event like `preventDefault`
or `stopPropagation` it would be easier for them.


---
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