@@ -14,6 +14,9 @@ qx.Class.define("osparc.form.tag.TagItem", {
14
14
construct : function ( ) {
15
15
this . base ( arguments ) ;
16
16
this . _setLayout ( new qx . ui . layout . HBox ( 5 ) ) ;
17
+ this . set ( {
18
+ alignY : "middle" ,
19
+ } ) ;
17
20
this . __validationManager = new qx . ui . form . validation . Manager ( ) ;
18
21
} ,
19
22
@@ -94,25 +97,26 @@ qx.Class.define("osparc.form.tag.TagItem", {
94
97
let control ;
95
98
switch ( id ) {
96
99
case "tag" :
97
- control = new osparc . ui . basic . Tag ( ) ;
100
+ control = new osparc . ui . basic . Tag ( ) . set ( {
101
+ alignY : "middle" ,
102
+ } ) ;
98
103
this . bind ( "name" , control , "value" ) ;
99
104
this . bind ( "color" , control , "color" ) ;
100
105
break ;
101
106
case "description" :
102
107
control = new qx . ui . basic . Label ( ) . set ( {
103
108
rich : true ,
104
109
allowGrowX : true ,
110
+ alignY : "middle" ,
105
111
} ) ;
106
112
this . bind ( "description" , control , "value" ) ;
107
113
break ;
108
114
case "shared-icon" :
109
115
control = new qx . ui . basic . Image ( ) . set ( {
110
116
minWidth : 30 ,
111
117
alignY : "middle" ,
112
- cursor : "pointer" ,
113
118
} ) ;
114
- osparc . dashboard . CardBase . populateShareIcon ( control , this . getAccessRights ( ) )
115
- control . addListener ( "tap" , ( ) => this . __openAccessRights ( ) , this ) ;
119
+ osparc . dashboard . CardBase . populateShareIcon ( control , this . getAccessRights ( ) ) ;
116
120
break ;
117
121
case "name-input" :
118
122
control = new qx . ui . form . TextField ( ) . set ( {
@@ -202,7 +206,6 @@ qx.Class.define("osparc.form.tag.TagItem", {
202
206
this . _add ( this . getChildControl ( "description" ) , {
203
207
flex : 1
204
208
} ) ;
205
- this . _add ( this . getChildControl ( "shared-icon" ) ) ;
206
209
this . _add ( this . __tagItemButtons ( ) ) ;
207
210
this . resetBackgroundColor ( ) ;
208
211
} ,
@@ -227,29 +230,40 @@ qx.Class.define("osparc.form.tag.TagItem", {
227
230
__tagItemButtons : function ( ) {
228
231
const canIWrite = osparc . share . CollaboratorsTag . canIWrite ( this . getMyAccessRights ( ) ) ;
229
232
const canIDelete = osparc . share . CollaboratorsTag . canIDelete ( this . getMyAccessRights ( ) ) ;
233
+ const buttonContainer = new qx . ui . container . Composite ( new qx . ui . layout . HBox ( 5 ) ) ;
234
+
235
+ const sharedIcon = this . getChildControl ( "shared-icon" ) ;
236
+ sharedIcon . set ( {
237
+ cursor : canIWrite ? "pointer" : null ,
238
+ } ) ;
239
+ if ( canIWrite ) {
240
+ sharedIcon . addListener ( "tap" , ( ) => this . __openAccessRights ( ) , this ) ;
241
+ }
242
+ buttonContainer . add ( sharedIcon ) ;
230
243
231
- const buttonContainer = new qx . ui . container . Composite ( new qx . ui . layout . HBox ( ) ) ;
232
244
const editButton = new qx . ui . form . Button ( ) . set ( {
233
245
icon : "@FontAwesome5Solid/pencil-alt/12" ,
234
246
toolTipText : this . tr ( "Edit" ) ,
235
247
enabled : canIWrite ,
236
248
} ) ;
249
+ buttonContainer . add ( editButton ) ;
250
+ editButton . addListener ( "execute" , ( ) => this . setMode ( this . self ( ) . modes . EDIT ) , this ) ;
251
+
237
252
const deleteButton = new osparc . ui . form . FetchButton ( ) . set ( {
238
253
appearance : "danger-button" ,
239
254
icon : "@FontAwesome5Solid/trash/12" ,
240
255
toolTipText : this . tr ( "Delete" ) ,
241
256
enabled : canIDelete ,
242
257
} ) ;
243
- buttonContainer . add ( editButton ) ;
244
258
buttonContainer . add ( deleteButton ) ;
245
- editButton . addListener ( "execute" , ( ) => this . setMode ( this . self ( ) . modes . EDIT ) , this ) ;
246
259
deleteButton . addListener ( "execute" , ( ) => {
247
260
deleteButton . setFetching ( true ) ;
248
261
osparc . store . Tags . getInstance ( ) . deleteTag ( this . getId ( ) )
249
262
. then ( ( ) => this . fireEvent ( "deleteTag" ) )
250
263
. catch ( console . error )
251
264
. finally ( ( ) => deleteButton . setFetching ( false ) ) ;
252
265
} , this ) ;
266
+
253
267
return buttonContainer ;
254
268
} ,
255
269
/**
0 commit comments