cancel
Showing results for 
Search instead for 
Did you mean: 

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

Smart_amp_Soft_
Confirmed Champ
Confirmed Champ

Hello,

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.

Thanks

1 REPLY 1

Marwane_K_A_
Star Contributor
Star Contributor

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>
      </rule>
    
  • 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.