Improve file attachment comment links.
Review Request #4148 — Created May 14, 2013 and submitted — Latest diff uploaded
Improve file attachment comment links. The file attachment comments in reviews had a link which looks similar to diff comments. The text of this link is the filename, and the destination was the download URL. In the case where the attachment has a review UI, we want the link target to be the review UI instead of the download URL. This change adds that in (with the ability for the review UI to customize the link, for example, to link to a specific page). This also includes some code for the review UI to customize the text of the link, for example, to list which page the comment is on.
Tested this in conjunction with our premium pdf review UI.
reviewboard/reviews/models.py | |||
---|---|---|---|
Revision c12543c7489c322020c3eb3f85dd704be6d7199b | New Change | ||
1550 lines | |||
def thumbnail(self):
|
|||
1551 |
The thumbnail will be generated from the appropriate ReviewUI,
|
1551 |
The thumbnail will be generated from the appropriate ReviewUI,
|
1552 |
if there is one for this type of file.
|
1552 |
if there is one for this type of file.
|
1553 |
"""
|
1553 |
"""
|
1554 |
return self.file_attachment.review_ui.get_comment_thumbnail(self) |
1554 |
return self.file_attachment.review_ui.get_comment_thumbnail(self) |
1555 | 1555 | ||
1556 |
def get_absolute_url(self): |
||
1557 |
"""Returns the URL for this comment.""" |
||
1558 |
if self.file_attachment.review_ui: |
||
1559 |
return self.file_attachment.review_ui.get_comment_link_url(self) |
||
1560 |
else: |
||
1561 |
return self.file_attachment.get_absolute_url() |
||
1562 | |||
1563 |
def get_link_text(self): |
||
1564 |
"""Returns the text for the link to the file.""" |
||
1565 |
if self.file_attachment.review_ui: |
||
1566 |
return self.file_attachment.review_ui.get_comment_link_text(self) |
||
1567 |
else: |
||
1568 |
return self.file_attachment.filename |
||
1569 | |||
1556 |
def get_file(self): |
1570 |
def get_file(self): |
1557 |
""" |
1571 |
""" |
1558 |
Generates the file referenced by this
|
1572 |
Generates the file referenced by this
|
1559 |
comment and returns the HTML markup embedding it.
|
1573 |
comment and returns the HTML markup embedding it.
|
1560 |
"""
|
1574 |
"""
|
217 lines |
reviewboard/reviews/ui/base.py |
---|
reviewboard/templates/reviews/review_detail.html |
---|