[WIP] Add ability to embed per file diffs on external sites
Review Request #7890 — Created Jan. 17, 2016 and discarded — Latest diff uploaded
Currently, Review Board's diffs can only be viewed within Review
Board. Sometimes, however, it would be nice to take a diff and
show it on another webpage, muchlike you can with GitHub's Gists
service, or a YouTube video.This change creates an endpoint for the individual FileDiffs
from the DiffViewer for an iframe to point to. E.g.:reviews.reviewboard.org/r/(review_request_id)/diff/(revision)/embed/(filediff_id)/
When this endpoint is hit, the necessary files to display a single
Diff fragment are returned as if it were extracted from the DiffViewer.This change also includes a chain link icon beside the filename
in the diff viewer which, when clicked, shows a box with
pre-filled input fields which will hold embed and permalinks to
that file diff.The full URL is generated and placed in the diff viewer dropdown box
Previously, the path was only included and now the full URL, with
the HTTP host, is included.A new template has been created to display a diff fragment instead
of using the diff fragment template from the diff viewer. This will
save on loading more static files than necessary for the embedded
diff fragment and provides more control.The proper styles have been applied to the diff fragment embed so
the embedded diff now looks presentable and in-line with the RB
theme.The original diff fragment view and the diff fragment embed view
shared a lot of the same code. Similar code between these two
class based views were extracted into a parent class.A link was also added to the embedded diff fragment that easily
allows a user to view the full diff on review board.
- Tested URI in browser with no ill side effects.
- Embed box needs to be fixed in Safari. Timeout is too fast.