Add checkbox fields for review requests.

Review Request #9156 — Created Aug. 29, 2017 and submitted

Information

Review Board
release-3.0.x
90cdb26...

Reviewers

This change adds Python and JavaScript classes to add checkbox-type fields in
review requests. Extensions can use this very simply by just subclassing
BaseCheckboxField and providing field_id and label attributes. The
resulting boolean value will be stored in extra_data as expected.

  • Ran js-tests.
  • Ran unit tests.
  • Created a test extension that used a checkbox field and verified that the
    state was correctly rendered when loading the page and correctly stored when
    the checkbox was clicked.
Description From Last Updated

Can you add unit tests for the template rendering and for the backend/frontend of the checkbox?

chipx86chipx86

These are missing default return statements. We should be explicit.

chipx86chipx86

Can we call this get_dom_attributes, to differentiate it from other types (like model attributes)?

chipx86chipx86

I'd love to avoid having a separate function. It's common in HTML to use a form like checked="checked" for otherwise …

chipx86chipx86

bool

chipx86chipx86
chipx86
  1. 
      
  2. Show all issues

    Can you add unit tests for the template rendering and for the backend/frontend of the checkbox?

    1. The template rendering doesn't seem like a good candidate for a test. I'll extend the JS-side tests to include this.

  3. reviewboard/reviews/fields.py (Diff revision 1)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    Show all issues

    These are missing default return statements. We should be explicit.

  4. reviewboard/reviews/fields.py (Diff revision 1)
     
     
    Show all issues

    Can we call this get_dom_attributes, to differentiate it from other types (like model attributes)?

  5. reviewboard/reviews/fields.py (Diff revision 1)
     
     
    Show all issues

    I'd love to avoid having a separate function. It's common in HTML to use a form like checked="checked" for otherwise value-less attributes. We can just do that instead, instead of requiring multiple functions.

  6. 
      
david
chipx86
  1. 
      
  2. reviewboard/reviews/fields.py (Diff revision 2)
     
     
    Show all issues

    bool

  3. 
      
david
Review request changed
Status:
Completed
Change Summary:
Pushed to release-3.0.x (4f8a18b)