Fix ReviewBoxListView iteration over changedescs.

Review Request #4505 — Created Aug. 28, 2013 and submitted

Information

Review Board
master

Reviewers

Fix ReviewBoxListView iteration over changedescs.

Our markup for change description boxes is a little weird, where we end up with
multiple nested elements with the 'changedesc' class. ReviewBoxListView was
iterating over everything with that class to set up the collapsable boxes,
which worked okay, but as soon as I tried to add something else to it, things
got weird.

This changes ReviewBoxListView.el to point to #content, and then iterates only
over the children.
Used in conjunction with the markdown change.
Description From Last Updated

You can just do $('#content'). Backbone is going to turn it into a jQuery element anyway.

chipx86chipx86
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
      Ignored Files:
        reviewboard/static/rb/js/views/reviewBoxListView.js
    
    
  2. 
      
reviewbot
  1. This is a review from Review Bot.
      Tool: Pyflakes
      Processed Files:
      Ignored Files:
        reviewboard/static/rb/js/views/reviewBoxListView.js
    
    
  2. 
      
chipx86
  1. So, while this is fine, I think my original code was not optimal, and you can kill two birds with one stone.
    
    Instead of doing this.$('...'), first grab $('#content'), and then use .children('.changedesc') and .children('review'). That should save a *lot* of lookups, and avoid issues like this.
    1. Even better, use this.$el.children('...') and have ReviewBoxListView's el set to $('#content') instead of document.body.
  2. 
      
david
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
      Ignored Files:
        reviewboard/static/rb/js/views/reviewBoxListView.js
        reviewboard/static/rb/js/pages/views/reviewRequestPageView.js
    
    
  2. 
      
reviewbot
  1. This is a review from Review Bot.
      Tool: Pyflakes
      Processed Files:
      Ignored Files:
        reviewboard/static/rb/js/views/reviewBoxListView.js
        reviewboard/static/rb/js/pages/views/reviewRequestPageView.js
    
    
  2. 
      
chipx86
  1. Small thing, but looks good.
  2. You can just do $('#content'). Backbone is going to turn it into a jQuery element anyway.
  3. 
      
david
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to master (e4edf33).
Loading...