Hackpads are smart collaborative documents. .

Israel M.

570 days ago
Unfiled. Edited by Israel M. 570 days ago
Israel M Israel Madueme
  • Finishing Checklist Extension
Fall 2015
640 days ago
Unfiled. Edited by Israel M. 640 days ago
  • Add dependencies (Week 1 - 18 Jan)
570 days ago
Unfiled. Edited by Israel M. 570 days ago
Israel M Custom Review Request Field Types
  • Project Description
See the Sonar project page for a detailed description. Basically Review Board has always had the ability for Extensions (or even the core) to add additional fields to a review request, for example for a company to track internal metadata. Unfortunately, these fields have always been limited to text or markdown. This project will be adding support for other field types like checkboxes, date selectors, dropdowns, and even custom fields defined by an ExtensionHook.
  • Useful docs I've read
Well since you asked...
  • What handles what?
Inside `reviewboard/reviews/fields.py` are the python classes that an extension can subclass to register a new field to a review request. These python classes handle the serialization of the field on the backend side as well as rendering the saved info as html. These are not responsible for creating the editors that let users change the field's value.
Inside `reviewboard/static/rb/js/views/reviewRequestEditorView.js` is the Backbone View that handles creating the overall structure for editing a review request as well as the individual field editors. Before the backbone view is initialized, the original html that the server responds with already contains some basic templating which allows this view to know where to render each field editor. Depending on the CSS classes of a field's containing element the field can be rendered differently. For example, a field without the 'editable' css class won't even be given an editor component.
  • What to do...what to do...
The main methods in this backbone view for this project are `render()`, `setupFieldEditors`, and `_buildEditor`. `_buildEditor` uses the inlineEditor component from Djblets as well as a TextEditorView to create the fancy textbox editors that also support markdown. I am wondering whether I should edit the `_buildEditor` method to support other field types, or whether I should create analogous `_bulidCheckboxEditor`, `_buildDropdownEditor`, etc, methods for each field type.
  • What I've gotten so far
So far I've been able to subclass the `BaseReviewRequestField` to create a custom field type that renders itself purple. I modified the `rbnotefield` extension from the rb-extension-pack project to test this out. I've also modifed the client side js to inject a checkbox input field instead of the default text editor. You can see a picture of this below, but, obviously there's a lot more work to be done...
634 days ago

Contact Support

Please check out our How-to Guide and FAQ first to see if your question is already answered! :)

If you have a feature request, please add it to this pad. Thanks!

Log in