couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (COUCHDB-2215) Update Primary Nav bar to match new docs
Date Mon, 31 Mar 2014 20:39:16 GMT

    [ https://issues.apache.org/jira/browse/COUCHDB-2215?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13955682#comment-13955682
] 

ASF GitHub Bot commented on COUCHDB-2215:
-----------------------------------------

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

    https://github.com/apache/couchdb/pull/201#discussion_r11135546
  
    --- Diff: src/fauxton/app/addons/fauxton/base.js ---
    @@ -202,21 +202,17 @@ function(app, FauxtonAPI, resizeColumns) {
         afterRender: function(){
           $('#primary-navbar li[data-nav-name="' + app.selectedHeader + '"]').addClass('active');
     
    -      var menuOpen = true;
           var $selectorList = $('body');
    -      $('.brand').off();
    -      $('.brand').on({
    +      this.$('.burger').off();
    +      this.$('.burger').on({
             click: function(e){
    -          if(!$(e.target).is('a')){
                 toggleMenu();
    -          }
    -        }
    +         }
           });
     
           function toggleMenu(){
             $selectorList.toggleClass('closeMenu');
    -        menuOpen = $selectorList.hasClass('closeMenu');
    -        this.resizeColumns.onResizeHandler();
    +        app.windowResize.onResizeHandler();
    --- End diff --
    
    app doesn't exist in this context. I think you mean this.resize because this.resize is
defined in the initialize function.
    
    
    the reason this.resizeColumns.onResizeHandler(); wouldn't work inside this toggle menu
function is that it's context is outside the function. 
    
    toggleMenu's context (this) doesn't have a variable called resizeColumns.
    
    If you move toggleMenu out into the view's object, then it will have access to this.resizeColumns
because it shares a context with it.
    
    
    But in future, if you ever come across this kinda thing,  you can always pass a context
into a JS function using .call() or .apply()  or if you don't want to execute the function
yet, you can use underscore's _.bind() method. 
    
    An example so you know what I mean:
    
    var  foo = { 
           name: "sue"
    };
    
    function sayName(greeting){
        return greeting+" "+this.name;
    };    
    sayName.call(foo,"hi");
    
    



> Update Primary Nav bar to match new docs
> ----------------------------------------
>
>                 Key: COUCHDB-2215
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-2215
>             Project: CouchDB
>          Issue Type: Improvement
>      Security Level: public(Regular issues) 
>            Reporter: Sue Lockwood
>
> Update the animation.  Add the burger to the top, Logo at the bottom, don't seperate
the 2 menus. 



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message