Skip to content

Draw section headings inside a fieldset - #3051

Open
ramonski wants to merge 3 commits into
2.xfrom
feature/setup-fieldset-sections
Open

ramonski wants to merge 3 commits into
2.xfrom
feature/setup-fieldset-sections

Conversation

@ramonski

@ramonski ramonski commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Description of the issue/feature this PR addresses

The SENAITE setup has tabs that hold twenty settings each. Analyses mixes display options, verification, result formatting, rejection and registration into one list, and Sampling runs the optional workflow steps straight into the turnaround times.

A fieldset cannot be broken up further. plone.supermodel's Fieldset holds a label, a description and a flat list of field names, and nothing else, so the only way to group within a tab today is to make more tabs. That scatters settings that belong together and breaks the deep links into #analyses.

Current behavior before PR

ANALYSES

  Categorise analysis services          [x]
  Categorize sample analyses            [x]
  Sample analyses required              [ ]
  Allow manual result capture date      [ ]
  Enable analysis specifications        [x]
  Exponential format threshold          [7]
  Immediate results entry               [ ]
  Enable analysis remarks               [ ]
  Automatic verification of samples     [x]
  Allow self-verification of results    [ ]
  Number of required verifications      [1]
  ...

Desired behavior after PR is merged

A schema can name the field that opens a section and the heading drawn above it:

ISetupSchema.setTaggedValue(FIELDSET_SECTIONS, {
    "categorise_analysis_services": _("Display"),
    "auto_verify_samples": _("Verification"),
    ...
})
ANALYSES

  DISPLAY
  ─────────────────────────────────────
  Categorise analysis services          [x]
  Categorize sample analyses            [x]
  ...

  VERIFICATION
  ─────────────────────────────────────
  Automatic verification of samples     [x]
  Allow self-verification of results    [ ]
  Number of required verifications      [1]

Twelve headings over the four longest tabs: Analyses, Appearance, Sampling and Notifications.

Implementation

Small, because the pieces were already there. SenaiteRenderWidget and its widget.pt already replace the ones from plone.app.z3cform, so the heading is a lookup on the widget's own schema and five lines of template:

  • senaite.core.config.FIELDSET_SECTIONS, the tagged value key
  • SenaiteRenderWidget.get_section_heading, which reads it off widget.field.interface
  • the heading in widget.pt, above the field wrapper, under tal:condition
  • the style in forms.scss

A field that is not named renders exactly as before, so a schema that declares no sections is untouched. No new view, adapter or registration.

Verification

The twelve headings render on the setup edit form, and an edit form of a schema that declares none is byte for byte what it was. Checked both on a running instance.

Full senaite.core test suite: 229 tests, 0 failures, 0 errors.

--
I confirm I have tested this PR thoroughly and coded it according to PEP8
and Plone's Python styleguide standards.

A fieldset is a flat list of fields: plone.supermodel's Fieldset holds
field names and nothing else, so a tab of twenty settings can only be
broken up by making more tabs, which scatters settings that belong
together.

A schema can now name the field that opens a section and the heading
drawn above it, through the senaite.core.fieldset_sections tagged
value. A field that is not named renders exactly as before, so nothing
changes on a schema that declares none.

The SENAITE setup declares them for its four longest tabs.
The two JavaScript sourcemaps the build rewrote are left out: no
JavaScript changed, only the stylesheet.
@ramonski ramonski added the Enhancement ✨ Improvement to existing functionality label Oct 8, 2026
@ramonski
ramonski requested a review from xispa October 8, 2026 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement ✨ Improvement to existing functionality

Development

Successfully merging this pull request may close these issues.

1 participant