T406989: Proof of concept for adding new statements through the Add Information button
Summary
This patch implements a Proof-of-Concept (PoC) for the "Add information" feature on the author page. This functionality allows a user to dynamically select a missing biographical field and displays the appropriate input control based on the expected data type. This focuses solely on creating a functional, user-friendly interface without connecting to a backend service.
Key Features Implemented
-
Dynamic Visibility: The "Add information" button is only displayed if the author is missing one or more biographical fields (e.g., 'Date of death', 'Nationality').
-
Dropdown Population: Upon clicking the button, it is replaced by a dropdown menu that only lists the fields currently missing from the biography table.
-
Dynamic Input Type: When a user selects a field from the dropdown, a text input box is displayed next to it.
-
For fields requiring structured data (like 'Date of birth' or 'Date of death'), the input type is dynamically set to type="date".
-
For all other fields, the input remains a standard type="text".
Code Changes
-
templates/author.html (HTML): Added the "Add information" button and the dynamic container elements (#add-info-controls, #field-dropdown-container, etc.) below the biography section.
-
templates/author.html (script): Added a new JavaScript block that:
-
Scans the DOM to determine truly missing fields from the biography table.
-
Hides the button if no fields are missing.
-
Handles the display toggle between the button and the controls.
-
Dynamically generates the dropdown and sets the correct input type (date or text) based on the field selected.
-
Jinja Templating: Used {% raw %} blocks and JavaScript variables to correctly handle Jinja translation calls within the script.
Testing Instructions






