couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertkowalski <...@git.apache.org>
Subject [GitHub] couchdb-fauxton pull request: Api bar improvements
Date Mon, 25 Aug 2014 20:31:26 GMT
Github user robertkowalski commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/37#discussion_r16678740
  
    --- Diff: app/addons/fauxton/base.js ---
    @@ -268,15 +270,42 @@ function(app, FauxtonAPI, resizeColumns, Components, ZeroClipboard)
{
         events:  {
           "click .api-url-btn" : "toggleAPIbar"
         },
    +    
    +    initialize: function () {
    +      var hideAPIbar = _.bind(this.hideAPIbar, this),
    +          navbarVisible = _.bind(this.navbarVisible, this);
    +
    +
    +      $('body').on('click.apibar',function(e) {
    +        var $navbar = $(e.target);
    +        if (!navbarVisible()) { return;}
    +        if ($navbar.hasClass('.api-url-btn')) { return;}
    +
    +        if (!$navbar.closest('.api-navbar').length){
    +          hideAPIbar();
    +        }
    +      });
    +    },
     
    -    toggleAPIbar: function(e){
    -      var $currentTarget = $(e.currentTarget).find('span');
    -      if ($currentTarget.hasClass("fonticon-plus")){
    -        $currentTarget.removeClass("fonticon-plus").addClass("fonticon-minus");
    -      }else{
    -        $currentTarget.removeClass("fonticon-minus").addClass("fonticon-plus");
    +    navbarVisible: function () {
    +      return this.$('.api-navbar').is(':visible');
    +    },
    +
    +    cleanup: function () {
    +      $('body').off('click.apibar');
    +    },
    +
    +    hideAPIbar: function () {
    +      this.$('.api-navbar').velocity("reverse", 250);
    +      this.$('.api-navbar').hide();
    --- End diff --
    
    If you add the hide in the callback, you can see the animation. The hide is then called
after the animation finished.
    
    ```javascript
        hideAPIbar: function () {
          var $navBar = this.$('.api-navbar');
          $navBar.velocity("reverse", 250, function () {
            $navBar.hide();
          });
        },
    ```


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