too tired cause I stayed up to stupid late to say something intelligeblle here see.
This commit is contained in:
parent
a9462d0f0e
commit
940c6f02a5
11 changed files with 136 additions and 56 deletions
|
@ -93,10 +93,12 @@ var findMappers = ['name', 'topic (by name)', 'map (by name)', 'synapse (by topi
|
||||||
function hideAll(duration) {
|
function hideAll(duration) {
|
||||||
if (duration == null) duration = 500;
|
if (duration == null) duration = 500;
|
||||||
Mconsole.graph.eachNode( function (n) {
|
Mconsole.graph.eachNode( function (n) {
|
||||||
n.setData('alpha', 0.4, 'end');
|
if (!(n.getData('inCommons') || n.getData('onCanvas'))) {
|
||||||
n.eachAdjacency(function(adj) {
|
n.setData('alpha', 0.4, 'end');
|
||||||
adj.setData('alpha', 0.4, 'end');
|
n.eachAdjacency(function(adj) {
|
||||||
});
|
adj.setData('alpha', 0.4, 'end');
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
Mconsole.fx.animate({
|
Mconsole.fx.animate({
|
||||||
modes: ['node-property:alpha',
|
modes: ['node-property:alpha',
|
||||||
|
@ -109,7 +111,7 @@ function showAll(duration) {
|
||||||
Mconsole.graph.eachNode( function (n) {
|
Mconsole.graph.eachNode( function (n) {
|
||||||
n.setData('alpha', 1, 'end');
|
n.setData('alpha', 1, 'end');
|
||||||
n.eachAdjacency(function(adj) {
|
n.eachAdjacency(function(adj) {
|
||||||
adj.setData('alpha', 1, 'end');
|
adj.setData('alpha', 1, 'end');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
Mconsole.fx.animate({
|
Mconsole.fx.animate({
|
||||||
|
@ -163,10 +165,20 @@ function onCanvasSearch(name,mapID,mapperID) {
|
||||||
|
|
||||||
|
|
||||||
function clearCanvas() {
|
function clearCanvas() {
|
||||||
Mconsole.graph.eachNode( function(n) { Mconsole.graph.removeNode(n.id); $('#'+n.id).remove(); });
|
Mconsole.graph.eachNode( function(n) { Mconsole.graph.removeNode(n.id); Mconsole.labels.disposeLabel(n.id); });
|
||||||
Mconsole.plot();
|
Mconsole.plot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function clearFoundData() {
|
||||||
|
Mconsole.graph.eachNode( function(n) {
|
||||||
|
if (n.getData('inCommons') === true) {
|
||||||
|
Mconsole.graph.removeNode(n.id);
|
||||||
|
Mconsole.labels.disposeLabel(n.id);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Mconsole.plot();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////
|
////
|
||||||
|
@ -256,18 +268,20 @@ $(document).ready(function() {
|
||||||
|
|
||||||
// only have the autocomplete enabled if they are searching in the commons
|
// only have the autocomplete enabled if they are searching in the commons
|
||||||
if (firstVal == "checked" && secondVal == "checked"){
|
if (firstVal == "checked" && secondVal == "checked"){
|
||||||
$('#topic_by_name_input').autocomplete( "option", "disabled", false );
|
//$('#topic_by_name_input').autocomplete( "option", "disabled", false );
|
||||||
|
$('#topic_by_name_input').autocomplete( "option", "disabled", true );
|
||||||
}
|
}
|
||||||
else if (firstVal == "checked"){
|
else if (firstVal == "checked"){
|
||||||
showAll();
|
setTimeout(function(){showAll();},0);
|
||||||
$('#topic_by_name_input').autocomplete( "option", "disabled", true );
|
$('#topic_by_name_input').autocomplete( "option", "disabled", true );
|
||||||
}
|
}
|
||||||
else if (secondVal == "checked"){
|
else if (secondVal == "checked"){
|
||||||
hideAll();
|
//setTimeout(function(){hideAll();},0);
|
||||||
$('#topic_by_name_input').autocomplete( "option", "disabled", false );
|
//$('#topic_by_name_input').autocomplete( "option", "disabled", false );
|
||||||
|
$('#topic_by_name_input').autocomplete( "option", "disabled", true );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
alert('Either select searching In the Commons, or On the Canvas to search');
|
alert('You either need to have searching On Your Canvas or In the Commons enabled');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
stop: function (event, $elem) {
|
stop: function (event, $elem) {
|
||||||
|
@ -278,20 +292,26 @@ $(document).ready(function() {
|
||||||
var topicName = $('#topic_by_name_input').val();
|
var topicName = $('#topic_by_name_input').val();
|
||||||
// run a search on the canvas or in the commons or both
|
// run a search on the canvas or in the commons or both
|
||||||
if (firstVal == "checked" && secondVal == "checked"){
|
if (firstVal == "checked" && secondVal == "checked"){
|
||||||
onCanvasSearch(topicName,null,null);
|
setTimeout(function(){onCanvasSearch(topicName,null,null);},0);
|
||||||
// and run a search in the commons
|
$('#topicsByName').val(topicName);
|
||||||
|
$('#topicsByUser').val("");
|
||||||
|
$('#topicsByMap').val("");
|
||||||
|
$('#get_topics_form').submit();
|
||||||
}
|
}
|
||||||
else if (firstVal == "checked"){
|
else if (firstVal == "checked"){
|
||||||
onCanvasSearch(topicName,null,null);
|
setTimeout(function(){onCanvasSearch(topicName,null,null);},0);
|
||||||
}
|
}
|
||||||
else if (secondVal == "checked"){
|
else if (secondVal == "checked"){
|
||||||
//run a search in the commons
|
$('#topicsByName').val(topicName);
|
||||||
|
$('#topicsByUser').val("");
|
||||||
|
$('#topicsByMap').val("");
|
||||||
|
$('#get_topics_form').submit();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//do nothing
|
//do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
if (topicName == "") showAll();
|
if (topicName == "") { clearFoundData(); }
|
||||||
},
|
},
|
||||||
delay: 2000
|
delay: 2000
|
||||||
});
|
});
|
||||||
|
@ -416,18 +436,20 @@ $(document).ready(function() {
|
||||||
// only have the autocomplete enabled if they are searching in the commons
|
// only have the autocomplete enabled if they are searching in the commons
|
||||||
|
|
||||||
if (firstNewVal == "checked" && secondNewVal == "checked"){
|
if (firstNewVal == "checked" && secondNewVal == "checked"){
|
||||||
onCanvasSearch(null,data.item.id,null);
|
setTimeout(function(){onCanvasSearch(null,data.item.id,null);},0);
|
||||||
$('#topicsByMap').val(data.item.id);
|
$('#topicsByMap').val(data.item.id);
|
||||||
$('#topicsByUser').val("");
|
$('#topicsByUser').val("");
|
||||||
|
$('#topicsByName').val("");
|
||||||
$('#get_topics_form').submit();
|
$('#get_topics_form').submit();
|
||||||
}
|
}
|
||||||
else if (firstNewVal == "checked"){
|
else if (firstNewVal == "checked"){
|
||||||
onCanvasSearch(null,data.item.id,null);
|
setTimeout(function(){onCanvasSearch(null,data.item.id,null);},0);
|
||||||
}
|
}
|
||||||
else if (secondNewVal == "checked"){
|
else if (secondNewVal == "checked"){
|
||||||
//hideAll();
|
//hideAll();
|
||||||
$('#topicsByMap').val(data.item.id);
|
$('#topicsByMap').val(data.item.id);
|
||||||
$('#topicsByUser').val("");
|
$('#topicsByUser').val("");
|
||||||
|
$('#topicsByName').val("");
|
||||||
$('#get_topics_form').submit();
|
$('#get_topics_form').submit();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -460,19 +482,21 @@ $(document).ready(function() {
|
||||||
|
|
||||||
// only have the autocomplete enabled if they are searching in the commons
|
// only have the autocomplete enabled if they are searching in the commons
|
||||||
|
|
||||||
if (firstNewVal == "checked" && secondNewVal == "checked"){
|
if (firstNewVal == "checked" && secondNewVal == "checked"){
|
||||||
onCanvasSearch(null,null,data.item.id.toString());
|
setTimeout(function(){onCanvasSearch(null,null,data.item.id.toString());},0);
|
||||||
$('#topicsByUser').val(data.item.id);
|
$('#topicsByUser').val(data.item.id);
|
||||||
$('#topicsByMap').val("");
|
$('#topicsByMap').val("");
|
||||||
|
$('#topicsByName').val("");
|
||||||
$('#get_topics_form').submit();
|
$('#get_topics_form').submit();
|
||||||
}
|
}
|
||||||
else if (firstNewVal == "checked"){
|
else if (firstNewVal == "checked"){
|
||||||
onCanvasSearch(null,null,data.item.id.toString());
|
setTimeout(function(){onCanvasSearch(null,null,data.item.id.toString());},0);
|
||||||
}
|
}
|
||||||
else if (secondNewVal == "checked"){
|
else if (secondNewVal == "checked"){
|
||||||
//hideAll();
|
//hideAll();
|
||||||
$('#topicsByUser').val(data.item.id);
|
$('#topicsByUser').val(data.item.id);
|
||||||
$('#topicsByMap').val("");
|
$('#topicsByMap').val("");
|
||||||
|
$('#topicsByName').val("");
|
||||||
$('#get_topics_form').submit();
|
$('#get_topics_form').submit();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -367,7 +367,7 @@ var nodeSettings = {
|
||||||
}
|
}
|
||||||
|
|
||||||
//check for edge label in data
|
//check for edge label in data
|
||||||
var desc = adj.getData("desc") + ' (' + adj.getData("id") + ')';
|
var desc = adj.getData("desc");
|
||||||
var showDesc = adj.getData("showDesc");
|
var showDesc = adj.getData("showDesc");
|
||||||
if( desc != "" && showDesc ) {
|
if( desc != "" && showDesc ) {
|
||||||
//now adjust the label placement
|
//now adjust the label placement
|
||||||
|
@ -399,7 +399,7 @@ function selectEdgeOnClickHandler(adj) {
|
||||||
|
|
||||||
function selectNodeOnClickHandler(node) {
|
function selectNodeOnClickHandler(node) {
|
||||||
|
|
||||||
$('.showcard').css('display','none');
|
$('.showcard').css('display','none');
|
||||||
$('.name').css('display','block');
|
$('.name').css('display','block');
|
||||||
$('.name.topic_' + node.id).css('display','none');
|
$('.name.topic_' + node.id).css('display','none');
|
||||||
$('.showcard.topic_' + node.id).fadeIn('fast');
|
$('.showcard.topic_' + node.id).fadeIn('fast');
|
||||||
|
@ -529,8 +529,7 @@ function onCreateLabelHandler(domElement, node) {
|
||||||
<div class="CardOnGraph" \
|
<div class="CardOnGraph" \
|
||||||
id="topic_$_id_$"> \
|
id="topic_$_id_$"> \
|
||||||
<a href="#" class="close-link">close</a> \
|
<a href="#" class="close-link">close</a> \
|
||||||
<p class="type best_in_place" \
|
<p class="type best_in_place best_in_place_metacode" \
|
||||||
id="best_in_place_metacode" \
|
|
||||||
data-url="/topics/$_id_$" \
|
data-url="/topics/$_id_$" \
|
||||||
data-object="topic" \
|
data-object="topic" \
|
||||||
data-collection=$_metacode_choices_$ \
|
data-collection=$_metacode_choices_$ \
|
||||||
|
@ -543,24 +542,23 @@ function onCreateLabelHandler(domElement, node) {
|
||||||
src="$_imgsrc_$" /> \
|
src="$_imgsrc_$" /> \
|
||||||
<div class="scroll"> \
|
<div class="scroll"> \
|
||||||
<span class="title"> \
|
<span class="title"> \
|
||||||
<span class="best_in_place" \
|
<span class="best_in_place best_in_place_name" \
|
||||||
id="best_in_place_name" \
|
|
||||||
data-url="/topics/$_id_$" \
|
data-url="/topics/$_id_$" \
|
||||||
data-object="topic" \
|
data-object="topic" \
|
||||||
data-attribute="name" \
|
data-attribute="name" \
|
||||||
data-type="input">$_name_$</span> \
|
data-type="input">$_name_$</span> \
|
||||||
<a href="/topics/$_id_$" target="_blank"> \
|
<a href="/topics/$_id_$" class="topic-go-arrow" target="_blank"> \
|
||||||
<img class="topic-go-arrow" \
|
<img class="topic-go-arrow" \
|
||||||
title="Go to the topic page" \
|
title="Go to the topic page" \
|
||||||
src="/assets/go-arrow.png" /> \
|
src="/assets/go-arrow.png" /> \
|
||||||
</a> \
|
</a> \
|
||||||
|
<div class="clearfloat"></div> \
|
||||||
</span> \
|
</span> \
|
||||||
<div class="contributor"> \
|
<div class="contributor"> \
|
||||||
Added by: <a href="/users/$_userid_$">$_username_$</a> \
|
Added by: <a href="/users/$_userid_$">$_username_$</a> \
|
||||||
</div> \
|
</div> \
|
||||||
<div class="desc"> \
|
<div class="desc"> \
|
||||||
<span class="best_in_place" \
|
<span class="best_in_place best_in_place_desc" \
|
||||||
id="best_in_place_desc" \
|
|
||||||
data-url="/topics/$_id_$" \
|
data-url="/topics/$_id_$" \
|
||||||
data-object="topic" \
|
data-object="topic" \
|
||||||
data-nil="$_desc_nil_$" \
|
data-nil="$_desc_nil_$" \
|
||||||
|
@ -568,8 +566,7 @@ function onCreateLabelHandler(domElement, node) {
|
||||||
data-type="textarea">$_desc_$</span> \
|
data-type="textarea">$_desc_$</span> \
|
||||||
</div> \
|
</div> \
|
||||||
</div> \
|
</div> \
|
||||||
<span class="best_in_place" \
|
<span class="best_in_place best_in_place_link" \
|
||||||
id="best_in_place_link" \
|
|
||||||
data-url="/topics/$_id_$" \
|
data-url="/topics/$_id_$" \
|
||||||
data-object="topic" \
|
data-object="topic" \
|
||||||
data-attribute="link" \
|
data-attribute="link" \
|
||||||
|
@ -612,7 +609,7 @@ function onCreateLabelHandler(domElement, node) {
|
||||||
|
|
||||||
var desc_nil = "<span class='gray'>Click to add description.</span>";
|
var desc_nil = "<span class='gray'>Click to add description.</span>";
|
||||||
html = html.replace(/\$_desc_nil_\$/g, desc_nil);
|
html = html.replace(/\$_desc_nil_\$/g, desc_nil);
|
||||||
if (node.getData("desc") == "") {
|
if (node.getData("desc") == "" && userid != null) {
|
||||||
html = html.replace(/\$_desc_\$/g, desc_nil);
|
html = html.replace(/\$_desc_\$/g, desc_nil);
|
||||||
} else {
|
} else {
|
||||||
html = html.replace(/\$_desc_\$/g, node.getData("desc"));
|
html = html.replace(/\$_desc_\$/g, node.getData("desc"));
|
||||||
|
|
|
@ -3,4 +3,4 @@
|
||||||
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
|
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
|
||||||
|
|
||||||
jQuery ->
|
jQuery ->
|
||||||
$('.best_in_place').best_in_place()
|
$('.authenticated .best_in_place').best_in_place()
|
|
@ -38,6 +38,15 @@ line-height: 24px;}
|
||||||
|
|
||||||
.topic .link { position:absolute; width:170px; top:295px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
.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 {
|
.topic-go-arrow {
|
||||||
width: 1em;
|
width: 1em;
|
||||||
height: 1em;
|
height: 1em;
|
||||||
|
|
|
@ -12,15 +12,28 @@ class MainController < ApplicationController
|
||||||
def search
|
def search
|
||||||
@current = current_user
|
@current = current_user
|
||||||
@topics = Array.new()
|
@topics = Array.new()
|
||||||
|
@synapses = Array.new()
|
||||||
|
if params[:topics_by_name] != ""
|
||||||
|
like_keyword = "%"+params[:topics_by_name]+"%"
|
||||||
|
@topics = Topic.where("name LIKE ?", like_keyword)
|
||||||
|
end
|
||||||
if params[:topics_by_user_id] != ""
|
if params[:topics_by_user_id] != ""
|
||||||
@user = User.find(params[:topics_by_user_id])
|
@user = User.find(params[:topics_by_user_id])
|
||||||
@topics = Topic.visibleToUser(@current, @user)
|
@topics = @topics | Topic.visibleToUser(@current, @user)
|
||||||
elsif params[:topics_by_map_id] != ""
|
|
||||||
@map = Map.find(params[:topics_by_map_id])
|
|
||||||
@topics = @map.topics.delete_if{|topic| not topic.authorize_to_view(@current)}
|
|
||||||
end
|
end
|
||||||
|
if params[:topics_by_map_id] != ""
|
||||||
|
@map = Map.find(params[:topics_by_map_id])
|
||||||
|
@topics = @topics | @map.topics.delete_if{|topic| not topic.authorize_to_view(@current)}
|
||||||
|
end
|
||||||
|
|
||||||
|
@topics.each do |t|
|
||||||
|
t.synapses.each do |s|
|
||||||
|
@synapses = @synapses.push(s) if not @synapses.include? s
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js { respond_with(@topics) }
|
format.js { respond_with(@topics,@synapses) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
<script type="text/javascript">
|
|
||||||
//create a global array we can fill with id's of loaded nodes
|
|
||||||
var loaded_nodes = new Array();
|
|
||||||
</script>
|
|
||||||
<div id="loaded_nodes" class="hidden"></div>
|
|
|
@ -60,6 +60,5 @@
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= render :partial => 'layouts/ga' if Rails.env.production? %>
|
<%= render :partial => 'layouts/ga' if Rails.env.production? %>
|
||||||
<%= render :partial => 'layouts/nodeinfo' %>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -91,7 +91,10 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<%= form_tag("/search", :method => "get", :id => 'get_topics_form', :class => 'get_topics_form', :remote => true) do %>
|
<%= form_tag("/search", :method => "get", :id => 'get_topics_form', :class => 'get_topics_form', :remote => true) do %>
|
||||||
|
<%= text_field_tag(:topics_by_name, "", :id => "topicsByName", :class => "getTopicsInput") %>
|
||||||
<%= text_field_tag(:topics_by_user_id, "", :id => "topicsByUser", :class => "getTopicsInput") %>
|
<%= text_field_tag(:topics_by_user_id, "", :id => "topicsByUser", :class => "getTopicsInput") %>
|
||||||
<%= text_field_tag(:topics_by_map_id, "", :id => "topicsByMap", :class => "getTopicsInput") %>
|
<%= text_field_tag(:topics_by_map_id, "", :id => "topicsByMap", :class => "getTopicsInput") %>
|
||||||
|
<%= text_field_tag(:synapses_by_user_id, "", :id => "synapsesByUser", :class => "getTopicsInput") %>
|
||||||
|
<%= text_field_tag(:synapses_by_map_id, "", :id => "synapsesByMap", :class => "getTopicsInput") %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
|
@ -15,22 +15,25 @@ var even = true;
|
||||||
temp.setData('dim', 1, 'start');
|
temp.setData('dim', 1, 'start');
|
||||||
temp.setData('dim', 25, 'end');
|
temp.setData('dim', 25, 'end');
|
||||||
temp.setData('inCommons',true);
|
temp.setData('inCommons',true);
|
||||||
|
temp.setData('onCanvas',false);
|
||||||
temp.setPos(new $jit.Complex(myX, myY), 'current');
|
temp.setPos(new $jit.Complex(myX, myY), 'current');
|
||||||
temp.setPos(new $jit.Complex(myX, myY), 'start');
|
temp.setPos(new $jit.Complex(myX, myY), 'start');
|
||||||
temp.setPos(new $jit.Complex(myX, myY), 'end');
|
temp.setPos(new $jit.Complex(myX, myY), 'end');
|
||||||
Mconsole.fx.plotNode(temp, Mconsole.canvas);
|
Mconsole.fx.plotNode(temp, Mconsole.canvas);
|
||||||
|
Mconsole.labels.plotLabel(Mconsole.canvas, temp, Mconsole.config);
|
||||||
myX += 100;
|
myX += 100;
|
||||||
even = !even;
|
even = !even;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var temp = Mconsole.graph.getNode('<%= topic.id %>');
|
var temp = Mconsole.graph.getNode('<%= topic.id %>');
|
||||||
if (temp == null) {
|
if (temp == null || temp.getData('inCommons')) {
|
||||||
var newnode = <%= topic.self_as_json.html_safe %>;
|
var newnode = <%= topic.self_as_json.html_safe %>;
|
||||||
Mconsole.graph.addNode(newnode);
|
Mconsole.graph.addNode(newnode);
|
||||||
var temp = Mconsole.graph.getNode('<%= topic.id %>');
|
var temp = Mconsole.graph.getNode('<%= topic.id %>');
|
||||||
temp.setData('dim', 1, 'start');
|
temp.setData('dim', 1, 'start');
|
||||||
temp.setData('dim', 25, 'end');
|
temp.setData('dim', 25, 'end');
|
||||||
temp.setData('inCommons',true);
|
temp.setData('inCommons',true);
|
||||||
|
temp.setData('onCanvas',false);
|
||||||
if (myX > (w-100)) {
|
if (myX > (w-100)) {
|
||||||
myX = -w + 400;
|
myX = -w + 400;
|
||||||
myY += 200;
|
myY += 200;
|
||||||
|
@ -47,13 +50,41 @@ var even = true;
|
||||||
temp.setPos(new $jit.Complex(myX, myY+100), 'end');
|
temp.setPos(new $jit.Complex(myX, myY+100), 'end');
|
||||||
}
|
}
|
||||||
Mconsole.fx.plotNode(temp, Mconsole.canvas);
|
Mconsole.fx.plotNode(temp, Mconsole.canvas);
|
||||||
|
Mconsole.labels.plotLabel(Mconsole.canvas, temp, Mconsole.config);
|
||||||
myX += 100;
|
myX += 100;
|
||||||
even = !even;
|
even = !even;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<% @synapses.each do |synapse| %>
|
||||||
|
var temp1 = null, temp2 = null;
|
||||||
|
temp1 = Mconsole.graph.getNode(<%= synapse.topic1.id %>);
|
||||||
|
temp2 = Mconsole.graph.getNode(<%= synapse.topic2.id %>);
|
||||||
|
if (!(temp1 == undefined || temp2 == undefined)) {
|
||||||
|
Mconsole.graph.addAdjacence(temp1, temp2, {});
|
||||||
|
temp = Mconsole.graph.getAdjacence(temp1.id, temp2.id);
|
||||||
|
temp.setDataset('start', {
|
||||||
|
lineWidth: 0.4
|
||||||
|
});
|
||||||
|
temp.setDataset('end', {
|
||||||
|
lineWidth: 2
|
||||||
|
});
|
||||||
|
var d = new Array(<%= synapse.node1_id.to_s() %>, <%= synapse.node2_id.to_s() %>);
|
||||||
|
temp.setDataset('current', {
|
||||||
|
desc: '<%= synapse.desc %>',
|
||||||
|
showDesc: false,
|
||||||
|
category: '<%= synapse.category %>',
|
||||||
|
id: '<%= synapse.id %>',
|
||||||
|
userid: '<%= synapse.user.id %>',
|
||||||
|
username: '<%= synapse.user.name %>'
|
||||||
|
});
|
||||||
|
temp.data.$direction = d;
|
||||||
|
Mconsole.fx.plotLine(temp, Mconsole.canvas);
|
||||||
|
}
|
||||||
|
<% end %>
|
||||||
|
|
||||||
Mconsole.fx.animate({
|
Mconsole.fx.animate({
|
||||||
modes: ['node-property:dim'],
|
modes: ['node-property:dim','edge-property:lineWidth'],
|
||||||
duration: 500
|
duration: 500
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,12 +12,10 @@ if ( Mconsole != null) {
|
||||||
temp = Mconsole.graph.getAdjacence(temp1.id, temp2.id);
|
temp = Mconsole.graph.getAdjacence(temp1.id, temp2.id);
|
||||||
console.log(temp);
|
console.log(temp);
|
||||||
temp.setDataset('start', {
|
temp.setDataset('start', {
|
||||||
lineWidth: 0.4,
|
lineWidth: 0.4
|
||||||
color: '#d1d1d1'
|
|
||||||
});
|
});
|
||||||
temp.setDataset('end', {
|
temp.setDataset('end', {
|
||||||
lineWidth: 3,
|
lineWidth: 2
|
||||||
color: '#36acfb'
|
|
||||||
});
|
});
|
||||||
var d = new Array(<%= @synapse.node1_id.to_s() %>, <%= @synapse.node2_id.to_s() %>);
|
var d = new Array(<%= @synapse.node1_id.to_s() %>, <%= @synapse.node2_id.to_s() %>);
|
||||||
temp.setDataset('current', {
|
temp.setDataset('current', {
|
||||||
|
@ -31,7 +29,7 @@ if ( Mconsole != null) {
|
||||||
temp.data.$direction = d;
|
temp.data.$direction = d;
|
||||||
Mconsole.fx.plotLine(temp, Mconsole.canvas);
|
Mconsole.fx.plotLine(temp, Mconsole.canvas);
|
||||||
Mconsole.fx.animate({
|
Mconsole.fx.animate({
|
||||||
modes: ['edge-property:lineWidth:color'],
|
modes: ['edge-property:lineWidth'],
|
||||||
duration: 400
|
duration: 400
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,8 @@ if (!$.isEmptyObject(Mconsole.graph.nodes)) {
|
||||||
var temp = Mconsole.graph.getNode('<%= @topic.id %>');
|
var temp = Mconsole.graph.getNode('<%= @topic.id %>');
|
||||||
temp.setData('dim', 1, 'start');
|
temp.setData('dim', 1, 'start');
|
||||||
temp.setData('dim', 40, 'end');
|
temp.setData('dim', 40, 'end');
|
||||||
|
temp.setData('onCanvas', false);
|
||||||
|
temp.setData('inCommons', false);
|
||||||
|
|
||||||
if (gType == "centered") {
|
if (gType == "centered") {
|
||||||
var tempPos = new $jit.Complex(x, y);
|
var tempPos = new $jit.Complex(x, y);
|
||||||
|
@ -58,12 +60,16 @@ if (!$.isEmptyObject(Mconsole.graph.nodes)) {
|
||||||
tempInit = false;
|
tempInit = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else if ( '<%= @synapse %>' == "false" ) {
|
||||||
Mconsole.fx.plotNode(temp, Mconsole.canvas);
|
Mconsole.fx.plotNode(temp, Mconsole.canvas);
|
||||||
Mconsole.fx.animate({
|
Mconsole.fx.animate({
|
||||||
modes: ['node-property:dim'],
|
modes: ['node-property:dim'],
|
||||||
duration: 500
|
duration: 500,
|
||||||
|
onComplete: function() {
|
||||||
|
selectNodeOnClickHandler(temp);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -72,12 +78,17 @@ if (!$.isEmptyObject(Mconsole.graph.nodes)) {
|
||||||
var temp = Mconsole.graph.getNode('<%= @topic.id %>');
|
var temp = Mconsole.graph.getNode('<%= @topic.id %>');
|
||||||
temp.setData('dim', 1, 'start');
|
temp.setData('dim', 1, 'start');
|
||||||
temp.setData('dim', 25, 'end');
|
temp.setData('dim', 25, 'end');
|
||||||
|
temp.setData('onCanvas', false);
|
||||||
|
temp.setData('inCommons', false);
|
||||||
temp.setPos(new $jit.Complex(x, y), 'current');
|
temp.setPos(new $jit.Complex(x, y), 'current');
|
||||||
temp.setPos(new $jit.Complex(x, y), 'start');
|
temp.setPos(new $jit.Complex(x, y), 'start');
|
||||||
temp.setPos(new $jit.Complex(x, y), 'end');
|
temp.setPos(new $jit.Complex(x, y), 'end');
|
||||||
Mconsole.fx.plotNode(temp, Mconsole.canvas);
|
Mconsole.fx.plotNode(temp, Mconsole.canvas);
|
||||||
Mconsole.fx.animate({
|
Mconsole.fx.animate({
|
||||||
modes: ['node-property:dim'],
|
modes: ['node-property:dim'],
|
||||||
duration: 500
|
duration: 500,
|
||||||
|
onComplete: function() {
|
||||||
|
selectNodeOnClickHandler(temp);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue