2013-01-11 23:49:59 +00:00
|
|
|
<%#
|
|
|
|
# @file
|
|
|
|
# Code to display a map
|
2013-01-23 18:55:50 +00:00
|
|
|
# /maps/:id
|
2013-01-11 23:49:59 +00:00
|
|
|
#%>
|
2013-07-09 16:32:13 +00:00
|
|
|
|
|
|
|
<% content_for :title, @map.name + " | Metamaps" %>
|
2013-01-06 23:40:48 +00:00
|
|
|
|
2014-01-31 00:32:15 +00:00
|
|
|
<% if authenticated? %>
|
2014-02-09 15:05:32 +00:00
|
|
|
<% if @map.permission == "commons" || @map.user == user %>
|
|
|
|
<div class="sidebarSave">
|
2014-02-21 01:22:13 +00:00
|
|
|
<div class="sidebarSaveIcon hoverForTip">
|
|
|
|
<div class="tip">Save Layout</div>
|
|
|
|
</div>
|
2014-02-09 15:05:32 +00:00
|
|
|
<div class="sidebarSaveBox"></div>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
2014-03-03 11:05:59 +00:00
|
|
|
<div class="sidebarFork">
|
|
|
|
<div class="sidebarForkIcon hoverForTip">
|
|
|
|
<div class="tip">Save To New Map</div>
|
|
|
|
</div>
|
|
|
|
<div class="sidebarForkBox"></div>
|
2014-02-21 01:22:13 +00:00
|
|
|
</div>
|
2014-03-03 11:05:59 +00:00
|
|
|
<% if @map.permission == "commons" || @map.user == user %>
|
|
|
|
<div class="sidebarCollaborate">
|
|
|
|
<div class="sidebarCollaborateIcon hoverForTip">
|
|
|
|
<div class="tip">Start Realtime Collaboration</div>
|
|
|
|
</div>
|
|
|
|
<div class="sidebarCollaborateBox">
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
2014-01-31 00:32:15 +00:00
|
|
|
<% end %>
|
2014-02-03 05:35:21 +00:00
|
|
|
<div class="sidebarFilter <%= authenticated? ? 'loggedin' : 'loggedout' %>">
|
2014-02-01 08:57:19 +00:00
|
|
|
<div class="sidebarFilterIcon"></div>
|
|
|
|
<div class="sidebarFilterBox">
|
|
|
|
<h3 class="filterByMetacode">Filter By Metacode</h3><span class="showAll">all</span><span class="hideAll">none</span>
|
|
|
|
<div class="clearfloat"></div>
|
|
|
|
<%= render :partial => 'main/filterbymetacode' %>
|
|
|
|
</div>
|
|
|
|
</div>
|
2013-01-06 23:40:48 +00:00
|
|
|
|
2014-01-29 03:46:58 +00:00
|
|
|
<div class="index">
|
2014-02-05 05:03:44 +00:00
|
|
|
<div class="openCheatsheet openLightbox" data-open="cheatsheet"></div>
|
2014-01-29 03:46:58 +00:00
|
|
|
<span><img width="35" height="35" src="/assets/map.png"></span>
|
|
|
|
<span class="mapName"><%= @map.name %></span>
|
|
|
|
<span class="mapInfo"></span>
|
|
|
|
<div class="clearfloat"></div>
|
2014-02-04 01:43:31 +00:00
|
|
|
<%= render :partial => 'maps/mapinfobox' %>
|
2014-01-29 03:46:58 +00:00
|
|
|
</div>
|
2012-10-26 10:04:52 +00:00
|
|
|
|
2013-01-05 02:39:16 +00:00
|
|
|
<div class="maps onMap" id="container">
|
2012-10-26 10:04:52 +00:00
|
|
|
<div id="center-container">
|
|
|
|
<div id="infovis"></div>
|
|
|
|
</div>
|
2013-03-17 09:18:30 +00:00
|
|
|
<div class="showcard" id="showcard"></div>
|
2012-10-26 10:04:52 +00:00
|
|
|
</div>
|
|
|
|
<div class="clearfloat"></div>
|
|
|
|
|
2013-01-05 02:39:16 +00:00
|
|
|
<% if authenticated? %>
|
2014-06-04 19:24:16 +00:00
|
|
|
|
|
|
|
<% # add these if you have edit permissions on the map %>
|
2014-03-03 11:05:59 +00:00
|
|
|
<% if @map.permission == "commons" || @map.user == user %>
|
2014-06-04 19:24:16 +00:00
|
|
|
|
|
|
|
<% # for creating and pulling in topics and synapses %>
|
2014-03-03 11:05:59 +00:00
|
|
|
<%= render :partial => 'newtopic' %>
|
|
|
|
<%= render :partial => 'newsynapse' %>
|
2014-06-04 19:24:16 +00:00
|
|
|
|
|
|
|
<% # for saving the layout of the map %>
|
|
|
|
<%= form_for @map, :url => savelayout_path(@map), :html => { :class => "saveMapLayout", :id => "saveMapLayout"}, remote: true do |form| %>
|
2014-01-31 00:32:15 +00:00
|
|
|
<%= form.hidden_field "coordinates", :value => "" %>
|
2014-06-04 19:24:16 +00:00
|
|
|
<% end %>
|
|
|
|
|
2014-01-31 00:32:15 +00:00
|
|
|
<% end %>
|
2014-06-04 19:24:16 +00:00
|
|
|
|
|
|
|
<% # for populating the change metacode list on the topic card %>
|
|
|
|
<%= render :partial => 'main/metacodeoptions' %>
|
2013-01-05 02:39:16 +00:00
|
|
|
<% end %>
|
2014-06-04 19:24:16 +00:00
|
|
|
|
|
|
|
|
2013-01-05 02:39:16 +00:00
|
|
|
<script>
|
2014-06-04 19:24:16 +00:00
|
|
|
var dragged = 0;
|
|
|
|
mapid = <%= @map.id %>;
|
|
|
|
<% if (@map.permission == "commons" && authenticated? ) || @map.user == user %>
|
|
|
|
mapperm = true;
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
viewMode = "graph";
|
|
|
|
json = <%= @mapjson %>;
|
|
|
|
if (json.length > 0) {
|
|
|
|
$(window).load(function () {
|
|
|
|
<% if (@map.arranged) %>
|
|
|
|
initialize("arranged");
|
|
|
|
<% else %>
|
|
|
|
initialize("chaotic");
|
|
|
|
<% end %>
|
2014-03-03 02:53:19 +00:00
|
|
|
});
|
2014-06-04 19:24:16 +00:00
|
|
|
} else {
|
|
|
|
$(window).load(function () {
|
|
|
|
initialize("chaotic", true);
|
2013-04-26 04:07:29 +00:00
|
|
|
});
|
2014-06-04 19:24:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
<% if authenticated? && (@map.permission == "commons" || @map.user == user) %>
|
|
|
|
// this is for the heroku staging environment
|
2014-06-09 17:36:23 +00:00
|
|
|
//window.realtime.socket = io.connect('http://gentle-savannah-1303.herokuapp.com');
|
2014-06-04 19:24:16 +00:00
|
|
|
|
|
|
|
// this is for metamaps.cc
|
|
|
|
//window.realtime.socket = io.connect('http://metamaps.cc:5001');
|
|
|
|
|
|
|
|
// this is for localhost development
|
2014-06-09 17:36:23 +00:00
|
|
|
window.realtime.socket = io.connect('http://localhost:5001');
|
2014-06-04 19:24:16 +00:00
|
|
|
|
|
|
|
window.realtime.socket.on('connect', function () {
|
|
|
|
console.log('socket connected');
|
|
|
|
window.realtime.setupSocket();
|
|
|
|
});
|
|
|
|
<% end %>
|
|
|
|
|
2014-01-29 03:46:58 +00:00
|
|
|
</script>
|