From 779e5e84e37278b8f3255a1061f2137f5b6a3a7d Mon Sep 17 00:00:00 2001
From: Clemens <cle1000.cb@gmail.com>
Date: Tue, 16 Aug 2016 12:37:35 +0200
Subject: refactor file up and download

---
 .../components/ContentView/UploadContentButton.jsx   | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

(limited to 'web/src/js/components/ContentView/UploadContentButton.jsx')

diff --git a/web/src/js/components/ContentView/UploadContentButton.jsx b/web/src/js/components/ContentView/UploadContentButton.jsx
index 0652b584..6764e234 100644
--- a/web/src/js/components/ContentView/UploadContentButton.jsx
+++ b/web/src/js/components/ContentView/UploadContentButton.jsx
@@ -1,4 +1,5 @@
 import { PropTypes } from 'react'
+import FileChooser from '../common/FileChooser'
 
 UploadContentButton.propTypes = {
     uploadContent: PropTypes.func.isRequired,
@@ -9,20 +10,11 @@ export default function UploadContentButton({ uploadContent }) {
     let fileInput;
 
     return (
-        <a className="btn btn-default btn-xs"
-           onClick={() => fileInput.click()}
-           title="Upload a file to replace the content.">
-            <i className="fa fa-upload"/>
-            <input
-                ref={ref => fileInput = ref}
-                className="hidden"
-                type="file"
-                onChange={e => {
-                    if (e.target.files.length > 0) uploadContent(e.target.files[0])
-                }}
-            />
-        </a>
-
+        <FileChooser
+            icon="fa-upload"
+            title="Upload a file to replace the content."
+            onOpenFile={uploadContent}
+            className="btn btn-default btn-xs"/>
     )
 }
 
-- 
cgit v1.2.3


From d4b18eae8181051f5230b796046cc7ff56e94862 Mon Sep 17 00:00:00 2001
From: Clemens <cle1000.cb@gmail.com>
Date: Fri, 19 Aug 2016 09:23:41 +0200
Subject: refactoring

---
 web/src/js/components/ContentView/UploadContentButton.jsx | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

(limited to 'web/src/js/components/ContentView/UploadContentButton.jsx')

diff --git a/web/src/js/components/ContentView/UploadContentButton.jsx b/web/src/js/components/ContentView/UploadContentButton.jsx
index 6764e234..de349af4 100644
--- a/web/src/js/components/ContentView/UploadContentButton.jsx
+++ b/web/src/js/components/ContentView/UploadContentButton.jsx
@@ -6,9 +6,7 @@ UploadContentButton.propTypes = {
 }
 
 export default function UploadContentButton({ uploadContent }) {
-
-    let fileInput;
-
+    
     return (
         <FileChooser
             icon="fa-upload"
-- 
cgit v1.2.3

