remove TODOs
This commit is contained in:
parent
dd8229512c
commit
3e07c431e0
5 changed files with 20 additions and 23 deletions
|
@ -4,6 +4,7 @@ import React from 'react'
|
|||
import ReactDOM from 'react-dom'
|
||||
|
||||
import Active from '../Active'
|
||||
import Visualize from '../Visualize'
|
||||
|
||||
import ReactTopicCard from '../../components/TopicCard'
|
||||
|
||||
|
@ -16,16 +17,18 @@ const TopicCard = {
|
|||
},
|
||||
populateShowCard: function(topic) {
|
||||
const self = TopicCard
|
||||
const topicCardObj = {
|
||||
topic: topic,
|
||||
ActiveMapper: Active.Mapper,
|
||||
updateTopic: obj => {
|
||||
topic.save(obj, { success: topic => self.populateShowCard(topic) })
|
||||
},
|
||||
metacodeSets: self.metacodeSets
|
||||
}
|
||||
ReactDOM.render(
|
||||
React.createElement(ReactTopicCard, topicCardObj),
|
||||
React.createElement(ReactTopicCard, {
|
||||
topic: topic,
|
||||
ActiveMapper: Active.Mapper,
|
||||
updateTopic: obj => {
|
||||
topic.save(obj, { success: topic => self.populateShowCard(topic) })
|
||||
},
|
||||
metacodeSets: self.metacodeSets,
|
||||
redrawCanvas: () => {
|
||||
visualize.mGraph.plot()
|
||||
}
|
||||
}),
|
||||
document.getElementById('showcard')
|
||||
)
|
||||
|
||||
|
|
|
@ -41,11 +41,7 @@ class Attachments extends Component {
|
|||
|
||||
if (!hasAttachment && !authorizedToEdit) return null
|
||||
|
||||
const embedlyLinkLoaded = 'TODO how to get this value'
|
||||
|
||||
const className = hasAttachment
|
||||
? `embeds ${embedlyLinkLoaded ? '' : 'nonEmbedlyLink'}`
|
||||
: 'attachments'
|
||||
const className = hasAttachment ? 'embeds' : 'attachments'
|
||||
|
||||
return (
|
||||
<div className={className}>
|
||||
|
|
|
@ -5,9 +5,6 @@ import React, { PropTypes, Component } from 'react'
|
|||
import MetacodeSelect from '../MetacodeSelect'
|
||||
import Permission from './Permission'
|
||||
|
||||
// TODO use a callback instead of an import
|
||||
import Visualize from '../../Metamaps/Visualize'
|
||||
|
||||
class Links extends Component {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
|
@ -27,7 +24,7 @@ class Links extends Component {
|
|||
this.props.updateTopic({
|
||||
metacode_id: metacodeId
|
||||
})
|
||||
Visualize.mGraph.plot()
|
||||
this.props.redrawCanvas()
|
||||
}
|
||||
|
||||
toggleShowMoreMaps = e => {
|
||||
|
@ -149,7 +146,8 @@ Links.propTypes = {
|
|||
icon_path: PropTypes.string, // url
|
||||
name: PropTypes.string
|
||||
}))
|
||||
}))
|
||||
})),
|
||||
redrawCanvas: PropTypes.func
|
||||
}
|
||||
|
||||
export default Links
|
||||
|
|
|
@ -3,7 +3,6 @@ import React, { PropTypes, Component } from 'react'
|
|||
// TODO how do we make it so that clicking elsewhere on the topic
|
||||
// card cancels this
|
||||
class Permission extends Component {
|
||||
|
||||
constructor(props) {
|
||||
super(props)
|
||||
this.state = {
|
||||
|
|
|
@ -10,7 +10,6 @@ class ReactTopicCard extends Component {
|
|||
const { topic, ActiveMapper } = this.props
|
||||
const authorizedToEdit = topic.authorizeToEdit(ActiveMapper)
|
||||
const hasAttachment = topic.get('link') && topic.get('link') !== ''
|
||||
const topicId = topic.isNew() ? topic.cid : topic.id // TODO should we be using cid here???
|
||||
|
||||
let classname = 'permission'
|
||||
if (authorizedToEdit) {
|
||||
|
@ -22,7 +21,7 @@ class ReactTopicCard extends Component {
|
|||
|
||||
return (
|
||||
<div className={classname}>
|
||||
<div className={`CardOnGraph ${hasAttachment ? 'hasAttachment' : ''}`} id={`topic_${topicId}`}>
|
||||
<div className={`CardOnGraph ${hasAttachment ? 'hasAttachment' : ''}`} id={`topic_${topic.id}`}>
|
||||
<Title name={topic.get('name')}
|
||||
authorizedToEdit={authorizedToEdit}
|
||||
onChange={this.props.updateTopic}
|
||||
|
@ -31,6 +30,7 @@ class ReactTopicCard extends Component {
|
|||
ActiveMapper={this.props.ActiveMapper}
|
||||
updateTopic={this.props.updateTopic}
|
||||
metacodeSets={this.props.metacodeSets}
|
||||
redrawCanvas={this.props.redrawCanvas}
|
||||
/>
|
||||
<Desc desc={topic.get('desc')}
|
||||
authorizedToEdit={authorizedToEdit}
|
||||
|
@ -58,7 +58,8 @@ ReactTopicCard.propTypes = {
|
|||
icon_path: PropTypes.string, // url
|
||||
name: PropTypes.string
|
||||
}))
|
||||
}))
|
||||
})),
|
||||
redrawCanvas: PropTypes.func
|
||||
}
|
||||
|
||||
export default ReactTopicCard
|
||||
|
|
Loading…
Add table
Reference in a new issue