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 desc = adj.getData("desc");
var showDesc = adj.getData("showDesc"); var showDesc = adj.getData("showDesc");
if( desc != "" && showDesc ) { if( desc != "" && showDesc ) {
// '&' to '&'
desc = decodeEntities(desc);
//now adjust the label placement //now adjust the label placement
var ctx = canvas.getCtx(); var ctx = canvas.getCtx();
var radius = canvas.getSize(); var radius = canvas.getSize();
@ -450,3 +453,14 @@ function onPlaceLabelHandler(domElement, node) {
style = label.style; style = label.style;
style.left = (-(w / 2 + 106)) + 'px'; 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 # PUT maps/:id/savelayout
def savelayout def savelayout
@map = Map.find(params[:id]) @map = Map.find(params[:id])
if params[:map][:coordinates] if params[:map][:coordinates]
@all = params[:map][:coordinates] @all = params[:map][:coordinates]
@all = @all.split(',') @all = @all.split(',')
@all.each do |topic| @all.each do |topic|
topic = topic.split('/') topic = topic.split('/')
@mapping = Mapping.find(topic[0]) @mapping = Mapping.find(topic[0])
if @mapping if @mapping
@mapping.xloc = topic[1] @mapping.xloc = topic[1]
@mapping.yloc = topic[2] @mapping.yloc = topic[2]
@mapping.save @mapping.save
end end
end end
@map.arranged = true @map.arranged = true
@map.save @map.save
end end
end end
# GET maps/:id/realtime # GET maps/:id/realtime

View file

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