cancel
Showing results for 
Search instead for 
Did you mean: 

Adding Content on Summary View for Facet

patrek
Star Contributor
Star Contributor

Hi,

I'm trying to figure out the best way to add content in the summary view if a facet is present for the document.

Already have an xhtml file with the content, but can't figure out how to declare it for it to show in the view.

Any pointer would be appreciated.

Thanks.

1 ACCEPTED ANSWER

Anahide_Tchertc
Elite Collaborator
Elite Collaborator

There are several ways to do that depending on how you'd like this feature to affect all document types, or whether you'd like to fine-tune it per document type.

To affect all document types, the easiest is to override the /incl/tabs/document_view.xhtml template to add your specific xhtml code.

To affect only some document types, you can package the xhtml code as a widget template, taking example on what's done for the widget showing comments in the summary, for instance: this template is at /widgets/summary/comments_widget_template.xhtml and its definition is made through extension points, you can browse it content here: org.nuxeo.ecm.platform.forms.layouts.webapp.summary

Note that the summary layout can be configured on documents by specifying the layout to use in the mode "summary", see for instance the specific configuration for the "Note" document type:

<type id="Note">
  [...]
  <layouts mode="summary">
    <layout>note_summary_layout</layout>
  </layouts>
  [...]
</type>

Defining your code as a widget template is also a good thing to be able to configure its presence on the summary view of a given document type using Nuxeo Studio.

View answer in original post

4 REPLIES 4

Daniel_Téllez
Champ in-the-making
Champ in-the-making

If you already have the content and the XHTML, what you have to do is to declare an action in a contrib to display your content. Something like this:

<?xml version="1.0" encoding="UTF-8"?>
<component name="my.component.name">

<extension target="org.nuxeo.ecm.platform.actions.ActionService"
  point="actions">

...

<action id="my_view" link="/incl/tabs/my_document_view.xhtml"
        enabled="true" label="My view" icon="/icons/file.gif" order="9">
  <category>VIEW_ACTION_LIST</category>
  <filter id="my_document_view_filter">
    <rule grant="true">
      <type>my_document</type>
    </rule>
  </filter>
</action>

...

</extension>
</component>

This will display your content as a new tab.

If the only thing you want is to display your content on summary, go to summary xhtml and include your own.

Anahide_Tchertc
Elite Collaborator
Elite Collaborator

There are several ways to do that depending on how you'd like this feature to affect all document types, or whether you'd like to fine-tune it per document type.

To affect all document types, the easiest is to override the /incl/tabs/document_view.xhtml template to add your specific xhtml code.

To affect only some document types, you can package the xhtml code as a widget template, taking example on what's done for the widget showing comments in the summary, for instance: this template is at /widgets/summary/comments_widget_template.xhtml and its definition is made through extension points, you can browse it content here: org.nuxeo.ecm.platform.forms.layouts.webapp.summary

Note that the summary layout can be configured on documents by specifying the layout to use in the mode "summary", see for instance the specific configuration for the "Note" document type:

<type id="Note">
  [...]
  <layouts mode="summary">
    <layout>note_summary_layout</layout>
  </layouts>
  [...]
</type>

Defining your code as a widget template is also a good thing to be able to configure its presence on the summary view of a given document type using Nuxeo Studio.

The problem with overriding, it makes you more fragile to updates in nuxeo-dm.

You're right, the second option is better in terms of maintenance.