removed embed. fixed switch metacode set lightbox overflow. disabled topic creation and topic deletion from public maps by non-owner
This commit is contained in:
parent
2a9a27c6c5
commit
ee1ca7853f
9 changed files with 191 additions and 172 deletions
|
@ -757,6 +757,8 @@ Metamaps.JIT = {
|
||||||
var positionsToSend = {};
|
var positionsToSend = {};
|
||||||
var topic;
|
var topic;
|
||||||
|
|
||||||
|
var authorized = Metamaps.Active.Map && Metamaps.Active.Map.authorizeToEdit(Metamaps.Active.Mapper);
|
||||||
|
|
||||||
if (node && !node.nodeFrom) {
|
if (node && !node.nodeFrom) {
|
||||||
var pos = eventInfo.getPos();
|
var pos = eventInfo.getPos();
|
||||||
// if it's a left click, or a touch, move the node
|
// if it's a left click, or a touch, move the node
|
||||||
|
@ -821,7 +823,7 @@ Metamaps.JIT = {
|
||||||
Metamaps.Visualize.mGraph.plot();
|
Metamaps.Visualize.mGraph.plot();
|
||||||
}
|
}
|
||||||
// if it's a right click or holding down alt, start synapse creation ->third option is for firefox
|
// if it's a right click or holding down alt, start synapse creation ->third option is for firefox
|
||||||
else if ((e.button == 2 || (e.button == 0 && e.altKey) || e.buttons == 2) && Metamaps.Active.Mapper) {
|
else if ((e.button == 2 || (e.button == 0 && e.altKey) || e.buttons == 2) && authorized) {
|
||||||
if (tempInit == false) {
|
if (tempInit == false) {
|
||||||
tempNode = node;
|
tempNode = node;
|
||||||
tempInit = true;
|
tempInit = true;
|
||||||
|
@ -886,6 +888,9 @@ Metamaps.JIT = {
|
||||||
$(document).trigger(Metamaps.JIT.events.mouseMove, [pos]);
|
$(document).trigger(Metamaps.JIT.events.mouseMove, [pos]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if ((e.button == 2 || (e.button == 0 && e.altKey) || e.buttons == 2) && !authorized) {
|
||||||
|
Metamaps.GlobalUI.notifyUser("Cannot edit Public map.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, // onDragMoveTopicHandler
|
}, // onDragMoveTopicHandler
|
||||||
onDragCancelHandler: function (node, eventInfo, e) {
|
onDragCancelHandler: function (node, eventInfo, e) {
|
||||||
|
@ -927,6 +932,9 @@ Metamaps.JIT = {
|
||||||
// check whether to save mappings
|
// check whether to save mappings
|
||||||
var checkWhetherToSave = function() {
|
var checkWhetherToSave = function() {
|
||||||
var map = Metamaps.Active.Map;
|
var map = Metamaps.Active.Map;
|
||||||
|
|
||||||
|
if (!map) return false;
|
||||||
|
|
||||||
var mapper = Metamaps.Active.Mapper;
|
var mapper = Metamaps.Active.Mapper;
|
||||||
// this case
|
// this case
|
||||||
// covers when it is a public map owned by you
|
// covers when it is a public map owned by you
|
||||||
|
@ -967,7 +975,13 @@ Metamaps.JIT = {
|
||||||
var now = Date.now(); //not compatible with IE8 FYI
|
var now = Date.now(); //not compatible with IE8 FYI
|
||||||
Metamaps.Mouse.lastCanvasClick = now;
|
Metamaps.Mouse.lastCanvasClick = now;
|
||||||
|
|
||||||
|
var authorized = Metamaps.Active.Map && Metamaps.Active.Map.authorizeToEdit(Metamaps.Active.Mapper);
|
||||||
|
|
||||||
if (now - storedTime < Metamaps.Mouse.DOUBLE_CLICK_TOLERANCE && !Metamaps.Mouse.didPan) {
|
if (now - storedTime < Metamaps.Mouse.DOUBLE_CLICK_TOLERANCE && !Metamaps.Mouse.didPan) {
|
||||||
|
if (Metamaps.Active.Map && !authorized) {
|
||||||
|
Metamaps.GlobalUI.notifyUser("Cannot edit Public map.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
// DOUBLE CLICK
|
// DOUBLE CLICK
|
||||||
//pop up node creation :)
|
//pop up node creation :)
|
||||||
Metamaps.Create.newTopic.addSynapse = false;
|
Metamaps.Create.newTopic.addSynapse = false;
|
||||||
|
@ -1269,12 +1283,16 @@ Metamaps.JIT = {
|
||||||
// add the proper options to the menu
|
// add the proper options to the menu
|
||||||
var menustring = '<ul>';
|
var menustring = '<ul>';
|
||||||
|
|
||||||
menustring += '<li class="rc-hide"><div class="rc-icon"></div>Hide until refresh</li>';
|
var authorized = Metamaps.Active.Map && Metamaps.Active.Map.authorizeToEdit(Metamaps.Active.Mapper);
|
||||||
if (Metamaps.Active.Map && Metamaps.Active.Mapper) menustring += '<li class="rc-remove"><div class="rc-icon"></div>Remove from map</li>';
|
|
||||||
if (Metamaps.Active.Mapper) menustring += '<li class="rc-delete"><div class="rc-icon"></div>Delete</li>';
|
var disabled = authorized ? "" : "disabled";
|
||||||
|
|
||||||
|
if (Metamaps.Active.Map) menustring += '<li class="rc-hide"><div class="rc-icon"></div>Hide until refresh</li>';
|
||||||
|
if (Metamaps.Active.Map && Metamaps.Active.Mapper) menustring += '<li class="rc-remove ' + disabled + '"><div class="rc-icon"></div>Remove from map</li>';
|
||||||
|
if (Metamaps.Active.Map && Metamaps.Active.Mapper) menustring += '<li class="rc-delete ' + disabled + '"><div class="rc-icon"></div>Delete</li>';
|
||||||
|
|
||||||
|
|
||||||
if (!Metamaps.Active.Map) menustring += '<li class="rc-center"><div class="rc-icon"></div>Center this topic</li>';
|
if (Metamaps.Active.Topic) menustring += '<li class="rc-center"><div class="rc-icon"></div>Center this topic</li>';
|
||||||
menustring += '<li class="rc-popout"><div class="rc-icon"></div>Open in new tab</li>';
|
menustring += '<li class="rc-popout"><div class="rc-icon"></div>Open in new tab</li>';
|
||||||
if (Metamaps.Active.Mapper) {
|
if (Metamaps.Active.Mapper) {
|
||||||
var options = '<ul><li class="changeP toCommons"><div class="rc-perm-icon"></div>commons</li> \
|
var options = '<ul><li class="changeP toCommons"><div class="rc-perm-icon"></div>commons</li> \
|
||||||
|
@ -1331,17 +1349,21 @@ Metamaps.JIT = {
|
||||||
// attach events to clicks on the list items
|
// attach events to clicks on the list items
|
||||||
|
|
||||||
// delete the selected things from the database
|
// delete the selected things from the database
|
||||||
$('.rc-delete').click(function () {
|
if (authorized) {
|
||||||
$('.rightclickmenu').remove();
|
$('.rc-delete').click(function () {
|
||||||
Metamaps.Control.deleteSelected();
|
$('.rightclickmenu').remove();
|
||||||
});
|
Metamaps.Control.deleteSelected();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// remove the selected things from the map
|
// remove the selected things from the map
|
||||||
$('.rc-remove').click(function () {
|
if (authorized) {
|
||||||
$('.rightclickmenu').remove();
|
$('.rc-remove').click(function () {
|
||||||
Metamaps.Control.removeSelectedEdges();
|
$('.rightclickmenu').remove();
|
||||||
Metamaps.Control.removeSelectedNodes();
|
Metamaps.Control.removeSelectedEdges();
|
||||||
});
|
Metamaps.Control.removeSelectedNodes();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// hide selected nodes and synapses until refresh
|
// hide selected nodes and synapses until refresh
|
||||||
$('.rc-hide').click(function () {
|
$('.rc-hide').click(function () {
|
||||||
|
@ -1445,11 +1467,13 @@ Metamaps.JIT = {
|
||||||
// add the proper options to the menu
|
// add the proper options to the menu
|
||||||
var menustring = '<ul>';
|
var menustring = '<ul>';
|
||||||
|
|
||||||
menustring += '<li class="rc-hide"><div class="rc-icon"></div>Hide until refresh</li>';
|
var authorized = Metamaps.Active.Map && Metamaps.Active.Map.authorizeToEdit(Metamaps.Active.Mapper);
|
||||||
if (Metamaps.Active.Map && Metamaps.Active.Map.authorizeToEdit(Metamaps.Active.Mapper)) {
|
|
||||||
menustring += '<li class="rc-remove"><div class="rc-icon"></div>Remove from map</li>';
|
var disabled = authorized ? "" : "disabled";
|
||||||
}
|
|
||||||
if (Metamaps.Active.Mapper) menustring += '<li class="rc-delete"><div class="rc-icon"></div>Delete</li>';
|
if (Metamaps.Active.Map) menustring += '<li class="rc-hide"><div class="rc-icon"></div>Hide until refresh</li>';
|
||||||
|
if (Metamaps.Active.Map && Metamaps.Active.Mapper) menustring += '<li class="rc-remove ' + disabled + '"><div class="rc-icon"></div>Remove from map</li>';
|
||||||
|
if (Metamaps.Active.Map && Metamaps.Active.Mapper) menustring += '<li class="rc-delete ' + disabled + '"><div class="rc-icon"></div>Delete</li>';
|
||||||
|
|
||||||
if (Metamaps.Active.Mapper) {
|
if (Metamaps.Active.Mapper) {
|
||||||
var permOptions = '<ul><li class="changeP toCommons"><div class="rc-perm-icon"></div>commons</li> \
|
var permOptions = '<ul><li class="changeP toCommons"><div class="rc-perm-icon"></div>commons</li> \
|
||||||
|
@ -1500,17 +1524,21 @@ Metamaps.JIT = {
|
||||||
// attach events to clicks on the list items
|
// attach events to clicks on the list items
|
||||||
|
|
||||||
// delete the selected things from the database
|
// delete the selected things from the database
|
||||||
$('.rc-delete').click(function () {
|
if (authorized) {
|
||||||
$('.rightclickmenu').remove();
|
$('.rc-delete').click(function () {
|
||||||
Metamaps.Control.deleteSelected();
|
$('.rightclickmenu').remove();
|
||||||
});
|
Metamaps.Control.deleteSelected();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// remove the selected things from the map
|
// remove the selected things from the map
|
||||||
$('.rc-remove').click(function () {
|
if (authorized) {
|
||||||
$('.rightclickmenu').remove();
|
$('.rc-remove').click(function () {
|
||||||
Metamaps.Control.removeSelectedEdges();
|
$('.rightclickmenu').remove();
|
||||||
Metamaps.Control.removeSelectedNodes();
|
Metamaps.Control.removeSelectedEdges();
|
||||||
});
|
Metamaps.Control.removeSelectedNodes();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// hide selected nodes and synapses until refresh
|
// hide selected nodes and synapses until refresh
|
||||||
$('.rc-hide').click(function () {
|
$('.rc-hide').click(function () {
|
||||||
|
|
|
@ -2566,12 +2566,22 @@ Metamaps.Control = {
|
||||||
Metamaps.Selected.Nodes.indexOf(node), 1);
|
Metamaps.Selected.Nodes.indexOf(node), 1);
|
||||||
},
|
},
|
||||||
deleteSelected: function () {
|
deleteSelected: function () {
|
||||||
|
|
||||||
|
if (!Metamaps.Active.Map) return;
|
||||||
|
|
||||||
var n = Metamaps.Selected.Nodes.length;
|
var n = Metamaps.Selected.Nodes.length;
|
||||||
var e = Metamaps.Selected.Edges.length;
|
var e = Metamaps.Selected.Edges.length;
|
||||||
var ntext = n == 1 ? "1 topic" : n + " topics";
|
var ntext = n == 1 ? "1 topic" : n + " topics";
|
||||||
var etext = e == 1 ? "1 synapse" : e + " synapses";
|
var etext = e == 1 ? "1 synapse" : e + " synapses";
|
||||||
var text = "You have " + ntext + " and " + etext + " selected. ";
|
var text = "You have " + ntext + " and " + etext + " selected. ";
|
||||||
|
|
||||||
|
var authorized = Metamaps.Active.Map.authorizeToEdit(Metamaps.Active.Mapper);
|
||||||
|
|
||||||
|
if (!authorized) {
|
||||||
|
Metamaps.GlobalUI.notifyUser("Cannot edit Public map.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var r = confirm(text + "Are you sure you want to permanently delete them all? This will remove them from all maps they appear on.");
|
var r = confirm(text + "Are you sure you want to permanently delete them all? This will remove them from all maps they appear on.");
|
||||||
if (r == true) {
|
if (r == true) {
|
||||||
Metamaps.Control.deleteSelectedEdges();
|
Metamaps.Control.deleteSelectedEdges();
|
||||||
|
@ -2579,6 +2589,16 @@ Metamaps.Control = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
deleteSelectedNodes: function () { // refers to deleting topics permanently
|
deleteSelectedNodes: function () { // refers to deleting topics permanently
|
||||||
|
|
||||||
|
if (!Metamaps.Active.Map) return;
|
||||||
|
|
||||||
|
var authorized = Metamaps.Active.Map.authorizeToEdit(Metamaps.Active.Mapper);
|
||||||
|
|
||||||
|
if (!authorized) {
|
||||||
|
Metamaps.GlobalUI.notifyUser("Cannot edit Public map.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var l = Metamaps.Selected.Nodes.length;
|
var l = Metamaps.Selected.Nodes.length;
|
||||||
for (var i = l - 1; i >= 0; i -= 1) {
|
for (var i = l - 1; i >= 0; i -= 1) {
|
||||||
var node = Metamaps.Selected.Nodes[i];
|
var node = Metamaps.Selected.Nodes[i];
|
||||||
|
@ -2586,6 +2606,16 @@ Metamaps.Control = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
deleteNode: function (nodeid) { // refers to deleting topics permanently
|
deleteNode: function (nodeid) { // refers to deleting topics permanently
|
||||||
|
|
||||||
|
if (!Metamaps.Active.Map) return;
|
||||||
|
|
||||||
|
var authorized = Metamaps.Active.Map.authorizeToEdit(Metamaps.Active.Mapper);
|
||||||
|
|
||||||
|
if (!authorized) {
|
||||||
|
Metamaps.GlobalUI.notifyUser("Cannot edit Public map.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var node = Metamaps.Visualize.mGraph.graph.getNode(nodeid);
|
var node = Metamaps.Visualize.mGraph.graph.getNode(nodeid);
|
||||||
var topic = node.getData('topic');
|
var topic = node.getData('topic');
|
||||||
var topicid = topic.id;
|
var topicid = topic.id;
|
||||||
|
@ -2598,33 +2628,45 @@ Metamaps.Control = {
|
||||||
Metamaps.Control.hideNode(nodeid);
|
Metamaps.Control.hideNode(nodeid);
|
||||||
},
|
},
|
||||||
removeSelectedNodes: function () { // refers to removing topics permanently from a map
|
removeSelectedNodes: function () { // refers to removing topics permanently from a map
|
||||||
|
|
||||||
|
if (!Metamaps.Active.Map) return;
|
||||||
|
|
||||||
var l = Metamaps.Selected.Nodes.length,
|
var l = Metamaps.Selected.Nodes.length,
|
||||||
i,
|
i,
|
||||||
node,
|
node,
|
||||||
mapperm = Metamaps.Active.Map.authorizeToEdit(Metamaps.Active.Mapper);
|
authorized = Metamaps.Active.Map.authorizeToEdit(Metamaps.Active.Mapper);
|
||||||
|
|
||||||
if (mapperm) {
|
if (!authorized) {
|
||||||
for (i = l - 1; i >= 0; i -= 1) {
|
Metamaps.GlobalUI.notifyUser("Cannot edit Public map.");
|
||||||
node = Metamaps.Selected.Nodes[i];
|
return;
|
||||||
Metamaps.Control.removeNode(node.id);
|
}
|
||||||
}
|
|
||||||
|
for (i = l - 1; i >= 0; i -= 1) {
|
||||||
|
node = Metamaps.Selected.Nodes[i];
|
||||||
|
Metamaps.Control.removeNode(node.id);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
removeNode: function (nodeid) { // refers to removing topics permanently from a map
|
removeNode: function (nodeid) { // refers to removing topics permanently from a map
|
||||||
var mapperm = Metamaps.Active.Map.authorizeToEdit(Metamaps.Active.Mapper);
|
|
||||||
|
if (!Metamaps.Active.Map) return;
|
||||||
|
|
||||||
|
var authorized = Metamaps.Active.Map.authorizeToEdit(Metamaps.Active.Mapper);
|
||||||
var node = Metamaps.Visualize.mGraph.graph.getNode(nodeid);
|
var node = Metamaps.Visualize.mGraph.graph.getNode(nodeid);
|
||||||
|
|
||||||
if (mapperm) {
|
if (!authorized) {
|
||||||
var topic = node.getData('topic');
|
Metamaps.GlobalUI.notifyUser("Cannot edit Public map.");
|
||||||
var topicid = topic.id;
|
return;
|
||||||
var mapping = node.getData('mapping');
|
|
||||||
mapping.destroy();
|
|
||||||
Metamaps.Topics.remove(topic);
|
|
||||||
$(document).trigger(Metamaps.JIT.events.removeTopic, [{
|
|
||||||
topicid: topicid
|
|
||||||
}]);
|
|
||||||
Metamaps.Control.hideNode(nodeid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var topic = node.getData('topic');
|
||||||
|
var topicid = topic.id;
|
||||||
|
var mapping = node.getData('mapping');
|
||||||
|
mapping.destroy();
|
||||||
|
Metamaps.Topics.remove(topic);
|
||||||
|
$(document).trigger(Metamaps.JIT.events.removeTopic, [{
|
||||||
|
topicid: topicid
|
||||||
|
}]);
|
||||||
|
Metamaps.Control.hideNode(nodeid);
|
||||||
},
|
},
|
||||||
hideSelectedNodes: function () {
|
hideSelectedNodes: function () {
|
||||||
var l = Metamaps.Selected.Nodes.length,
|
var l = Metamaps.Selected.Nodes.length,
|
||||||
|
@ -2709,6 +2751,16 @@ Metamaps.Control = {
|
||||||
deleteSelectedEdges: function () { // refers to deleting topics permanently
|
deleteSelectedEdges: function () { // refers to deleting topics permanently
|
||||||
var edge,
|
var edge,
|
||||||
l = Metamaps.Selected.Edges.length;
|
l = Metamaps.Selected.Edges.length;
|
||||||
|
|
||||||
|
if (!Metamaps.Active.Map) return;
|
||||||
|
|
||||||
|
var authorized = Metamaps.Active.Map.authorizeToEdit(Metamaps.Active.Mapper);
|
||||||
|
|
||||||
|
if (!authorized) {
|
||||||
|
Metamaps.GlobalUI.notifyUser("Cannot edit Public map.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (var i = l - 1; i >= 0; i -= 1) {
|
for (var i = l - 1; i >= 0; i -= 1) {
|
||||||
edge = Metamaps.Selected.Edges[i];
|
edge = Metamaps.Selected.Edges[i];
|
||||||
Metamaps.Control.deleteEdge(edge);
|
Metamaps.Control.deleteEdge(edge);
|
||||||
|
@ -2716,6 +2768,15 @@ Metamaps.Control = {
|
||||||
},
|
},
|
||||||
deleteEdge: function (edge) {
|
deleteEdge: function (edge) {
|
||||||
|
|
||||||
|
if (!Metamaps.Active.Map) return;
|
||||||
|
|
||||||
|
var authorized = Metamaps.Active.Map.authorizeToEdit(Metamaps.Active.Mapper);
|
||||||
|
|
||||||
|
if (!authorized) {
|
||||||
|
Metamaps.GlobalUI.notifyUser("Cannot edit Public map.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (edge.getData("synapses").length - 1 === 0) {
|
if (edge.getData("synapses").length - 1 === 0) {
|
||||||
Metamaps.Control.hideEdge(edge);
|
Metamaps.Control.hideEdge(edge);
|
||||||
}
|
}
|
||||||
|
@ -2743,16 +2804,32 @@ Metamaps.Control = {
|
||||||
i,
|
i,
|
||||||
edge;
|
edge;
|
||||||
|
|
||||||
if (Metamaps.Active.Map) {
|
if (!Metamaps.Active.Map) return;
|
||||||
for (i = l - 1; i >= 0; i -= 1) {
|
|
||||||
edge = Metamaps.Selected.Edges[i];
|
var authorized = Metamaps.Active.Map.authorizeToEdit(Metamaps.Active.Mapper);
|
||||||
Metamaps.Control.removeEdge(edge);
|
|
||||||
}
|
if (!authorized) {
|
||||||
Metamaps.Selected.Edges = new Array();
|
Metamaps.GlobalUI.notifyUser("Cannot edit Public map.");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = l - 1; i >= 0; i -= 1) {
|
||||||
|
edge = Metamaps.Selected.Edges[i];
|
||||||
|
Metamaps.Control.removeEdge(edge);
|
||||||
|
}
|
||||||
|
Metamaps.Selected.Edges = new Array();
|
||||||
},
|
},
|
||||||
removeEdge: function (edge) {
|
removeEdge: function (edge) {
|
||||||
|
|
||||||
|
if (!Metamaps.Active.Map) return;
|
||||||
|
|
||||||
|
var authorized = Metamaps.Active.Map.authorizeToEdit(Metamaps.Active.Mapper);
|
||||||
|
|
||||||
|
if (!authorized) {
|
||||||
|
Metamaps.GlobalUI.notifyUser("Cannot edit Public map.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (edge.getData("mappings").length - 1 === 0) {
|
if (edge.getData("mappings").length - 1 === 0) {
|
||||||
Metamaps.Control.hideEdge(edge);
|
Metamaps.Control.hideEdge(edge);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1180,6 +1180,13 @@ h3.realtimeBoxTitle {
|
||||||
background-color: #E0E0E0;
|
background-color: #E0E0E0;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
.rightclickmenu li.disabled {
|
||||||
|
opacity: 0.4;
|
||||||
|
}
|
||||||
|
.rightclickmenu li.disabled:hover {
|
||||||
|
background-color: transparent;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
.rightclickmenu > ul > li .rc-icon {
|
.rightclickmenu > ul > li .rc-icon {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
@ -1976,6 +1983,8 @@ and it won't be important on password protected instances */
|
||||||
font-family: 'din-medium', helvetica, sans-serif;
|
font-family: 'din-medium', helvetica, sans-serif;
|
||||||
color: #424242;
|
color: #424242;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
text-align: justify;
|
||||||
|
padding-right: 16px;
|
||||||
}
|
}
|
||||||
#switchMetacodes > p {
|
#switchMetacodes > p {
|
||||||
margin: 16px 0 16px 0;
|
margin: 16px 0 16px 0;
|
||||||
|
@ -1990,10 +1999,17 @@ and it won't be important on password protected instances */
|
||||||
#metacodeSwitchTabs li.ui-state-active a {
|
#metacodeSwitchTabs li.ui-state-active a {
|
||||||
color: #00BCD4;
|
color: #00BCD4;
|
||||||
}
|
}
|
||||||
|
.metacodeSwitchTab {
|
||||||
|
max-height: 300px;
|
||||||
|
overflow-y: auto;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
.customMetacodeList {
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
.customMetacodeList,
|
.customMetacodeList,
|
||||||
.metacodeSetList {
|
.metacodeSetList {
|
||||||
height: 301px;
|
height: 301px;
|
||||||
overflow-y: auto;
|
|
||||||
margin: 5px 0 15px 0;
|
margin: 5px 0 15px 0;
|
||||||
}
|
}
|
||||||
.customMetacodeList ul li {
|
.customMetacodeList ul li {
|
||||||
|
|
|
@ -113,6 +113,7 @@
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
line-height:15px;
|
line-height:15px;
|
||||||
font-family: helvetica, sans-serif;
|
font-family: helvetica, sans-serif;
|
||||||
|
overflow-y: scroll;
|
||||||
}
|
}
|
||||||
.CardOnGraph.hasAttachment .scroll {
|
.CardOnGraph.hasAttachment .scroll {
|
||||||
height: auto;
|
height: auto;
|
||||||
|
|
|
@ -81,8 +81,8 @@ class MapsController < ApplicationController
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html {
|
format.html {
|
||||||
@allmappers = @map.contributors
|
@allmappers = @map.contributors
|
||||||
@alltopics = @map.topics # should limit to topics visible to user
|
@alltopics = @map.topics.delete_if {|t| t.permission == "private" && (!authenticated? || (authenticated? && @current.id != t.user_id)) }
|
||||||
@allsynapses = @map.synapses # should also be limited
|
@allsynapses = @map.synapses.delete_if {|s| s.permission == "private" && (!authenticated? || (authenticated? && @current.id != s.user_id)) }
|
||||||
@allmappings = @map.mappings
|
@allmappings = @map.mappings
|
||||||
|
|
||||||
respond_with(@allmappers, @allmappings, @allsynapses, @alltopics, @map)
|
respond_with(@allmappers, @allmappings, @allsynapses, @alltopics, @map)
|
||||||
|
@ -102,8 +102,8 @@ class MapsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
@allmappers = @map.contributors
|
@allmappers = @map.contributors
|
||||||
@alltopics = @map.topics # should limit to topics visible to user
|
@alltopics = @map.topics.delete_if {|t| t.permission == "private" && (!authenticated? || (authenticated? && @current.id != t.user_id)) }
|
||||||
@allsynapses = @map.synapses # should also be limited
|
@allsynapses = @map.synapses.delete_if {|s| s.permission == "private" && (!authenticated? || (authenticated? && @current.id != s.user_id)) }
|
||||||
@allmappings = @map.mappings
|
@allmappings = @map.mappings
|
||||||
|
|
||||||
@json = Hash.new()
|
@json = Hash.new()
|
||||||
|
@ -118,27 +118,6 @@ class MapsController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# GET maps/:id/embed
|
|
||||||
def embed
|
|
||||||
@current = current_user
|
|
||||||
@map = Map.find(params[:id]).authorize_to_show(@current)
|
|
||||||
|
|
||||||
if not @map
|
|
||||||
redirect_to root_url and return
|
|
||||||
end
|
|
||||||
|
|
||||||
@alltopics = @map.topics # should limit to topics visible to user
|
|
||||||
@allsynapses = @map.synapses # should also be limited
|
|
||||||
@allmappings = @map.mappings
|
|
||||||
@allmetacodes = Metacode.all
|
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.html { respond_with(@allmetacodes, @allmappings, @allsynapses, @alltopics, @map, @user) }
|
|
||||||
format.json { render json: @map }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# POST maps
|
# POST maps
|
||||||
def create
|
def create
|
||||||
|
|
||||||
|
|
|
@ -34,8 +34,8 @@ class TopicsController < ApplicationController
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html {
|
format.html {
|
||||||
@alltopics = [@topic] + @topic.relatives # should limit to topics visible to user
|
@alltopics = ([@topic] + @topic.relatives).delete_if {|t| t.permission == "private" && (!authenticated? || (authenticated? && @current.id != t.user_id)) } # should limit to topics visible to user
|
||||||
@allsynapses = @topic.synapses # should also be limited
|
@allsynapses = @topic.synapses.delete_if {|s| s.permission == "private" && (!authenticated? || (authenticated? && @current.id != s.user_id)) }
|
||||||
|
|
||||||
respond_with(@allsynapses, @alltopics, @topic)
|
respond_with(@allsynapses, @alltopics, @topic)
|
||||||
}
|
}
|
||||||
|
@ -52,8 +52,8 @@ class TopicsController < ApplicationController
|
||||||
redirect_to root_url and return
|
redirect_to root_url and return
|
||||||
end
|
end
|
||||||
|
|
||||||
@alltopics = @topic.relatives # should limit to topics visible to user
|
@alltopics = @topic.relatives.delete_if {|t| t.permission == "private" && (!authenticated? || (authenticated? && @current.id != t.user_id)) }
|
||||||
@allsynapses = @topic.synapses # should also be limited
|
@allsynapses = @topic.synapses.delete_if {|s| s.permission == "private" && (!authenticated? || (authenticated? && @current.id != s.user_id)) }
|
||||||
|
|
||||||
@json = Hash.new()
|
@json = Hash.new()
|
||||||
@json['topic'] = @topic
|
@json['topic'] = @topic
|
||||||
|
|
|
@ -1,83 +0,0 @@
|
||||||
<%#
|
|
||||||
# @file
|
|
||||||
# Code to display a map
|
|
||||||
# /maps/:id
|
|
||||||
#%>
|
|
||||||
|
|
||||||
<% content_for :title, @map.name + " | Metamaps" %>
|
|
||||||
|
|
||||||
<div id="preloaded-images">
|
|
||||||
<img src="/assets/MMCCicon_realtime_blue.png" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<% if authenticated? %>
|
|
||||||
<div class="sidebarFork">
|
|
||||||
<div class="sidebarForkIcon">
|
|
||||||
</div>
|
|
||||||
<div class="sidebarForkBox"></div>
|
|
||||||
</div>
|
|
||||||
<% if @map.permission == "commons" || @map.user == user %>
|
|
||||||
<div class="sidebarCollaborate">
|
|
||||||
<div class="sidebarCollaborateIcon blue"></div>
|
|
||||||
<div class="sidebarCollaborateBox">
|
|
||||||
<h3 class="realtimeBoxTitle">Realtime: </h3>
|
|
||||||
<span class="realtimeOnOff rtOn">ON</span>
|
|
||||||
<div class="clearfloat"></div>
|
|
||||||
<div class="realtimeMapperList">
|
|
||||||
<ul>
|
|
||||||
<li class="rtMapper littleRtOn rtMapperSelf">
|
|
||||||
<%= user.name %> (me)
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
<div class="sidebarFilter <%= authenticated? ? 'loggedin' : 'loggedout' %>">
|
|
||||||
<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 => 'shared/filterbymetacode' %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="index">
|
|
||||||
<div class="openCheatsheet openLightbox" data-open="cheatsheet"></div>
|
|
||||||
<span class="mapInfo"></span>
|
|
||||||
<div class="clearfloat"></div>
|
|
||||||
<%= render :partial => 'maps/mapinfobox' %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="maps onMap" id="container">
|
|
||||||
<div id="center-container">
|
|
||||||
<div id="infovis"></div>
|
|
||||||
</div>
|
|
||||||
<div class="showcard" id="showcard"></div>
|
|
||||||
</div>
|
|
||||||
<div class="clearfloat"></div>
|
|
||||||
|
|
||||||
<% if authenticated? %>
|
|
||||||
|
|
||||||
<% # add these if you have edit permissions on the map %>
|
|
||||||
<% if @map.permission == "commons" || @map.user == user %>
|
|
||||||
<% # for creating and pulling in topics and synapses %>
|
|
||||||
<%= render :partial => 'newtopic' %>
|
|
||||||
<%= render :partial => 'newsynapse' %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% # for populating the change metacode list on the topic card %>
|
|
||||||
<%= render :partial => 'shared/metacodeoptions' %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
|
|
||||||
<script>
|
|
||||||
Metamaps.Active.Map = <%= @map.to_json.html_safe %>;
|
|
||||||
Metamaps.Metacodes = <%= @allmetacodes.to_json.html_safe %>;
|
|
||||||
Metamaps.Topics = <%= @alltopics.to_json.html_safe %>;
|
|
||||||
Metamaps.Synapses = <%= @allsynapses.to_json.html_safe %>;
|
|
||||||
Metamaps.Mappings = <%= @allmappings.to_json.html_safe %>;
|
|
||||||
Metamaps.Settings.embed = true;
|
|
||||||
</script>
|
|
|
@ -30,12 +30,14 @@
|
||||||
<% m.metacodes.sort{|x,y| x.name <=> y.name }.each_with_index do |m, index| %>
|
<% m.metacodes.sort{|x,y| x.name <=> y.name }.each_with_index do |m, index| %>
|
||||||
<% @list += '<li><img src="' + m.icon + '" alt="' + m.name + '" /><p>' + m.name.downcase + '</p><div class="clearfloat"></div></li>' %>
|
<% @list += '<li><img src="' + m.icon + '" alt="' + m.name + '" /><p>' + m.name.downcase + '</p><div class="clearfloat"></div></li>' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<p class="setDesc"><%= m.desc %></p>
|
<div class="metacodeSwitchTab">
|
||||||
<div class="metacodeSetList">
|
<p class="setDesc"><%= m.desc %></p>
|
||||||
<ul>
|
<div class="metacodeSetList">
|
||||||
<%= @list.html_safe %>
|
<ul>
|
||||||
</ul>
|
<%= @list.html_safe %>
|
||||||
<div class="clearfloat"></div>
|
</ul>
|
||||||
|
<div class="clearfloat"></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button class="button" onclick="Metamaps.Create.updateMetacodeSet(<%= m.id %>, <%= localindex %>, false);">
|
<button class="button" onclick="Metamaps.Create.updateMetacodeSet(<%= m.id %>, <%= localindex %>, false);">
|
||||||
Switch Set
|
Switch Set
|
||||||
|
|
|
@ -29,7 +29,6 @@ Metamaps::Application.routes.draw do
|
||||||
match 'maps/mappers/:id', to: 'maps#index', via: :get, as: :usermaps
|
match 'maps/mappers/:id', to: 'maps#index', via: :get, as: :usermaps
|
||||||
match 'maps/topics/:id', to: 'maps#index', via: :get, as: :topicmaps
|
match 'maps/topics/:id', to: 'maps#index', via: :get, as: :topicmaps
|
||||||
resources :maps, except: [:new, :edit]
|
resources :maps, except: [:new, :edit]
|
||||||
match 'maps/:id/embed', to: 'maps#embed', via: :get, as: :embed
|
|
||||||
match 'maps/:id/contains', to: 'maps#contains', via: :get, as: :contains
|
match 'maps/:id/contains', to: 'maps#contains', via: :get, as: :contains
|
||||||
|
|
||||||
devise_for :users, controllers: { registrations: 'users/registrations', passwords: 'users/passwords', sessions: 'devise/sessions' }, :skip => [:sessions]
|
devise_for :users, controllers: { registrations: 'users/registrations', passwords: 'users/passwords', sessions: 'devise/sessions' }, :skip => [:sessions]
|
||||||
|
|
Loading…
Reference in a new issue