Merge branch 'master' of github.com:Connoropolous/metamaps_gen002

This commit is contained in:
Connor Turland 2013-02-16 19:03:48 -05:00
commit 210c73e81b
3 changed files with 33 additions and 15 deletions

View file

@ -300,6 +300,9 @@ var nodeSettings = {
var desc = adj.getData("desc");
var showDesc = adj.getData("showDesc");
if( desc != "" && showDesc ) {
// '&' to '&'
desc = decodeEntities(desc);
//now adjust the label placement
var ctx = canvas.getCtx();
var radius = canvas.getSize();
@ -450,3 +453,14 @@ function onPlaceLabelHandler(domElement, node) {
style = label.style;
style.left = (-(w / 2 + 106)) + 'px';
}
// thanks to http://stackoverflow.com/questions/4338963/
// convert-html-character-entities-back-to-regular-text-using-javascript
function decodeEntities(desc) {
var str, temp = document.createElement('p');
temp.innerHTML = desc; //browser handles the entities
str = temp.textContent || temp.innerText;
temp = null; //delete the element;
return str;
}//decodeEntities

View file

@ -148,23 +148,23 @@ class MapsController < ApplicationController
# PUT maps/:id/savelayout
def savelayout
@map = Map.find(params[:id])
@map = Map.find(params[:id])
if params[:map][:coordinates]
@all = params[:map][:coordinates]
@all = @all.split(',')
@all.each do |topic|
topic = topic.split('/')
@mapping = Mapping.find(topic[0])
if @mapping
if params[:map][:coordinates]
@all = params[:map][:coordinates]
@all = @all.split(',')
@all.each do |topic|
topic = topic.split('/')
@mapping = Mapping.find(topic[0])
if @mapping
@mapping.xloc = topic[1]
@mapping.yloc = topic[2]
@mapping.save
@mapping.yloc = topic[2]
@mapping.save
end
end
@map.arranged = true
@map.save
end
end
@map.arranged = true
@map.save
end
end
# GET maps/:id/realtime

View file

@ -41,6 +41,10 @@
});
</script>
<%= render :partial => 'main/find' %>
<%= render :partial => 'main/analyze' %>
<%= render :partial => 'main/organize' %>
<% if authenticated? %>
<%= render :partial => 'topics/new' %>
<%= render :partial => 'synapses/new' %>