@@ -169,7 +169,7 @@ qx.Class.define("osparc.dashboard.NewPlusMenu", {
169169 __addCategories : function ( categories ) {
170170 categories . forEach ( category => {
171171 const categoryHeader = this . self ( ) . createHeader ( category [ "title" ] , null , category [ "description" ] ) ;
172- categoryHeader . categoryId = category [ "id" ] ;
172+ categoryHeader [ " categoryId" ] = category [ "id" ] ;
173173 this . __categoryHeaders . push ( categoryHeader ) ;
174174 this . add ( categoryHeader ) ;
175175 } ) ;
@@ -181,35 +181,33 @@ qx.Class.define("osparc.dashboard.NewPlusMenu", {
181181 osparc . utils . Utils . setIdToWidget ( menuButton , templateData . idToWidget ) ;
182182
183183 if ( templateData . showDisabled ) {
184- if ( templateData . showDisabled ) {
185- menuButton . set ( {
186- enabled : false ,
187- toolTipText : templateData . description ,
184+ menuButton . set ( {
185+ enabled : false ,
186+ toolTipText : templateData . description ,
187+ } ) ;
188+ } else {
189+ const templateFound = templates . find ( t => t . name === templateData . expectedTemplateLabel ) ;
190+ if ( templateFound ) {
191+ if ( menuButton . getIcon ( ) === null && templateFound [ "thumbnail" ] ) {
192+ menuButton . setIcon ( templateFound [ "thumbnail" ] ) ;
193+ }
194+ menuButton . addListener ( "tap" , ( ) => {
195+ this . fireDataEvent ( "newStudyFromTemplateClicked" , {
196+ templateData : templateFound ,
197+ newStudyLabel : templateData . newStudyLabel ,
198+ } ) ;
188199 } ) ;
189200 }
190- let idx = null ;
191- if ( templateData . category ) {
192- idx = this . __getLastIdxFromCategory ( templateData . category ) ;
193- }
194- if ( idx ) {
195- this . addAt ( menuButton , idx + 1 ) ;
196- } else {
197- this . add ( menuButton ) ;
198- }
199- return ;
200201 }
201202
202- const templateFound = templates . find ( t => t . name === templateData . expectedTemplateLabel ) ;
203- if ( templateFound ) {
204- if ( menuButton . getIcon ( ) === null && templateFound [ "thumbnail" ] ) {
205- menuButton . setIcon ( templateFound [ "thumbnail" ] ) ;
206- }
207- menuButton . addListener ( "tap" , ( ) => {
208- this . fireDataEvent ( "newStudyFromTemplateClicked" , {
209- templateData : templateFound ,
210- newStudyLabel : templateData . newStudyLabel ,
211- } ) ;
212- } ) ;
203+ let idx = null ;
204+ if ( templateData . category ) {
205+ idx = this . __getLastIdxFromCategory ( templateData . category ) ;
206+ }
207+ if ( idx ) {
208+ menuButton [ "categoryId" ] = templateData . category ;
209+ this . addAt ( menuButton , idx + 1 ) ;
210+ } else {
213211 this . add ( menuButton ) ;
214212 }
215213 } ,
0 commit comments