Page MenuHomePhabricator

Customize the work page according to the type of work
Open, MediumPublic

Description

Feature summary: Work pages should include different fields (properties) depending onthe type of work. For example, books should include the property "Publication date" (Property 577) while paintings should include the property "Inception" (Property 571).

Use case(s): At this moment, the pages are designed with a book model in mind. For this reason, when the work is a painting, a movie, or another type of work, there are some fields (dates, languages, etc.) that are left empty because they do not use the same properties as books. Even the placeholder image used when there is no descriptive image of the object is a generic book. The page for each type of work should have specific properties.

Benefits: Customizing the properties of each type of work can be a slow and difficult job, but it will serve to provide complete and accurate information regardless of the type of work.

Event Timeline

Pepe_piton triaged this task as Medium priority.Jul 16 2024, 3:10 PM
Pepe_piton updated the task description. (Show Details)

@Pepe_piton I've worked on this. Please kindly review it.

The changes I made:

  • Created a method to detect the type of work based on the P31 (instance of) property and mapping Q IDs to types: painting, film, sculpture, book, album, artwork.
  • Implemented type-specific property loading
  • Created a function to handle complex quantity values (duration, dimensions)
  • Update app.py to pass and get date and type-specific properties based on work type
  • Updated template with conditional rendering to show different properties based on work_typ

Result: Each work type now displays contextually appropriate information instead of generic properties for all works.

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

Waiting for your feedback