reviewboard.reviews.templatetags.reviewtags¶
Tags related to review requests.
- display_review_request_trophies(context, review_request)[source]¶
Returns the HTML for the trophies awarded to a review request.
- comment_replies(context, review, comment, context_id)[source]¶
Render a list of replies to a comment.
This loads all the replies made to a particular comment and renders them in order by timestamp, showing the author of each comment, the timestamp, and the text in the appropriate format.
- Parameters:
context (
django.template.RequestContext
) – The template context for the page.review (
reviewboard.reviews.models.review.Review
) – The review being replied to.comment (
reviewboard.reviews.models.base_comment.BaseComment
) – The comment being replied to.context_id (
unicode
) – An internal ID used by the JavaScript code for storing and categorizing replies.
- Returns:
The resulting HTML for the replies.
- Return type:
django.utils.safestring.SafeText
- review_body_replies(context, review, body_field, context_id)[source]¶
Render a list of replies to a body field of a review.
This loads all the replies made to a review’s header/footer body field and renders them in order by timestamp, showing the author of each comment, the timestamp, and the text in the appropriate format.
- Parameters:
context (
django.template.RequestContext
) – The template context for the page.review (
reviewboard.reviews.models.review.Review
) – The review being replied to.body_field (
unicode
) – The body field to look up replies to. This can be eitherbody_top
orbody_bottom
.context_id (
unicode
) – An internal ID used by the JavaScript code for storing and categorizing replies.
- Returns:
The resulting HTML for the replies.
- Return type:
django.utils.safestring.SafeText
- Raises:
django.template.TemplateSyntaxError – There was an invalid
body_field
provided.
- reply_section(context, review, comment, context_type, context_id, reply_to_text='')[source]¶
Render a template for displaying a reply.
This takes the same parameters as
reply_list()
. The template rendered by this function,reviews/review_reply_section.html
, is responsible for invokingreply_list()
and as such passes these variables through. It does not make use of them itself.- Parameters:
context (
django.template.Context
) – The collection of key-value pairs available in the template.review (
reviewboard.reviews.models.Review
) – The review being replied to.comment (
reviewboard.reviews.models.BaseComment
) – The comment being replied to.context_type (
unicode
) – The type of comment being replied to. This is one ofdiff_comments
,screenshot_comments
,file_attachment_comments
,general_comments
(if the reply is to a comment), orbody_top
orbody_bottom
if the reply is to the header or footer text of the review.context_id (
unicode
) – The internal ID used by the JavaScript code for storing and categorizing comments.reply_to_text (
unicode
) – The text in the review being replied to.
- Returns:
The context to use when rendering the template included by the inclusion tag.
- Return type:
- reviewer_list(review_request)[source]¶
Returns a humanized list of target reviewers in a review request.
- for_review_request_field(context, nodelist, review_request_details, fieldset)[source]¶
Loops through all fields in a fieldset.
This can take a fieldset instance or a fieldset ID.
- for_review_request_fieldset(context, nodelist, review_request_details)[source]¶
Loop through all fieldsets.
- Parameters:
context (
dict
) – The render context.nodelist (
django.template.NodeList
) – The contents of the template inside the blocktag.review_request_details (
reviewboard.reviews.models.base_review_request_details.BaseReviewRequestDetails
) – The review request or draft being rendered.
- Returns:
The rendered tag contents.
- Return type:
- review_request_field(context, nodelist, review_request_details, field_id)[source]¶
Render a block with a specific review request field.
- Parameters:
context (
dict
) – The render context.nodelist (
django.template.NodeList
) – The contents of the template inside the blocktag.review_request_details (
reviewboard.reviews.models.base_review_request_details.BaseReviewRequestDetails
) – The review request or draft being rendered.field_id (
unicode
) – The ID of the field to add to the render context.
- Returns:
The rendered block.
- Return type:
- bug_url(bug_id, review_request)[source]¶
Returns the URL based on a bug number on the specified review request.
If the repository the review request belongs to doesn’t have an associated bug tracker, this returns None.
- star(context, obj)[source]¶
Render the code for displaying a star used for starring items.
The rendered code should handle click events so that the user can toggle the star. The star is rendered by the template
reviews/star.html
.- Parameters:
context (
django.template.RequestContext
) – The template context for the page.obj (
reviewboard.reviews.models.review_request.ReviewRequest
or :class:`` :class:`` :class:`` :class:`` :class:`` :class:`` :class:`` :class:`` :class:``reviewboard.reviews.models.group.Group
) –
- Returns:
The rendered HTML for the star.
- Return type:
django.utils.safestring.SafeText
- render_star(user, obj)[source]¶
Does the actual work of rendering the star. The star tag is a wrapper around this.
- comment_issue(context, review_request, comment, comment_type)[source]¶
Renders the code responsible for handling comment issue statuses.
- pretty_print_issue_status(status)[source]¶
Turns an issue status code into a human-readable status string.
- expand_fragment_link(context, expanding, tooltip, expand_above, expand_below, text=None)[source]¶
Renders a diff comment fragment expansion link.
This link will expand the context by the supplied expanding_above and expanding_below values.
expanding is expected to be one of ‘above’, ‘below’, or ‘line’.
- expand_fragment_header_link(context, header)[source]¶
Render a diff comment fragment header expansion link.
This link expands the context to contain the given line number.
- diff_comment_line_numbers(context, chunks, comment)[source]¶
Render the changed line number ranges for a diff, for use in e-mail.
This will display the original and patched line ranges covered by a comment, transforming the comment’s stored virtual line ranges into human-readable ranges. It’s intended for use in e-mail.
The template tag’s output will list the original line ranges only if there are ranges to show, and same with the patched line ranges.
- Parameters:
context (
django.template.Context
) – The template context.chunks (
list
) – The list of chunks for the diff.comment (
reviewboard.reviews.models.diff_comment.Comment
) – The comment containing the line ranges.
- Returns:
A string representing the line ranges for the comment.
- Return type:
- reviewable_page_model_data(context: ReviewRequestContext) → SafeString[source]¶
Output JSON-serialized data for a RB.ReviewablePage model.
The data will be used by
RB.ReviewablePage()
in order to populate the review request and editor with the necessary state.- Parameters:
context (
django.template.RequestContext
) – The current template context.- Returns:
The resulting JSON-serialized data. This consists of keys that are meant to be injected into an existing dictionary.
- Return type:
- render_review_request_entries(context, entries)[source]¶
Render a series of entries on the page.
- Parameters:
context (
django.template.RequestContext
) – The existing template context on the page.entries (
list
of :class:`` :class:`` :class:`` :class:`` :class:`` :class:`` :class:`` :class:`` :class:`` :class:`` :class:`` :class:`` :class:``reviewboard.reviews.detail.BaseReviewRequestPageEntry
) – The entries to render.
- Returns:
The resulting HTML for the entries.
- Return type:
- code_block(context, nodelist, lexer_name)[source]¶
Syntax-highlight a block of code using the given Pygments lexer name.
New in version 5.0.
- Parameters:
- Returns:
The resulting HTML.
- Return type:
Example
{% code_block "python" %} def my_func(a, b=1): pass {% end_code_block %}