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 ReactDOM from 'react-dom'
|
||||||
|
|
||||||
import Active from '../Active'
|
import Active from '../Active'
|
||||||
|
import Visualize from '../Visualize'
|
||||||
|
|
||||||
import ReactTopicCard from '../../components/TopicCard'
|
import ReactTopicCard from '../../components/TopicCard'
|
||||||
|
|
||||||
|
@ -16,16 +17,18 @@ const TopicCard = {
|
||||||
},
|
},
|
||||||
populateShowCard: function(topic) {
|
populateShowCard: function(topic) {
|
||||||
const self = TopicCard
|
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(
|
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')
|
document.getElementById('showcard')
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -41,11 +41,7 @@ class Attachments extends Component {
|
||||||
|
|
||||||
if (!hasAttachment && !authorizedToEdit) return null
|
if (!hasAttachment && !authorizedToEdit) return null
|
||||||
|
|
||||||
const embedlyLinkLoaded = 'TODO how to get this value'
|
const className = hasAttachment ? 'embeds' : 'attachments'
|
||||||
|
|
||||||
const className = hasAttachment
|
|
||||||
? `embeds ${embedlyLinkLoaded ? '' : 'nonEmbedlyLink'}`
|
|
||||||
: 'attachments'
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={className}>
|
<div className={className}>
|
||||||
|
|
|
@ -5,9 +5,6 @@ import React, { PropTypes, Component } from 'react'
|
||||||
import MetacodeSelect from '../MetacodeSelect'
|
import MetacodeSelect from '../MetacodeSelect'
|
||||||
import Permission from './Permission'
|
import Permission from './Permission'
|
||||||
|
|
||||||
// TODO use a callback instead of an import
|
|
||||||
import Visualize from '../../Metamaps/Visualize'
|
|
||||||
|
|
||||||
class Links extends Component {
|
class Links extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props)
|
super(props)
|
||||||
|
@ -27,7 +24,7 @@ class Links extends Component {
|
||||||
this.props.updateTopic({
|
this.props.updateTopic({
|
||||||
metacode_id: metacodeId
|
metacode_id: metacodeId
|
||||||
})
|
})
|
||||||
Visualize.mGraph.plot()
|
this.props.redrawCanvas()
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleShowMoreMaps = e => {
|
toggleShowMoreMaps = e => {
|
||||||
|
@ -149,7 +146,8 @@ Links.propTypes = {
|
||||||
icon_path: PropTypes.string, // url
|
icon_path: PropTypes.string, // url
|
||||||
name: PropTypes.string
|
name: PropTypes.string
|
||||||
}))
|
}))
|
||||||
}))
|
})),
|
||||||
|
redrawCanvas: PropTypes.func
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Links
|
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
|
// TODO how do we make it so that clicking elsewhere on the topic
|
||||||
// card cancels this
|
// card cancels this
|
||||||
class Permission extends Component {
|
class Permission extends Component {
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props)
|
super(props)
|
||||||
this.state = {
|
this.state = {
|
||||||
|
|
|
@ -10,7 +10,6 @@ class ReactTopicCard extends Component {
|
||||||
const { topic, ActiveMapper } = this.props
|
const { topic, ActiveMapper } = this.props
|
||||||
const authorizedToEdit = topic.authorizeToEdit(ActiveMapper)
|
const authorizedToEdit = topic.authorizeToEdit(ActiveMapper)
|
||||||
const hasAttachment = topic.get('link') && topic.get('link') !== ''
|
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'
|
let classname = 'permission'
|
||||||
if (authorizedToEdit) {
|
if (authorizedToEdit) {
|
||||||
|
@ -22,7 +21,7 @@ class ReactTopicCard extends Component {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classname}>
|
<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')}
|
<Title name={topic.get('name')}
|
||||||
authorizedToEdit={authorizedToEdit}
|
authorizedToEdit={authorizedToEdit}
|
||||||
onChange={this.props.updateTopic}
|
onChange={this.props.updateTopic}
|
||||||
|
@ -31,6 +30,7 @@ class ReactTopicCard extends Component {
|
||||||
ActiveMapper={this.props.ActiveMapper}
|
ActiveMapper={this.props.ActiveMapper}
|
||||||
updateTopic={this.props.updateTopic}
|
updateTopic={this.props.updateTopic}
|
||||||
metacodeSets={this.props.metacodeSets}
|
metacodeSets={this.props.metacodeSets}
|
||||||
|
redrawCanvas={this.props.redrawCanvas}
|
||||||
/>
|
/>
|
||||||
<Desc desc={topic.get('desc')}
|
<Desc desc={topic.get('desc')}
|
||||||
authorizedToEdit={authorizedToEdit}
|
authorizedToEdit={authorizedToEdit}
|
||||||
|
@ -58,7 +58,8 @@ ReactTopicCard.propTypes = {
|
||||||
icon_path: PropTypes.string, // url
|
icon_path: PropTypes.string, // url
|
||||||
name: PropTypes.string
|
name: PropTypes.string
|
||||||
}))
|
}))
|
||||||
}))
|
})),
|
||||||
|
redrawCanvas: PropTypes.func
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ReactTopicCard
|
export default ReactTopicCard
|
||||||
|
|
Loading…
Add table
Reference in a new issue