Commenting functionality for text-based review UIs

Review Request #3613 — Created Dec. 2, 2012 and submitted — Latest diff uploaded


Review Board


Implement functionality to allow text-based rendered review UIs to be commented on. This would allow users to comment on Markdown, XML, and RST rendered UIs (to name a few).

The functionality is done by:
- Creating a TextBasedReviewable. This inherits from FileAttachmentReviewable. All text-based UIs must now inherit from TextBasedReviewable for commenting functionality.
- Creating a TextBasedCommentBlock view and model. These comment block view is used in TextBasedReviewable as the comment block view.

In TextBasedReviewable, each rendered element is wrapped with <div class="text-review-ui-container" data-child-id="{id of child}"></div> (Note: this is not done recursively. If there is a paragraph with multiple nested hyperlinks, only the paragraph will be wrapped -- not the nested hyperlinks). The id that is assigned is unique auto-incremented ID. If there are n elements that will be wrapped, the IDs will range from [0..n-1].

A ghost comment icon is also displayed for the comments. This styling for this has been borrowed from diffviewer. 
This patch was applied on r/3434 (Markdown Review UI) and all testing was done on that review UI.

- Created single comment
- Created multiple comments on the same element
- Created multiple comments on different elements

(Did the above 3 with issues as well)

In all tests, everything saved and published successfully. Upon refreshing the rendered UI, the comments were displayed in the ghost comment icon and mouseover/click worked. 

Additionally, I made sure that nothing was broken in side-by-side diff after I made changes to diffviewer.less.

This was tested on Chrome on Mac.