Centralize the templates used for review request page entries.

Review Request #9038 - Created June 27, 2017 and submitted

Christian Hammond
Review Board
release-3.0.x
988be7b...
reviewboard

Entries on the review request page (reviews, changes, and the initial
status updates) now share the same base templates, with information
provided by the entry classes on the Python side.

The base template provides the general structure used for boxes on the
review request page, handling anchors, avatars, labels, the header,
banners, and container for the main content. The specific entries
subclass this, filling out the necessary blocks to set the CSS classes,
header title, entry content, labels, etc. that are needed.

Avatars are based on a new avatar_user attribute on entries. If set,
and if avatars are enabled, that user's avatar will be rendered.
Templates can also provide custom images to use here.

There's now only a single JavaScript template for constructing the
model/view for each entry. The data and options are provided by new
methods on the entry classes on the Python side, as are the names of the
model/view JavaScript classes to use.

These changes make it easier to maintain entries, and will lead to
extension-provided entries for the review request page.

Tested that reviews, replies, changes (with and without status updates),
and the initial status updates entries all looked correct and all had
complete functionality (replying, collapsing, revoking Ship Its, etc. all
worked).

Tested with avatars enabled and disabled.

  • 0
  • 0
  • 0
  • 14
  • 14
Description From Last Updated
Checks run (1 failed, 1 succeeded)
flake8 passed.
JSHint failed.

JSHint

David Trowbridge
  1. 
      
  2. Please use either "status_area" or "status_updates_area" to be consistent with the naming throughout the rest of the code.

    1. This isn't about status updates. This is the box-statuses section of the entry box where the Ship It and the Fix It labels are, along with avatars. It predates the status updates work.

    2. My bad.

    3. No worries, very easy to confuse the two. We might want to rename the thing on the side.

  3. Please call this "box-status-updates"

  4. Please use either "status_area" or "status_updates_area" to be consistent with the naming throughout the rest of the code.

  5. Please use either "status_area" or "status_updates_area" to be consistent with the naming throughout the rest of the code.

  6. 
      
Christian Hammond
Review request changed

Change Summary:

  • StatusUpdatesEntryMixin now inherits from DiffCommentsSerializerMixin and ReviewSerializerMixin and provides a common version of get_js_model_data.
  • JavaScript model data for reviews and diff comments is now only serialized if there's something to serialize (no more empty entries).

Commit:

-41260af4df16fd1246da79c3c6c06f3d14938dec
+988be7b39d2b0a85a810c5e3134c9d1fa9528b37

Diff:

Revision 2 (+382 -255)

Show changes

Checks run (1 failed, 1 succeeded)

flake8 passed.
JSHint failed.

JSHint

David Trowbridge
  1. Ship It!
  2. 
      
Christian Hammond
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-3.0.x (dfa1389)
Loading...