diff options
author | cle1000 <cle1000.cb@gmail.com> | 2017-02-08 21:09:03 +0100 |
---|---|---|
committer | cle1000 <cle1000.cb@gmail.com> | 2017-02-08 21:09:03 +0100 |
commit | fb06c664379fc009c68dc780120fe600cd74cf5f (patch) | |
tree | 14f9f13b30ff505584abbd48a454f01a215e8ae6 /web/src/js/components/ContentView | |
parent | b4bed57d4c7a48357009520a8dfae86a7c60b536 (diff) | |
download | mitmproxy-fb06c664379fc009c68dc780120fe600cd74cf5f.tar.gz mitmproxy-fb06c664379fc009c68dc780120fe600cd74cf5f.tar.bz2 mitmproxy-fb06c664379fc009c68dc780120fe600cd74cf5f.zip |
remove contentview selector and view description if edit mode is on
Diffstat (limited to 'web/src/js/components/ContentView')
-rw-r--r-- | web/src/js/components/ContentView/ContentViewOptions.jsx | 4 | ||||
-rw-r--r-- | web/src/js/components/ContentView/ViewSelector.jsx | 15 |
2 files changed, 5 insertions, 14 deletions
diff --git a/web/src/js/components/ContentView/ContentViewOptions.jsx b/web/src/js/components/ContentView/ContentViewOptions.jsx index 6bc66db2..1ec9013e 100644 --- a/web/src/js/components/ContentView/ContentViewOptions.jsx +++ b/web/src/js/components/ContentView/ContentViewOptions.jsx @@ -12,13 +12,13 @@ ContentViewOptions.propTypes = { function ContentViewOptions({ flow, message, uploadContent, readonly, contentViewDescription }) { return ( <div className="view-options"> - <ViewSelector message={message}/> + {readonly ? <ViewSelector message={message}/> : <span><b>View:</b> edit</span>} <DownloadContentButton flow={flow} message={message}/> {!readonly && <UploadContentButton uploadContent={uploadContent}/> } - <span>{contentViewDescription}</span> + {readonly && <span>{contentViewDescription}</span>} </div> ) } diff --git a/web/src/js/components/ContentView/ViewSelector.jsx b/web/src/js/components/ContentView/ViewSelector.jsx index fcdc3ee3..43a53995 100644 --- a/web/src/js/components/ContentView/ViewSelector.jsx +++ b/web/src/js/components/ContentView/ViewSelector.jsx @@ -1,6 +1,5 @@ import React, { PropTypes, Component } from 'react' import { connect } from 'react-redux' -import * as ContentViews from './ContentViews' import { setContentView } from '../../ducks/ui/flow'; import Dropdown from '../common/Dropdown' @@ -8,27 +7,20 @@ import Dropdown from '../common/Dropdown' ViewSelector.propTypes = { contentViews: PropTypes.array.isRequired, activeView: PropTypes.string.isRequired, - isEdit: PropTypes.bool.isRequired, setContentView: PropTypes.func.isRequired } -function ViewSelector ({contentViews, activeView, isEdit, setContentView}){ - let edit = ContentViews.Edit.displayName - let inner = <span> <b>View:</b> {activeView} <span className="caret"></span> </span> +function ViewSelector ({contentViews, activeView, setContentView}){ + let inner = <span> <b>View:</b> {activeView.toLowerCase()} <span className="caret"></span> </span> return ( <Dropdown dropup className="pull-left" btnClass="btn btn-default btn-xs" text={inner}> {contentViews.map(name => - <a href="#" key={name} onClick={e => {e.preventDefault(); setContentView(name)}}> + <a href="#" key={name} onClick={e => {e.preventDefault(); setContentView(name)}}> {name.toLowerCase().replace('_', ' ')} </a> ) } - {isEdit && - <a href="#" onClick={e => {e.preventDefault(); setContentView(edit)}}> - {edit.toLowerCase()} - </a> - } </Dropdown> ) } @@ -37,7 +29,6 @@ export default connect ( state => ({ contentViews: state.settings.contentViews, activeView: state.ui.flow.contentView, - isEdit: !!state.ui.flow.modifiedFlow, }), { setContentView, } |