diff --git a/app/assets/stylesheets/base.scss.erb b/app/assets/stylesheets/base.scss.erb index f4e247f2..fd2349a7 100644 --- a/app/assets/stylesheets/base.scss.erb +++ b/app/assets/stylesheets/base.scss.erb @@ -33,7 +33,6 @@ .showcard { position:absolute; - display:none; top:100px; left:100px; width:300px; diff --git a/frontend/src/Metamaps/GlobalUI/ReactApp.js b/frontend/src/Metamaps/GlobalUI/ReactApp.js index b2c5b7eb..75e4ed8b 100644 --- a/frontend/src/Metamaps/GlobalUI/ReactApp.js +++ b/frontend/src/Metamaps/GlobalUI/ReactApp.js @@ -151,7 +151,7 @@ const ReactApp = { metacodeSets: TopicCard.metacodeSets, updateTopic: TopicCard.updateTopic, onTopicFollow: TopicCard.onTopicFollow, - redrawCanvas: TopicCard.redrawCanvas + redrawCanvas: () => Visualize.mGraph.plot() } }, getTopicProps: function() { diff --git a/frontend/src/Metamaps/Views/TopicCard.js b/frontend/src/Metamaps/Views/TopicCard.js index cc77dc83..670ce762 100644 --- a/frontend/src/Metamaps/Views/TopicCard.js +++ b/frontend/src/Metamaps/Views/TopicCard.js @@ -7,9 +7,6 @@ import GlobalUI, { ReactApp } from '../GlobalUI' const TopicCard = { openTopic: null, // stores the topic that's currently open metacodeSets: [], - redrawCanvas: () => { - Visualize.mGraph.plot() - }, init: function(serverData) { const self = TopicCard self.metacodeSets = serverData.metacodeSets @@ -41,20 +38,11 @@ const TopicCard = { var topic = node.getData('topic') self.openTopic = topic self.render() - $('.showcard').fadeIn('fast', () => { - $('.showcard').draggable({ - handle: '.metacodeImage', - stop: function() { - $(this).height('auto') - } - }) - opts.complete && opts.complete() - }) }, hideCard: function() { var self = TopicCard - $('.showcard').fadeOut('fast') self.openTopic = null + self.render() } } diff --git a/frontend/src/components/MapView/index.js b/frontend/src/components/MapView/index.js index 21932bfd..8a9901a3 100644 --- a/frontend/src/components/MapView/index.js +++ b/frontend/src/components/MapView/index.js @@ -77,7 +77,7 @@ export default class MapView extends Component { toggleMetacode, toggleMapper, toggleSynapse, filterAllMetacodes, filterAllMappers, filterAllSynapses, filterData, openImportLightbox, forkMap, openHelpLightbox, - mapIsStarred, onMapStar, onMapUnstar, + mapIsStarred, onMapStar, onMapUnstar, openTopic, onZoomExtents, onZoomIn, onZoomOut, hasLearnedTopicCreation } = this.props const { chatOpen } = this.state const onChatOpen = () => { @@ -107,7 +107,7 @@ export default class MapView extends Component { filterAllMappers={filterAllMappers} filterAllSynapses={filterAllSynapses} /> - + {openTopic && } {currentUser && } {currentUser && this.mapChat = x} />} -
-
- - <Links topic={topic} - ActiveMapper={this.props.currentUser} - updateTopic={wrappedUpdateTopic} - metacodeSets={this.props.metacodeSets} - redrawCanvas={this.props.redrawCanvas} - /> - <Desc desc={topic.get('desc')} - authorizedToEdit={authorizedToEdit} - onChange={wrappedUpdateTopic} - /> - <Attachments topic={topic} - authorizedToEdit={authorizedToEdit} - updateTopic={wrappedUpdateTopic} - /> - {Util.isTester(currentUser) && <Follow isFollowing={isFollowing} onTopicFollow={wrappedTopicFollow} />} - <div className="clearfloat"></div> + <Draggable handle=".metacodeImage" defaultPosition={{x: 100, y: 100}}> + <div className="showcard mapElement mapElementHidden" id="showcard"> + <div className={classname}> + <div className={`CardOnGraph ${hasAttachment ? 'hasAttachment' : ''}`} id={`topic_${topic.id}`}> + <Title name={topic.get('name')} + authorizedToEdit={authorizedToEdit} + onChange={wrappedUpdateTopic} + /> + <Links topic={topic} + ActiveMapper={this.props.currentUser} + updateTopic={wrappedUpdateTopic} + metacodeSets={this.props.metacodeSets} + redrawCanvas={this.props.redrawCanvas} + /> + <Desc desc={topic.get('desc')} + authorizedToEdit={authorizedToEdit} + onChange={wrappedUpdateTopic} + /> + <Attachments topic={topic} + authorizedToEdit={authorizedToEdit} + updateTopic={wrappedUpdateTopic} + /> + {Util.isTester(currentUser) && <Follow isFollowing={isFollowing} onTopicFollow={wrappedTopicFollow} />} + <div className="clearfloat"></div> + </div> </div> </div> - </div> + </Draggable> ) } } diff --git a/package.json b/package.json index 6c259080..8525a725 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,7 @@ "outdent": "0.3.0", "react": "15.4.2", "react-dom": "15.4.2", + "react-draggable": "2.2.3", "react-dropzone": "3.9.1", "react-onclickoutside": "5.9.0", "react-router": "3.0.2",