Revision selectors
Review Request #6120 — Created July 19, 2014 and discarded
Adding revision selector for attachments. To avoid code duplication with existing selector for diffs, a common parent class called CommonRevisionSelectorView was created.
Tested as part of https://reviews.reviewboard.org/r/5824/
Description | From | Last Updated |
---|---|---|
__super__ isn't a public part of backbone's API. Instead, we should be using our own _super method: _super(this).initialize.apply(this, arguments); |
david | |
This won't quite work. Instead, you should use this: { attachmentRevisionText: iterpolate( gettext('Attachment Revision %s'), [this.options.revision]) } |
david | |
Same comment about __super__. Because you're specifying your own arguments, call is a better choice than apply: return _super(this).render.call( this, … |
david | |
This comment is wrong. |
david | |
There's no value variable delclared in this method, which means that this is global. It also seems like this method … |
david | |
What is '4'? |
david | |
This should use _super and call |
david | |
This comment is wrong. |
david | |
This should use _super and call |
david | |
This fits on one line |
david | |
I don't know what this comment is about. |
david | |
Remove this line? |
david | |
Add a blank line between these. |
david | |
_super |
david | |
_super and call |
david | |
_super and call |
david | |
_super and call |
david | |
This does exactly what the parent class' _onLabelClick implementation does, so you can remove it. |
david | |
Indentation is super weird here. |
david | |
This comment can go away. |
david | |
Did you mean to be passing an array for the argument? I suspect not. Also, this would all fit on … |
david | |
Did you mean to be passing an array for the argument? I suspect not. |
david | |
We should have slightly different labels between these two. For diffs, we want ['orig', '1', '2', '3', ...], because the … |
david | |
Doesn't this end up adding one too many ticks for file attachments? |
david | |
You're passing one single argument to the super render, which is an array of stuff. Based on your implementation above, … |
david | |
This should use _super and call |
david | |
Shouldn't have an array around ev. |
david |
-
-
__super__
isn't a public part of backbone's API. Instead, we should be using our own_super
method:_super(this).initialize.apply(this, arguments);
-
This won't quite work. Instead, you should use this:
{ attachmentRevisionText: iterpolate( gettext('Attachment Revision %s'), [this.options.revision]) }
-
Same comment about
__super__
.Because you're specifying your own arguments,
call
is a better choice thanapply
:return _super(this).render.call( this, this.options.numRevisions, true, 1);
-
-
There's no
value
variable delclared in this method, which means that this is global.It also seems like this method half assumes that there can be multiple handles, and half assumes that there's a single value.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Tool: PEP8 Style Checker Processed Files: reviewboard/staticbundles.py Ignored Files: reviewboard/static/rb/js/diffviewer/views/commonRevisionSelectorView.js reviewboard/static/rb/js/diffviewer/views/diffRevisionSelectorView.js reviewboard/static/rb/js/diffviewer/views/attachmentRevisionSelectorView.js Tool: Pyflakes Processed Files: reviewboard/staticbundles.py Ignored Files: reviewboard/static/rb/js/diffviewer/views/commonRevisionSelectorView.js reviewboard/static/rb/js/diffviewer/views/diffRevisionSelectorView.js reviewboard/static/rb/js/diffviewer/views/attachmentRevisionSelectorView.js
-
-
-
-
Did you mean to be passing an array for the argument? I suspect not. Also, this would all fit on one line.
-
-
We should have slightly different labels between these two.
For diffs, we want ['orig', '1', '2', '3', ...], because the options are to diff between the original file and one of the revisions, or between two of the revisions.
For file attachments, there's no 'orig', since there's no upstream version of the file. We therefore should have ['1', '2', '3', ...]
-
-
You're passing one single argument to the super
render
, which is an array of stuff. Based on your implementation above, each of these should just be additional arguments tocall
.Can you thoroughly test diffs and interdiffs to make sure you're not causing any regressions?
-
-
- Change Summary:
-
Addressed feedback, retested both attachment and diff selectors - they work as expected.
-
Tool: Pyflakes Processed Files: reviewboard/staticbundles.py Ignored Files: reviewboard/static/rb/js/diffviewer/views/commonRevisionSelectorView.js reviewboard/static/rb/js/diffviewer/views/diffRevisionSelectorView.js reviewboard/static/rb/js/diffviewer/views/attachmentRevisionSelectorView.js Tool: PEP8 Style Checker Processed Files: reviewboard/staticbundles.py Ignored Files: reviewboard/static/rb/js/diffviewer/views/commonRevisionSelectorView.js reviewboard/static/rb/js/diffviewer/views/diffRevisionSelectorView.js reviewboard/static/rb/js/diffviewer/views/attachmentRevisionSelectorView.js