Jump to >

reviewboard.reviews.templatetags.reviewtags

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
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 either body_top or body_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 invoking reply_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 of diff_comments, screenshot_comments, file_attachment_comments, general_comments (if the reply is to a comment), or body_top or body_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

dict

reviewer_list(review_request)[source]

Returns a humanized list of target reviewers in a review request.

review_request_actions(context)[source]

Render all registered review request actions.

Parameters

context (django.template.Context) – The collection of key-value pairs available in the template.

Returns

The HTML content to be rendered.

Return type

unicode

child_actions(context)[source]

Render all registered child actions.

Parameters

context (django.template.Context) – The collection of key-value pairs available in the template.

Returns

The HTML content to be rendered.

Return type

unicode

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

unicode

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

unicode

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
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.

issue_status_icon(status)[source]

Return an icon name for the issue status.

Parameters

status (unicode) – The stored issue status for the comment.

Returns

The icon name for the issue status.

Return type

unicode

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’.

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
Returns

A string representing the line ranges for the comment.

Return type

unicode

reviewable_page_model_data(context)[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

unicode

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 reviewboard.reviews.detail.BaseReviewRequestPageEntry) – The entries to render.

Returns

The resulting HTML for the entries.

Return type

unicode