Tutorials

Custom Content View for Documentation Items

Updated: February 9, 2017 Page Information Edit on GitHub

At the first step of this tutorial, we created a new document type, called documentationItem.

Documentation items should be available in specific containers. This will enable us to add specific user actions, listing view and filters on this specific folder.

Creating a Folderish Document Type

In the Nuxeo Platform everything is a document. Folders or workspaces are documents that are set up with the facet "folderish". This facet enables any document type to have children.

Creating the Document Type

  1. In Studio, in Content model > Document Types, click on New.
  2. Fill in the creation popup and click on Next.

    • Feature ID: TechnicalDocumentationContainer
    • Extends: Nothing
    • Label: Technical Documentation Folder

Note:

We could extend the Folder document type to inherit its folderish facet. But it would also mean inheriting any other facet and schema the Folder document type has. So we decide not to extend Folder and to manually choose the facets we want.

Making the Document Type Folderish

  1. On the TechnicalDocumentationContainer Definition tab, choose the Collaboratives Spaces Category.
  2. Choose a nice icon.
  3. In Facets, select the Document is folderish facet. It automatically adds an Accepted children type section. No children are selected by default. The Show Create Child Action box is checked.
  4. In this Accepted children type section, select documentationItem.

Read more:

Defining the Folder Layouts

The container should just have a title and a description.

  1. Click on the Creation Layout tab.
  2. Click on the icon of the WARNING row and confirm deletion.
  3. Repeat step 2 on the View Layout and Edit Layout tabs.
  4. Click on Save.

Restricting Where documentationItem Documents Can Be Created

  1. Go to the documentationItem Definition tab.
  2. In the Container Types, remove Folder and Workspaces and add TechnicalDocumentationContainer.
  3. Click on Save. Documentation items can now be created in documentation containers only.

Testing Your Changes

  1. Redeploy your changes on your Nuxeo Platform.
  2. Create a technical documentation container in a workspace.
  3. In the container, create a new document. You only see a Technical Documentation Item.

Adapting the Listing in a Folder

The Content tab of a documentation container shows very generic information. It should show documentationItem metadata instead.

In Nuxeo, listings of documents are called Content Views. To show specific information in a documentation container, you need to create a new content view.

Creating a New Content View

  1. In Studio, go to Listings & Views > Content Views and click on New.
  2. Name it TechnicalDocListing.
  3. Click on Next.

Defining the Query

We want the documentation container to display the list of its children. So we will keep the default query filter but add a query parameter to get every document whose parent is the current document.

  1. Edit the query filter to add a parameter ecm:parentId= ?. You should get the filter below:

    ecm:mixinType != 'HiddenInNavigation' AND ecm:isCheckedInVersion = 0 AND ecm:currentLifeCycleState != 'deleted' AND ecm:parentId= ?
    
  2. In the Query parameter, click on Add and type the parameter below. It will define what to use as the value for ecm:parentId= ? defined above.

    #{currentDocument.id}
    

Defining the Filter Search Layout

We also want to be able to filter the documents inside our folder.

  1. In the Search layout part of the form, leave Display the form as a filter checked and choose Unfolded filter.
  2. In the Search layout, drag and drop the "Full Text" built-in widget.
  3. Drag and drop the Nature metadata from the quality schema.
  4. Edit the Nature widget.
    1. Select the widget type "Single directory suggestion" and choose the vocabulary qualNat.
    2. Keep the = operator.
  5. Click on Save.

