From 80a5e8335f866f93a847d55504b91d9279c7834a Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Sat, 18 Feb 2017 16:59:58 -0800 Subject: [PATCH] render metacodeOptions in right click menu with react --- frontend/src/Metamaps/JIT.js | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/frontend/src/Metamaps/JIT.js b/frontend/src/Metamaps/JIT.js index 54e48b65..8c8492b6 100644 --- a/frontend/src/Metamaps/JIT.js +++ b/frontend/src/Metamaps/JIT.js @@ -2,9 +2,14 @@ import _ from 'lodash' import outdent from 'outdent' +import clipboard from 'clipboard-js' +import React from 'react' +import ReactDOM from 'react-dom' import $jit from '../patched/JIT' +import MetacodeSelect from '../components/MetacodeSelect' + import Active from './Active' import Control from './Control' import Create from './Create' @@ -21,7 +26,6 @@ import Topic from './Topic' import TopicCard from './Views/TopicCard' import Util from './Util' import Visualize from './Visualize' -import clipboard from 'clipboard-js' let panningInt @@ -1418,9 +1422,7 @@ const JIT = {
` - const metacodeOptions = $('#metacodeOptions').html() - - menustring += '
  • Change metacode' + metacodeOptions + '
  • ' + menustring += '
  • Change metacode
  • ' } if (Active.Topic) { if (!Active.Mapper) { @@ -1475,6 +1477,20 @@ const JIT = { // add the menu to the page $('#wrapper').append(rightclickmenu) + ReactDOM.render( + React.createElement(MetacodeSelect, { + onMetacodeSelect: metacodeId => { + const topic = Topic.get(node.id) + debugger + topic.save({ + metacode_id: metacodeId + }) + }, + metacodeSets: TopicCard.metacodeSets + }), + document.getElementById('metacodeOptionsWrapper') + ) + // attach events to clicks on the list items // delete the selected things from the database @@ -1524,7 +1540,6 @@ const JIT = { // change the metacode of all the selected nodes that you have edit permission for $('.rc-metacode li li').click(function() { $('.rightclickmenu').remove() - // Control.updateSelectedMetacodes($(this).attr('data-id')) })