Simplify and generalize review UI instantiation.
Review Request #4357 — Created July 23, 2013 and submitted
Simplify and generalize review UI instantiation. Review UIs no longer need their own custom templates to set up the models and views for UIs, or to allocate a location to pack it into. This is all standardized now in a default review UI template, and all the customization goes into the ReviewUI subclass. ReviewUI now has some new fields to set: name, js_view_class, js_model_class, and js_files. It also introduces get_js_model_data and get_js_view_data functions. 'name' indicates the displayed name of the review UI, or rather the type of thing being reviewed. This should generally be something like 'Image', 'PDF', etc. 'js_model_class' and 'js_view_class' are the names of the classes in JavaScript that are to be instantiated. These are assumed to be subclasses of AbstractReviewable and AbstractReviewableView. 'js_files' is a list of file paths. This is not fully fleshed out, and will more than likely be replaced after moving to require.js. 'get_js_model_data' and 'get_js_view_data' return data that will be serialized and passed to the model or view during instantiation. Review UIs should be updated to provide these and to remove the template_name and object_key fields. If they do need something special, they can override the default template. There are some blocks that can be used to add fine-grained changes.
Tested loading and reviewing screenshots and image file attachments. No problems. Unit tests pass.
-
This is a review from Review Bot. Tool: Pyflakes Processed Files: reviewboard/reviews/ui/screenshot.py reviewboard/reviews/ui/base.py reviewboard/reviews/ui/image.py Ignored Files: reviewboard/templates/reviews/screenshotindex.html reviewboard/templates/reviews/ui/default.html reviewboard/templates/reviews/ui/image.html reviewboard/templates/reviews/ui/screenshot.html