481 |
481 |
482 showAllComments : function() { |
482 showAllComments : function() { |
483 checkForOpenedDialog(null, function() { |
483 checkForOpenedDialog(null, function() { |
484 gShowingAllComments = true ; |
484 gShowingAllComments = true ; |
485 var allTopComments = CY.Array.map(gDb.comments, function(c){return c.id;}) ; |
485 var allTopComments = CY.Array.map(gDb.comments, function(c){return c.id;}) ; |
|
486 // Reorder if by scope. |
|
487 if (parent.$("#browse_by").val() == 'scope') { |
|
488 allTopComments.sort(function (a,b) { |
|
489 if (gDb.ordered_comment_ids['scope'].indexOf(a) < gDb.ordered_comment_ids['scope'].indexOf(b)) |
|
490 return -1; |
|
491 if (gDb.ordered_comment_ids['scope'].indexOf(a) > gDb.ordered_comment_ids['scope'].indexOf(b)) |
|
492 return 1 |
|
493 return 0 |
|
494 }); |
|
495 } |
486 // GIB: go down the 'add comment' icon |
496 // GIB: go down the 'add comment' icon |
487 this.showComments(allTopComments, [0,30], true) ; |
497 this.showComments(allTopComments, [0,30], true) ; |
488 }, this, null) ; |
498 }, this, null) ; |
489 }, |
499 }, |
490 |
500 |
491 showScopeRemovedComments : function() { |
501 showScopeRemovedComments : function() { |
492 checkForOpenedDialog(null, function() { |
502 checkForOpenedDialog(null, function() { |
493 gShowingAllComments = true ; |
503 gShowingAllComments = true ; |
494 var scopeRemovedComments = CY.Array.filter(gDb.comments, function(comment) { return (comment.start_wrapper == -1) ; }) ; |
504 var scopeRemovedComments = CY.Array.filter(gDb.comments, function(comment) { return (comment.start_wrapper == -1) ; }) ; |
495 var scopeRemovedCommentIds = CY.Array.map(scopeRemovedComments, function(c){return c.id;}) ; |
505 var scopeRemovedCommentIds = CY.Array.map(scopeRemovedComments, function(c){return c.id;}) ; |
|
506 // Reorder if by scope. |
|
507 if (parent.$("#browse_by").val() == 'scope') { |
|
508 scopeRemovedCommentIds.sort(function (a,b) { |
|
509 if (gDb.ordered_comment_ids['scope'].indexOf(a) < gDb.ordered_comment_ids['scope'].indexOf(b)) |
|
510 return -1; |
|
511 if (gDb.ordered_comment_ids['scope'].indexOf(a) > gDb.ordered_comment_ids['scope'].indexOf(b)) |
|
512 return 1 |
|
513 return 0 |
|
514 }); |
|
515 } |
496 // GIB: go down the 'add comment' icon |
516 // GIB: go down the 'add comment' icon |
497 this.showComments(scopeRemovedCommentIds, [0,30], true) ; |
517 this.showComments(scopeRemovedCommentIds, [0,30], true) ; |
498 |
518 |
499 }, this, null) ; |
519 }, this, null) ; |
500 }, |
520 }, |