From 61f192434fade43af81dc74602aef218d5c5be19 Mon Sep 17 00:00:00 2001
From: Clemens <cle1000.cb@gmail.com>
Date: Thu, 21 Jul 2016 11:50:02 +0200
Subject: moved editor to raw_view mode

---
 web/src/js/components/ContentView.jsx | 65 +++++++++++++++--------------------
 1 file changed, 28 insertions(+), 37 deletions(-)

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

diff --git a/web/src/js/components/ContentView.jsx b/web/src/js/components/ContentView.jsx
index f7eafc89..93f16ec0 100644
--- a/web/src/js/components/ContentView.jsx
+++ b/web/src/js/components/ContentView.jsx
@@ -6,7 +6,6 @@ import * as MetaViews from './ContentView/MetaViews'
 import ContentLoader from './ContentView/ContentLoader'
 import ViewSelector from './ContentView/ViewSelector'
 import { setContentView, displayLarge, updateEdit } from '../ducks/ui/flow'
-import CodeEditor from './common/CodeEditor'
 
 ContentView.propTypes = {
     // It may seem a bit weird at the first glance:
@@ -19,7 +18,7 @@ ContentView.propTypes = {
 ContentView.isContentTooLarge = msg => msg.contentLength > 1024 * 1024 * (ContentViews.ViewImage.matches(msg) ? 10 : 0.2)
 
 function ContentView(props) {
-    const { flow, message, contentView, selectView, displayLarge, setDisplayLarge, onContentChange, isFlowEditorOpen, setModifiedFlowContent } = props
+    const { flow, message, contentView, selectView, displayLarge, setDisplayLarge, onContentChange, readonly, isFlowEditorOpen } = props
 
     if (message.contentLength === 0) {
         return <MetaViews.ContentEmpty {...props}/>
@@ -37,43 +36,35 @@ function ContentView(props) {
 
     return (
         <div>
-            {isFlowEditorOpen ? (
+            {View.textView ? (
                 <ContentLoader flow={flow} message={message}>
-                        <CodeEditor content="" onChange={content =>{setModifiedFlowContent(content)}}/>
-                    </ContentLoader>
-            ): (
-                <div>
-                    {View.textView ? (
-                        <ContentLoader flow={flow} message={message}>
-                            <View content="" />
-                        </ContentLoader>
-                    ) : (
-                        <View flow={flow} message={message} />
-                    )}
-                    <div className="view-options text-center">
-                        <ViewSelector onSelectView={selectView} active={View} message={message}/>
-                        &nbsp;
-                        <a className="btn btn-default btn-xs"
-                           href={MessageUtils.getContentURL(flow, message)}
-                           title="Download the content of the flow.">
-                            <i className="fa fa-download"/>
-                        </a>
-                        &nbsp;
-                        <a  className="btn btn-default btn-xs"
-                            onClick={() => ContentView.fileInput.click()}
-                            title="Upload a file to replace the content."
-                        >
-                            <i className="fa fa-upload"/>
-                        </a>
-                        <input
-                            ref={ref => ContentView.fileInput = ref}
-                            className="hidden"
-                            type="file"
-                            onChange={e => {if(e.target.files.length > 0) onContentChange(e.target.files[0])}}
-                        />
-                    </div>
-                </div>
+                    <View readonly={readonly} isFlowEditorOpen={isFlowEditorOpen} content="" />
+                </ContentLoader>
+            ) : (
+                <View flow={flow} message={message} />
             )}
+            <div className="view-options text-center">
+                <ViewSelector onSelectView={selectView} active={View} message={message}/>
+                &nbsp;
+                <a className="btn btn-default btn-xs"
+                   href={MessageUtils.getContentURL(flow, message)}
+                   title="Download the content of the flow.">
+                    <i className="fa fa-download"/>
+                </a>
+                &nbsp;
+                <a  className="btn btn-default btn-xs"
+                    onClick={() => ContentView.fileInput.click()}
+                    title="Upload a file to replace the content."
+                >
+                    <i className="fa fa-upload"/>
+                </a>
+                <input
+                    ref={ref => ContentView.fileInput = ref}
+                    className="hidden"
+                    type="file"
+                    onChange={e => {if(e.target.files.length > 0) onContentChange(e.target.files[0])}}
+                />
+            </div>
         </div>
     )
 }
-- 
cgit v1.2.3


From 70ca10b423de4a57a395798aa94189ba4da7840f Mon Sep 17 00:00:00 2001
From: Clemens <cle1000.cb@gmail.com>
Date: Thu, 21 Jul 2016 19:13:16 +0200
Subject: moved editor to raw_view mode, add content_file_upload

---
 web/src/js/components/ContentView.jsx | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

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

diff --git a/web/src/js/components/ContentView.jsx b/web/src/js/components/ContentView.jsx
index 93f16ec0..06272627 100644
--- a/web/src/js/components/ContentView.jsx
+++ b/web/src/js/components/ContentView.jsx
@@ -18,7 +18,7 @@ ContentView.propTypes = {
 ContentView.isContentTooLarge = msg => msg.contentLength > 1024 * 1024 * (ContentViews.ViewImage.matches(msg) ? 10 : 0.2)
 
 function ContentView(props) {
-    const { flow, message, contentView, selectView, displayLarge, setDisplayLarge, onContentChange, readonly, isFlowEditorOpen } = props
+    const { flow, message, contentView, selectView, displayLarge, setDisplayLarge, uploadContent, onContentChange, readonly } = props
 
     if (message.contentLength === 0) {
         return <MetaViews.ContentEmpty {...props}/>
@@ -38,10 +38,10 @@ function ContentView(props) {
         <div>
             {View.textView ? (
                 <ContentLoader flow={flow} message={message}>
-                    <View readonly={readonly} isFlowEditorOpen={isFlowEditorOpen} content="" />
+                    <View readonly={readonly} onChange={onContentChange} content="" />
                 </ContentLoader>
             ) : (
-                <View flow={flow} message={message} />
+                <View flow={flow} readonly={readonly} message={message} />
             )}
             <div className="view-options text-center">
                 <ViewSelector onSelectView={selectView} active={View} message={message}/>
@@ -62,7 +62,7 @@ function ContentView(props) {
                     ref={ref => ContentView.fileInput = ref}
                     className="hidden"
                     type="file"
-                    onChange={e => {if(e.target.files.length > 0) onContentChange(e.target.files[0])}}
+                    onChange={e => {if(e.target.files.length > 0) uploadContent(e.target.files[0])}}
                 />
             </div>
         </div>
@@ -73,7 +73,6 @@ export default connect(
     state => ({
         contentView: state.ui.flow.contentView,
         displayLarge: state.ui.flow.displayLarge,
-        isFlowEditorOpen : !!state.ui.flow.modifiedFlow // FIXME
     }),
     {
         selectView: setContentView,
-- 
cgit v1.2.3


From f578bf512248c609296d2ff0ea2007a6feac561f Mon Sep 17 00:00:00 2001
From: Clemens <cle1000.cb@gmail.com>
Date: Fri, 22 Jul 2016 19:07:53 +0200
Subject: file upload updates contentview, editable contentloader, diffs on
 upload

---
 web/src/js/components/ContentView.jsx | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

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

diff --git a/web/src/js/components/ContentView.jsx b/web/src/js/components/ContentView.jsx
index 06272627..7c8ac510 100644
--- a/web/src/js/components/ContentView.jsx
+++ b/web/src/js/components/ContentView.jsx
@@ -18,7 +18,7 @@ ContentView.propTypes = {
 ContentView.isContentTooLarge = msg => msg.contentLength > 1024 * 1024 * (ContentViews.ViewImage.matches(msg) ? 10 : 0.2)
 
 function ContentView(props) {
-    const { flow, message, contentView, selectView, displayLarge, setDisplayLarge, uploadContent, onContentChange, readonly } = props
+    const { flow, message, contentView, selectView, displayLarge, setDisplayLarge, lastFileUpload, uploadContent, onContentChange, content, readonly } = props
 
     if (message.contentLength === 0) {
         return <MetaViews.ContentEmpty {...props}/>
@@ -33,15 +33,14 @@ function ContentView(props) {
     }
 
     const View = ContentViews[contentView]
-
     return (
         <div>
             {View.textView ? (
-                <ContentLoader flow={flow} message={message}>
+                <ContentLoader flow={flow} lastFileUpload={lastFileUpload} readonly={readonly} message={message}>
                     <View readonly={readonly} onChange={onContentChange} content="" />
                 </ContentLoader>
             ) : (
-                <View flow={flow} readonly={readonly} message={message} />
+                <View flow={flow} lastFileUpload={lastFileUpload} readonly={readonly} content={content} message={message} />
             )}
             <div className="view-options text-center">
                 <ViewSelector onSelectView={selectView} active={View} message={message}/>
@@ -73,6 +72,7 @@ export default connect(
     state => ({
         contentView: state.ui.flow.contentView,
         displayLarge: state.ui.flow.displayLarge,
+        lastFileUpload: state.ui.flow.lastFileUpload
     }),
     {
         selectView: setContentView,
-- 
cgit v1.2.3


From 0aedea6e60f22f78f3523b860027550159ba6dd8 Mon Sep 17 00:00:00 2001
From: Clemens <cle1000.cb@gmail.com>
Date: Mon, 25 Jul 2016 09:05:24 +0200
Subject: remove lastFileUpload field

---
 web/src/js/components/ContentView.jsx | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

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

diff --git a/web/src/js/components/ContentView.jsx b/web/src/js/components/ContentView.jsx
index 7c8ac510..e88d1ce2 100644
--- a/web/src/js/components/ContentView.jsx
+++ b/web/src/js/components/ContentView.jsx
@@ -18,7 +18,7 @@ ContentView.propTypes = {
 ContentView.isContentTooLarge = msg => msg.contentLength > 1024 * 1024 * (ContentViews.ViewImage.matches(msg) ? 10 : 0.2)
 
 function ContentView(props) {
-    const { flow, message, contentView, selectView, displayLarge, setDisplayLarge, lastFileUpload, uploadContent, onContentChange, content, readonly } = props
+    const { flow, message, contentView, selectView, displayLarge, setDisplayLarge, uploadContent, onContentChange, content, readonly } = props
 
     if (message.contentLength === 0) {
         return <MetaViews.ContentEmpty {...props}/>
@@ -36,11 +36,11 @@ function ContentView(props) {
     return (
         <div>
             {View.textView ? (
-                <ContentLoader flow={flow} lastFileUpload={lastFileUpload} readonly={readonly} message={message}>
+                <ContentLoader flow={flow}  readonly={readonly} message={message}>
                     <View readonly={readonly} onChange={onContentChange} content="" />
                 </ContentLoader>
             ) : (
-                <View flow={flow} lastFileUpload={lastFileUpload} readonly={readonly} content={content} message={message} />
+                <View flow={flow} readonly={readonly} content={content} message={message} />
             )}
             <div className="view-options text-center">
                 <ViewSelector onSelectView={selectView} active={View} message={message}/>
@@ -72,11 +72,10 @@ export default connect(
     state => ({
         contentView: state.ui.flow.contentView,
         displayLarge: state.ui.flow.displayLarge,
-        lastFileUpload: state.ui.flow.lastFileUpload
     }),
     {
         selectView: setContentView,
         displayLarge,
-        updateEdit,
+        updateEdit
     }
 )(ContentView)
-- 
cgit v1.2.3


From 1ea094e9dcf187a409dab9ca9a2b3a0b10f243f7 Mon Sep 17 00:00:00 2001
From: Clemens <cle1000.cb@gmail.com>
Date: Mon, 25 Jul 2016 15:47:05 +0200
Subject: remove auto change to raw mode on edit

---
 web/src/js/components/ContentView.jsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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

diff --git a/web/src/js/components/ContentView.jsx b/web/src/js/components/ContentView.jsx
index e88d1ce2..80dec0f4 100644
--- a/web/src/js/components/ContentView.jsx
+++ b/web/src/js/components/ContentView.jsx
@@ -40,7 +40,7 @@ function ContentView(props) {
                     <View readonly={readonly} onChange={onContentChange} content="" />
                 </ContentLoader>
             ) : (
-                <View flow={flow} readonly={readonly} content={content} message={message} />
+                <View flow={flow} readonly={readonly} onChange={onContentChange} content={content} message={message} />
             )}
             <div className="view-options text-center">
                 <ViewSelector onSelectView={selectView} active={View} message={message}/>
-- 
cgit v1.2.3


From 70dbd1b32d13d30e15c03ee91b0fab7bfdf429b3 Mon Sep 17 00:00:00 2001
From: Maximilian Hils <git@maximilianhils.com>
Date: Mon, 25 Jul 2016 17:03:50 -0700
Subject: web: refactor ContentLoader

---
 web/src/js/components/ContentView.jsx | 35 ++++++++---------------------------
 1 file changed, 8 insertions(+), 27 deletions(-)

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

diff --git a/web/src/js/components/ContentView.jsx b/web/src/js/components/ContentView.jsx
index 80dec0f4..9ec0266b 100644
--- a/web/src/js/components/ContentView.jsx
+++ b/web/src/js/components/ContentView.jsx
@@ -1,10 +1,11 @@
 import React, { Component, PropTypes } from 'react'
 import { connect } from 'react-redux'
-import { MessageUtils } from '../flow/utils.js'
 import * as ContentViews from './ContentView/ContentViews'
 import * as MetaViews from './ContentView/MetaViews'
-import ContentLoader from './ContentView/ContentLoader'
 import ViewSelector from './ContentView/ViewSelector'
+import UploadContentButton from './ContentView/UploadContentButton'
+import DownloadContentButton from './ContentView/DownloadContentButton'
+
 import { setContentView, displayLarge, updateEdit } from '../ducks/ui/flow'
 
 ContentView.propTypes = {
@@ -18,7 +19,7 @@ ContentView.propTypes = {
 ContentView.isContentTooLarge = msg => msg.contentLength > 1024 * 1024 * (ContentViews.ViewImage.matches(msg) ? 10 : 0.2)
 
 function ContentView(props) {
-    const { flow, message, contentView, selectView, displayLarge, setDisplayLarge, uploadContent, onContentChange, content, readonly } = props
+    const { flow, message, contentView, selectView, displayLarge, setDisplayLarge, uploadContent, onContentChange, readonly } = props
 
     if (message.contentLength === 0) {
         return <MetaViews.ContentEmpty {...props}/>
@@ -35,34 +36,14 @@ function ContentView(props) {
     const View = ContentViews[contentView]
     return (
         <div>
-            {View.textView ? (
-                <ContentLoader flow={flow}  readonly={readonly} message={message}>
-                    <View readonly={readonly} onChange={onContentChange} content="" />
-                </ContentLoader>
-            ) : (
-                <View flow={flow} readonly={readonly} onChange={onContentChange} content={content} message={message} />
-            )}
+            <View flow={flow} message={message} readonly={readonly} onChange={onContentChange}/>
+
             <div className="view-options text-center">
                 <ViewSelector onSelectView={selectView} active={View} message={message}/>
                 &nbsp;
-                <a className="btn btn-default btn-xs"
-                   href={MessageUtils.getContentURL(flow, message)}
-                   title="Download the content of the flow.">
-                    <i className="fa fa-download"/>
-                </a>
+                <DownloadContentButton flow={flow} message={message}/>
                 &nbsp;
-                <a  className="btn btn-default btn-xs"
-                    onClick={() => ContentView.fileInput.click()}
-                    title="Upload a file to replace the content."
-                >
-                    <i className="fa fa-upload"/>
-                </a>
-                <input
-                    ref={ref => ContentView.fileInput = ref}
-                    className="hidden"
-                    type="file"
-                    onChange={e => {if(e.target.files.length > 0) uploadContent(e.target.files[0])}}
-                />
+                <UploadContentButton uploadContent={uploadContent}/>
             </div>
         </div>
     )
-- 
cgit v1.2.3


From e1587b2bc1b425a162af30d6c271bcd392047b02 Mon Sep 17 00:00:00 2001
From: Maximilian Hils <git@maximilianhils.com>
Date: Mon, 25 Jul 2016 17:12:39 -0700
Subject: make empty buttons editable

---
 web/src/js/components/ContentView.jsx | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

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

diff --git a/web/src/js/components/ContentView.jsx b/web/src/js/components/ContentView.jsx
index 9ec0266b..75662509 100644
--- a/web/src/js/components/ContentView.jsx
+++ b/web/src/js/components/ContentView.jsx
@@ -19,17 +19,17 @@ ContentView.propTypes = {
 ContentView.isContentTooLarge = msg => msg.contentLength > 1024 * 1024 * (ContentViews.ViewImage.matches(msg) ? 10 : 0.2)
 
 function ContentView(props) {
-    const { flow, message, contentView, selectView, displayLarge, setDisplayLarge, uploadContent, onContentChange, readonly } = props
+    const { flow, message, contentView, isDisplayLarge, displayLarge, uploadContent, onContentChange, readonly } = props
 
-    if (message.contentLength === 0) {
+    if (message.contentLength === 0 && readonly) {
         return <MetaViews.ContentEmpty {...props}/>
     }
 
-    if (message.contentLength === null) {
+    if (message.contentLength === null && readonly) {
         return <MetaViews.ContentMissing {...props}/>
     }
 
-    if (!displayLarge && ContentView.isContentTooLarge(message)) {
+    if (!isDisplayLarge && ContentView.isContentTooLarge(message)) {
         return <MetaViews.ContentTooLarge {...props} onClick={displayLarge}/>
     }
 
@@ -39,7 +39,7 @@ function ContentView(props) {
             <View flow={flow} message={message} readonly={readonly} onChange={onContentChange}/>
 
             <div className="view-options text-center">
-                <ViewSelector onSelectView={selectView} active={View} message={message}/>
+                <ViewSelector message={message}/>
                 &nbsp;
                 <DownloadContentButton flow={flow} message={message}/>
                 &nbsp;
@@ -52,10 +52,9 @@ function ContentView(props) {
 export default connect(
     state => ({
         contentView: state.ui.flow.contentView,
-        displayLarge: state.ui.flow.displayLarge,
+        isDisplayLarge: state.ui.flow.displayLarge,
     }),
     {
-        selectView: setContentView,
         displayLarge,
         updateEdit
     }
-- 
cgit v1.2.3

