Skip to content

Commit 65606f4

Browse files
authored
Merge pull request #1378 from processing/missing-upload
Fixes #1361 - upload option missing for folder
2 parents bd8293f + 31ca964 commit 65606f4

File tree

1 file changed

+46
-35
lines changed

1 file changed

+46
-35
lines changed

client/modules/IDE/components/FileNode.jsx

Lines changed: 46 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -185,40 +185,50 @@ export class FileNode extends React.Component {
185185
{(() => { // eslint-disable-line
186186
if (this.props.fileType === 'folder') {
187187
return (
188-
<li>
189-
<button
190-
aria-label="add file"
191-
onClick={() => {
192-
this.props.newFile(this.props.id);
193-
setTimeout(() => this.hideFileOptions(), 0);
194-
}}
195-
onBlur={this.onBlurComponent}
196-
onFocus={this.onFocusComponent}
197-
className="sidebar__file-item-option"
198-
>
199-
Add File
200-
</button>
201-
</li>
202-
);
203-
}
204-
})()}
205-
{(() => { // eslint-disable-line
206-
if (this.props.fileType === 'folder') {
207-
return (
208-
<li>
209-
<button
210-
aria-label="add folder"
211-
onClick={() => {
212-
this.props.newFolder(this.props.id);
213-
setTimeout(() => this.hideFileOptions(), 0);
214-
}}
215-
onBlur={this.onBlurComponent}
216-
onFocus={this.onFocusComponent}
217-
className="sidebar__file-item-option"
218-
>
219-
Add Folder
220-
</button>
221-
</li>
188+
<React.Fragment>
189+
<li>
190+
<button
191+
aria-label="add folder"
192+
onClick={() => {
193+
this.props.newFolder(this.props.id);
194+
setTimeout(this.hideFileOptions, 0);
195+
}}
196+
onBlur={this.onBlurComponent}
197+
onFocus={this.onFocusComponent}
198+
className="sidebar__file-item-option"
199+
>
200+
Create folder
201+
</button>
202+
</li>
203+
<li>
204+
<button
205+
aria-label="add file"
206+
onClick={() => {
207+
this.props.newFile(this.props.id);
208+
setTimeout(this.hideFileOptions, 0);
209+
}}
210+
onBlur={this.onBlurComponent}
211+
onFocus={this.onFocusComponent}
212+
className="sidebar__file-item-option"
213+
>
214+
Create file
215+
</button>
216+
</li>
217+
<li>
218+
<button
219+
aria-label="upload file"
220+
onClick={() => {
221+
this.props.openUploadFileModal(this.props.id);
222+
setTimeout(this.hideFileOptions, 0);
223+
}}
224+
onBlur={this.onBlurComponent}
225+
onFocus={this.onFocusComponent}
226+
>
227+
Upload file
228+
</button>
229+
</li>
230+
231+
</React.Fragment>
222232
);
223233
}
224234
})()}
@@ -289,7 +299,8 @@ FileNode.propTypes = {
289299
newFolder: PropTypes.func.isRequired,
290300
showFolderChildren: PropTypes.func.isRequired,
291301
hideFolderChildren: PropTypes.func.isRequired,
292-
canEdit: PropTypes.bool.isRequired
302+
canEdit: PropTypes.bool.isRequired,
303+
openUploadFileModal: PropTypes.func.isRequired
293304
};
294305

295306
FileNode.defaultProps = {

0 commit comments

Comments
 (0)