partway to save to map functionality on topic view
This commit is contained in:
parent
dee531e3ef
commit
35dd8c1816
2 changed files with 17 additions and 18 deletions
|
@ -182,7 +182,15 @@ function saveToMap() {
|
|||
var nodes_data = "", synapses_data = "";
|
||||
var synapses_array = new Array();
|
||||
Mconsole.graph.eachNode(function(n) {
|
||||
nodes_data += n.id + '/' + n.pos.x + '/' + n.pos.y + ',';
|
||||
var x, y;
|
||||
if (n.pos.x && n.pos.y) {
|
||||
x = n.pos.x;
|
||||
y = n.pos.y;
|
||||
} else {
|
||||
var x = Math.cos(n.pos.theta) * n.pos.rho;
|
||||
var y = Math.sin(n.pos.theta) * n.pos.rho;
|
||||
}
|
||||
nodes_data += n.id + '/' + x + '/' + y + ',';
|
||||
n.eachAdjacency(function(adj) {
|
||||
synapses_array.push(adj.getData("id"));
|
||||
});
|
||||
|
|
|
@ -14,23 +14,13 @@
|
|||
#
|
||||
#%>
|
||||
|
||||
<!--<div class="focus topic_<%= @topic.id %>">
|
||||
<div class="focusleft">
|
||||
<p><%= @topic.metacode.name %></p>
|
||||
<%= image_tag @topic.metacode.icon, :class => 'icon', :size => '50x50' %>
|
||||
</div>
|
||||
<div class="focusmiddle">
|
||||
<h1 class="title"><span class="title-text"><%= @topic.name %></span> <% if (@topic.permission == "commons" && authenticated?) || @topic.user == user %><%= link_to "[edit]", edit_topic_path(@topic) %><% end %></h1>
|
||||
<div class="desc">
|
||||
<p><%= @topic.desc %></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="focusright">
|
||||
<p>Link</p>
|
||||
<%= link_to @topic.link, @topic.link, :class => 'link', :target => '_blank' %>
|
||||
</div>
|
||||
<div class="headertop">
|
||||
<% if authenticated? %>
|
||||
<button onclick="saveToMap();">Save to Map</button>
|
||||
<% end %>
|
||||
<button onclick='clearCanvasExceptRoot();'>Clear Canvas</button>
|
||||
</div>
|
||||
<div class="clearfloat nodemargin"></div>-->
|
||||
<div class="clearfloat"></div>
|
||||
|
||||
<h1 class="index">
|
||||
Viewing Topic: <%= @topic.name %>
|
||||
|
@ -54,5 +44,6 @@
|
|||
<% if authenticated? %>
|
||||
<%= render :partial => 'topics/new' %>
|
||||
<%= render :partial => 'synapses/new' %>
|
||||
<%= render :partial => 'maps/new' %>
|
||||
<% end %>
|
||||
|
||||
|
|
Loading…
Reference in a new issue