diff --git a/src/file/edit-file-content.js b/src/file/edit-file-content.js
new file mode 100644
index 0000000..34a142e
--- /dev/null
+++ b/src/file/edit-file-content.js
@@ -0,0 +1,82 @@
+/**
+ * This file is part of VILLASweb.
+ *
+ * VILLASweb is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * VILLASweb is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with VILLASweb. If not, see .
+ ******************************************************************************/
+
+import React from 'react';
+import {FormGroup, FormControl, Button, Col} from 'react-bootstrap';
+import AppDispatcher from "../common/app-dispatcher";
+import Dialog from '../common/dialogs/dialog';
+
+class EditFileContent extends React.Component {
+ valid = true;
+
+ constructor(props) {
+ super(props);
+
+ this.state = {
+ uploadFile: null,
+
+ };
+ }
+
+ selectUploadFile(event) {
+ this.setState({ uploadFile: event.target.files[0] });
+ };
+
+ startEditContent(){
+ const formData = new FormData();
+ formData.append("file", this.state.uploadFile);
+
+ AppDispatcher.dispatch({
+ type: 'files/start-edit',
+ data: formData,
+ token: this.props.sessionToken,
+ id: this.props.file.id
+ });
+
+ this.setState({ uploadFile: null });
+ };
+
+
+ onClose = () => {
+ this.props.onClose();
+ };
+
+
+
+
+ render() {
+ return ;
+ }
+}
+
+export default EditFileContent;
diff --git a/src/file/edit-file-name.js b/src/file/edit-file-name.js
deleted file mode 100644
index 05481b3..0000000
--- a/src/file/edit-file-name.js
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
- * This file is part of VILLASweb.
- *
- * VILLASweb is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * VILLASweb is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with VILLASweb. If not, see .
- ******************************************************************************/
-
-import React from 'react';
-import {FormGroup, FormControl, FormLabel, Col} from 'react-bootstrap';
-
-import Dialog from '../common/dialogs/dialog';
-
-class EditFileName extends React.Component {
- valid = true;
-
- constructor(props) {
- super(props);
-
- this.state = {
- file: {},
-
- };
- }
-
- onClose = canceled => {
- if (canceled) {
- if (this.props.onClose != null) {
- this.props.onClose();
- }
-
- return;
- }
-
- if (this.valid && this.props.onClose != null) {
- this.props.onClose(this.state.file);
- }
- };
-
- handleChange = event => {
- this.props.file.name = event.target.value;
- this.setState({file: this.props.file});
-
- let name = true;
-
- if (this.state.name === '') {
- name = false;
- }
-
- this.valid = name;
-
- };
-
-
-
- render() {
- return ;
- }
-}
-
-export default EditFileName;
diff --git a/src/file/edit-files.js b/src/file/edit-files.js
index 3e2e003..8cc3421 100644
--- a/src/file/edit-files.js
+++ b/src/file/edit-files.js
@@ -21,7 +21,7 @@ import Dialog from '../common/dialogs/dialog';
import AppDispatcher from "../common/app-dispatcher";
import Table from "../common/table";
import TableColumn from "../common/table-column";
-import EditFileName from "./edit-file-name";
+import EditFileContent from "./edit-file-content";
class EditFilesDialog extends React.Component {
@@ -39,14 +39,9 @@ class EditFilesDialog extends React.Component {
};
}
- onClose(canceled) {
- if (canceled === false) {
- if (true) {
- this.props.onClose();
- }
- } else {
- this.props.onClose();
- }
+ onClose() {
+
+ this.props.onClose();
}
selectUploadFile(event) {
@@ -87,18 +82,7 @@ class EditFilesDialog extends React.Component {
};
- closeEditModal(data){
- if(data !== {} || data !== "undefined"){
- const formData = new FormData();
- formData.append("object", data);
-
- AppDispatcher.dispatch({
- type: 'files/start-edit',
- data: formData,
- token: this.props.sessionToken,
- id: data.id
- });
- }
+ closeEditModal(){
this.setState({editModal: false});
}
@@ -135,7 +119,7 @@ class EditFilesDialog extends React.Component {
return (
-