Commit 6d3d2c3a authored by Florent Chehab's avatar Florent Chehab

Better editor comments and fixed incorrectForcedSave

parent 32a0a937
......@@ -19,14 +19,14 @@ import Form from "./Form";
/**
* Class to handle editions of models on the frontend. It should be extended, eg:
*
class BlablaEditor extends Editor {
renderForm() {
return <blablaForm
modelData={this.props.modelData}
ref={this.formRef}
/>;
}
}
* class BlablaEditor extends Editor {
* renderForm() {
* return <blablaForm
* modelData={this.props.modelData}
* ref={this.formRef}
* />;
* }
* }
*
* @class Editor
* @extends {Component}
......@@ -97,7 +97,6 @@ class Editor extends Component {
handleSaveEditorRequest() {
const formHasError = this.formHasError();
if (!formHasError.status) { // no error, we can save if necessary
if (this.props.forceSave || this.formHasChanges()) {
// Copy the model data and copy above the data from the form
// So that we don't forget anything.
......@@ -137,7 +136,10 @@ class Editor extends Component {
/**
* This function is extended to handle custom behaviors on component update
* This function is extended to handle all the logic such as
* - opening the editor
* - Detecting when there was a successful save
* - etc.
*
* @memberof Editor
*/
......
......@@ -97,7 +97,7 @@ class GenericModule extends CustomComponentForAPI {
handleEditPendingModeration = (rawModelData) => {
this.setState({
rawModelDataForEditor: rawModelData,
forceSave: true,
forceSave: this.userCanModerate(),
});
this.handleClosePendingModeration();
this.handleOpenEditor(true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment