Added Show Links for Interdiffs
Review Request #2810 — Created Jan. 21, 2012 and discarded
Added Show Links for Interdiffs. When a user uploads a diff, we show a link to the uploaded diff revision. We should also provide a linke to the interdiff, showing what's changed.
User Testing: Local testing done on Ubuntu 11.10 running Firefox 9.0.1 Integration Testing: Merge branch 'master' into interdiff Automated Testing: Tests Passed 470 (18 Skipped) PEP8
Description | From | Last Updated |
---|---|---|
Excellent Work! One thing: this could be "Show changes" rather than "See what's changed." Opinions? |
ME medanat | |
Wont work with multiple reviews |
CI cim1 | |
Can you break this into multiple lines to enhance readability? Also, I see a loose comma there, not sure what … |
ME medanat | |
These template tags are a little hard to read. Notice above how we do indentation within the tags, like so: … |
mike_conley | |
I'm not a template expert here, but looking above, I think we prefer: {% ifequal fieldinfo.title == "Diff" %} Also, … |
mike_conley | |
Same comment as above for this section, regarding indentation. |
mike_conley | |
You have trailing whitespace |
david | |
This line looks like more than 80 characters |
david | |
You don't need the parentheses. |
david | |
You can just use item[2] inline, instead of assigning it to diffset_id |
david | |
Trailing whitespace |
david | |
I know this isn't your code, but: This needs to be indented. |
ME medanat | |
Again, I know this isn't your code, but: This needs to be indented. |
ME medanat | |
Please use this form: {% if item.1 %} {% else %} {{item.0}} {% endif %} Makes it easier to read. |
chipx86 | |
Same here, and below. |
chipx86 | |
So, I'm actually not wild about using template tags for this. It's the wrong way to compute the logic. Instead, … |
chipx86 | |
Just for consistencies sake, lets use double quotes for 'added'. |
mike_conley | |
The {% of this endif should be at the beginning of the line, and the "e" of "endif" should be … |
mike_conley | |
We'll want to wrap "Show Changes" inside a trans. |
mike_conley | |
Same as above, re the alignment of {% endif %} |
mike_conley | |
This {% endif %} needs to be aligned like: {% endif %} |
mike_conley | |
Comma at the end of this. |
chipx86 | |
No need for parens unless it spans multiple lines. |
chipx86 | |
Should be pk= instead of id=. pk is an alias, but it's better to use it instead of hard-coding when … |
chipx86 | |
Mind fixing this line while you're in here? |
chipx86 | |
This one too. |
chipx86 | |
The HTML tags' indentation should be relative to the other HTML tags, not the templatetags. |
chipx86 | |
In Django, you never want to hard-code a URL. So, what you should do is use the {% url %} … |
chipx86 | |
Alignment is off. |
chipx86 | |
This should be inside the elif, and no blank line before the elif. |
chipx86 | |
This may trigger an additional query, so I'd recommend adding 'diffset_history__diffsets' to a review_request.select_related() query above. |
chipx86 | |
Curtis - can you (or ChipX86) confirm this does what ChipX86 asked? |
mike_conley | |
This must be aligned with the other parameters. |
chipx86 | |
No need for the \ |
chipx86 | |
Must be aligned. |
chipx86 | |
No need for the \. The reason being that it's in parens, so Python knows the line isn't ending. |
chipx86 |
-
3.png: New Feature - Screenshots:
-
Feature I Mimicked
- Change Summary:
-
Fixed issue, it now shows the incremental changes from a prior posted diff, and the version before it.
- Screenshots:
-
-
Well done Curtis. I personally love this feature. I can see you're your own worst critic, haha. As I mentioned earlier, I'm not a huge fan of "See what's changed", but that just may be me. Thanks! -Yazan
-
Can you break this into multiple lines to enhance readability? Also, I see a loose comma there, not sure what the purpose of it is.
-
- Change Summary:
-
Removed interdiff showing for files added/removed. Changed wording to Show Changes
-
Hey Curtis: This is good work! I'm a little concerned that we're getting a bit too logic-y in the template, and that templatetags might be of some better use... let's see what the others think. Review is below. Thanks! -Mike
-
These template tags are a little hard to read. Notice above how we do indentation within the tags, like so: {% for item in fieldinfo.info.removed %} {% if item.1 %}... {% else %}... {% endif %} {% endfor %} Can you make yours the same way, for readability?
-
I'm not a template expert here, but looking above, I think we prefer: {% ifequal fieldinfo.title == "Diff" %} Also, I'm a little worried that this conditional will break if/when we do localization... Is there no other, less localization-sensitive way of ensuring that this fieldinfo is about a diff? If not, perhaps a templatetag would be useful here.
-
- Change Summary:
-
Used a better approach for interdiffs thanks to Davids and Mikes code reviews, involving custom template tags. Cleaned up syntax. Merged with master. Ran automated tests.
- Description:
-
~ Added Show Links for Interdiffs.
~ Used a better approach for interdiffs thanks to Davids and Mikes code reviews, involving custom template tags. Cleaned up syntax.
- - When a user uploads a diff, we show a link to the uploaded diff revision. We should also provide a linke to the interdiff, showing what's changed. This can probably be titled "Show what's changed." <- I went with "See what's changed." to mimic how a similar feature works in a different part of reviewboard.
- Testing Done:
-
~ Local testing done on Ubuntu 11.10 running Firefox 9.0.1
~ User Testing: Local testing done on Ubuntu 11.10 running Firefox 9.0.1
+ Integration Testing: Merge branch 'master' into interdiff + Automated Testing: Tests Passed 470 (18 Skipped) - Diff:
-
Revision 7 (+137 -37)
- Description:
-
~ Used a better approach for interdiffs thanks to Davids and Mikes code reviews, involving custom template tags. Cleaned up syntax.
~ Added Show Links for Interdiffs.
+ + When a user uploads a diff, we show a link to the uploaded diff revision. We should also provide a linke to the interdiff, showing what's changed.
-
Something is pretty weird with your change: your diff seems to include several recently-committed changes.
-
-
-
Please use this form: {% if item.1 %} <a href="..."> {% else %} {{item.0}} {% endif %} Makes it easier to read.
-
-
So, I'm actually not wild about using template tags for this. It's the wrong way to compute the logic. Instead, this data should just be part of the fields_changed list generated in reviews/views.py in review_detail(). It already does a bunch of processing on things. It should add an additional URL for the interdiff (since it can easily calculate it there), and then the template just simply displays that URL.
-
-
-
-
-
Should be pk= instead of id=. pk is an alias, but it's better to use it instead of hard-coding when it comes to IDs.
-
-
-
-
In Django, you never want to hard-code a URL. So, what you should do is use the {% url %} tag. This takes a name and parameters. But, first you'll have to give the URL for what you want a name. This lives in reviews/urls.py. Look at the "# Review request interdiffs" section, at the first URL. You want to make this use the url() stuff, like elsewhere in the file. The name should be "view-interdiff". Then you'd use {% url view-interdiff review_request.display_id past_revision current_revision %}
-
For the select_related stuff, you'll need to first modify _find_review_request to take an optional extra parameter to specify what should be selected. The changes would end up looking something like: def _find_review_request(..., select_related=None): q = ReviewRequest.objects.all() if select_related: q = q.select_related(*select_related) if local_site_name: ... q = q.filter(local_site=local_site, local_id=review_request_id) else: q = q.filter(pk=review_request_id) try: review_request = q.get() except ReviewRequest.DoesNotExist: raise Http404 ... (You may have to make modifications to this) Then your call to _find_review_request at the top of review_detail would pass in a list of fields we want to query. The one you care about right now is "diffset_history__diffsets".
- Change Summary:
-
Implemented select_related() with the aid of Christian. Modified _find_review_request so that it would take an optional select_related paramater to perform when fetching the review request. Ran though PEP8. Automated Testing. Tests Passed 470 (18 Skipped)
- Testing Done:
-
User Testing: Local testing done on Ubuntu 11.10 running Firefox 9.0.1
Integration Testing: Merge branch 'master' into interdiff ~ Automated Testing: Tests Passed 470 (18 Skipped) ~ Automated Testing: Tests Passed 470 (18 Skipped) + PEP8