diff --git a/app/assets/javascripts/Jit/find.js b/app/assets/javascripts/Jit/find.js index 346ebf8e..476fa1c9 100644 --- a/app/assets/javascripts/Jit/find.js +++ b/app/assets/javascripts/Jit/find.js @@ -528,16 +528,13 @@ function openFind() { } function closeFind() { + clearFoundData(); + findOpen = false; - Mconsole.graph.eachNode( function (n) { - n.setData('inCommons', false); - n.setData('onCanvas', false); - }); - Mconsole.plot(); - $('#closeFind, #findWhere').css('display','none'); - $('#sideOptionFind').css('cursor','pointer'); - $('#sideOptionFind').animate({ - width: '45px', - height: '32px' - }, 100); -} + $('#closeFind, #findWhere').css('display','none'); + $('#sideOptionFind').css('cursor','pointer'); + $('#sideOptionFind').animate({ + width: '45px', + height: '32px' + }, 100); +}//closeFind diff --git a/app/assets/javascripts/Jit/graphsettings-event-handlers.js b/app/assets/javascripts/Jit/graphsettings-event-handlers.js index f12f3d73..a0c155e8 100644 --- a/app/assets/javascripts/Jit/graphsettings-event-handlers.js +++ b/app/assets/javascripts/Jit/graphsettings-event-handlers.js @@ -33,6 +33,10 @@ function nodeDoubleClickHandler(node, e) { return; } + if (userid == null) { + return; + } + node.setData('inCommons', false); deselectNode(node); if (window.mapid) { diff --git a/app/controllers/mappings_controller.rb b/app/controllers/mappings_controller.rb index e30a226d..7fdda422 100644 --- a/app/controllers/mappings_controller.rb +++ b/app/controllers/mappings_controller.rb @@ -14,33 +14,35 @@ class MappingsController < ApplicationController # POST mappings def create - @mapping = Mapping.new() + @user = current_user + if @user + @mapping = Mapping.new() - //TODO authenticate and put a user + @mapping.user = @user + @mapping.xloc = params[:xloc] if params[:xloc] + @mapping.yloc = params[:yloc] if params[:yloc] - @mapping.xloc = params[:xloc] if params[:xloc] - @mapping.yloc = params[:yloc] if params[:yloc] - - if params[:map] - if params[:map][:id] - @map = Map.find(params[:map][:id]) - @mapping.map = @map + if params[:map] + if params[:map][:id] + @map = Map.find(params[:map][:id]) + @mapping.map = @map + end end + if params[:topic] + if params[:topic][:id] + @topic = Topic.find(params[:topic][:id]) + @mapping.topic = @topic + @mapping.category = "Topic" + end + elsif params[:synapse] + if params[:synapse][:id] + @topic = Synapse.find(params[:synapse][:id]) + @mapping.synapse = @synapse + @mapping.category = "Synapse" + end + end + @mapping.save() end - if params[:topic] - if params[:topic][:id] - @topic = Topic.find(params[:topic][:id]) - @mapping.topic = @topic - @mapping.category = "Topic" - end - elsif params[:synapse] - if params[:synapse][:id] - @topic = Synapse.find(params[:synapse][:id]) - @mapping.synapse = @synapse - @mapping.category = "Synapse" - end - end - @mapping.save() end # GET /mappings/:id