Ticket #567 (closed Enhancement: fixed)

Opened 7 years ago

Last modified 7 years ago

Webclient: a PageModel should provide access to its parent PageModel

Reported by: jri Owned by: jri
Priority: Major Milestone: Release 4.1.3
Component: DeepaMehta Standard Distribution Version: 4.1.2
Keywords: Cc: dgf, Malte
Complexity: 3 Area: Application Framework / API
Module: deepamehta-webclient

Description

This would allow for more complex detail panel render logic.
For concrete use cases see #541 and #566.

Change History

comment:1 Changed 7 years ago by jri

  • Status changed from new to accepted

comment:2 Changed 7 years ago by Jörg Richter

Webclient API: navigate parent page model (#567).

The format of the page model objects passed to renderers has slightly changed.
This breaks existing renderers (see below).
The standard renderers are adapted.

This fixes "File content renderer fails when embedded in parent topic" (see #566).

CHANGES

The page_model objects passed to a detail panel renderer (simple renderer or multi renderer) have an additional property:

parent -- the parent page model. Undefined for a top-level page model.

To e.g. access the parent topic from inside a simple render:

page_model.parent.object

BREAKING CHANGES

  • The page_model.toplevel_object property is gone. Use parent instead.

Note: you can navigate several levels up by chaining, e.g.:

page_model.parent.parent.object.id

Also consider using dm4c.selected_object which holds the object selected on the topicmap.

  • The arguments of the (client-side) option_topics hook are changed.

There is now a single page_model argument (instead of the former 3).

  • The arguments of dm4c.render.page_model.create_page_model() have changed:
    create_page_model(object, assoc_def, field_uri, render_mode, parent_page_model)
    

parent_page_model is new (for top-level page models pass undefined).
toplevel_object is gone.

  • The arguments of dm4c.render.page_model.extend_composite_page_model() have changed:
    extend_composite_page_model(object, assoc_def, field_uri, render_mode, page_model)
    

The 4th argument, toplevel_object, is gone.

See #567.

comment:3 Changed 7 years ago by jri

  • Status changed from accepted to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.