';
+ if (mapid == null) {
+ littleHTML += ' \
+
\
+ ';
+ }
+ else if (mapid != null && userid != null) {
+ littleHTML += ' \
+
\
+ ';
+ }
+ if (userid != null) {
+ littleHTML += ' \
+
\
+ ';
+ }
+ littleHTML += '
';
+ littleHTML = littleHTML.replace(/\$_id_\$/g, node.id);
+ littleHTML = littleHTML.replace(/\$_mapid_\$/g, mapid);
+ littleHTML = littleHTML.replace(/\$_name_\$/g, node.name);
+ nameContainer.innerHTML = littleHTML;
domElement.appendChild(nameContainer);
style.fontSize = "0.9em";
style.color = "#222222";
// add some events to the label
- nameContainer.onclick = function(){
+ $(nameContainer).find('.label').click(function(){
selectNodeOnClickHandler(node)
+ });
+
+ nameContainer.onmouseover = function(){
+ $('.name.topic_' + node.id + ' .nodeOptions').css('display','block');
}
+
+ nameContainer.onmouseout = function(){
+ $('.name.topic_' + node.id + ' .nodeOptions').css('display','none');
+ }
+
//bind callbacks
$(showCard).find('.type.best_in_place').bind("ajax:success", function() {
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
index 4c057ec0..86ffa8b5 100644
--- a/app/assets/javascripts/application.js
+++ b/app/assets/javascripts/application.js
@@ -21,7 +21,7 @@
// other options are 'graph'
var viewMode = "list";
-var labelType, useGradients, nativeTextSupport, animate, json, Mconsole = null, gType, tempNode = null, tempInit = false, tempNode2 = null, metacodeIMGinit = false, findOpen = false, analyzeOpen = false, organizeOpen = false, goRealtime = false;
+var labelType, useGradients, nativeTextSupport, animate, json, Mconsole = null, gType, tempNode = null, tempInit = false, tempNode2 = null, metacodeIMGinit = false, findOpen = false, analyzeOpen = false, organizeOpen = false, goRealtime = false, mapid = null;
$(document).ready(function() {
@@ -54,7 +54,6 @@ var labelType, useGradients, nativeTextSupport, animate, json, Mconsole = null,
if (! sliding1) {
sliding1 = true;
if (userid != null) {
- $('.footer .menu').css('border','1px solid #000');
$('.footer .menu').animate({
height: '252px'
}, 300, function() {
@@ -78,7 +77,6 @@ var labelType, useGradients, nativeTextSupport, animate, json, Mconsole = null,
height: '0px'
}, 300, function() {
sliding1 = false;
- $('.footer .menu').css('border','none');
});
}
},800);
@@ -125,6 +123,23 @@ function saveToMap() {
$('#new_map').fadeIn('fast');
}
+
+// this is for hiding one topic from your canvas
+function removeFromCanvas(topic_id) {
+ var node = Mconsole.graph.getNode(topic_id);
+ node.setData('alpha', 0, 'end');
+ node.eachAdjacency(function(adj) {
+ adj.setData('alpha', 0, 'end');
+ });
+ Mconsole.fx.animate({
+ modes: ['node-property:alpha',
+ 'edge-property:alpha'],
+ duration: 1000
+ });
+ Mconsole.graph.removeNode(topic_id);
+ Mconsole.labels.disposeLabel(topic_id);
+}
+
function addMetacode() {
// code from http://www.professorcloud.com/mainsite/carousel-integration.htm
//mouseWheel:true,
diff --git a/app/assets/stylesheets/topics.css.scss b/app/assets/stylesheets/topics.css.scss
index ecf313fb..6ed2b6b6 100644
--- a/app/assets/stylesheets/topics.css.scss
+++ b/app/assets/stylesheets/topics.css.scss
@@ -1,58 +1,97 @@
-// Place all the styles related to the Topics controller here.
-// They will automatically be included in application.css.
-// You can use Sass (SCSS) here: http://sass-lang.com/
-
-.topic { display:block; float:left; position:relative; width:175px; height:300px; padding:10px 5px 10px 35px; background: url('bg.png'); border-radius:15px; margin:30px 0 30px 50px; color:#000; }
-
-.close-link,
-.topic .delete {
-position: absolute;
-top: -14px;
-left: 0px;
-background: none;
-border: 0;
-color: white;
-border: none;
-font-size: 14px;
-margin: 0;
-padding: 0;
-cursor:pointer;
-}
-
-.topic .scroll { display:block; height:283px; }
-
-.topic .type {position: absolute;
-color: white;
-top: -22px;
-right: 0;
-font-weight: bold;
-font-size: 20px;
-line-height: 24px;}
-
-.topic .icon { position:absolute; top:135px; left:-25px; }
-
-.topic .title { font-size:22px; line-height:25px; display:block; border-bottom:2px solid #000; padding-bottom:5px; }
-
-.topic .desc { font-size:15px; font-family:Arial, Helvetica, sans-serif; }
-.topic .desc h3 { font-style:normal; margin-top:5px; }
-
-.topic .link { position:absolute; width:170px; top:295px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
-
-.best_in_place_name {
- max-width:130px;
- float:left;
-}
-
-.best_in_place_name input{
- max-width:130px;
-}
-
-.topic-go-arrow {
- width: 1em;
- height: 1em;
- float: right;
-}
-
-.gray {
- color: #999999;
-}
+// Place all the styles related to the Topics controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
+
+.nodeOptions {
+ display:none;
+ position: absolute;
+ top: -5px;
+ right: -17px;
+}
+
+.onCanvas .removeFromMap {
+ display:none !important;
+}
+
+.onMap .removeFromCanvas {
+ display:none !important;
+}
+
+.unauthenticated .deleteTopic {
+ display:none !important;
+}
+
+.removeFromCanvas {
+ display: block;
+ width: 17px;
+ height: 16px;
+ background: url('removeFromCanvas.png') no-repeat 2px 0;
+}
+
+.removeFromMap {
+ display: block;
+ width: 17px;
+ height: 16px;
+ background: url('removeFromMap.png') no-repeat 2px 0;
+}
+
+.deleteTopic {
+ display: block;
+ width: 17px;
+ height: 16px;
+ background: url('delete.png') no-repeat 2px 0;
+}
+
+.topic { display:block; float:left; position:relative; width:175px; height:300px; padding:10px 5px 10px 35px; background: url('bg.png'); border-radius:15px; margin:30px 0 30px 50px; color:#000; }
+
+.topic .delete {
+position: absolute;
+top: -14px;
+left: 0px;
+background: none;
+border: 0;
+color: white;
+border: none;
+font-size: 14px;
+margin: 0;
+padding: 0;
+cursor:pointer;
+}
+
+.topic .scroll { display:block; height:283px; }
+
+.topic .type {position: absolute;
+color: white;
+top: -22px;
+right: 0;
+font-weight: bold;
+font-size: 20px;
+line-height: 24px;}
+
+.topic .icon { position:absolute; top:135px; left:-25px; }
+
+.topic .title { font-size:22px; line-height:25px; display:block; border-bottom:2px solid #000; padding-bottom:5px; }
+
+.topic .desc { font-size:15px; font-family:Arial, Helvetica, sans-serif; }
+.topic .desc h3 { font-style:normal; margin-top:5px; }
+
+.topic .link { position:absolute; width:170px; top:295px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
+
+.best_in_place_name {
+ max-width:130px;
+ float:left;
+}
+
+.best_in_place_name input{
+ max-width:130px;
+}
+
+.topic-go-arrow {
+ width: 25px;
+ height: 25px;
+ float: right;
+}
+
+.gray {
+ color: #999999;
+}
diff --git a/app/controllers/maps_controller.rb b/app/controllers/maps_controller.rb
index 70ace5f6..347d70f1 100644
--- a/app/controllers/maps_controller.rb
+++ b/app/controllers/maps_controller.rb
@@ -107,14 +107,6 @@ class MapsController < ApplicationController
@map.attributes = params[:map]
@map.save
- if params[:outtopics]
- @outtopics = params[:outtopics]
- @outtopics.each do |topic|
- @mapping = Mapping.where("map_id = ? AND topic_id = ?", @map.id, topic).first
- @mapping.delete
- end
- end
-
respond_with(@user, location: map_path(@map)) do |format|
end
end
diff --git a/app/controllers/topics_controller.rb b/app/controllers/topics_controller.rb
index fb49ae15..5b95df3c 100644
--- a/app/controllers/topics_controller.rb
+++ b/app/controllers/topics_controller.rb
@@ -129,7 +129,32 @@ class TopicsController < ApplicationController
# respond_with(@user, location: topic_url(@topic)) do |format|
# end
end
-
+
+ # GET mappings/:map_id/:topic_id/removefrommap
+ def removefrommap
+ @current = current_user
+ @mapping = Mapping.find_by_topic_id_and_map_id(params[:topic_id],params[:map_id])
+
+ @map = Map.find(params[:map_id])
+ @topic = Topic.find(params[:topic_id])
+ @mappings = @map.mappings.select{|m|
+ if m.category == "Synapse"
+ m.synapse.topic1 == @topic || m.synapse.topic2 == @topic
+ else
+ false
+ end
+ }
+ @mappings.each do |m|
+ m.delete
+ end
+
+ @mapping.delete
+
+ respond_to do |format|
+ format.js
+ end
+ end
+
# DELETE topics/:id
def destroy
@current = current_user
diff --git a/app/views/main/console.html.erb b/app/views/main/console.html.erb
index d3f8d28a..4fe2cf66 100644
--- a/app/views/main/console.html.erb
+++ b/app/views/main/console.html.erb
@@ -1,27 +1,27 @@
-
-
+
+<% if authenticated? %>
+ <%= render :partial => 'newtopic' %>
+ <%= render :partial => 'newsynapse' %>
+<% end %>
+<%= form_for @map, :url => realtime_path(@map), :method => "GET", :html => { :id => "MapRealtime"}, remote: true do |form| %>
+ <%= form.hidden_field :time, :value => Time.now.to_i %>
+ <%= form.hidden_field :ids, :value => 0 %>
+<% end %>
+
+
-
-<% if authenticated? %>
- <%= render :partial => 'newtopic' %>
- <%= render :partial => 'newsynapse' %>
-<% end %>
-<%= form_for @map, :url => realtime_path(@map), :method => "GET", :html => { :id => "MapRealtime"}, remote: true do |form| %>
- <%= form.hidden_field :time, :value => Time.now.to_i %>
- <%= form.hidden_field :ids, :value => 0 %>
-<% end %>
-
\ No newline at end of file
diff --git a/app/views/topics/destroy.js.erb b/app/views/topics/destroy.js.erb
index da2a26ae..42d2677c 100644
--- a/app/views/topics/destroy.js.erb
+++ b/app/views/topics/destroy.js.erb
@@ -1 +1,17 @@
-$('#<%= dom_id(@topic) %>').fadeOut('slow');
\ No newline at end of file
+if (Mconsole != null) {
+ var node = Mconsole.graph.getNode(<%= @topic.id %>);
+ node.setData('alpha', 0, 'end');
+ node.eachAdjacency(function(adj) {
+ adj.setData('alpha', 0, 'end');
+ });
+ Mconsole.fx.animate({
+ modes: ['node-property:alpha',
+ 'edge-property:alpha'],
+ duration: 1000
+ });
+ Mconsole.graph.removeNode(<%= @topic.id %>);
+ Mconsole.labels.disposeLabel(<%= @topic.id %>);
+}
+else {
+ $('#<%= dom_id(@topic) %>').fadeOut('slow');
+}
\ No newline at end of file
diff --git a/app/views/topics/removefrommap.js.erb b/app/views/topics/removefrommap.js.erb
new file mode 100644
index 00000000..7241640d
--- /dev/null
+++ b/app/views/topics/removefrommap.js.erb
@@ -0,0 +1,14 @@
+if (Mconsole != null) {
+ var node = Mconsole.graph.getNode(<%= @mapping.topic_id %>);
+ node.setData('alpha', 0, 'end');
+ node.eachAdjacency(function(adj) {
+ adj.setData('alpha', 0, 'end');
+ });
+ Mconsole.fx.animate({
+ modes: ['node-property:alpha',
+ 'edge-property:alpha'],
+ duration: 1000
+ });
+ Mconsole.graph.removeNode(<%= @mapping.topic_id %>);
+ Mconsole.labels.disposeLabel(<%= @mapping.topic_id %>);
+}
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index 6ae5eff9..98020f20 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -10,6 +10,7 @@ ISSAD::Application.routes.draw do
match 'maps/:id/savelayout', to: 'maps#savelayout', via: :put, as: :savelayout
match 'maps/:id/realtime', to: 'maps#realtime', via: :get, as: :realtime
+ match 'mappings/:map_id/:topic_id/removefrommap', to: 'topics#removefrommap', via: :get, as: :removefrommap
resource :session