Skip to content

Commit

Permalink
FIxed composer of comments not resetting
Browse files Browse the repository at this point in the history
  • Loading branch information
mschering committed Jan 15, 2024
1 parent 9dafbd4 commit 9be8123
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
8 changes: 7 additions & 1 deletion www/go/core/views/extjs3/form/EntityPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,16 @@ go.form.EntityPanel = Ext.extend(Ext.form.FormPanel, {
return this;
},

/**
* Resets the form to the configured state.
* It does not reset to the form that kas loaded!
*/
reset: function() {
this.currentId = null
this.entity = null;
this.getForm().reset();
this.getForm().items.each(function(f){
f.setValue(f.initialConfig.value);
});
},

submit: function (cb, scope) {
Expand Down
4 changes: 4 additions & 0 deletions www/go/core/views/extjs3/form/FormGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,10 @@ go.form.FormGroup = Ext.extend(Ext.Panel, {
},

setValue: function (records) {

if(!records) {
records = [];
}
// this.dirty = true;
this.removeAll();
if(records === null) return;
Expand Down
26 changes: 10 additions & 16 deletions www/go/modules/community/comments/views/extjs3/Composer.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,25 +53,18 @@ go.modules.comments.Composer = Ext.extend(go.form.EntityPanel, {
this.sendBtn.handler.call(this);
},


attach: ( field, response, file, imgEl) => {


if(imgEl) {
return;
}


this.attachmentBox.setValue(this.attachmentBox.getValue().concat([{
blobId: response.blobId,
name: response.name
}]))

this.onSync()

this.onSync();
},


scope: this
}
});
Expand All @@ -92,17 +85,18 @@ go.modules.comments.Composer = Ext.extend(go.form.EntityPanel, {

try {
await this.submit();

this.reset(); // otherwise it will update the second time
this.textField.setHeight(this.minComposerHeight);

this.onSync()
this.textField.syncValue();
this.ownerCt.doLayout();
this.doLayout();
} catch(e) {
GO.errorDialog.show(e.message);
}
this.reset(); // otherwise it will update the second time
this.textField.setHeight(this.minComposerHeight);

this.onSync()
this.textField.syncValue();
this.ownerCt.doLayout();
this.doLayout();

this.textField.focus();

this.sendBtn.setDisabled(false);

Expand Down

0 comments on commit 9be8123

Please sign in to comment.