Fix ReviewBoxListView iteration over changedescs.
Review Request #4505 — Created Aug. 28, 2013 and submitted
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. |
chipx86 |
-
This is a review from Review Bot. Tool: Pyflakes Processed Files: Ignored Files: reviewboard/static/rb/js/views/reviewBoxListView.js
-
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.
- Change Summary:
-
Make suggested change.
- Description:
-
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. ~ I tried to disentagle the styles but it's kind of a mess. Instead, I've fixed
~ the javascript to avoid .changedesc.box and only use .changedesc. ~ This changes ReviewBoxListView.el to point to #content, and then iterates only
~ over the children.
-
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
-
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