Page MenuHomePhabricator

Hide author data fields when they have no value
Closed, ResolvedPublicFeature

Assigned To
Authored By
Pepe_piton
Oct 9 2025, 5:31 PM
Referenced Files
Restricted File
Oct 15 2025, 1:04 AM
Restricted File
Oct 15 2025, 1:04 AM
Restricted File
Oct 9 2025, 7:43 PM
F66740479: Screenshot 2025-10-09 202804.png
Oct 9 2025, 7:32 PM
F66740475: Screenshot 2025-10-09 193602.png
Oct 9 2025, 7:32 PM
F66740415: Screen Shot 2025-10-09 at 6.54.29 PM.png
Oct 9 2025, 7:05 PM
F66740413: Screen Shot 2025-10-09 at 6.53.57 PM.png
Oct 9 2025, 7:05 PM
F66740396: biography-after.png
Oct 9 2025, 5:31 PM

Description

Feature summary: This feature aims to hide the author page data fields when they have no value. At the moment, when there is little data about an author, the page looks like this:

biography-before.png (389×501 px, 19 KB)

After the feature is implemented, that same page should look like this:

biography-after.png (187×464 px, 9 KB)

You can get a clue as to how to implement this solution by looking at how the "ethnicity" field is handled in the author.html template.

Benefits: This feature will give the author page a more elegant appearance, even when there is little data about the person.

Event Timeline

hello, @Pepe_piton
i made a merge request related this issue:-https://gitlab.wikimedia.org/toolforge-repos/paulina/-/merge_requests/33/diffs?commit_id=76eab43e749393767ccf01a582f37b7fa4439365
Changes made:

  • Added JavaScript check to hide rows with empty values dynamically.
  • Ensured template fields such as Nationality, Ethnicity, Occupation, and Date of Death are displayed only when data is available.
  • Tested locally — the layout now renders cleanly without blank rows.

I'd appreciate it if you could take a look at my work and provide feedback. I want to make sure I'm meeting expectations and understand any areas for improvemen

https://gitlab.wikimedia.org/toolforge-repos/paulina/-/merge_requests/36

Implemented the changes in the above PR
For displaying values of various fields, I employed a list of dicts (with field label and value) within the jinja template, iterating over them in a for loop. Skipping the ones where the value attribute of the dict is empty.

Kindly review. Thanks!

@Oluwatumininu.m, Thanks for your contribution. You catched the essence of the task: adding if statements with Jinja2 in the author.html page. Simple and readable. Congrats!

@Rolalove, You also did a good job, with a solution similar to Oluwatumininu.m, which is also the first solution I had in mind. You also made some code style improvements to the file, which are very nice, but keep in mind that sometimes if you include the code style improvements in the same PR as the feature, it can be a little tricky to review the feature.

@Dipanshu1223, You really surprised me with your Javascript approach! It works very well. Using the row classes, you managed to hide the empty fields.

@shreya-bhagat, Nice! You went a step further and leveraged Jinja2's features to create a loop for the biography table. The peculiarities of some fields (date of birth and date of death) added some complexity to the loop, but you managed to make it work well. This solution is also very nice because it reduces the number of lines.

Thanks again for your work. With different and clever approaches, you all solved the task.

@Oluwatumininu.m, Thanks for your contribution. You catched the essence of the task: adding if statements with Jinja2 in the author.html page. Simple and readable. Congrats!

Thank you so very much for the feedback @Pepe_piton

@Oluwatumininu.m, Thanks for your contribution. You catched the essence of the task: adding if statements with Jinja2 in the author.html page. Simple and readable. Congrats!

@Rolalove, You also did a good job, with a solution similar to Oluwatumininu.m, which is also the first solution I had in mind. You also made some code style improvements to the file, which are very nice, but keep in mind that sometimes if you include the code style improvements in the same PR as the feature, it can be a little tricky to review the feature.

@Dipanshu1223, You really surprised me with your Javascript approach! It works very well. Using the row classes, you managed to hide the empty fields.

@shreya-bhagat, Nice! You went a step further and leveraged Jinja2's features to create a loop for the biography table. The peculiarities of some fields (date of birth and date of death) added some complexity to the loop, but you managed to make it work well. This solution is also very nice because it reduces the number of lines.

Thanks again for your work. With different and clever approaches, you all solved the task.

Thank you so much for the detailed feedback @Pepe_piton .

Good afternoon,

I’m a little late to the party but since I’ve completed this microtask, I would very much appreciate comments and feedback from you @Nat_WDU and @Pepe_piton .

Please find attached my Merge Request.

Hello @Pepe_piton,

I would really love your feedback and comments on my solution.

I must say that I am delighted to finally be able to submit a merge request before the microtask is resolved. It is also a refresher for me as I have been away from Flask for a while.

Here is my Merge Request. Thank you.

Before
{F66751223}

After
{F66751226}

@Miiswom @Chumzine @Aradhya05 Good work!

Whether by identifying each field and putting an if statement in each one, as Miiswom and Chumzine did, or by building a loop, as Aradhya05 did, you achieved the expected result.

I merged @Chumzine solution. Thanks to everyone!

Pepe_piton claimed this task.