• 
      

    Add new standard support for subforms on pages.

    Review Request #10950 — Created March 12, 2020 and submitted

    Information

    Review Board
    release-4.0.x
    51021eb...

    Reviewers

    We have a number of pages in the administration UI today that make use
    of subforms, which are forms dynamically hidden or shown based on
    the selection on another form control. Each one of these had to be
    written manually, which made implementations inconsistent and sometimes
    buggy.

    This change introduces a new formal subform implementation, which we'll
    be able to start using in the settings pages. There are several new
    things introduced here:

    1. An -is-subform modifier on rb-c-form-fieldset, which turns a
      fieldset into a subform.

    2. Data attributes for specifying a subform group, ID, and a controller
      element ID (which is used to automatically manage subform displays).

    3. Guidance on setting both the disabled and hidden attributes to
      ensure the form's data won't be validated or sent to the server, and
      hiding the form from display and from screen readers (note that
      hidden is an HTML 5.1 attribute, which is available in all our
      supported browsers, including IE11).

    4. Support in RB.FormView for automatically setting up and managing
      subform state based on the data attributes.

    5. Standard templates for representing a form instance as a subform,
      and a dictionary of subform IDs to forms as subforms.

    Upcoming changes will update other forms to use this, fixing our form
    validation issues on Django 1.11.

    Unit tests pass.

    Made use of this to update all the existing subforms (which will be
    in an upcoming change). Verified everything worked as expected.

    Description From Last Updated

    Col: 48 ['group1'] is better written in dot notation.

    reviewbot reviewbot

    Col: 48 ['group2'] is better written in dot notation.

    reviewbot reviewbot

    Col: 41 ['group1'] is better written in dot notation.

    reviewbot reviewbot

    Col: 51 ['subform1'] is better written in dot notation.

    reviewbot reviewbot

    Col: 41 ['group1'] is better written in dot notation.

    reviewbot reviewbot

    Col: 51 ['subform2'] is better written in dot notation.

    reviewbot reviewbot

    Col: 41 ['group2'] is better written in dot notation.

    reviewbot reviewbot

    Col: 51 ['subform3'] is better written in dot notation.

    reviewbot reviewbot

    Col: 41 ['group2'] is better written in dot notation.

    reviewbot reviewbot

    Col: 51 ['subform4'] is better written in dot notation.

    reviewbot reviewbot

    Should be "Render the view"

    david david

    Should this really be set to have a default, since options.group is required? Perhaps we should remove the default value …

    david david

    controllerGroup?

    david david
    Checks run (1 failed, 1 succeeded)
    flake8 passed.
    JSHint failed.

    JSHint

    chipx86
    david
    1. 
        
    2. Show all issues

      Should be "Render the view"

    3. Show all issues

      Should this really be set to have a default, since options.group is required? Perhaps we should remove the default value and then assert on options?

      1. I was just aiming to make the errors fully about the parameters (if you provide a blank options, you're not doing any better), but I can change that.

    4. Show all issues

      controllerGroup?

      1. Oops, search/replace issue. Was changing "category" to "group". Missed fixing this one.

    5. 
        
    chipx86
    david
    1. Ship It!
    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-4.0.x (ea878e6)