Don't show the popup menu when only one type of document


Sometime i only have the possibility to add one type of document, It's possible to bypass the popup menu and directly move to the document creation layout ?

If i can't, i think i have to do a User Action who do the job.


0 votes

1 answers



In short: you could probably do it, but it would be complicated for what it's worth.

Here's a possible approach (not tested):

  • Override the default “newDocument” action (source) to make it hide when there's only <= 1 available type

     <rule grant="false">
        <condition>#{typesTool.getTypesList().size() <= 1}</condition>
  • Add a new user action (like you said), that will appear only in this case. A limitation is that you will have to explicitly specify the document type to be created, like with the “newWorskace” button (see the “link” attribute):

    <action ... link="#{documentActions.createDocument('Workspace')}">

You could hack this issue by making one button for each type and add some complex conditions, but it would get quite complicated.

Alternately, if you're not afraid of XHTML, you could write some code to tweak the "select_document_type.xhtml" template, which is more technical but probably a better idea.

0 votes