@@ -20,12 +20,12 @@ qx.Class.define("osparc.info.CommentsList", {
2020 extend : qx . ui . core . Widget ,
2121
2222 /**
23- * @param studyId {String} Study Id
23+ * @param studyData {String} Study Data
2424 */
25- construct : function ( studyId ) {
25+ construct : function ( studyData ) {
2626 this . base ( arguments ) ;
2727
28- this . __studyId = studyId ;
28+ this . __studyData = studyData ;
2929
3030 this . _setLayout ( new qx . ui . layout . VBox ( 10 ) ) ;
3131
@@ -35,6 +35,7 @@ qx.Class.define("osparc.info.CommentsList", {
3535 } ,
3636
3737 members : {
38+ __studyData : null ,
3839 __nextRequestParams : null ,
3940
4041 _createChildControlImpl : function ( id ) {
@@ -50,13 +51,23 @@ qx.Class.define("osparc.info.CommentsList", {
5051 control = new qx . ui . container . Composite ( new qx . ui . layout . VBox ( 5 ) ) . set ( {
5152 alignY : "middle"
5253 } ) ;
53- this . _add ( control ) ;
54+ this . _add ( control , {
55+ flex : 1
56+ } ) ;
5457 break ;
5558 case "load-more-button" :
5659 control = new osparc . ui . form . FetchButton ( this . tr ( "Load more comments..." ) ) ;
5760 control . addListener ( "execute" , ( ) => this . fetchComments ( false ) ) ;
5861 this . _add ( control ) ;
5962 break ;
63+ case "add-comment" :
64+ if ( osparc . data . model . Study . canIWrite ( this . __studyData [ "accessRights" ] ) ) {
65+ control = new osparc . info . CommentAdd ( this . __studyData [ "uuid" ] ) ;
66+ control . setPaddingLeft ( 10 ) ;
67+ control . addListener ( "commentAdded" , ( ) => this . fetchComments ( ) ) ;
68+ this . _add ( control ) ;
69+ }
70+ break ;
6071 }
6172
6273 return control || this . base ( arguments , id ) ;
@@ -66,6 +77,7 @@ qx.Class.define("osparc.info.CommentsList", {
6677 this . getChildControl ( "title" ) ;
6778 this . getChildControl ( "comments-list" ) ;
6879 this . getChildControl ( "load-more-button" ) ;
80+ this . getChildControl ( "add-comment" ) ;
6981 } ,
7082
7183 fetchComments : function ( removeComments = true ) {
@@ -92,7 +104,7 @@ qx.Class.define("osparc.info.CommentsList", {
92104 __getNextRequest : function ( ) {
93105 const params = {
94106 url : {
95- studyId : this . __studyId ,
107+ studyId : this . __studyData [ "uuid" ] ,
96108 offset : 0 ,
97109 limit : 20
98110 }
0 commit comments