Defining the Results Layout

  1. Click on the Results tab.
  2. Add two columns by clicking the Add column button.
  3. Drag the following into the results columns:

    • Built-in Widgets > Icon and document type
    • Built-in Widgets > Title with link

      Title with link widget

      You always need that widget if you want to be able to navigate to the documents displayed in the search results.

    • Widgets by Property > quality schema > Nature: On the Layout Widget Editor popup, select the Single directory suggestion widget type and the qualNat vocabulary.
    • Widgets by Property > quality schema > Process: On the Layout Widget Editor popup, select the Single directory suggestion widget type and the procQual vocabulary.
    • Widgets by Property > dublincore schema > Modified
    • Built-in Widgets > Lifecycle state
    • Built-in Widgets > Version
  4. Click on the icon to edit the columns labels. For instance you don't want a label for the Icon and document type column.
  5. Click on Save. We now have a new content view available but we need to use it with the TechnicalDocumentationContainer.

Using the New Content View

  1. In the Studio menu, click Content model > Document Types > TechnicalDocumentationContainer.
  2. Click on the Tabs tab.
  3. Click on the Content Views sub-tab.
  4. In the Main content field select the content view TechnicalDocListing.
  5. Click on Save.

Testing Your Changes

  1. Deploy your changes on your Nuxeo Platform.
  2. Go to the documentation folder created earlier and enjoy the results: If you deploy the filter, you will see that you can filter documents by Nature.

Congratulations

You now have a place to create documentation items. This new container leverages the specific metadata of documentation items.

To sum up what we saw:

  • A container document type is a document type with the Folderish facet.
  • The Container Types and Accepted Children types define containment rules.
  • The listing of a folder is called a content view and is composed of three elements:

    • A query that can hold dynamic parameters
    • A filter that can be used in the user interface
    • A result tab to display the returned documents

It is now time to add custom behaviors, such as the locking policy on which we initially decided.

6 months ago Solen Guitter NXDOC-1087: Use new previous/next navigation
7 months ago GitHub Fix capital letter
7 months ago Fred Vadon lts2016-review update technical documentation tuto
8 months ago Solen Guitter Fix screenshot size, remove empty lines and ' ', update review dates
8 months ago Solen Guitter NXDOC-966: Review custom content view for documentation items
8 months ago Andrew Goodricke Add content-review-lts2016 to labels
9 months ago Kevin Leturc NXP-19481: Update MarkLogic page to detail how to configure range element indexes
a year ago Manon Lumeau 42 | ix Studio menu label
2 years ago Solen Guitter 41
2 years ago Solen Guitter 40
2 years ago Solen Guitter 39 | Screenshot update
2 years ago Solen Guitter 38 | Use custom metatada for Nature
2 years ago Solen Guitter 37
2 years ago Solen Guitter 36 | Step formatting
2 years ago Solen Guitter 35
2 years ago Solen Guitter 34
2 years ago Solen Guitter 33
2 years ago Solen Guitter 32 | Using 2/3 page layout
3 years ago Solen Guitter 31
3 years ago Solen Guitter 30
3 years ago Solen Guitter 29
3 years ago Solen Guitter 28 | Added read more
3 years ago Solen Guitter 27 | Review steps
3 years ago Alain Escaffre 26
3 years ago Alain Escaffre 25
3 years ago Alain Escaffre 23
3 years ago Alain Escaffre 24
3 years ago Alain Escaffre 22
3 years ago Alain Escaffre 21
3 years ago Alain Escaffre 20
3 years ago Alain Escaffre 19
3 years ago Alain Escaffre 18
3 years ago Alain Escaffre 17
3 years ago Alain Escaffre 16
3 years ago Alain Escaffre 15
3 years ago Alain Escaffre 14
3 years ago Solen Guitter 13
4 years ago Solen Guitter 12
4 years ago Alain Escaffre 11
4 years ago Alain Escaffre 10
4 years ago Solen Guitter 9
4 years ago Solen Guitter 8 | Reorganized steps
4 years ago Frédéric Vadon 6
4 years ago Frédéric Vadon 7
4 years ago Frédéric Vadon 4
4 years ago Frédéric Vadon 5
4 years ago Frédéric Vadon 3
4 years ago Frédéric Vadon 2
4 years ago Frédéric Vadon 1
History: Created by Frédéric Vadon