this is a lot of changes. too many to say here, oops

This commit is contained in:
Connor Turland 2014-01-28 22:46:58 -05:00
parent 5c3a0c28d8
commit 414e59e280
189 changed files with 2117 additions and 1066 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 269 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 919 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 471 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 772 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 725 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,008 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 466 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 603 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 892 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.8 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.9 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.9 KiB

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 543 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

View file

@ -1,13 +1,12 @@
function selectEdgeOnClickHandler(adj, e) {
if (Mconsole.busy) return;
//editing overrides everything else
if (e.altKey) {
//in select-edit-delete-nodes-and-edges.js
editEdge(adj, e);
if (synapseWasDoubleClicked()) {
synapseDoubleClickHandler(adj, e);
return;
}
var edgeIsSelected = MetamapsModel.selectedEdges.indexOf(adj);
if (edgeIsSelected == -1) edgeIsSelected = false;
else if (edgeIsSelected != -1) edgeIsSelected = true;
@ -30,18 +29,48 @@ function selectEdgeOnClickHandler(adj, e) {
Mconsole.plot();
}//selectEdgeOnClickHandler
function synapseDoubleClickHandler(adj, e) {
editEdge(adj, e);
}
/*
* Returns a boolean saying if the synapse was double clicked in our understanding of the word
*/
function synapseWasDoubleClicked() {
//grab the timestamp of the click
var storedTime = MetamapsModel.lastSynapseClick;
var now = Date.now(); //not compatible with IE8 FYI
MetamapsModel.lastSynapseClick = now;
if (now - storedTime < MetamapsModel.DOUBLE_CLICK_TOLERANCE) {
return true;
} else {
return false;
}
}//synapseWasDoubleClicked;
function nodeDoubleClickHandler(node, e) {
keepFromCommons(node);
openNodeShowcard(node);
}
function enterKeyHandler() {
var selectedNodesCopy = MetamapsModel.selectedNodes.slice(0);
var len = selectedNodesCopy.length;
for (var i = 0; i < len; i += 1) {
n = selectedNodesCopy[i];
keepFromCommons(n);
}//for
Mconsole.plot();
// if the metacode spinner is open, create topic when enter is pressed
if ( $('.new_topic').css('display') != 'none' ) {
$('.new_topic').submit();
}
// if the metacode spinner is open, create topic when enter is pressed
else if ( $('.new_synapse').css('display') != 'none' ) {
$('.new_synapse').submit();
}
//var selectedNodesCopy = MetamapsModel.selectedNodes.slice(0);
//var len = selectedNodesCopy.length;
//for (var i = 0; i < len; i += 1) {
// n = selectedNodesCopy[i];
// keepFromCommons(n);
//}//for
//Mconsole.plot();
}//enterKeyHandler
function escKeyHandler() {
@ -53,36 +82,16 @@ function escKeyHandler() {
* Make a node "in the commons" (with a green circle) lose its
* green circle so it stays on the console/map/...
*/
function keepFromCommons(node) {
function keepFromCommons(id) {
if (userid == null) {
return;
}
//greenCircle being true denotes it's actually "in the commons" still
if (node.getData('greenCircle') == false) {
return;
}
//this line adds it to the console if you close seek
node.setData('greenCircle', false);
//this is just aesthetic
deselectNode(node);
//this adds the node to the map, if it's a map
if (window.mapid) {
$.post('/mappings',
{
topic: {id: node.id},
map: {id: window.mapid},
xloc: node.pos.x,
yloc: node.pos.y
},
function(data, textStatus, jqXHR) {
console.log(data);
node.setData('mappingid', data.id);
});
}
$('#topic_addSynapse').val("false");
$('#topic_x').val(0);
$('#topic_y').val(0);
$('#topic_grabTopic').val(id);
$('.new_topic').submit();
}//doubleClickNodeHandler
/*
@ -143,14 +152,20 @@ function canvasDoubleClickHandler(canvasLoc,e) {
$('#new_topic').css('left', e.clientX + "px");
$('#new_topic').css('top', e.clientY + "px");
$('#topic_x').val(canvasLoc.x);
$('#topic_y').val(canvasLoc.y);
$('#topic_name').autocomplete('enable');
$('#topic_y').val(canvasLoc.y);
$('#new_topic').fadeIn('fast');
addMetacode();
$('#topic_name').focus();
} else {
$('#new_topic').fadeOut('fast');
$('#new_synapse').fadeOut('fast');
// reset the draw synapse positions to false
MetamapsModel.synapseStartCoord = false;
MetamapsModel.synapseEndCoord = false;
// set all node dimensions back to normal
Mconsole.graph.eachNode(function (n) {
n.setData('dim', 25, 'current');
});
tempInit = false;
tempNode = null;
tempNode2 = null;
@ -250,13 +265,25 @@ function onDragMoveTopicHandler(node, eventInfo, e) {
if (tempInit == false) {
tempNode = node;
tempInit = true;
// set the draw synapse start position
MetamapsModel.synapseStartCoord = {
x: node.pos.getc().x,
y: node.pos.getc().y
};
}
//
temp = eventInfo.getNode();
if (temp != false && temp.id != node.id) { // this means a Node has been returned
tempNode2 = temp;
// set the draw synapse end position
MetamapsModel.synapseEndCoord = {
x: temp.pos.getc().x,
y: temp.pos.getc().y
};
Mconsole.plot();
renderMidArrow({ x: tempNode.pos.getc().x, y: tempNode.pos.getc().y }, { x: temp.pos.getc().x, y: temp.pos.getc().y }, 13, false, Mconsole.canvas);
// before making the highlighted one bigger, make sure all the others are regular size
Mconsole.graph.eachNode(function (n) {
n.setData('dim', 25, 'current');
@ -279,8 +306,12 @@ function onDragMoveTopicHandler(node, eventInfo, e) {
$('#new_synapse').css('top',myY + "px");
$('#topic_x').val(eventInfo.getPos().x);
$('#topic_y').val(eventInfo.getPos().y);
// set the draw synapse end position
MetamapsModel.synapseEndCoord = {
x: eventInfo.getPos().x,
y: eventInfo.getPos().y
};
Mconsole.plot();
renderMidArrow({ x: tempNode.pos.getc().x, y: tempNode.pos.getc().y }, { x: pos.x, y: pos.y }, 13, false, Mconsole.canvas);
Mconsole.fx.plotNode(tempNode, Mconsole.canvas);
}
}

View file

@ -31,7 +31,12 @@ MetamapsModel.edgeHoveringOver = false;
MetamapsModel.boxStartCoordinates = false;
MetamapsModel.boxEndCoordinates = false;
//coordinates for drawing edge that's not created yet
MetamapsModel.synapseStartCoord = false;
MetamapsModel.synapseEndCoord = false;
//double clicking of nodes or canvas
MetamapsModel.lastSynapseClick = 0;
MetamapsModel.lastNodeClick = 0;
MetamapsModel.lastCanvasClick = 0;
MetamapsModel.DOUBLE_CLICK_TOLERANCE = 300;

View file

@ -13,7 +13,6 @@ function graphSettings(type, embed) {
//by scrolling and DnD
Navigation: {
enable: true,
type: 'HTML',
//Enable panning events only if we're dragging the empty
//canvas (and not a node).
panning: 'avoid nodes',
@ -39,8 +38,11 @@ function graphSettings(type, embed) {
},
//Native canvas text styling
Label: {
type: 'HTML', //Native or HTML
type: 'Native', //Native or HTML
size: 20,
family: 'LatoLight',
textBaseline: 'hanging',
color:'#000'
//style: 'bold'
},
//Add Tips
@ -52,7 +54,6 @@ function graphSettings(type, embed) {
Events: {
enable: true,
enableForEdges: true,
type: 'HTML',
onMouseMove: function(node, eventInfo, e) {
onMouseMoveHandler(node, eventInfo, e);
},
@ -123,6 +124,17 @@ function graphSettings(type, embed) {
}
canvasDoubleClickHandler(eventInfo.getPos(), e);
}//if
},
onRightClick: function (node, eventInfo, e) {
if (node && !node.nodeFrom) {
// open right click menu
}
else if (node && node.nodeFrom) { // the variable 'node' is actually an edge/adjacency
// open right click menu
}
else {
// right click on open canvas, options here?
}
}
},
//Number of iterations for the FD algorithm
@ -131,13 +143,13 @@ function graphSettings(type, embed) {
levelDistance: 200,
// Add text to the labels. This method is only triggered
// on label creation and only for DOM labels (not native canvas ones).
onCreateLabel: function (domElement, node) {
onCreateLabelHandler(type, domElement, node);
},
//onCreateLabel: function (domElement, node) {
// onCreateLabelHandler(type, domElement, node);
//},
// Change node styles when DOM labels are placed or moved.
onPlaceLabel: function (domElement, node) {
onPlaceLabelHandler(domElement, node);
}
//onPlaceLabel: function (domElement, node) {
// onPlaceLabelHandler(domElement, node);
//}
};
if (embed) {
@ -191,7 +203,7 @@ function hideCards() {
}
// defining code to draw edges with arrows pointing in one direction
var renderMidArrow = function(from, to, dim, swap, canvas){
var renderMidArrow = function(from, to, dim, swap, canvas, placement, newSynapse){
var ctx = canvas.getCtx();
// invert edge direction
if (swap) {
@ -204,7 +216,10 @@ var renderMidArrow = function(from, to, dim, swap, canvas){
// scale it
vect.$scale(dim / vect.norm());
// compute the midpoint of the edge line
var midPoint = new $jit.Complex((to.x + from.x) / 2, (to.y + from.y) / 2);
var newX = (to.x - from.x) * placement + from.x;
var newY = (to.y - from.y) * placement + from.y;
var midPoint = new $jit.Complex(newX, newY);
// move midpoint by half the "length" of the arrow so the arrow is centered on the midpoint
var arrowPoint = new $jit.Complex((vect.x / 0.7) + midPoint.x, (vect.y / 0.7) + midPoint.y);
// compute the tail intersection point with the edge line
@ -213,8 +228,12 @@ var renderMidArrow = function(from, to, dim, swap, canvas){
var normal = new $jit.Complex(-vect.y / 2, vect.x / 2);
var v1 = intermediatePoint.add(normal);
var v2 = intermediatePoint.$add(normal.$scale(-1));
//ctx.strokeStyle = "#222222";
if (newSynapse) {
ctx.strokeStyle = "#222222";
ctx.lineWidth = 2;
ctx.globalAlpha = 0.4;
}
ctx.beginPath();
ctx.moveTo(from.x, from.y);
ctx.lineTo(to.x, to.y);
@ -225,38 +244,6 @@ var renderMidArrow = function(from, to, dim, swap, canvas){
ctx.lineTo(v2.x, v2.y);
ctx.stroke();
};
// defining code to draw edges with arrows pointing in both directions
var renderMidArrows = function(from, to, dim, swap, canvas){
var ctx = canvas.getCtx();
// invert edge direction
if (swap) {
var tmp = from;
from = to;
to = tmp;
}
// vect represents a line from tip to tail of the arrow
var vect = new $jit.Complex(to.x - from.x, to.y - from.y);
// scale it
vect.$scale(dim / vect.norm());
// compute the midpoint of the edge line
var midPoint = new $jit.Complex((to.x + from.x) / 2, (to.y + from.y) / 2);
// move midpoint by half the "length" of the arrow so the arrow is centered on the midpoint
var arrowPoint = new $jit.Complex((vect.x / 0.7) + midPoint.x, (vect.y / 0.7) + midPoint.y);
// compute the tail intersection point with the edge line
var intermediatePoint = new $jit.Complex(arrowPoint.x - vect.x,
arrowPoint.y - vect.y);
// vector perpendicular to vect
var normal = new $jit.Complex(-vect.y / 2, vect.x / 2);
var v1 = intermediatePoint.add(normal);
var v2 = intermediatePoint.$add(normal.$scale(-1));
//ctx.strokeStyle = "#222222";
ctx.beginPath();
ctx.moveTo(v1.x, v1.y);
ctx.lineTo(arrowPoint.x, arrowPoint.y);
ctx.lineTo(v2.x, v2.y);
ctx.stroke();
};
// defining custom node type
var nodeSettings = {
@ -309,13 +296,14 @@ var nodeSettings = {
edgeHelper.line.render({ x: pos.x, y: pos.y }, { x: posChild.x, y: posChild.y }, canvas);
}
else if (directionCat == "both") {
renderMidArrow({ x: pos.x, y: pos.y }, { x: posChild.x, y: posChild.y }, 13, true, canvas);
renderMidArrow({ x: pos.x, y: pos.y }, { x: posChild.x, y: posChild.y }, 13, false, canvas);
renderMidArrow({ x: pos.x, y: pos.y }, { x: posChild.x, y: posChild.y }, 13, true, canvas, 0.7);
renderMidArrow({ x: pos.x, y: pos.y }, { x: posChild.x, y: posChild.y }, 13, false, canvas, 0.7);
}
else if (directionCat == "from-to") {
var direction = adj.data.$direction;
var inv = (direction && direction.length > 1 && direction[0] != adj.nodeFrom.id);
renderMidArrow({ x: pos.x, y: pos.y }, { x: posChild.x, y: posChild.y }, 13, inv, canvas);
renderMidArrow({ x: pos.x, y: pos.y }, { x: posChild.x, y: posChild.y }, 13, inv, canvas, 0.7);
renderMidArrow({ x: pos.x, y: pos.y }, { x: posChild.x, y: posChild.y }, 13, inv, canvas, 0.3);
}
}//renderEdgeArrow
@ -549,7 +537,6 @@ function onDragEndTopicHandler(node, eventInfo, e, allowRealtime) {
$('#topic_addSynapse').val("false");
$('#synapse_topic1id').val(tempNode.id);
$('#synapse_topic2id').val(tempNode2.id);
$('#synapse_desc').autocomplete('enable');
$('#new_synapse').fadeIn('fast');
$('#synapse_desc').focus();
tempNode = null;

View file

@ -7040,6 +7040,19 @@ Graph.Plot = {
!animating && opt.onAfterPlotLine(adj);
}
});
//START METAMAPS CODE
if (MetamapsModel.synapseStartCoord) {
ctx.save();
var X = MetamapsModel.synapseStartCoord.x;
var Y = MetamapsModel.synapseStartCoord.y;
var X2 = MetamapsModel.synapseEndCoord.x;
var Y2 = MetamapsModel.synapseEndCoord.y;
renderMidArrow({ x: X, y: Y }, { x: X2, y: Y2 }, 13, false, canvas, 0.5, true);
ctx.restore();
}
//END METAMAPS CODE
ctx.save();
if(node.drawn) {
!animating && opt.onBeforePlotNode(node);
@ -7213,8 +7226,32 @@ Graph.Label.Native = new Class({
ctx.font = node.getLabelData('style') + ' ' + node.getLabelData('size') + 'px ' + node.getLabelData('family');
ctx.textAlign = node.getLabelData('textAlign');
ctx.fillStyle = ctx.strokeStyle = node.getLabelData('color');
// ORIGINAL CODE ctx.fillStyle = ctx.strokeStyle = node.getLabelData('color');
ctx.textBaseline = node.getLabelData('textBaseline');
//START METAMAPS CODE
//render background
ctx.fillStyle = 'rgba(255, 255, 255, 0.7)';
var margin = 5;
var height = 16 + margin; //font size + margin
var CURVE = height / 2; //offset for curvy corners
var width = ctx.measureText(node.name).width + 2 * margin - 2 * CURVE;
var labelX = (pos.x - width/2) - margin + CURVE/2;
var labelY = pos.y + node.getData("height"); // - height + margin;
ctx.fillRect(labelX, labelY, width, height);
//curvy corners woo - circles in place of last CURVE pixels of rect
ctx.beginPath();
ctx.arc(labelX, labelY + CURVE, CURVE, 0.5 * Math.PI, 1.5 * Math.PI, false);
ctx.closePath();
ctx.fill();
ctx.beginPath();
ctx.arc(labelX + width, labelY + CURVE, CURVE, 1.5 * Math.PI, 0.5 * Math.PI, false);
ctx.closePath();
ctx.fill();
ctx.fillStyle = ctx.strokeStyle = node.getLabelData('color');
// END METAMAPS CODE
this.renderLabel(canvas, node, controller);
},
@ -7235,7 +7272,10 @@ Graph.Label.Native = new Class({
renderLabel: function(canvas, node, controller) {
var ctx = canvas.getCtx();
var pos = node.pos.getc(true);
ctx.fillText(node.name, pos.x, pos.y + node.getData("height") / 2);
//ctx.fillText(node.name, pos.x, pos.y + node.getData("height") / 2);
// START METAMAPS CODE
ctx.fillText(node.name, pos.x, pos.y + node.getData("height"));
// END METAMAPS CODE
},
hideLabel: $.empty,

View file

@ -230,7 +230,6 @@ function updateEdgeDisplay(edge, dir, dirCat) {
}
function best_in_place_perms(edge) {
console.log(edge);
var output =
'<span class="best_in_place best_in_place_permission" \
id="best_in_place_topic_$_id_$_permission" \

View file

@ -9,12 +9,12 @@
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
// require autocomplete-rails-uncompressed
//
//= require jquery
//= require jquery-ui
//= require jquery.purr
//= require best_in_place
//= require autocomplete-rails-uncompressed
//= require jquery_ujs
//= require_tree .
@ -25,21 +25,66 @@ var labelType, useGradients, nativeTextSupport, animate, json, Mconsole = null,
$(document).ready(function() {
var menuIsOpen = false, searchIsOpen = false, accountIsOpen = false;
$('#new_topic, #new_synapse').bind('contextmenu', function(e){
return false;
});
/// this is for the topic creation autocomplete field
$('#topic_name').bind('railsAutocomplete.select', function(event, data){
if (data.item.id != undefined) {
$('#topic_grabTopic').val(data.item.id);
$('#topic_name').typeahead([
{
name: 'topic_autocomplete',
template: '<p>{{value}}</p><div class="type">{{type}}</div><img width="20" height="20" src="{{typeImageURL}}" alt="{{type}}" title="{{type}}"/>',
remote: {
url: '/topics/autocomplete_topic?term=%QUERY'
},
engine: Hogan
}
]);
$('#topic_name').bind('typeahead:selected', function (event, datum, dataset) {
$('#topic_grabTopic').val(datum.id);
$('.new_topic').submit();
}
});
event.preventDefault();
event.stopPropagation();
});
$('.new_topic').bind('submit', function(event, data){
$('.new_topic, .new_synapse').bind('submit', function(event, data){
event.preventDefault();
});
});
// this is for the search box
$('.sidebarSearchField').typeahead([
{
name: 'topics',
template: $('.topicTemplate').html(),
remote: {
url: '/search/topics?term=%QUERY'
},
engine: Hogan,
header: '<h3 class="search-header">Topics</h3>'
},
{
name: 'maps',
template: $('.mapTemplate').html(),
remote: {
url: '/search/maps?term=%QUERY'
},
engine: Hogan,
header: '<h3 class="search-header">Maps</h3>'
},
{
name: 'mappers',
template: $('.mapperTemplate').html(),
remote: {
url: '/search/mappers?term=%QUERY'
},
engine: Hogan,
header: '<h3 class="search-header">Mappers</h3>'
}
]);
$(".scroll").mCustomScrollbar();
@ -52,49 +97,131 @@ var labelType, useGradients, nativeTextSupport, animate, json, Mconsole = null,
//$('.nodemargin').css('padding-top',$('.focus').css('height'));
// controls the sliding hover of the menus at the top
var sliding1 = false;
var sliding1 = false;
var lT;
$(".logo").hover(
function () {
$('.menuflag').hide();
clearTimeout(lT);
if (! sliding1) {
sliding1 = true;
var listLength = $('.logo .menu li').length * 28;
$('.footer .menu').animate({
height: listLength + 'px'
}, 300, function() {
sliding1 = false;
});
}
},
function () {
lT = setTimeout(function() {
var closeMenu = function() {
lT = setTimeout(function() {
if (! sliding1) {
sliding1 = true;
$('.footer .menu').animate({
height: '0px'
}, 300, function() {
sliding1 = false;
menuIsOpen = false;
sliding1 = true;
// $('.footer .menu').animate({
// height: '0px'
// }, 300, function() {
// sliding1 = false;
// menuIsOpen = false;
// });
$('.footer').css('border-top-right-radius','5px');
$('.logo').animate({
'background-position-x':'-10px'
}, 300);
$('.footer .menu').fadeOut(300, function() {
sliding1 = false;
menuIsOpen = false;
});
}
},800);
}
);
}
var openMenu = function() {
//closeAccount();
//closeSearch();
$('.menuflag').hide();
clearTimeout(lT);
if (! sliding1) {
sliding1 = true;
// $('.footer .menu').animate({
// height: listLength + 'px'
// }, 300, function() {
// sliding1 = false;
// });
$('.footer').css('border-top-right-radius','0');
$('.logo').animate({
'background-position-x':'-7px'
}, 300);
$('.footer .menu').fadeIn(300, function() {
sliding1 = false;
});
}
}
// bind the hover events
$(".logo").hover(openMenu, closeMenu);
var menuIsOpen = false;
// when on touch screen, make touching on the logo do what hovering does on desktop
$("#mainTitle a").bind('touchend', function(evt) {
if (!menuIsOpen) {
menuIsOpen = true;
var listLength = $('.logo .menu li').length * 28;
$('.footer .menu').animate({
height: listLength + 'px'
}, 300);
openMenu();
evt.preventDefault();
evt.stopPropogation();
evt.stopPropagation();
}
});
});
// start account section
$('.sidebarAccountIcon').click(function(e) {
if (!accountIsOpen) openAccount();
else if (accountIsOpen) closeAccount();
e.stopPropagation();
});
$('.sidebarAccountBox').click(function(e) {
e.stopPropagation();
});
function openAccount() {
//closeMenu();
//closeSearch();
if (!accountIsOpen) {
$('.sidebarAccountBox').fadeIn(300, function() {
//$('.sidebarSearchField').css({padding:'5px 10px', width:'180px'}).focus();
accountIsOpen = true;
});
}
}
function closeAccount() {
if (accountIsOpen) {
$('.sidebarAccountBox').fadeOut(300, function() {
accountIsOpen = false;
});
}
}
// end account section
// start search section
$('.sidebarSearchIcon').click(function(e) {
if (!searchIsOpen) openSearch();
else if (searchIsOpen) closeSearch();
e.stopPropagation();
});
$('.sidebarSearch .twitter-typeahead').click(function(e) {
e.stopPropagation();
});
function openSearch() {
hideCards();
$('.sidebarSearch .twitter-typeahead, .sidebarSearch .tt-hint, .sidebarSearchField').animate({
width: '200px'
}, 300, function() {
$('.sidebarSearchField, .sidebarSearch .tt-hint').css({padding:'5px 10px', width:'180px'});
$('.sidebarSearchField').focus();
searchIsOpen = true;
});
}
function closeSearch() {
if (searchIsOpen) {
$('.sidebarSearchField, .sidebarSearch .tt-hint').css({padding:'5px 0', width:'200px'});
$('.sidebarSearch .twitter-typeahead, .sidebarSearch .tt-hint, .sidebarSearchField').animate({
width: '0'
}, 300, function() {
searchIsOpen = false;
});
}
}
// end search section
$('body').click(function() {
closeSearch();
closeAccount();
});
addHoverForSettings();
@ -119,6 +246,15 @@ var labelType, useGradients, nativeTextSupport, animate, json, Mconsole = null,
event.preventDefault();
saveLayoutAll();
});
// bind keyboard handlers
$('body').bind('keyup', function(e) {
switch(e.which) {
case 13: enterKeyHandler(); break;
case 27: escKeyHandler(); break;
default: break; //console.log(e.which);
}
});
}); // end document.ready
@ -244,7 +380,7 @@ function addMetacode() {
yRadius:40,
xPos: 150,
yPos: 40,
speed:0.15,
speed:0.3,
mouseWheel:true,
bringToFront: true
});
@ -305,24 +441,17 @@ function MconsoleReset() {
var mX = Mconsole.canvas.scaleOffsetX;
var mY = Mconsole.canvas.scaleOffsetY;
Mconsole.canvas.scale((1/mX),(1/mY));
}
function hideLabels() {
if (Mconsole.labels.labelsHidden) {
Mconsole.labels.hideLabels();
$('.hidelabels').html('Hide Labels');
}
else if (!Mconsole.labels.labelsHidden) {
Mconsole.labels.hideLabels(true);
$('.hidelabels').html('Show Labels');
}
}
function openNodeShowcard(node) {
//populate the card that's about to show with the right topics data
populateShowCard(node);
$('*').keypress(function(e) {
switch(e.which) {
case 13: enterKeyHandler(); break;
case 27: escKeyHandler(); break;
default: //alert(e.which); break;
}
});
// positions the card in the right place
$('#showcard').css('top', '250px');
$('#showcard').css('left', '100px');
$('.showcard.topic_' + node.id).fadeIn('fast');
//node.setData('dim', 1, 'current');
MetamapsModel.showcardInUse = node.id;
}

View file

@ -1,130 +0,0 @@
/*
* Unobtrusive autocomplete
*
* To use it, you just have to include the HTML attribute autocomplete
* with the autocomplete URL as the value
*
* Example:
* <input type="text" data-autocomplete="/url/to/autocomplete">
*
* Optionally, you can use a jQuery selector to specify a field that can
* be updated with the element id whenever you find a matching value
*
* Example:
* <input type="text" data-autocomplete="/url/to/autocomplete" data-id-element="#id_field">
*/
(function(jQuery)
{
var self = null;
jQuery.fn.railsAutocomplete = function() {
return this.live('focus',function() {
if (!this.railsAutoCompleter) {
this.railsAutoCompleter = new jQuery.railsAutocomplete(this);
}
});
};
jQuery.railsAutocomplete = function (e) {
_e = e;
this.init(_e);
};
jQuery.railsAutocomplete.fn = jQuery.railsAutocomplete.prototype = {
railsAutocomplete: '0.0.1'
};
jQuery.railsAutocomplete.fn.extend = jQuery.railsAutocomplete.extend = jQuery.extend;
jQuery.railsAutocomplete.fn.extend({
init: function(e) {
e.delimiter = jQuery(e).attr('data-delimiter') || null;
function split( val ) {
return val.split( e.delimiter );
}
function extractLast( term ) {
return split( term ).pop().replace(/^\s+/,"");
}
jQuery(e).autocomplete({
source: function( request, response ) {
jQuery.getJSON( jQuery(e).attr('data-autocomplete'), {
term: extractLast( request.term )
}, function() {
if(arguments[0].length == 0) {
arguments[0] = []
//arguments[0][0] = { id: "", label: "no existing match" }
}
jQuery(arguments[0]).each(function(i, el) {
var obj = {};
obj[el.id] = el;
jQuery(e).data(obj);
});
response.apply(null, arguments);
});
},
change: function( event, ui ) {
if(jQuery(jQuery(this).attr('data-id-element')).val() == "") {
return;
}
jQuery(jQuery(this).attr('data-id-element')).val(ui.item ? ui.item.id : "");
var update_elements = jQuery.parseJSON(jQuery(this).attr("data-update-elements"));
var data = ui.item ? jQuery(this).data(ui.item.id.toString()) : {};
if(update_elements && jQuery(update_elements['id']).val() == "") {
return;
}
for (var key in update_elements) {
jQuery(update_elements[key]).val(ui.item ? data[key] : "");
}
},
search: function() {
// custom minLength
var term = extractLast( this.value );
if ( term.length < 2 ) {
return false;
}
},
focus: function() {
// prevent value inserted on focus
return false;
},
select: function( event, ui ) {
var terms = split( this.value );
// remove the current input
terms.pop();
// add the selected item
terms.push( ui.item.value );
// add placeholder to get the comma-and-space at the end
if (e.delimiter != null) {
terms.push( "" );
this.value = terms.join( e.delimiter );
} else {
this.value = terms.join("");
if (jQuery(this).attr('data-id-element')) {
jQuery(jQuery(this).attr('data-id-element')).val(ui.item.id);
}
if (jQuery(this).attr('data-update-elements')) {
var data = jQuery(this).data(ui.item.id.toString());
var update_elements = jQuery.parseJSON(jQuery(this).attr("data-update-elements"));
for (var key in update_elements) {
jQuery(update_elements[key]).val(data[key]);
}
}
}
var remember_string = this.value;
jQuery(this).bind('keyup.clearId', function(){
if(jQuery(this).val().trim() != remember_string.trim()){
jQuery(jQuery(this).attr('data-id-element')).val("");
jQuery(this).unbind('keyup.clearId');
}
});
jQuery(e).trigger('railsAutocomplete.select', ui);
return false;
}
});
}
});
jQuery(document).ready(function(){
jQuery('input[data-autocomplete]').railsAutocomplete();
});
})(jQuery);

View file

@ -7,6 +7,40 @@
//
// Please retain this copyright header in all versions of the software
//////////////////////////////////////////////////////////////////////////////////
var matched, browser;
jQuery.uaMatch = function( ua ) {
ua = ua.toLowerCase();
var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
/(msie) ([\w.]+)/.exec( ua ) ||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
[];
return {
browser: match[ 1 ] || "",
version: match[ 2 ] || "0"
};
};
matched = jQuery.uaMatch( navigator.userAgent );
browser = {};
if ( matched.browser ) {
browser[ matched.browser ] = true;
browser.version = matched.version;
}
// Chrome is Webkit, but Webkit is also Safari.
if ( browser.chrome ) {
browser.webkit = true;
} else if ( browser.webkit ) {
browser.safari = true;
}
jQuery.browser = browser;
(function($) {
@ -206,6 +240,8 @@
if ( items[this.frontIndex] === undefined ) { return; } // Images might not have loaded yet.
// METAMAPS CODE
$('#topic_metacode').val($(items[this.frontIndex].image).attr('title'));
$('img.cloudcarousel').css({"background":"none", "width":"","height":""});
$(items[this.frontIndex].image).css({"width":"45px","height":"45px"});
// NOT METAMAPS CODE
$(options.titleBox).html( $(items[this.frontIndex].image).attr('title'));
$(options.altBox).html( $(items[this.frontIndex].image).attr('alt'));
@ -285,11 +321,11 @@
if (item.imageOK)
{
var img = item.image;
w = img.width = item.orgWidth * scale;
img.style.zIndex = "" + (scale * 100)>>0; // >>0 = Math.foor(). Firefox doesn't like fractional decimals in z-index.
w = img.width = item.orgWidth * scale;
h = img.height = item.orgHeight * scale;
img.style.left = x + px ;
img.style.top = y + px;
img.style.zIndex = "" + (scale * 100)>>0; // >>0 = Math.foor(). Firefox doesn't like fractional decimals in z-index.
if (item.reflection !== null)
{
reflHeight = options.reflHeight * scale;

View file

@ -0,0 +1,576 @@
/*
* Copyright 2011 Twitter, Inc.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var Hogan = {};
(function (Hogan, useArrayBuffer) {
Hogan.Template = function (renderFunc, text, compiler, options) {
this.r = renderFunc || this.r;
this.c = compiler;
this.options = options;
this.text = text || '';
this.buf = (useArrayBuffer) ? [] : '';
}
Hogan.Template.prototype = {
// render: replaced by generated code.
r: function (context, partials, indent) { return ''; },
// variable escaping
v: hoganEscape,
// triple stache
t: coerceToString,
render: function render(context, partials, indent) {
return this.ri([context], partials || {}, indent);
},
// render internal -- a hook for overrides that catches partials too
ri: function (context, partials, indent) {
return this.r(context, partials, indent);
},
// tries to find a partial in the curent scope and render it
rp: function(name, context, partials, indent) {
var partial = partials[name];
if (!partial) {
return '';
}
if (this.c && typeof partial == 'string') {
partial = this.c.compile(partial, this.options);
}
return partial.ri(context, partials, indent);
},
// render a section
rs: function(context, partials, section) {
var tail = context[context.length - 1];
if (!isArray(tail)) {
section(context, partials, this);
return;
}
for (var i = 0; i < tail.length; i++) {
context.push(tail[i]);
section(context, partials, this);
context.pop();
}
},
// maybe start a section
s: function(val, ctx, partials, inverted, start, end, tags) {
var pass;
if (isArray(val) && val.length === 0) {
return false;
}
if (typeof val == 'function') {
val = this.ls(val, ctx, partials, inverted, start, end, tags);
}
pass = (val === '') || !!val;
if (!inverted && pass && ctx) {
ctx.push((typeof val == 'object') ? val : ctx[ctx.length - 1]);
}
return pass;
},
// find values with dotted names
d: function(key, ctx, partials, returnFound) {
var names = key.split('.'),
val = this.f(names[0], ctx, partials, returnFound),
cx = null;
if (key === '.' && isArray(ctx[ctx.length - 2])) {
return ctx[ctx.length - 1];
}
for (var i = 1; i < names.length; i++) {
if (val && typeof val == 'object' && names[i] in val) {
cx = val;
val = val[names[i]];
} else {
val = '';
}
}
if (returnFound && !val) {
return false;
}
if (!returnFound && typeof val == 'function') {
ctx.push(cx);
val = this.lv(val, ctx, partials);
ctx.pop();
}
return val;
},
// find values with normal names
f: function(key, ctx, partials, returnFound) {
var val = false,
v = null,
found = false;
for (var i = ctx.length - 1; i >= 0; i--) {
v = ctx[i];
if (v && typeof v == 'object' && key in v) {
val = v[key];
found = true;
break;
}
}
if (!found) {
return (returnFound) ? false : "";
}
if (!returnFound && typeof val == 'function') {
val = this.lv(val, ctx, partials);
}
return val;
},
// higher order templates
ho: function(val, cx, partials, text, tags) {
var compiler = this.c;
var options = this.options;
options.delimiters = tags;
var text = val.call(cx, text);
text = (text == null) ? String(text) : text.toString();
this.b(compiler.compile(text, options).render(cx, partials));
return false;
},
// template result buffering
b: (useArrayBuffer) ? function(s) { this.buf.push(s); } :
function(s) { this.buf += s; },
fl: (useArrayBuffer) ? function() { var r = this.buf.join(''); this.buf = []; return r; } :
function() { var r = this.buf; this.buf = ''; return r; },
// lambda replace section
ls: function(val, ctx, partials, inverted, start, end, tags) {
var cx = ctx[ctx.length - 1],
t = null;
if (!inverted && this.c && val.length > 0) {
return this.ho(val, cx, partials, this.text.substring(start, end), tags);
}
t = val.call(cx);
if (typeof t == 'function') {
if (inverted) {
return true;
} else if (this.c) {
return this.ho(t, cx, partials, this.text.substring(start, end), tags);
}
}
return t;
},
// lambda replace variable
lv: function(val, ctx, partials) {
var cx = ctx[ctx.length - 1];
var result = val.call(cx);
if (typeof result == 'function') {
result = coerceToString(result.call(cx));
if (this.c && ~result.indexOf("{\u007B")) {
return this.c.compile(result, this.options).render(cx, partials);
}
}
return coerceToString(result);
}
};
var rAmp = /&/g,
rLt = /</g,
rGt = />/g,
rApos =/\'/g,
rQuot = /\"/g,
hChars =/[&<>\"\']/;
function coerceToString(val) {
return String((val === null || val === undefined) ? '' : val);
}
function hoganEscape(str) {
str = coerceToString(str);
return hChars.test(str) ?
str
.replace(rAmp,'&amp;')
.replace(rLt,'&lt;')
.replace(rGt,'&gt;')
.replace(rApos,'&#39;')
.replace(rQuot, '&quot;') :
str;
}
var isArray = Array.isArray || function(a) {
return Object.prototype.toString.call(a) === '[object Array]';
};
})(typeof exports !== 'undefined' ? exports : Hogan);
(function (Hogan) {
// Setup regex assignments
// remove whitespace according to Mustache spec
var rIsWhitespace = /\S/,
rQuot = /\"/g,
rNewline = /\n/g,
rCr = /\r/g,
rSlash = /\\/g,
tagTypes = {
'#': 1, '^': 2, '/': 3, '!': 4, '>': 5,
'<': 6, '=': 7, '_v': 8, '{': 9, '&': 10
};
Hogan.scan = function scan(text, delimiters) {
var len = text.length,
IN_TEXT = 0,
IN_TAG_TYPE = 1,
IN_TAG = 2,
state = IN_TEXT,
tagType = null,
tag = null,
buf = '',
tokens = [],
seenTag = false,
i = 0,
lineStart = 0,
otag = '{{',
ctag = '}}';
function addBuf() {
if (buf.length > 0) {
tokens.push(new String(buf));
buf = '';
}
}
function lineIsWhitespace() {
var isAllWhitespace = true;
for (var j = lineStart; j < tokens.length; j++) {
isAllWhitespace =
(tokens[j].tag && tagTypes[tokens[j].tag] < tagTypes['_v']) ||
(!tokens[j].tag && tokens[j].match(rIsWhitespace) === null);
if (!isAllWhitespace) {
return false;
}
}
return isAllWhitespace;
}
function filterLine(haveSeenTag, noNewLine) {
addBuf();
if (haveSeenTag && lineIsWhitespace()) {
for (var j = lineStart, next; j < tokens.length; j++) {
if (!tokens[j].tag) {
if ((next = tokens[j+1]) && next.tag == '>') {
// set indent to token value
next.indent = tokens[j].toString()
}
tokens.splice(j, 1);
}
}
} else if (!noNewLine) {
tokens.push({tag:'\n'});
}
seenTag = false;
lineStart = tokens.length;
}
function changeDelimiters(text, index) {
var close = '=' + ctag,
closeIndex = text.indexOf(close, index),
delimiters = trim(
text.substring(text.indexOf('=', index) + 1, closeIndex)
).split(' ');
otag = delimiters[0];
ctag = delimiters[1];
return closeIndex + close.length - 1;
}
if (delimiters) {
delimiters = delimiters.split(' ');
otag = delimiters[0];
ctag = delimiters[1];
}
for (i = 0; i < len; i++) {
if (state == IN_TEXT) {
if (tagChange(otag, text, i)) {
--i;
addBuf();
state = IN_TAG_TYPE;
} else {
if (text.charAt(i) == '\n') {
filterLine(seenTag);
} else {
buf += text.charAt(i);
}
}
} else if (state == IN_TAG_TYPE) {
i += otag.length - 1;
tag = tagTypes[text.charAt(i + 1)];
tagType = tag ? text.charAt(i + 1) : '_v';
if (tagType == '=') {
i = changeDelimiters(text, i);
state = IN_TEXT;
} else {
if (tag) {
i++;
}
state = IN_TAG;
}
seenTag = i;
} else {
if (tagChange(ctag, text, i)) {
tokens.push({tag: tagType, n: trim(buf), otag: otag, ctag: ctag,
i: (tagType == '/') ? seenTag - ctag.length : i + otag.length});
buf = '';
i += ctag.length - 1;
state = IN_TEXT;
if (tagType == '{') {
if (ctag == '}}') {
i++;
} else {
cleanTripleStache(tokens[tokens.length - 1]);
}
}
} else {
buf += text.charAt(i);
}
}
}
filterLine(seenTag, true);
return tokens;
}
function cleanTripleStache(token) {
if (token.n.substr(token.n.length - 1) === '}') {
token.n = token.n.substring(0, token.n.length - 1);
}
}
function trim(s) {
if (s.trim) {
return s.trim();
}
return s.replace(/^\s*|\s*$/g, '');
}
function tagChange(tag, text, index) {
if (text.charAt(index) != tag.charAt(0)) {
return false;
}
for (var i = 1, l = tag.length; i < l; i++) {
if (text.charAt(index + i) != tag.charAt(i)) {
return false;
}
}
return true;
}
function buildTree(tokens, kind, stack, customTags) {
var instructions = [],
opener = null,
token = null;
while (tokens.length > 0) {
token = tokens.shift();
if (token.tag == '#' || token.tag == '^' || isOpener(token, customTags)) {
stack.push(token);
token.nodes = buildTree(tokens, token.tag, stack, customTags);
instructions.push(token);
} else if (token.tag == '/') {
if (stack.length === 0) {
throw new Error('Closing tag without opener: /' + token.n);
}
opener = stack.pop();
if (token.n != opener.n && !isCloser(token.n, opener.n, customTags)) {
throw new Error('Nesting error: ' + opener.n + ' vs. ' + token.n);
}
opener.end = token.i;
return instructions;
} else {
instructions.push(token);
}
}
if (stack.length > 0) {
throw new Error('missing closing tag: ' + stack.pop().n);
}
return instructions;
}
function isOpener(token, tags) {
for (var i = 0, l = tags.length; i < l; i++) {
if (tags[i].o == token.n) {
token.tag = '#';
return true;
}
}
}
function isCloser(close, open, tags) {
for (var i = 0, l = tags.length; i < l; i++) {
if (tags[i].c == close && tags[i].o == open) {
return true;
}
}
}
Hogan.generate = function (tree, text, options) {
var code = 'var _=this;_.b(i=i||"");' + walk(tree) + 'return _.fl();';
if (options.asString) {
return 'function(c,p,i){' + code + ';}';
}
return new Hogan.Template(new Function('c', 'p', 'i', code), text, Hogan, options);
}
function esc(s) {
return s.replace(rSlash, '\\\\')
.replace(rQuot, '\\\"')
.replace(rNewline, '\\n')
.replace(rCr, '\\r');
}
function chooseMethod(s) {
return (~s.indexOf('.')) ? 'd' : 'f';
}
function walk(tree) {
var code = '';
for (var i = 0, l = tree.length; i < l; i++) {
var tag = tree[i].tag;
if (tag == '#') {
code += section(tree[i].nodes, tree[i].n, chooseMethod(tree[i].n),
tree[i].i, tree[i].end, tree[i].otag + " " + tree[i].ctag);
} else if (tag == '^') {
code += invertedSection(tree[i].nodes, tree[i].n,
chooseMethod(tree[i].n));
} else if (tag == '<' || tag == '>') {
code += partial(tree[i]);
} else if (tag == '{' || tag == '&') {
code += tripleStache(tree[i].n, chooseMethod(tree[i].n));
} else if (tag == '\n') {
code += text('"\\n"' + (tree.length-1 == i ? '' : ' + i'));
} else if (tag == '_v') {
code += variable(tree[i].n, chooseMethod(tree[i].n));
} else if (tag === undefined) {
code += text('"' + esc(tree[i]) + '"');
}
}
return code;
}
function section(nodes, id, method, start, end, tags) {
return 'if(_.s(_.' + method + '("' + esc(id) + '",c,p,1),' +
'c,p,0,' + start + ',' + end + ',"' + tags + '")){' +
'_.rs(c,p,' +
'function(c,p,_){' +
walk(nodes) +
'});c.pop();}';
}
function invertedSection(nodes, id, method) {
return 'if(!_.s(_.' + method + '("' + esc(id) + '",c,p,1),c,p,1,0,0,"")){' +
walk(nodes) +
'};';
}
function partial(tok) {
return '_.b(_.rp("' + esc(tok.n) + '",c,p,"' + (tok.indent || '') + '"));';
}
function tripleStache(id, method) {
return '_.b(_.t(_.' + method + '("' + esc(id) + '",c,p,0)));';
}
function variable(id, method) {
return '_.b(_.v(_.' + method + '("' + esc(id) + '",c,p,0)));';
}
function text(id) {
return '_.b(' + id + ');';
}
Hogan.parse = function(tokens, text, options) {
options = options || {};
return buildTree(tokens, '', [], options.sectionTags || []);
},
Hogan.cache = {};
Hogan.compile = function(text, options) {
// options
//
// asString: false (default)
//
// sectionTags: [{o: '_foo', c: 'foo'}]
// An array of object with o and c fields that indicate names for custom
// section tags. The example above allows parsing of {{_foo}}{{/foo}}.
//
// delimiters: A string that overrides the default delimiters.
// Example: "<% %>"
//
options = options || {};
var key = text + '||' + !!options.asString;
var t = this.cache[key];
if (t) {
return t;
}
t = this.generate(this.parse(this.scan(text, options.delimiters), text, options), text, options);
return this.cache[key] = t;
};
})(typeof exports !== 'undefined' ? exports : Hogan);

View file

@ -1,6 +1,6 @@
window.app.realtime =
connect : () ->
window.app.socket = io.connect('http://metamaps.cc:5001');
window.app.socket.on 'connect', () ->
subscribeToRooms()
console.log('socket connected')
#window.app.socket = io.connect('http://localhost:5001');
#window.app.socket.on 'connect', () ->
#subscribeToRooms()
#console.log('socket connected')

File diff suppressed because one or more lines are too long

View file

@ -59,7 +59,7 @@ html {
body {
background:#031924 url(background2-for-repeating.jpg) repeat 0 0;
font-family: 'katarine-web', sans-serif;
font-family: 'LatoLight', helvetica, sans-serif;
background-attachment:fixed;
color:#FFF;
}
@ -88,6 +88,43 @@ a {
text-decoration:none;
}
button.button, a.button, input[type="submit"] {
border: none;
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.2);
box-shadow: 0 1px 2px rgba(0,0,0,.2);
border: none;
border-bottom-left-radius: 0;
border-top-left-radius: 0;
height: 30px;
outline: none;
padding: 0 0;
width: 60px;
-webkit-box-shadow: none;
box-shadow: none;
background: #69a3a4;
background: -webkit-linear-gradient(top,#69a3a4,#69a3aF);
background: linear-gradient(top,#4387fd,#4683ea);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#4387fd,endColorstr=#4683ea,GradientType=1);
vertical-align: top;
color: #fff!important;
margin: 0px;
cursor: default!important;
display: inline-block;
font-weight: bold;
line-height: 29px;
min-width: 54px;
text-align: center;
text-decoration: none!important;
-webkit-border-radius: 2px;
border-radius: 2px;
-webkit-user-select: none;
}
button.button:hover, a.button:hover, input[type="submit"]:hover {
-webkit-box-shadow: 0 1px 0 rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.2);
box-shadow: 0 1px 0 rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.2);
}
/*
* Utility
*/
@ -109,6 +146,10 @@ a {
* Layout stuffs
*/
#barometer_tab {
display:none;
}
#error_explanation {
background: #612127;
padding: 30px;
@ -123,7 +164,6 @@ a {
}
.profile {
overflow-y:scroll;
height:100%;
margin-bottom:50px;
}
@ -210,12 +250,28 @@ a {
position: absolute;
}
.anypage #topic_name {
width:200px;
position:absolute;
#new_topic .twitter-typeahead {
position:absolute !important;
top:40px;
left:50px;
z-index:9999;
z-index:9999;
width:202px;
height: 37px;
font-family: 'katarine-web';
}
.anypage #topic_name, .anypage .tt-hint {
width:190px;
background: rgba(0,0,0,0.8);
height: 25px;
margin: 0;
padding: 5px 5px;
border: 1px solid black;
outline: none;
font-size: 25px;
line-height: 35px;
color: rgba(255,255,255,0.7);
font-family: 'katarine-web';
}
#metacodeImg {
@ -235,13 +291,21 @@ label, select, input, textarea {
}
label {
margin-top:5px;
margin-top:10px;
margin-bottom:4px;
}
input[type="submit"] {
margin-top:5px;
}
#user_remember_me {
margin-top:11px;
}
#user_remember_me, label[for="user_remember_me"] {
float:left;
}
.contentarea p,
.contentarea ul,
.contentarea ol,
@ -340,118 +404,410 @@ box-shadow: 6px 6px 8px rgba(0,0,0,0.4);
margin:0 0;
}
/* bottom right corner stuffs */
.wrapper div.index {
position: fixed;
bottom: 9px;
right: 0px;
z-index: 9999;
width: auto;
background: rgba(0,0,0,0.7);
padding: 1px 10px 0px 10px;
font-family: "vinyl",sans-serif;
font-style:italic;
height: 35px;
font-size: 30px;
line-height: 38px;
border:1px solid #000;
border-right:none;
border-bottom-left-radius:5px;
border-top-left-radius:5px;
}
.wrapper div.index .openCheatsheet {
position:absolute;
top:0;
left:-45px;
background: rgba(0,0,0,0.7) url('MMCCicon_help.png') no-repeat center center;
background-size: 32px 32px;
border:1px solid #000;
border-radius:5px;
height:36px;
width:36px;
cursor:pointer;
}
.wrapper div.index span {
float:left;
}
.wrapper div.index span.mapName {
text-transform:uppercase;
margin-right:9px;
}
.wrapper div.index span.mapInfo {
width: 24px;
height: 24px;
line-height: 24px;
text-align: center;
margin-top: 5px;
font-size: 27px;
background: url('MMCCicon_info.png') no-repeat center center;
background-size:24px 24px;
cursor:pointer;
}
.wrapper h1.index {
position: fixed;
bottom: 9px;
right: 0;
z-index: 9999;
width: auto;
background: url('black_bg.png');
background: rgba(0,0,0,0.7);
padding: 1px 10px 0px 20px;
border-bottom-left-radius: 5px;
border-top-left-radius: 5px;
text-transform:uppercase;
font-style:italic;
height: 35px;
font-size: 30px;
line-height: 38px;
border:1px solid #000;
border-right:none;
border-bottom-left-radius:5px;
border-top-left-radius:5px;
}
.nodemargin {
padding-top:120px;
/* account */
.sidebarAccount {
position:absolute;
top:5px;
right:5px;
z-index:200;
width: 35px;
height:35px;
}
.focus {
position:fixed;
top:0;
left:0;
width:90%;
z-index:2;
display: block;
min-width:533px;
margin: 50px 50px 25px 50px;
background: url('bg.png'); border-radius: 20px;
color:#000;
border:1px solid #000;
.sidebarAccountIcon {
position:absolute;
width: 35px;
height: 35px;
background: #69a3a4 url('MMCCicon_mapper.png') no-repeat center center;
background-size: 28px 28px;
cursor:pointer;
}
.sidebarAccountBox {
position:absolute;
display:none;
height:auto;
background: rgba(0,0,0,0.7);
top: 36px;
right:0;
padding: 10px;
border: 1px solid black;
min-width:120px;
font-family: 'LatoLight', helvetica, sans-serif;
}
.sidebarAccountBox.loggedin {
width:auto;
}
.sidebarAccountBox.loggedout {
width:200px;
}
.focus h1 {
margin-top:0;
.sidebarAccountBox h3 {
font-family: 'vinyl', helvetica, sans-serif;
text-transform:uppercase;
font-style:italic;
}
.focusleft,
.focusmiddle,
.focusright {
.sidebarAccountBox ul {
list-style:none;
}
.sidebarAccountBox li.accountIcon {
padding: 6px 0 6px 25px;
background-size: 18px 18px;
background-repeat: no-repeat;
background-position: 0px 6px;
font-size: 18px;
line-height: 20px;
}
li.accountMaps {
background-image: url('MMCCicon_map.png');
}
li.accountSettings {
background-image: url('MMCCicon_settings.png');
}
li.accountInvite{
background-image: url('MMCCicon_invite.png');
}
li.accountLogout {
background-image: url('MMCCicon_logout.png');
}
li.accountIcon a {
display:block;
}
.sidebarAccountBox a {
color:white;
}
.sidebarAccountBox input[type="email"], .sidebarAccountBox input[type="password"] {
width: 200px;
height: 32px;
font-size: 15px;
direction: ltr;
-webkit-appearance: none;
appearance: none;
display: inline-block;
margin: 0;
padding: 0 8px;
background: #fff;
border: 1px solid #d9d9d9;
border-top: 1px solid #c0c0c0;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
-webkit-border-radius: 1px;
-moz-border-radius: 1px;
border-radius: 1px;
font: -webkit-small-control;
color: initial;
letter-spacing: normal;
word-spacing: normal;
text-transform: none;
text-indent: 0px;
text-shadow: none;
display: inline-block;
text-align: start;
}
.sidebarAccountBox .links a {
display:block;
margin-top:5px;
}
/* search */
.sidebarSearch {
position:absolute;
top:5px;
left:5px;
height: 35px;
z-index:200;
}
.sidebarSearchIcon {
float:left;
width: 35px;
height: 35px;
background: #cf8e88 url('search_icon_32x32.png') no-repeat center center;
background-size: 25px 25px;
cursor:pointer;
}
.sidebarSearch .twitter-typeahead {
float:left;
}
.focusleft {
width:20%;
min-width:70px;
text-align:center;
.sidebarSearchField, .sidebarSearch .tt-hint {
height:25px;
padding:5px 0;
width:0px;
margin: 0;
border: 0;
outline: none;
font-size: 25px;
line-height:35px;
background:rgba(0,0,0,0.7);
color: rgba(255,255,255,0.6);
font-family: 'katarine-web';
}
.focusmiddle {
display:block;
width:49%;
min-height:115px;
border-right:2px solid #000;
border-left:2px solid #000;
.sidebarSearch .tt-dropdown-menu {
left:-35px !important;
background: rgba(0,0,0,0.7);
min-width: 440px;
border: 1px solid black;
}
.focusright {
width:30%;
min-width:150px;
}
.focus .focusleft p {
font-weight:normal;
font-size:16px;
.sidebarSearch .tt-dropdown-menu h3 {
font-family:'vinyl',helvetica,sans-serif;
text-transform:uppercase;
font-style:italic;
font-size:20px;
line-height:20px;
padding:10px 0 5px 0;
margin: 10px 0 3px 10px;
}
.focus .focusright p {
font-weight:normal;
.sidebarSearch .tt-suggestions {
font-family:'LatoLight', helvetica, sans-serif;
}
.sidebarSearch .tt-suggestion {
background: rgba(0,0,0,0.5);
border: 1px solid black;
}
.sidebarSearch .tt-is-under-cursor {
background:black;
}
.sidebarSearch .tt-suggestion .icon {
float:left;
width:36px;
height:36px;
margin-right:5px;
}
.sidebarSearch .tt-dataset-mappers .tt-suggestion .icon {
width:28px;
height:28px;
padding:4px;
}
.sidebarSearch .resultText {
width: 280px;
display: block;
float: left;
}
.sidebarSearch .resultTitle {
font-weight:bold;
font-size:20px;
line-height:22px;
width:100%;
padding-top:8px;
}
.sidebarSearch .resultDesc {
font-style:italic;
font-size:16px;
line-height:20px;
padding:10px 0 5px 10px;
line-height:16px;
width:100%;
padding: 6px 0;
}
.focus .icon {
margin:0 auto;
.sidebarSearch .tip {
display:none;
}
.focus .title {
font-size:22px;
line-height:25px;
border-bottom:2px solid #000;
padding:10px;
.sidebarSearch div.autoOptions {
width: 117px;
float: left;
position:relative;
display:none;
}
.focus .desc {
padding:10px;
height:75px;
font-family:Arial, Helvetica, sans-serif;
}
.focus .desc h3 {
font-style:normal;
}
.focus .location {
padding-left:10px;
}
.focus .link {
padding:0 0 0 10px;
.sidebarSearch .tt-is-under-cursor .autoOptions {
display:block;
width:90%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.sidebarSearch .autoOptions button, .sidebarSearch .autoOptions a, .sidebarSearch .autoOptions div {
position: absolute;
padding: 0;
margin: 0;
border: none;
outline: none;
}
.sidebarSearch button.addToMap {
width: 20px;
height: 20px;
background: url(/assets/MMCCicon_add.png) no-repeat center center;
background-size: 15px 15px;
top: 10px;
left: 0px;
}
.sidebarSearch a.goTo {
width: 20px;
height: 20px;
background: url(/assets/MMCCicon_pop-out.png) no-repeat center center;
background-size: 15px 15px;
top: 11px;
left: 22px;
}
.sidebarSearch div.mapCount {
width: 20px;
height: 20px;
background: url(/assets/MMCCicon_map.png) no-repeat 0px center;
background-size: 14px 14px;
top: 0px;
left: 50px;
padding-left: 18px;
font-size: 12px;
line-height: 20px;
}
.sidebarSearch div.topicCount {
width: 20px;
height: 20px;
background: url(/assets/MMCCicon_topic.png) no-repeat 0px center;
background-size: 14px 14px;
top: 0px;
left: 50px;
padding-left: 18px;
font-size: 12px;
line-height: 20px;
}
.sidebarSearch div.synapseCount {
width: 20px;
height: 20px;
background: url(/assets/MMCCicon_synapse.png) no-repeat 0px center;
background-size: 14px 14px;
top: 0px;
left: 83px;
padding-left: 15px;
font-size: 12px;
line-height: 20px;
}
.sidebarSearch div.topicOriginatorIcon {
width: 20px;
height: 20px;
background: url(/assets/MMCCicon_mapper.png) no-repeat center center;
background-size: 16px 16px;
top: 21px;
left: 52px;
}
.sidebarSearch div.mapContributorsIcon {
width: 20px;
height: 20px;
background: url(/assets/MMCCicon_mapper.png) no-repeat 0px center;
background-size: 16px 16px;
top: 21px;
left: 50px;
padding-left: 18px;
font-size: 12px;
line-height: 20px;
}
.sidebarSearch div.topicPermission, .sidebarSearch div.mapPermission {
width: 20px;
height: 20px;
background-size: 20px 20px !important;
top: 20px;
left: 84px;
}
.sidebarSearch div.topicPermission.commons, .sidebarSearch div.mapPermission.commons {
background: url(/assets/MMCCicon_commons.png) no-repeat center center;
}
.sidebarSearch div.topicPermission.public, .sidebarSearch div.mapPermission.public {
background: url(/assets/MMCCicon_public.png) no-repeat center center;
}
.sidebarSearch div.topicPermission.private, .sidebarSearch div.mapPermission.private {
background: url(/assets/MMCCicon_private.png) no-repeat center center;
}
.sidebarSearch .tt-dataset-mappers a.goTo {
top:7px;
}
.sidebarSearch .tt-dataset-mappers div.mapCount {
top:8px;
}
/* end search */
.nodemargin {
padding-top:120px;
}
.divider {
@ -468,177 +824,21 @@ box-shadow: 6px 6px 8px rgba(0,0,0,0.4);
}
#cards {
height:100%;
overflow-y:scroll;
height:100%;
}
#cards p.empty {
margin-left:50px;
}
/* --- styling the sideOptions section ---*/
.sideOption {
position:fixed;
left:0px;
display:block;
height:32px;
background: #FFF;
padding:0 0 0 15px;
border-bottom-right-radius:10px;
border-top-right-radius:10px;
color:#000;
border:1px solid #000;
overflow:hidden;
cursor:pointer;
box-shadow: 6px 6px 8px rgba(0,0,0,0.4);
}
#sideOptionFind {
top:25%;
width:45px;
}
#sideOptionAnalyze {
top:35%;
width:64px;
}
#sideOptionOrganize {
top:45%;
width:75px;
display:none;
}
.closeSideOption {
position:fixed;
left:4px;
display:none;
margin-top: -22px;
cursor: pointer;
background: #000;
padding: 0 4px;
border-radius: 8px;
}
#closeFind {
top:25%;
}
#closeAnalyze {
top:35%;
}
#closeOrganize {
top:45%;
}
#findWhere {
position:fixed;
top:25%;
left:90px;
display:none;
margin-top:-20px;
}
.findWhereField, #findWhere input, #findWhere p {
float:left;
}
.findWhereField.inCommons {
color:#67be5f;
}
.sideOption select,
.sideOption span {
float:left;
margin-top:10px;
}
.sideOption .spacer {
margin:10px 10px 0;
}
.sideOption .find_key {
margin-right:8px;
}
.find_topic_by_name {
display: block;
}
.find_topic_by_name input, .find_map_by_name input, .find_mapper_by_name input {
margin:10px 0 0 0;
width: 270px;
border-radius: 10px;
height: 20px;
padding: 0 10px;
outline: none;
}
.find_mapper_by_name,
.find_map_by_name {
display:none;
}
.find_topic_by_metacode {
z-index:12;
display:none;
width:auto;
color: #67AF9F;
}
.find_topic_by_metacode ul {
display:block;
}
.find_topic_by_metacode ul li {
clear:both;
list-style-type:none;
display:block;
padding:3px;
}
.find_topic_by_metacode ul img {
width:40px;
height:40px;
float:left;
}
.find_topic_by_metacode ul p {
float:left;
display: block;
margin: 0;
background: none;
padding: 10px 4px 2px 4px;
}
.find_topic_by_metacode #filters-one {
float:left;
}
.find_topic_by_metacode #filters-two {
float:left;
}
.find_topic_by_metacode #filters-three {
float:left;
}
.find_topic_by_metacode li.toggledOff {
opacity: 0.4;
}
#get_topics_form {
display:none;
}
/* --- styling the logo button ---*/
.footer {
/*.footer {
width: 188px;
display: block;
position: fixed;
bottom: 9px;
height: 38px;
background: url('black_bg.png');
background: rgba(0,0,0,0.5);
border-bottom-right-radius: 5px;
border-top-right-radius: 5px;
z-index: 15000;
@ -655,12 +855,29 @@ box-shadow: 6px 6px 8px rgba(0,0,0,0.4);
padding: 3px 8px;
margin: -0.75em 0 0;
}
*/
.footer {
display: block;
position: fixed;
bottom: 9px;
height: 35px;
z-index: 15000;
border:1px solid #000;
border-bottom-right-radius:5px;
border-top-right-radius:5px;
}
.logo {
z-index:12;
display:block;
width: 136px;
background: rgba(0,0,0,0.7) url(menu_icon_32.png) no-repeat -10px 8px;
padding: 5px 0px 1px 15px;
background-size: 22px 20px;
}
#mainTitle {
float: left;
/*background: url('black_bg.png') repeat 0 0;*/
padding: 0 5px;
border-radius: 10px;
}
#mainTitle a {
@ -669,37 +886,33 @@ box-shadow: 6px 6px 8px rgba(0,0,0,0.4);
font-style: italic;
text-transform:uppercase;
font-weight: 400;
}
#beta {
float:left;
margin-left: 2px;
font-size:30px;
line-height:30px;
}
.footer .menu {
display:block;
display:none;
position:absolute;
border:none;
bottom:42px;
left:10px;
height:0px;
bottom:36px;
left:-1px;
height:142px;
z-index:12;
width:118px;
width:151px;
color: #67AF9F;
white-space: nowrap;
text-align: center;
font-size: 16px;
overflow: hidden;
padding: 0 8px;
padding: 0;
margin: 0;
background: white;
border-radius: 6px;
/*border-radius: 6px;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
box-shadow: 0 2px rgba(0, 0, 0, 0.05), 0 -2px rgba(0, 0, 0, 0.05) inset;
-webkit-box-shadow: 0 2px rgba(0, 0, 0, 0.05), 0 -2px rgba(0, 0, 0, 0.05) inset;
-moz-box-shadow: 0 2px rgba(0, 0, 0, 0.05), 0 -2px rgba(0, 0, 0, 0.05) inset;
background: url('black_bg.png') repeat 0 0;
-moz-box-shadow: 0 2px rgba(0, 0, 0, 0.05), 0 -2px rgba(0, 0, 0, 0.05) inset;*/
background: rgba(0,0,0,0.7);/*url('black_bg.png'); */
border-left:1px solid #000;
border-right:1px solid #000;
}
@ -710,21 +923,65 @@ box-shadow: 6px 6px 8px rgba(0,0,0,0.4);
float:none;
list-style-type:none;
display:block;
padding:3px;
padding:0;
text-align:center;
border-top:1px solid #999;
}
.footer ul li.first {
border:none;
li.meta .button {
background: #89aa7b;
margin:7px;
}
.footer ul li a:hover {
color:#9E2;
li.beta {
margin: 4px 0 0 !important;
border-top: 1px solid black;
border-bottom: 1px solid black;
position: relative;
height: 30px;
}
.footer ul li a {
color: #FFF;
.inBeta {
background: rgba(0,0,0,0.6);
display: inline-block;
color: white;
height: 30px;
padding: 0 5px;
font-family: 'LatoLight';
font-size: 30px;
position: absolute;
top: 0;
left: 0;
line-height: 30px;
}
li.beta button {
position: absolute;
top: 0;
right: 0;
width: 84px;
border-radius: 0;
font-size: 12px;
margin: 0;
}
li.tutorial, li.exploreMaps {
height:30px;
line-height:30px;
font-size:20px;
}
li.tutorial a, li.exploreMaps a {
display:block;
}
li.exploreMaps {
border-top:1px solid white;
}
.footer ul li a {
color: #FFF;
}
.menuflag {
position: absolute;
@ -748,7 +1005,6 @@ font-size: 21px;
}
.home_bg {
overflow-y:scroll;
display:block;
height:100%;
}
@ -806,3 +1062,7 @@ background: url('home_bg2.png') no-repeat center -46px;
#edit_synapse label.left {
margin-right: 0.5em;
}
.templates {
display:none;
}

View file

@ -1,9 +1,25 @@
class ApplicationController < ActionController::Base
protect_from_forgery
# this is for global login
include ContentHelper
helper_method :user
helper_method :authenticated?
after_filter :store_location
def store_location
# store last url - this is needed for post-login redirect to whatever the user last visited.
if (!request.fullpath.match("/users/") && !request.xhr?) # don't store ajax calls
session[:previous_url] = request.fullpath
end
end
def after_sign_in_path_for(resource)
session[:previous_url] || root_path
end
private
def require_no_user

View file

@ -1,10 +1,13 @@
class MainController < ApplicationController
include TopicsHelper
include MapsHelper
include UsersHelper
before_filter :require_user, only: [:invite]
respond_to :html, :js, :json
# home page
def home
@maps = Map.visibleToUser(@current, nil).sort! { |a,b| b.created_at <=> a.created_at }
@maps = @maps.slice(0,5)
@ -12,46 +15,12 @@ class MainController < ApplicationController
respond_with(@maps)
end
def console
end
def search
@current = current_user
@topics = Array.new()
@synapses = Array.new()
if params[:topics_by_name] != ""
like_keyword = "%"+params[:topics_by_name]+"%"
like_keyword.downcase! #convert to lowercase for better comparison
@topics = Topic.where("LOWER(name) LIKE ?", like_keyword)
end
if params[:topics_by_user_id] != ""
@user = User.find(params[:topics_by_user_id])
@topics = @topics | Topic.visibleToUser(@current, @user)
end
if params[:topics_by_map_id] != ""
@map = Map.find(params[:topics_by_map_id])
@topics = @topics | @map.topics.delete_if{|topic| not topic.authorize_to_view(@current)}
end
@topics.each do |t|
t.synapses.each do |s|
@synapses = @synapses.push(s) if not @synapses.include? s
end
end
@topics.sort! { |a,b| a.name.downcase <=> b.name.downcase }
respond_to do |format|
format.js { respond_with(@topics,@synapses) }
end
end
# /request
def requestinvite
end
# /invite
def invite
@user = current_user
@ -60,5 +29,112 @@ class MainController < ApplicationController
end
end
### SEARCHING ###
# get /search/topics?term=SOMETERM
def searchtopics
@current = current_user
term = params[:term]
if term && !term.empty? && term.downcase[0..3] != "map:" && term.downcase[0..6] != "mapper:" && term.downcase != "topic:"
#remove "topic:" if appended at beginning
term = term[6..-1] if term.downcase[0..5] == "topic:"
#check whether there's a filter by metacode as part of the query
filterByMetacode = false
Metacode.all.each do |m|
lOne = m.name.length+1
lTwo = m.name.length
if term.downcase[0..lTwo] == m.name.downcase + ":"
term = term[lOne..-1]
filterByMetacode = m
end
end
if filterByMetacode
if term == ""
@topics = []
else
search = '%' + term.downcase + '%'
@topics = Topic.where('LOWER("name") like ? OR LOWER("desc") like ? OR LOWER("link") like ?', search, search, search).
where('metacode_id = ?', filterByMetacode.id).limit(10).order('"name"').visibleToUser(@current,nil)
end
else
search = '%' + term.downcase + '%'
@topics = Topic.where('LOWER("name") like ? OR LOWER("desc") like ? OR LOWER("link") like ?', search, search, search).
limit(10).order('"name"').visibleToUser(@current,nil)
end
else
@topics = []
end
render json: autocomplete_array_json(@topics)
#if params[:topics_by_user_id] != ""
# @user = User.find(params[:topics_by_user_id])
# @topics = @topics | Topic.visibleToUser(@current, @user)
#end
#if params[:topics_by_map_id] != ""
# @map = Map.find(params[:topics_by_map_id])
# @topics = @topics | @map.topics.delete_if{|topic| not topic.authorize_to_view(@current)}
#end
#@topics.sort! { |a,b| a.name.downcase <=> b.name.downcase }
end
# get /search/maps?term=SOMETERM
def searchmaps
@current = current_user
term = params[:term]
if term && !term.empty? && term.downcase[0..5] != "topic:" && term.downcase[0..6] != "mapper:" && term.downcase != "map:"
#remove "map:" if appended at beginning
term = term[4..-1] if term.downcase[0..3] == "map:"
search = '%' + term.downcase + '%'
@maps = Map.where('LOWER("name") like ? OR LOWER("desc") like ?', search, search).
limit(10).order('"name"').visibleToUser(@current,nil)
else
@maps = []
end
render json: autocomplete_map_array_json(@maps)
#if params[:topics_by_user_id] != ""
# @user = User.find(params[:topics_by_user_id])
# @topics = @topics | Topic.visibleToUser(@current, @user)
#end
#if params[:topics_by_map_id] != ""
# @map = Map.find(params[:topics_by_map_id])
# @topics = @topics | @map.topics.delete_if{|topic| not topic.authorize_to_view(@current)}
#end
#@topics.sort! { |a,b| a.name.downcase <=> b.name.downcase }
end
# get /search/mappers?term=SOMETERM
def searchmappers
@current = current_user
term = params[:term]
if term && !term.empty? && term.downcase[0..3] != "map:" && term.downcase[0..5] != "topic:" && term.downcase != "mapper:"
#remove "mapper:" if appended at beginning
term = term[7..-1] if term.downcase[0..6] == "mapper:"
@mappers = User.where('LOWER("name") like ?', '%' + term.downcase + '%').
limit(10).order('"name"')
else
@mappers = []
end
render json: autocomplete_user_array_json(@mappers)
#if params[:topics_by_user_id] != ""
# @user = User.find(params[:topics_by_user_id])
# @topics = @topics | Topic.visibleToUser(@current, @user)
#end
#if params[:topics_by_map_id] != ""
# @map = Map.find(params[:topics_by_map_id])
# @topics = @topics | @map.topics.delete_if{|topic| not topic.authorize_to_view(@current)}
#end
#@topics.sort! { |a,b| a.name.downcase <=> b.name.downcase }
end
end

View file

@ -1,10 +1,24 @@
class TopicsController < ApplicationController
include TopicsHelper
before_filter :require_user, only: [:new, :create, :edit, :update, :removefrommap, :destroy]
respond_to :html, :js, :json
autocomplete :topic, :name, :full => true, :extra_data => [:user_id], :display_value => :topic_autocomplete_method
#autocomplete :topic, :name, :full => true, :extra_data => [:user_id], :display_value => :topic_autocomplete_method
# GET /topics/autocomplete_topic
def autocomplete_topic
@current = current_user
term = params[:term]
if term && !term.empty?
t = Topic.where('LOWER("name") like ?', term.downcase + '%').
limit(10).order('"name"').visibleToUser(@current,nil)
else
t = []
end
render json: autocomplete_array_json(t)
end
# GET topics
# or GET /users/:user_id/topics

View file

@ -14,19 +14,6 @@ class UsersController < ApplicationController
respond_with(@user)
end
# GET /user/:id
def show
@user = User.find(params[:id])
@topics = Topic.visibleToUser(@current, @user).sort! { |a,b| b.created_at <=> a.created_at }
@topics = @topics.slice(0,3)
@synapses = Synapse.visibleToUser(@current, @user).sort! { |a,b| b.created_at <=> a.created_at }
@synapses = @synapses.slice(0,3)
@maps = Map.visibleToUser(@current, @user).sort! { |a,b| b.created_at <=> a.created_at }
@maps = @maps.slice(0,3)
respond_with(@user, @topics, @synapses, @maps)
end
# PUT /user
def update
@user = current_user

View file

@ -0,0 +1,13 @@
module ContentHelper
def resource_name
:user
end
def resource
@resource ||= User.new
end
def devise_mapping
@devise_mapping ||= Devise.mappings[:user]
end
end

View file

@ -1,2 +1,32 @@
module MapsHelper
## this one is for building our custom JSON autocomplete format for typeahead
def autocomplete_map_array_json(maps)
temp = []
maps.each do |m|
map = {}
map['id'] = m.id
map['label'] = m.name
map['value'] = m.name
map['description'] = m.desc.truncate(30)
map['permission'] = m.permission
map['topicCount'] = m.topics.count
map['synapseCount'] = m.synapses.count
map['contributorCount'] = m.contributors.count
contributorList = ''
if m.contributors.count > 0
contributorList += '<ul>'
m.contributors.each do |c|
contributorList += '<li>' + c.name + '</li>'
end
contributorList += '</ul>'
end
map['contributorList'] = contributorList
temp.push map
end
return temp
end
end

View file

@ -1,5 +1,26 @@
module TopicsHelper
## this one is for building our custom JSON autocomplete format for typeahead
def autocomplete_array_json(topics)
temp = []
topics.each do |t|
topic = {}
topic['id'] = t.id
topic['label'] = t.name
topic['value'] = t.name
topic['description'] = t.desc.truncate(35) # make this return matched results
topic['type'] = t.metacode.name
topic['typeImageURL'] = '/assets/' + t.metacode.icon
topic['permission'] = t.permission
topic['mapCount'] = t.maps.count
topic['synapseCount'] = t.synapses.count
topic['originator'] = t.user.name
temp.push topic
end
return temp
end
#find all nodes in any given nodes network
def network(node, array, count)
# recurse starting with a node to find all connected nodes and return an array of topics that constitutes the starting nodes network

View file

@ -1,2 +1,18 @@
module UsersHelper
## this one is for building our custom JSON autocomplete format for typeahead
def autocomplete_user_array_json(users)
temp = []
users.each do |u|
user = {}
user['id'] = u.id
user['label'] = u.name
user['value'] = u.name
user['mapCount'] = u.maps.count
temp.push user
end
return temp
end
end

View file

@ -21,6 +21,17 @@ def mk_permission
"pr"
end
end
#return an array of the contributors to the map
def contributors
contributors = []
self.mappings.each do |m|
contributors.push(m.user) if !contributors.include?(m.user)
end
return contributors
end
###### JSON ######

View file

@ -18,7 +18,7 @@ has_many :maps, :through => :mappings
def relatives
topics1 + topics2
end
end
belongs_to :metacode

View file

@ -0,0 +1,40 @@
<%#
# @file
# The inner HTML of the account box that comes up in the bottom left
#%>
<% if authenticated? %>
<% account = current_user %>
<h3 class="accountHeader">Hello <%= account.name.split[0...1][0] %>!</h3>
<ul>
<li class="accountIcon accountMaps"><%= link_to "My Maps", user_maps_url(user) %></li>
<li class="accountIcon accountSettings"><%= link_to "Settings", edit_user_url(account) %></li>
<li class="accountIcon accountInvite"><%= link_to "Share Invite", invite_path %></li>
<li class="accountIcon accountLogout"><%= link_to "Logout", "/sign_out", id: "Logout" %></li>
</ul>
<% else %>
<h3 class="accountHeader">Sign In</h3>
<%= form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => { class: "loginAnywhere" }) do |f| %>
<div>
<%= f.label :email %>
<%= f.email_field :email, :autofocus => true %>
</div>
<div>
<%= f.label :password %>
<%= f.password_field :password %>
</div>
<% if devise_mapping.rememberable? -%>
<div><%= f.check_box :remember_me %> <%= f.label :remember_me %><div class="clearfloat"></div></div>
<% end -%>
<div>
<%= f.submit "Sign in" %><br>
</div>
<% end %>
<div class="links">
<%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
<%= link_to "Forgot your password?", new_password_path(resource_name) %>
<% end -%>
<a href="/request">Request Invite</a>
</div>
<% end %>

View file

@ -0,0 +1,88 @@
<%#
# @file
# templates for the upper right autocomplete results
#%>
<div class="templates">
<div class="topicTemplate">
<img class="icon" src="{{typeImageURL}}">
<span class="tip metacodeTip">{{type}}</span>
<div class="resultText">
<p class="resultTitle">{{value}}</p>
<p class="resultDesc">{{description}}</p>
</div>
<div class="autoOptions">
<% if controller_name == 'maps' && action_name == 'show' && @map.authorize_to_edit(@current) %>
<button class="addToMap" onclick="keepFromCommons({{id}})"></button>
<span class="tip">add to map</span>
<% end %>
<a href="/topics/{{id}}" target="_blank" class="goTo">
<span class="tip">open in new tab</span>
</a>
<div class="mapCount">
<span class="tip">appears on maps</span>
{{mapCount}}
</div>
<div class="synapseCount">
<span class="tip"># of synapses</span>
{{synapseCount}}
</div>
<div class="topicOriginatorIcon">
<span class="tip topicOriginator">{{originator}}</span>
</div>
<div class="topicPermission {{permission}}">
<span class="tip">permission: {{permission}}</span>
</div>
</div>
<div class="clearfloat"></div>
</div>
<div class="mapTemplate">
<img class="icon" src="/assets/map.png">
<div class="resultText">
<p class="resultTitle">{{value}}</p>
<p class="resultDesc">{{description}}</p>
</div>
<div class="autoOptions">
<a href="/maps/{{id}}" target="_blank" class="goTo">
<span class="tip">open in new tab</span>
</a>
<div class="topicCount">
<span class="tip">has topics</span>
{{topicCount}}
</div>
<div class="synapseCount">
<span class="tip">has synapses</span>
{{synapseCount}}
</div>
<div class="mapContributorsIcon">
<span class="tip mapContributors">{{contributorList}}</span>
{{contributorCount}}
</div>
<div class="mapPermission {{permission}}">
<span class="tip">permission: {{permission}}</span>
</div>
</div>
<div class="clearfloat"></div>
</div>
<div class="mapperTemplate">
<img class="icon" width="28" height="28" src="/assets/MMCCicon_mapper.png">
<div class="resultText">
<p class="resultTitle">{{value}}</p>
</div>
<div class="autoOptions">
<a href="/maps/mappers/{{id}}" target="_blank" class="goTo">
<span class="tip">open in new tab</span>
</a>
<div class="mapCount">
<span class="tip"># of maps</span>
{{mapCount}}
</div>
</div>
<div class="clearfloat"></div>
</div>
</div>

View file

@ -47,43 +47,50 @@
<%= content_tag :div, class: authenticated? ? "main authenticated" : "main unauthenticated" do %>
<div class="wrapper" id="wrapper">
<div class="sidebarSearch">
<div class="sidebarSearchIcon"></div>
<input type="text" class="sidebarSearchField" placeholder="Search..."></input>
<div class="clearfloat"></div>
<%= render :partial => 'layouts/searchtemplates' %>
</div>
<div class="sidebarAccount">
<div class="sidebarAccountIcon"></div>
<div class="sidebarAccountBox <%= authenticated? ? 'loggedin' : 'loggedout' %>">
<%= render :partial => 'layouts/account' %>
</div>
</div>
<%= yield %>
</div>
<div class="footer">
<div class="logo">
<% unless authenticated? %>
<ul class="menu">
<li class="first"><a href="http://blog.metamaps.cc" target="_blank">About</a></li>
<li><a href="/request">Request Invite</a></li>
<li><%= link_to "Explore Maps", maps_url %></li>
<% if Topic.exists?(260) %>
<li><%= link_to "Tour", "/topics/260" %></li>
<% end %>
<li class="last"><%= link_to "Login", new_user_session_path, id: "Login" %></li>
</ul>
<% end %>
<% if authenticated? %>
<ul class="menu">
<li class="first"><a href="http://blog.metamaps.cc" target="_blank">About</a></li>
<li><%= link_to "Send Invite", invite_path %></li>
<li><%= link_to "Explore Maps", maps_url %></li>
<li><%= link_to "Create Map", new_map_url %></li>
<li><%= link_to "My Maps", user_maps_url(user) %></li>
<li><%= link_to "My Profile", user_url(user) %></li>
<li><%= link_to "Settings", edit_user_url(user) %></li>
<li><%= link_to "Console", console_url %></li>
<% unless Map.first(:conditions => [ "id = ?", 7]).nil? %>
<li><%= link_to "Feedback", map_path(Map.find(7)) %></li>
<% end %>
<li class="last"><%= link_to "Logout", destroy_user_session_path, method: 'delete', id: "Login" %></li>
</ul>
<% end %>
<h1 id="mainTitle"><%= link_to "metamaps", root_url %></h1><div id="beta">beta</div>
<ul class="menu">
<li class="meta">
<a href="#" class="button" target="_blank">about</a>
</li>
<li class="beta">
<div class="inBeta">beta</div>
<button onclick="BAROMETER.show();">feedback!</button>
</li>
<li class="tutorial"><a href="#" target="_blank">tutorial</a></li>
<li class="exploreMaps"><%= link_to "explore maps", maps_url %></li>
</ul>
<div id="mainTitle"><%= link_to "metamaps", root_url %></div><!--<div id="beta">beta</div>-->
</div>
</div>
<% end %>
<%= render :partial => 'layouts/ga' if Rails.env.production? %>
<% if authenticated? %>
<style type='text/css'>@import url('http://getbarometer.s3.amazonaws.com/assets/barometer/css/barometer.css');</style>
<script src='http://getbarometer.s3.amazonaws.com/assets/barometer/javascripts/barometer.js' type='text/javascript'></script>
<script type="text/javascript" charset="utf-8">
BAROMETER.load('6FWffBApknnjr7p3Oxf2L');
</script>
<style>
</style>
<% end %>
</body>
</html>

View file

@ -1,10 +0,0 @@
<%#
# @file
# Analyze partial view. New options for the analyze menu go here.
#%>
<span id="closeAnalyze" class="closeSideOption">close</span>
<div class="sideOption" id="sideOptionAnalyze">
<span class="find_key">Analyze...</span>
<div class="clearfloat"></div>
<div class="analysis"></div>
</div>

View file

@ -1,80 +0,0 @@
<%#
# @file
# Find partial view. New options for the find menu go here.
#%>
<span id="closeFind" class="closeSideOption">close</span>
<form id="findWhere">
<span class="findWhereField onCanvas"><input type="checkbox" id="onCanvas"><p>On my Canvas</p></span>
<span class="findWhereField inCommons"><input type="checkbox" id="inCommons" checked="checked"><p>In the Commons</p></span>
</form>
<div class="sideOption" id="sideOptionFind">
<span class="find_key">Seek...</span>
<select class="select_content">
<option value="topics" selected="selected">Topics</option>
<!-- <option value="synapses">Synapses</option> -->
<option value="maps">Maps</option>
<option value="mappers">Mappers</option>
</select>
<span class="spacer">by</span>
<select class="select_type">
<option value="name" selected="selected">name</option>
<option value="metacode">metacode</option>
<option value="map (by name)">map (by name)</option>
<option value="mapper (by name)">mapper (by name)</option>
</select>
<div class="clearfloat"></div>
<%= form_for Topic.new, :html => { :class => "find_topic_by_name find find_topic", :id => "find_topic_by_name" } do |f| %>
<%= f.autocomplete_field :name, autocomplete_topic_name_topics_path, :id => "topic_by_name_input", :placeholder => "Search for topics..." %>
<% end %>
<%= form_for Map.new, :html => { :class => "find_map_by_name find", :id => "find_map_by_name" } do |f| %>
<%= f.autocomplete_field :name, autocomplete_map_name_maps_path, :id => "map_by_name_input", :placeholder => "Search for maps..." %>
<% end %>
<%= form_for User.new, :html => { :class => "find_mapper_by_name find", :id => "find_mapper_by_name" } do |f| %>
<%= f.autocomplete_field :name, autocomplete_user_name_users_path, :id => "mapper_by_name_input", :placeholder => "Search for mappers..." %>
<% end %>
<div class="find_topic_by_metacode find find_topic" id="find_topic_by_metacode">
<ul id="filters-one">
<li id="showAll">Show All</li>
<li><img src="/assets/action.png" alt="Action" /><p>action</p></li>
<li><img src="/assets/activity.png" alt="Activity" /><p>activity</p></li>
<li><img src="/assets/bizarre.png" alt="Bizarre" /><p>bizarre</p></li>
<li><img src="/assets/catalyst.png" alt="Catalyst" /><p>catalyst</p></li>
<li><img src="/assets/closed.png" alt="Closed" /><p>closed</p></li>
<li><img src="/assets/experience.png" alt="Experience" /><p>experience</p></li>
<li><img src="/assets/futuredev.png" alt="Future Dev" /><p>future dev</p></li>
<li><img src="/assets/group.png" alt="Group" /><p>group</p></li>
<li><img src="/assets/idea.png" alt="Idea" /><p>idea</p></li>
</ul>
<ul id="filters-two">
<li id="hideAll">Hide All</li>
<li><img src="/assets/implication.png" alt="Implication" /><p>implication</p></li>
<li><img src="/assets/insight.png" alt="Insight" /><p>insight</p></li>
<li><img src="/assets/intention.png" alt="Intention" /><p>intention</p></li>
<li><img src="/assets/knowledge.png" alt="Knowledge" /><p>knowledge</p></li>
<li><img src="/assets/location.png" alt="Location" /><p>location</p></li>
<li><img src="/assets/openissue.png" alt="Open Issue" /><p>open issue</p></li>
<li><img src="/assets/opinion.png" alt="Opinion" /><p>opinion</p></li>
<li><img src="/assets/opportunity.png" alt="Opportunity" /><p>opportunity</p></li>
<li><img src="/assets/person.png" alt="Person" /><p>person</p></li>
</ul>
<ul id="filters-three">
<li><img src="/assets/platform.png" alt="Platform" /><p>platform</p></li>
<li><img src="/assets/problem.png" alt="Problem" /><p>problem</p></li>
<li><img src="/assets/question.png" alt="Question" /><p>question</p></li>
<li><img src="/assets/reference.png" alt="Reference" /><p>reference</p></li>
<li><img src="/assets/requirement.png" alt="Requirement" /><p>requirement</p></li>
<li><img src="/assets/resource.png" alt="Resource" /><p>resource</p></li>
<li><img src="/assets/role.png" alt="Role" /><p>role</p></li>
<li><img src="/assets/task.png" alt="Task" /><p>task</p></li>
<li><img src="/assets/tool.png" alt="Tool" /><p>tool</p></li>
<li><img src="/assets/trajectory.png" alt="Trajectory" /><p>trajectory</p></li>
</ul>
</div>
<%= form_tag("/search", :method => "get", :id => 'get_topics_form', :class => 'get_topics_form', :remote => true) do %>
<%= text_field_tag(:topics_by_name, "", :id => "topicsByName", :class => "getTopicsInput") %>
<%= text_field_tag(:topics_by_user_id, "", :id => "topicsByUser", :class => "getTopicsInput") %>
<%= text_field_tag(:topics_by_map_id, "", :id => "topicsByMap", :class => "getTopicsInput") %>
<%= text_field_tag(:synapses_by_user_id, "", :id => "synapsesByUser", :class => "getTopicsInput") %>
<%= text_field_tag(:synapses_by_map_id, "", :id => "synapsesByMap", :class => "getTopicsInput") %>
<% end %>
</div>

View file

@ -1,9 +0,0 @@
<%#
# @file
# Organize partial view. New options for the organize menu go here.
#%>
<span id="closeOrganize" class="closeSideOption">close</span>
<div class="sideOption" id="sideOptionOrganize">
<!-- <span class="find_key" onclick="setTimeout(function(){organize();},0)">Organize...</span> -->
<span class="find_key">Organize...</span>
</div>

View file

@ -1,48 +0,0 @@
<%#
# @file
# Located at /console
# Console view has the Find/Analyze/Organize tabs, and starts mostly empty
# so it's kind of like a workspace. You can then save to map, etc.
# Emphasis is on pulling in and creating data.
#%>
<% content_for :title, "Console | Metamaps" %>
<div class="headertop">
<div class="tab"></div>
<button class="hidelabels" onclick="hideLabels();">Hide Labels</button>
<button onclick="hideSelectedEdges();hideSelectedNodes();">Hide Selected</button>
<button onclick="enterKeyHandler();">Keep Selected</button>
<% if authenticated? %>
<button onclick="var r=confirm('Are you sure you want to permanently delete selected objects?!'); if (r == true) {deleteSelectedEdges();deleteSelectedNodes();}">Delete Selected</button>
<button onclick="saveToMap();">Save to Map</button>
<% end %>
<button onclick='clearCanvas();'>Clear Canvas</button>
</div>
<div class="clearfloat"></div>
<h1 class="index">
Console
</h1>
<div class="maps onCanvas" id="container">
<div id="center-container">
<div id="infovis"></div>
</div>
<div class="showcard" id="showcard"></div>
</div>
<div class="clearfloat"></div>
<% if authenticated? %>
<%= render :partial => 'topics/new' %>
<%= render :partial => 'synapses/new' %>
<%= render :partial => 'maps/new' %>
<% end %>
<script>
//if (json.length > 0) {
$(document).ready(function() {
initialize("chaotic", true);
});
//}
</script>
<%= render :partial => 'find' %>

View file

@ -79,7 +79,6 @@ $jit.RGraph.Plot.NodeTypes.implement({
type = node.data.t,
ctx = canvas.getCtx();
console.log(type);
if (type == "map") {
ctx.drawImage(image1, pos.x - dim, pos.y - dim, dim*2, dim*2);
} else if (type == 1) {

View file

@ -11,7 +11,7 @@
<img class="cloudcarousel" width="40" height="40" src="/assets/<%= metacode.icon %>" alt="<%= metacode.name %>" title="<%= metacode.name %>"/>
<% end %>
</div>
<%= form.autocomplete_field :name, autocomplete_topic_name_topics_path, :placeholder => "What is the name of your topic?" %>
<%= form.text_field :name, :placeholder => "title..." %>
<%= form.hidden_field :metacode, :value => "Action" %>
<%= form.hidden_field :x, :value => 0 %>
<%= form.hidden_field :y, :value => 0 %>

View file

@ -6,17 +6,11 @@
<% content_for :title, @map.name + " | Metamaps" %>
<div class="headertop">
<!-- <div class="headertop">
<div class="tab"></div>
<button class="hidelabels" onclick="hideLabels();">Hide Labels</button>
<button onclick="if (!goRealtime) { this.innerHTML = 'Stop Realtime'; } else if (goRealtime) { this.innerHTML = 'Start Realtime'; } goRealtime = !goRealtime;">Start Realtime</button>
<button onclick="hideSelectedEdges();hideSelectedNodes();">Hide Selected</button>
<button onclick="enterKeyHandler();">Keep Selected</button>
<% if authenticated? %>
<% if (@map.permission == "commons" && authenticated?) || @map.user == user %>
<button onclick="removeSelectedEdges();removeSelectedNodes();">Remove Selected</button>
<% end %>
<button onclick="var r=confirm('Are you sure you want to permanently delete selected objects?!'); if (r == true) {deleteSelectedEdges();deleteSelectedNodes();}">Delete Selected</button>
<% if (@map.permission == "commons" && authenticated?) || @map.user == user %>
<%= form_for @map, :url => savelayout_path(@map), :html => { :class => "saveMapLayout", :id => "saveMapLayout"}, remote: true do |form| %>
<%= form.hidden_field "coordinates", :value => "" %>
@ -27,19 +21,15 @@
<% end %>
<button onclick='clearCanvas();'>Clear Canvas</button>
</div>
<div class="clearfloat"></div>
<div class="clearfloat"></div> -->
<h1 class="index">
<% if (@map.permission == "commons" && authenticated?) || @map.user == user %>
Editing Map:
<% else %>
Viewing Map:
<% end %>
<%= @map.name %>
<% if (@map.permission == "commons" && authenticated?) || @map.user == user %>
<%= link_to "[edit]", edit_map_path(@map) %>
<% end %>
</h1>
<div class="index">
<div class="openCheatsheet"></div>
<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>
</div>
<div class="maps onMap" id="container">
<div id="center-container">
@ -65,7 +55,7 @@
viewMode = "graph";
json = <%= @mapjson %>;
if (json.length > 0) {
$(document).ready(function() {
$(window).load(function() {
<% if (@map.arranged) %>
initialize("arranged");
<% else %>
@ -74,7 +64,7 @@
});
}
else {
$(document).ready(function() {
$(window).load(function() {
initialize("chaotic", true);
});
}
@ -119,6 +109,4 @@
}
});
}
</script>
<%= render :partial => 'main/find' %>
</script>

View file

@ -4,28 +4,32 @@
*/
$('#new_synapse').fadeOut('fast');
$('#synapse_desc').attr('value','');
$('.ui-autocomplete.ui-widget').fadeOut('fast');
$('#synapse_desc').autocomplete('disable');
$('#synapse_topic1id').attr('value','0');
$('#synapse_topic2id').attr('value','0');
// reset the draw synapse positions to false
MetamapsModel.synapseStartCoord = false;
MetamapsModel.synapseEndCoord = false;
var temp1, temp2, temp;
if ( Mconsole != null) {
temp1 = Mconsole.graph.getNode(<%= @synapse.topic1.id %>);
temp2 = Mconsole.graph.getNode(<%= @synapse.topic2.id %>);
temp2.setData('dim', 25, 'current');
Mconsole.graph.addAdjacence(temp1, temp2, {});
temp = Mconsole.graph.getAdjacence(temp1.id, temp2.id);
temp.setDataset('start', {
lineWidth: 0.4
lineWidth: 0.4,
alpha: 0.1
});
temp.setDataset('end', {
lineWidth: 2
lineWidth: 2,
alpha: 1
});
var d = new Array(<%= @synapse.node1_id.to_s() %>, <%= @synapse.node2_id.to_s() %>);
temp.setDataset('current', {
desc: '<%= @synapse.desc %>',
showDesc: false, //will be changed by selectEdge
showDesc: true, //will be changed by selectEdge
category: '<%= @synapse.category %>',
id: '<%= @synapse.id %>',
userid: '<%= @synapse.user.id %>',
@ -33,8 +37,16 @@ if ( Mconsole != null) {
permission: '<%= @synapse.permission %>'
});
temp.data.$direction = d;
Mconsole.fx.plotLine(temp, Mconsole.canvas);
selectEdge(temp);
Mconsole.fx.animate({
modes: ['edge-property:lineWidth:alpha'],
duration: 100,
onComplete: function() {
setTimeout(function (){
temp.setData('showDesc', false);
Mconsole.plot();
}, 3000);
}
});
}
else {
json = <%= @synapse.selfplusnodes_as_json.html_safe %>

View file

@ -13,7 +13,7 @@
<img class="cloudcarousel" width="40" height="40" src="/assets/<%= metacode.icon %>" alt="<%= metacode.name %>" title="<%= metacode.name %>"/>
<% end %>
</div>
<%= form.autocomplete_field :name, autocomplete_topic_name_topics_path, :placeholder => "What is the name of your topic?" %>
<%= form.text_field :name, :placeholder => "title..." %>
<%= form.hidden_field :metacode, :value => "Action" %>
<%= form.hidden_field :x, :value => 0 %>
<%= form.hidden_field :y, :value => 0 %>

View file

@ -2,10 +2,8 @@
* @file
* This javascript is returned and executed when you create a new node.
*/
$('#topic_name').autocomplete('disable');
$('.ui-autocomplete.ui-widget').fadeOut('fast');
$('#new_topic').fadeOut('fast');
$('#topic_name').attr('value','');
$('#topic_name').typeahead('setQuery','');
$('#topic_grabTopic').attr('value','null');
$('#topic_addSynapse').attr('value','false');
@ -52,7 +50,6 @@ if (!$.isEmptyObject(Mconsole.graph.nodes)) {
if ( '<%= @synapse %>' == "true" ) {
$('#synapse_topic1id').val(tempNode.id);
$('#synapse_topic2id').val(temp.id);
$('#synapse_desc').autocomplete('enable');
$('#synapse_desc').val("");
$('#new_synapse').fadeIn('fast');
$('#synapse_desc').focus();
@ -60,7 +57,10 @@ if (!$.isEmptyObject(Mconsole.graph.nodes)) {
modes: ['node-property:dim'],
duration: 500,
onComplete: function() {
renderMidArrow({ x: tempNode.pos.getc().x, y: tempNode.pos.getc().y }, { x: temp.pos.getc().x, y: temp.pos.getc().y }, 13, false, Mconsole.canvas);
setTimeout(function (){
temp.setData('dim', 25, 'current');
Mconsole.plot();
}, 3000);
Mconsole.fx.plotNode(tempNode, Mconsole.canvas);
Mconsole.fx.plotNode(temp, Mconsole.canvas);
tempNode = null;
@ -74,7 +74,10 @@ if (!$.isEmptyObject(Mconsole.graph.nodes)) {
modes: ['node-property:dim'],
duration: 500,
onComplete: function() {
selectNode(temp);
setTimeout(function (){
temp.setData('dim', 25, 'current');
Mconsole.plot();
}, 3000);
}
});
@ -103,7 +106,10 @@ if (!$.isEmptyObject(Mconsole.graph.nodes)) {
modes: ['node-property:dim'],
duration: 500,
onComplete: function() {
selectNode(temp);
setTimeout(function (){
temp.setData('dim', 25, 'current');
Mconsole.plot();
}, 3000);
}
});
}

View file

@ -25,9 +25,13 @@
</div>
<div class="clearfloat"></div>
<h1 class="index">
Viewing Topic: <%= @topic.name %>
</h1>
<div class="index">
<div class="openCheatsheet"></div>
<span><img width="35" height="35" src="/assets/<%= @topic.metacode.icon %>"></span>
<span class="mapName"><%= @topic.name %></span>
<span class="mapInfo"></span>
<div class="clearfloat"></div>
</div>
<div class="relatives" id="container">
<div id="center-container">
@ -40,7 +44,7 @@
<script>
json = <%= @relatives %>;
console.log(json);
$(document).ready(function() {
$(window).load(function() {
initialize("centered");
});
</script>

View file

@ -5,6 +5,8 @@
#%>
<% content_for :title, @user.name + "'s Settings | Metamaps" %>
<h1 class="index">Your Settings</h1>
<%= formula_form_for @user, url: user_url do |form| %>
<h3>Choose Active Metacodes</h3>

View file

@ -1,4 +1,4 @@
<h1 class="index">Password Reset</h1>
<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %>
<%= devise_error_messages! %>
@ -10,7 +10,6 @@
<div><%= f.submit "Send me reset password instructions" %></div>
<%= render "devise/shared/links" %>
<% end %>

View file

@ -1,7 +1,9 @@
<h1 class="index">Sign Up</h1>
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
<%= devise_error_messages! %>
<h3>Sign up</h3>
<h3>Sign Up</h3>
<div><%= f.label :name %>
<%= f.text_field :name, :autofocus => true %></div>
@ -20,7 +22,7 @@
<div><%= f.submit "Sign up" %></div>
<%= render "devise/shared/links" %>
<div>Don't have an access code? <a href="/request">Request an Invite</a></div>
<% end %>

View file

@ -1,4 +1,4 @@
<h1 class="index">Sign In</h1>
<%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
<h3>Sign in</h3>
@ -10,12 +10,15 @@
<%= f.password_field :password %></div>
<% if devise_mapping.rememberable? -%>
<div><%= f.check_box :remember_me %> <%= f.label :remember_me %></div>
<div><%= f.check_box :remember_me %> <%= f.label :remember_me %><div class="clearfloat"></div></div>
<% end -%>
<div><%= f.submit "Sign in" %></div>
<%= render "devise/shared/links" %>
<%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
<% end -%>
<div>Don't have an account? <a href="/request">Request an Invite</a></div>
<% end %>

View file

@ -1,40 +0,0 @@
<%#
# @file
# User profile page
# TODO: What URL?
# TODO: Is this code used?
#%>
<% content_for :title, @user.name + "'s Profile | Metamaps" %>
<div class="profile">
<h2>Recently Created Topics <%= link_to "see all", user_topics_path(@user)%></h2>
<div class="centeredProfile">
<% @topics.each do |topic| %>
<%= render topic %>
<% end %>
</div>
<div class="clearfloat"></div>
<h2>Recently Created Synapses <%= link_to "see all", user_synapses_path(@user)%></h2>
<div class="centeredProfile">
<% @synapses.each do |synapse| %>
<%= render synapse %>
<% end %>
</div>
<div class="clearfloat"></div>
<h2>Recently Created Maps <%= link_to "see all", user_maps_path(@user)%></h2>
<div class="centeredProfile">
<% @maps.each do |map| %>
<%= render map %>
<% end %>
</div>
<div class="clearfloat leaveSpace"></div>
</div>
<h1 class="index">
Viewing Mapper: <%= @user.name %>
</h1>

View file

@ -2,20 +2,20 @@ ISSAD::Application.routes.draw do
root to: 'main#home', via: :get
match 'console', to: 'main#console', via: :get, as: :console
match 'request', to: 'main#requestinvite', via: :get, as: :request
match 'invite', to: 'main#invite', via: :get, as: :invite
match 'search', to: 'main#search', via: :get, as: :search
match '/search/topics', to: 'main#searchtopics', via: :get, as: :searchtopics
match '/search/maps', to: 'main#searchmaps', via: :get, as: :searchmaps
match '/search/mappers', to: 'main#searchmappers', via: :get, as: :searchmappers
match 'maps/:id/savelayout', to: 'maps#savelayout', via: :put, as: :savelayout
match 'topics/:map_id/:topic_id/removefrommap', to: 'topics#removefrommap', via: :post, as: :removefrommap
match 'synapses/:map_id/:synapse_id/removefrommap', to: 'synapses#removefrommap', via: :post, as: :removefrommap
resources :topics do
get :autocomplete_topic_name, :on => :collection
get :autocomplete_topic, :on => :collection
end
match 'topics/:id/:format', to: 'topics#json', via: :get, as: :json
@ -31,7 +31,11 @@ ISSAD::Application.routes.draw do
match 'maps/:id/:format', to: 'maps#json', via: :get, as: :json
devise_for :users, :path_names => { :sign_in => 'login', :sign_out => 'logout' }
resources :users do
devise_scope :user do
get "sign_out", :to => "devise/sessions#destroy"
end
resources :users, except: :show do
get :autocomplete_user_name, :on => :collection
resources :topics, :only => [:index]
resources :synapses, :only => [:index]
@ -40,60 +44,4 @@ ISSAD::Application.routes.draw do
resources :mappings
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Sample resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Sample resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Sample resource route with more complex sub-resources
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', :on => :collection
# end
# end
# Sample resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
# root :to => 'welcome#index'
# See how all your routes lay out with "rake routes"
# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
# match ':controller(/:action(/:id))(.:format)'
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 269 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 269 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 919 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 919 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 471 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 471 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 772 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 772 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 725 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 725 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,008 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,008 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Some files were not shown because too many files have changed in this diff Show more