This commit is contained in:
Bashar Jabbour 2014-10-07 14:47:18 -04:00
commit e3c677fa5b
25 changed files with 639 additions and 526 deletions

View file

@ -37,7 +37,7 @@ Driessen][git-branching-model]. Here's an overview:
Metamaps developers should be basing their work on. The `master` branch is not guaranteed to be stable. Metamaps developers should be basing their work on. The `master` branch is not guaranteed to be stable.
* All commits intended for `master` should take place on your own personal * All commits intended for `master` should take place on your own personal
fork, and be submitted via pull request when ready. fork, and be submitted via pull request when ready.
* Only maintainers can accept pull requests from forks into the core Famo.us * Only maintainers can accept pull requests from forks into the core Metamaps.cc
repository. repository.
* Please squash your commits into a single commit before making a pull request. * Please squash your commits into a single commit before making a pull request.
@ -68,10 +68,11 @@ TODO
### Branch grouping tokens ### Branch grouping tokens
All pull requests submitted to Famo.us should occur on a new branch. For these All pull requests submitted to Metamaps.cc should occur on a new branch. For these
branches, we at metamaps use a short token indicating the nature of the branch in branches, we at metamaps use a short token indicating the nature of the branch in
question followed by a solidus (`/`) and a kebab-cased string describing the question followed by a solidus (`/`) and a kebab-cased string describing the
branch. We are using the following tokens: branch. We are using the following tokens:
**NOTE: Not sure the above is right, but also not sure what to change it to **
bug // bug fixes bug // bug fixes
wip // work in progress wip // work in progress

View file

@ -19,7 +19,7 @@ gem 'json'
gem 'rails3-jquery-autocomplete' gem 'rails3-jquery-autocomplete'
gem 'best_in_place' gem 'best_in_place'
gem 'kaminari' # pagination gem 'kaminari' # pagination
gem 'uservoice-ruby'
gem 'paperclip' gem 'paperclip'
gem 'aws-sdk' gem 'aws-sdk'

View file

@ -58,6 +58,7 @@ GEM
warden (~> 1.2.3) warden (~> 1.2.3)
erubis (2.7.0) erubis (2.7.0)
execjs (2.0.2) execjs (2.0.2)
ezcrypto (0.7.2)
formtastic (2.2.1) formtastic (2.2.1)
actionpack (>= 3.0) actionpack (>= 3.0)
formula (1.0.1) formula (1.0.1)
@ -84,6 +85,7 @@ GEM
mini_portile (= 0.6.0) mini_portile (= 0.6.0)
nokogiri (1.6.2.1-x86-mingw32) nokogiri (1.6.2.1-x86-mingw32)
mini_portile (= 0.6.0) mini_portile (= 0.6.0)
oauth (0.4.7)
orm_adapter (0.5.0) orm_adapter (0.5.0)
paperclip (4.1.1) paperclip (4.1.1)
activemodel (>= 3.0.0) activemodel (>= 3.0.0)
@ -141,6 +143,10 @@ GEM
uglifier (2.5.0) uglifier (2.5.0)
execjs (>= 0.3.0) execjs (>= 0.3.0)
json (>= 1.8.0) json (>= 1.8.0)
uservoice-ruby (0.0.11)
ezcrypto (>= 0.7.2)
json (>= 1.7.5)
oauth (>= 0.4.7)
warden (1.2.3) warden (1.2.3)
rack (>= 1.0) rack (>= 1.0)
@ -167,3 +173,4 @@ DEPENDENCIES
redis (= 2.2.2) redis (= 2.2.2)
sass-rails sass-rails
uglifier (>= 1.0.3) uglifier (>= 1.0.3)
uservoice-ruby

View file

@ -3,7 +3,7 @@ if(BAROMETER == undefined) {
BAROMETER = {}; BAROMETER = {};
} }
BAROMETER.load = function(barometer_id) { //BAROMETER.load = function(barometer_id) {
this.barometer_id = barometer_id; this.barometer_id = barometer_id;
this.empty_url = "http://getbarometer.s3.amazonaws.com/assets/barometer/images/transparent.gif"; this.empty_url = "http://getbarometer.s3.amazonaws.com/assets/barometer/images/transparent.gif";
this.feedback_url = 'http://getbarometer.com/system/feedback_form/' + this.barometer_id; this.feedback_url = 'http://getbarometer.com/system/feedback_form/' + this.barometer_id;

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -0,0 +1,49 @@
var USERVOICE;
if(USERVOICE == undefined) {
USERVOICE = {};
}
USERVOICE.load = function (barometer_id) {
// Include the UserVoice JavaScript SDK (only needed once on a page)
UserVoice=window.UserVoice||[];(function(){var uv=document.createElement('script');uv.type='text/javascript';uv.async=true;uv.src='//widget.uservoice.com/wybK0nSMNuhlWkIKzTyWg.js';var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(uv,s)})();
//
// UserVoice Javascript SDK developer documentation:
// https://www.uservoice.com/o/javascript-sdk
//
// Set colors
UserVoice.push(['set', {
accent_color: '#448dd6',
trigger_color: 'white',
trigger_background_color: 'rgba(46, 49, 51, 0.6)'
}]);
// Identify the user and pass traits
// To enable, replace sample data with actual user traits and uncomment the line
//TODO NEED HELP HERE MAKING SURE CORRECT USER DATA GETS PUSHED
UserVoice.push(['identify', {
//email: 'getElementsByTagName(userid)', // Users email address
name: "userid", // Users real name
//created_at: 1364406966, // Unix timestamp for the date the user signed up
id: "Metamaps.Active.Mapper.id", // Optional: Unique id of the user (if set, this should not change)
//type: 'Owner', // Optional: segment your users by type
//account: {
// id: 123, // Optional: associate multiple users with a single account
// name: 'Acme, Co.', // Account name
// created_at: 1364406966, // Unix timestamp for the date the account was created
// monthly_rate: 9.99, // Decimal; monthly rate of the account
// ltv: 1495.00, // Decimal; lifetime value of the account
// plan: 'Enhanced' // Plan name for the account
//}
}]);
// Add default trigger to the bottom-right corner of the window:
UserVoice.push(['addTrigger', { mode: 'contact', trigger_position: 'bottom-left' }]);
// Or, use your own custom trigger:
//UserVoice.push(['addTrigger', '#barometer_tab', { mode: 'contact' }]);
// Autoprompt for Satisfaction and SmartVote (only displayed under certain conditions)
UserVoice.push(['autoprompt', {}]);
};

View file

@ -8405,7 +8405,11 @@ $jit.RGraph = new Class( {
*/ */
refresh: function(){ refresh: function(){
this.compute();
// START METAMAPS CODE
// this.compute();
// END METAMAPS CODE
// ORIGINAL CODE: this.compute();
this.plot(); this.plot();
}, },
@ -9119,7 +9123,10 @@ $jit.ForceDirected = new Class( {
Computes positions and plots the tree. Computes positions and plots the tree.
*/ */
refresh: function() { refresh: function() {
this.compute(); // START METAMAPS CODE
// this.compute();
// END METAMAPS CODE
// ORIGINAL CODE: this.compute();
this.plot(); this.plot();
}, },

View file

@ -373,29 +373,7 @@ Metamaps.GlobalUI.Search = {
self.close(0, true); self.close(0, true);
} }
break; break;
case 65:
case 97:
if (e.ctrlKey){
Metamaps.Control.deselectAllNodes();
Metamaps.Control.deselectAllEdges();
e.preventDefault();
Metamaps.Visualize.mGraph.graph.eachNode(function (n) {
Metamaps.Control.selectNode(n,e);
});
Metamaps.Visualize.mGraph.plot();
}
break;
case 69:
case 101:
if (e.ctrlKey){
e.preventDefault();
Metamaps.JIT.zoomExtents();
}
break;
default: default:
break; //console.log(e.which); break; //console.log(e.which);
} }
@ -424,7 +402,6 @@ Metamaps.GlobalUI.Search = {
padding: '7px 10px 3px 10px', padding: '7px 10px 3px 10px',
width: '380px' width: '380px'
}); });
$('.sidebarSearchField').focus();
self.changing = false; self.changing = false;
self.isOpen = true; self.isOpen = true;
}); });
@ -451,11 +428,6 @@ Metamaps.GlobalUI.Search = {
}); });
} }
}, closeAfter); }, closeAfter);
/*if (self.locked) {
$('.sidebarSearchField').typeahead('setQuery', '');
$('.sidebarSearchField').blur();
}*/
}, },
startTypeahead: function () { startTypeahead: function () {
var self = Metamaps.GlobalUI.Search; var self = Metamaps.GlobalUI.Search;

View file

@ -97,7 +97,20 @@ Metamaps.JIT = {
var pos = adj.nodeFrom.pos.getc(true); var pos = adj.nodeFrom.pos.getc(true);
var posChild = adj.nodeTo.pos.getc(true); var posChild = adj.nodeTo.pos.getc(true);
var synapse = adj.getData("synapses")[0]; // for now, just grab the first synapse var synapse;
if(adj.getData("displayIndex")) {
synapse = adj.getData("synapses")[adj.getData("displayIndex")];
if (!synapse) {
delete adj.data.$displayIndex;
synapse = adj.getData("synapses")[0];
}
}
else {
synapse = adj.getData("synapses")[0];
}
if (!synapse) return; // this means there are no corresponding synapses for
// this edge, don't render it
var directionCat = synapse.get("category"); var directionCat = synapse.get("category");
@ -568,7 +581,12 @@ Metamaps.JIT = {
levelDistance: 200 levelDistance: 200
}, },
onMouseEnter: function (edge) { onMouseEnter: function (edge) {
if (edge.getData('alpha') === 0) return; // don't do anything if the edge is filtered var filtered = edge.getData('alpha') === 0;
// don't do anything if the edge is filtered
// or if the canvas is animating
if (filtered || Metamaps.Visualize.mGraph.busy) return;
$('canvas').css('cursor', 'pointer'); $('canvas').css('cursor', 'pointer');
var edgeIsSelected = Metamaps.Selected.Edges.indexOf(edge); var edgeIsSelected = Metamaps.Selected.Edges.indexOf(edge);
//following if statement only executes if the edge being hovered over is not selected //following if statement only executes if the edge being hovered over is not selected
@ -1089,17 +1107,22 @@ Metamaps.JIT = {
} }
//The test synapse was selected! //The test synapse was selected!
// make sure the edge hasn't been hidden from the page
var node1id = synapse.get('edge').nodeFrom.id;
var node2id = synapse.get('edge').nodeTo.id;
var edge = Metamaps.Visualize.mGraph.graph.getAdjacence(node1id, node2id);
if(selectTest){ if(selectTest){
if(e.ctrlKey){ if(e.ctrlKey){
if(Metamaps.Selected.Edges.indexOf(synapse.get('edge')) != -1 ){ if(Metamaps.Selected.Edges.indexOf(synapse.get('edge')) != -1 ){
Metamaps.Control.deselectEdge(synapse.get('edge')); Metamaps.Control.deselectEdge(synapse.get('edge'));
} }
else{ else{
Metamaps.Control.selectEdge(synapse.get('edge')); if (edge) Metamaps.Control.selectEdge(synapse.get('edge'));
} }
} }
else{ else{
Metamaps.Control.selectEdge(synapse.get('edge')); if (edge) Metamaps.Control.selectEdge(synapse.get('edge'));
} }
} }
}); });
@ -1227,24 +1250,14 @@ Metamaps.JIT = {
top: e.clientY top: e.clientY
}); });
//add the menu to the page //add the menu to the page
$('#infovis-canvaswidget').append(rightclickmenu); $('#wrapper').append(rightclickmenu);
// attach events to clicks on the list items // attach events to clicks on the list items
// delete the selected things from the database // delete the selected things from the database
$('.rc-delete').click(function () { $('.rc-delete').click(function () {
$('.rightclickmenu').remove(); $('.rightclickmenu').remove();
var n = Metamaps.Selected.Nodes.length; Metamaps.Control.deleteSelected();
var e = Metamaps.Selected.Edges.length;
var ntext = n == 1 ? "1 topic" : n + " topics";
var etext = e == 1 ? "1 synapse" : e + " synapses";
var text = "You have " + ntext + " and " + etext + " selected. ";
var r = confirm(text + "Are you sure you want to permanently delete them all? This will remove them from all maps they appear on.");
if (r == true) {
Metamaps.Control.deleteSelectedEdges();
Metamaps.Control.deleteSelectedNodes();
}
}); });
// remove the selected things from the map // remove the selected things from the map
@ -1259,12 +1272,12 @@ Metamaps.JIT = {
$('.rightclickmenu').remove(); $('.rightclickmenu').remove();
Metamaps.Control.hideSelectedEdges(); Metamaps.Control.hideSelectedEdges();
Metamaps.Control.hideSelectedNodes(); Metamaps.Control.hideSelectedNodes();
}); });
// when in radial, center on the topic you picked // when in radial, center on the topic you picked
$('.rc-center').click(function () { $('.rc-center').click(function () {
$('.rightclickmenu').remove(); $('.rightclickmenu').remove();
centerOn(node.id); Metamaps.Topic.centerOn(node.id);
}); });
// open the entity in a new tab // open the entity in a new tab
@ -1282,7 +1295,7 @@ Metamaps.JIT = {
}); });
// change the metacode of all the selected nodes that you have edit permission for // change the metacode of all the selected nodes that you have edit permission for
$('.rc-metacode li').click(function () { $('.rc-metacode li li').click(function () {
$('.rightclickmenu').remove(); $('.rightclickmenu').remove();
// //
Metamaps.Control.updateSelectedMetacodes($(this).attr('data-id')); Metamaps.Control.updateSelectedMetacodes($(this).attr('data-id'));
@ -1378,17 +1391,7 @@ Metamaps.JIT = {
// delete the selected things from the database // delete the selected things from the database
$('.rc-delete').click(function () { $('.rc-delete').click(function () {
$('.rightclickmenu').remove(); $('.rightclickmenu').remove();
var n = Metamaps.Selected.Nodes.length; Metamaps.Control.deleteSelected();
var e = Metamaps.Selected.Edges.length;
var ntext = n == 1 ? "1 topic" : n + " topics";
var etext = e == 1 ? "1 synapse" : e + " synapses";
var text = "You have " + ntext + " and " + etext + " selected. ";
var r = confirm(text + "Are you sure you want to permanently delete them all? This will remove them from all maps they appear on.");
if (r == true) {
Metamaps.Control.deleteSelectedEdges();
Metamaps.Control.deleteSelectedNodes();
}
}); });
// remove the selected things from the map // remove the selected things from the map
@ -1644,6 +1647,11 @@ Metamaps.JIT = {
var ratioX = spanX / width; var ratioX = spanX / width;
var ratioY = spanY / height; var ratioY = spanY / height;
var cogX = (maxX + minX)/2;
var cogY = (maxY + minY)/2;
canvas.translate(-1* cogX, -1* cogY);
var newRatio = Math.max(ratioX,ratioY); var newRatio = Math.max(ratioX,ratioY);
var scaleMultiplier = 1/newRatio*0.9; var scaleMultiplier = 1/newRatio*0.9;
@ -1659,43 +1667,6 @@ Metamaps.JIT = {
canvas.scale(scaleMultiplier,scaleMultiplier); canvas.scale(scaleMultiplier,scaleMultiplier);
} }
counter = 0;
nodes.forEach(function (n) {
var x = n.pos.x,
y = n.pos.y;
if (counter == 0){
maxX = x;
minX = x;
maxY = y;
minY = y;
}
var arrayOfLabelLines = Metamaps.Util.splitLine(n.name, 30).split('\n'),
dim = n.getData('dim'),
ctx = canvas.getCtx();
var height = 25 * arrayOfLabelLines.length;
var index, lineWidths = [];
for (index = 0; index < arrayOfLabelLines.length; ++index) {
lineWidths.push(ctx.measureText(arrayOfLabelLines[index]).width)
}
var width = Math.max.apply(null, lineWidths) + 8;
maxX = Math.max(x + width /2,maxX);
maxY = Math.max(y + n.getData("height") + 5 + height,maxY);
minX = Math.min(x - width /2,minX);
minY = Math.min(y - dim,minY);
counter++;
});
var cogX = (maxX + minX)/2;
var cogY = (maxY + minY)/2;
canvas.translate(-1* cogX, -1* cogY);
$(document).trigger(Metamaps.JIT.events.zoom, [event]); $(document).trigger(Metamaps.JIT.events.zoom, [event]);
} }
else if(nodes.length == 1){ else if(nodes.length == 1){

View file

@ -27,7 +27,7 @@ Metamaps.Settings = {
background: '#344A58', background: '#344A58',
synapses: { synapses: {
normal: '#888888', normal: '#888888',
hover: '#222222', hover: '#888888',
selected: '#FFFFFF' selected: '#FFFFFF'
}, },
topics: { topics: {
@ -40,6 +40,7 @@ Metamaps.Settings = {
} }
}; };
Metamaps.Touch = { Metamaps.Touch = {
touchPos: null, // this stores the x and y values of a current touch event touchPos: null, // this stores the x and y values of a current touch event
touchDragNode: null // this stores a reference to a JIT node that is being dragged touchDragNode: null // this stores a reference to a JIT node that is being dragged
@ -61,6 +62,12 @@ Metamaps.Mouse = {
}; };
Metamaps.Selected = { Metamaps.Selected = {
reset: function () {
var self = Metamaps.Selected;
self.Nodes = [];
self.edges = [];
},
Nodes: [], Nodes: [],
Edges: [] Edges: []
}; };
@ -697,7 +704,7 @@ Metamaps.TopicCard = {
var setMapperImage = function (mapper) { var setMapperImage = function (mapper) {
$('.contributorIcon').attr('src', mapper.get('image')); $('.contributorIcon').attr('src', mapper.get('image'));
}; };
Metamaps.Mapper.get(topic.get('user_id'), setMapperImage) Metamaps.Mapper.get(topic.get('user_id'), setMapperImage);
// starting embed.ly // starting embed.ly
var resetFunc = function () { var resetFunc = function () {
@ -975,11 +982,13 @@ Metamaps.SynapseCard = {
//so label is missing while editing //so label is missing while editing
Metamaps.Control.deselectEdge(edge); Metamaps.Control.deselectEdge(edge);
var synapse = edge.getData('synapses')[0]; // for now, just get the first synapse var index = edge.getData("displayIndex") ? edge.getData("displayIndex") : 0;
var synapse = edge.getData('synapses')[index]; // for now, just get the first synapse
//create the wrapper around the form elements, including permissions //create the wrapper around the form elements, including permissions
//classes to make best_in_place happy //classes to make best_in_place happy
var edit_div = document.createElement('div'); var edit_div = document.createElement('div');
edit_div.innerHTML = '<div id="editSynUpperBar"></div><div id="editSynLowerBar"></div>';
edit_div.setAttribute('id', 'edit_synapse'); edit_div.setAttribute('id', 'edit_synapse');
if (synapse.authorizeToEdit(Metamaps.Active.Mapper)) { if (synapse.authorizeToEdit(Metamaps.Active.Mapper)) {
edit_div.className = 'permission canEdit'; edit_div.className = 'permission canEdit';
@ -987,9 +996,9 @@ Metamaps.SynapseCard = {
} else { } else {
edit_div.className = 'permission cannotEdit'; edit_div.className = 'permission cannotEdit';
} }
$('.main .wrapper').append(edit_div); $('#wrapper').append(edit_div);
self.populateShowCard(synapse); self.populateShowCard(edge, synapse);
//drop it in the right spot, activate it //drop it in the right spot, activate it
$('#edit_synapse').css('position', 'absolute'); $('#edit_synapse').css('position', 'absolute');
@ -1004,7 +1013,7 @@ Metamaps.SynapseCard = {
//$('#edit_synapse_name input').focus(); //$('#edit_synapse_name input').focus();
$('#edit_synapse').show(); $('#edit_synapse').show();
self.openSynapseCard = synapse.isNew() ? synapse.cid : synapse.id; self.openSynapseCard = edge;
}, },
hideCard: function () { hideCard: function () {
@ -1012,39 +1021,43 @@ Metamaps.SynapseCard = {
Metamaps.SynapseCard.openSynapseCard = null; Metamaps.SynapseCard.openSynapseCard = null;
}, },
populateShowCard: function (synapse) { populateShowCard: function (edge, synapse) {
var self = Metamaps.SynapseCard; var self = Metamaps.SynapseCard;
self.add_name_form(synapse); self.add_synapse_count(edge);
self.add_desc_form(synapse);
self.add_drop_down(edge, synapse);
self.add_user_info(synapse); self.add_user_info(synapse);
self.add_perms_form(synapse); self.add_perms_form(synapse);
if (synapse.authorizeToEdit(Metamaps.Active.Mapper)) { self.add_direction_form(synapse);
self.add_direction_form(synapse);
}
}, },
add_synapse_count: function (edge) {
var count = edge.getData("synapses").length;
add_name_form: function (synapse) { $('#editSynUpperBar').append('<div id="synapseCardCount">' + count + '</div>')
},
add_desc_form: function (synapse) {
var data_nil = 'Click to add description.'; var data_nil = 'Click to add description.';
// TODO make it so that this would work even in sandbox mode, // TODO make it so that this would work even in sandbox mode,
// currently with Best_in_place it won't // currently with Best_in_place it won't
//name editing form //desc editing form
$('#edit_synapse').append('<div id="edit_synapse_name"></div>'); $('#editSynUpperBar').append('<div id="edit_synapse_desc"></div>');
$('#edit_synapse_name').attr('class', 'best_in_place best_in_place_desc'); $('#edit_synapse_desc').attr('class', 'best_in_place best_in_place_desc');
$('#edit_synapse_name').attr('data-object', 'synapse'); $('#edit_synapse_desc').attr('data-object', 'synapse');
$('#edit_synapse_name').attr('data-attribute', 'desc'); $('#edit_synapse_desc').attr('data-attribute', 'desc');
$('#edit_synapse_name').attr('data-type', 'textarea'); $('#edit_synapse_desc').attr('data-type', 'textarea');
$('#edit_synapse_name').attr('data-nil', data_nil); $('#edit_synapse_desc').attr('data-nil', data_nil);
$('#edit_synapse_name').attr('data-url', '/synapses/' + synapse.id); $('#edit_synapse_desc').attr('data-url', '/synapses/' + synapse.id);
$('#edit_synapse_name').html(synapse.get("desc")); $('#edit_synapse_desc').html(synapse.get("desc"));
//if edge data is blank or just whitespace, populate it with data_nil //if edge data is blank or just whitespace, populate it with data_nil
if ($('#edit_synapse_name').html().trim() == '') { if ($('#edit_synapse_desc').html().trim() == '') {
$('#edit_synapse_name').html(data_nil); $('#edit_synapse_desc').html(data_nil);
} }
$('#edit_synapse_name').bind("ajax:success", function () { $('#edit_synapse_desc').bind("ajax:success", function () {
var desc = $(this).html(); var desc = $(this).html();
if (desc == data_nil) { if (desc == data_nil) {
synapse.set("desc", ''); synapse.set("desc", '');
@ -1055,16 +1068,64 @@ Metamaps.SynapseCard = {
Metamaps.Visualize.mGraph.plot(); Metamaps.Visualize.mGraph.plot();
}); });
}, },
add_drop_down: function (edge, synapse) {
var list, i, synapses, l;
synapses = edge.getData("synapses");
l = synapses.length;
if (l > 1) {
// append the element that you click to show dropdown select
$('#editSynUpperBar').append('<div id="dropdownSynapses"></div>');
$('#dropdownSynapses').click(function(e){
e.preventDefault();
e.stopPropagation(); // stop it from immediately closing it again
$('#switchSynapseList').toggle();
});
// hide the dropdown again if you click anywhere else on the synapse card
$('#edit_synapse').click(function(){
$('#switchSynapseList').hide();
});
// generate the list of other synapses
list = '<ul id="switchSynapseList">';
for (i = 0; i < l; i++) {
if (synapses[i] !== synapse) { // don't add the current one to the list
list += '<li data-synapse-index="' + i + '">' + synapses[i].get('desc') + '</li>';
}
}
list += '</ul>'
// add the list of the other synapses
$('#editSynLowerBar').append(list);
// attach click listeners to list items that
// will cause it to switch the displayed synapse
// when you click it
$('#switchSynapseList li').click(function(e){
e.stopPropagation();
var index = parseInt($(this).attr('data-synapse-index'));
edge.setData('displayIndex', index);
Metamaps.Visualize.mGraph.plot();
Metamaps.SynapseCard.showCard(edge, false);
});
}
},
add_user_info: function (synapse) { add_user_info: function (synapse) {
var u = '<div id="edgeUser" class="hoverForTip">'; var u = '<div id="edgeUser" class="hoverForTip">';
u += '<img src="" width="24" height="24" />'
u += '<div class="tip">Created by ' + synapse.get("user_name") + '</div></div>'; u += '<div class="tip">Created by ' + synapse.get("user_name") + '</div></div>';
$('#edit_synapse').append(u); $('#editSynLowerBar').append(u);
// get mapper image
var setMapperImage = function (mapper) {
$('#edgeUser img').attr('src', mapper.get('image'));
};
Metamaps.Mapper.get(synapse.get('user_id'), setMapperImage);
}, },
add_perms_form: function (synapse) { add_perms_form: function (synapse) {
//permissions - if owner, also allow permission editing //permissions - if owner, also allow permission editing
$('#edit_synapse').append('<div class="mapPerm ' + synapse.get("permission").substring(0, 2) + '"></div>'); $('#editSynLowerBar').append('<div class="mapPerm ' + synapse.get("permission").substring(0, 2) + '"></div>');
// ability to change permission // ability to change permission
var selectingPermission = false; var selectingPermission = false;
@ -1101,10 +1162,8 @@ Metamaps.SynapseCard = {
add_direction_form: function (synapse) { add_direction_form: function (synapse) {
//directionality checkboxes //directionality checkboxes
$('#edit_synapse').append('<input type="checkbox" id="edit_synapse_left">'); $('#editSynLowerBar').append('<div id="edit_synapse_left"></div>');
$('#edit_synapse').append('<label class="left">&lt;</label>'); $('#editSynLowerBar').append('<div id="edit_synapse_right"></div>');
$('#edit_synapse').append('<input type="checkbox" id="edit_synapse_right">');
$('#edit_synapse').append('<label class="right">&gt;</label>');
var edge = synapse.get('edge'); var edge = synapse.get('edge');
@ -1113,11 +1172,11 @@ Metamaps.SynapseCard = {
if (edge.nodeFrom.pos.x < edge.nodeTo.pos.x || if (edge.nodeFrom.pos.x < edge.nodeTo.pos.x ||
edge.nodeFrom.pos.x == edge.nodeTo.pos.x && edge.nodeFrom.pos.x == edge.nodeTo.pos.x &&
edge.nodeFrom.pos.y < edge.nodeTo.pos.y) { edge.nodeFrom.pos.y < edge.nodeTo.pos.y) {
var left = edge.nodeTo; var left = edge.nodeTo.getData("topic");
var right = edge.nodeFrom; var right = edge.nodeFrom.getData("topic");
} else { } else {
var left = edge.nodeFrom; var left = edge.nodeFrom.getData("topic");
var right = edge.nodeTo; var right = edge.nodeTo.getData("topic");
} }
/* /*
@ -1128,42 +1187,48 @@ Metamaps.SynapseCard = {
var directionCat = synapse.get('category'); //both, none, from-to var directionCat = synapse.get('category'); //both, none, from-to
if (directionCat == 'from-to') { if (directionCat == 'from-to') {
var from_to = synapse.getDirection(); var from_to = [synapse.get("node1_id"), synapse.get("node2_id")];
if (from_to[0] == left.id) { if (from_to[0] == left.id) {
//check left checkbox //check left checkbox
$('#edit_synapse_left').prop('checked', true); $('#edit_synapse_left').addClass('checked');
} else { } else {
//check right checkbox //check right checkbox
$('#edit_synapse_right').prop('checked', true); $('#edit_synapse_right').addClass('checked');
} }
} else if (directionCat == 'both') { } else if (directionCat == 'both') {
//check both checkboxes //check both checkboxes
$('#edit_synapse_left').prop('checked', true); $('#edit_synapse_left').addClass('checked');
$('#edit_synapse_right').prop('checked', true); $('#edit_synapse_right').addClass('checked');
} }
$('#edit_synapse_left, #edit_synapse_right').click(function () {
var leftChecked = $('#edit_synapse_left').is(':checked');
var rightChecked = $('#edit_synapse_right').is(':checked');
var dir = synapse.getDirection(); if (synapse.authorizeToEdit(Metamaps.Active.Mapper)) {
var dirCat = 'none'; $('#edit_synapse_left, #edit_synapse_right').click(function () {
if (leftChecked && rightChecked) {
dirCat = 'both'; $(this).toggleClass('checked');
} else if (!leftChecked && rightChecked) {
dirCat = 'from-to';
dir = [right.id, left.id];
} else if (leftChecked && !rightChecked) {
dirCat = 'from-to';
dir = [left.id, right.id];
}
synapse.save({ var leftChecked = $('#edit_synapse_left').is('.checked');
category: dirCat, var rightChecked = $('#edit_synapse_right').is('.checked');
node1_id: dir[0],
node2_id: dir[1] var dir = synapse.getDirection();
var dirCat = 'none';
if (leftChecked && rightChecked) {
dirCat = 'both';
} else if (!leftChecked && rightChecked) {
dirCat = 'from-to';
dir = [right.id, left.id];
} else if (leftChecked && !rightChecked) {
dirCat = 'from-to';
dir = [left.id, right.id];
}
synapse.save({
category: dirCat,
node1_id: dir[0],
node2_id: dir[1]
});
Metamaps.Visualize.mGraph.plot();
}); });
Metamaps.Visualize.mGraph.plot(); } // if
});
} //add_direction_form } //add_direction_form
}; // end Metamaps.SynapseCard }; // end Metamaps.SynapseCard
@ -1323,6 +1388,7 @@ Metamaps.Visualize = {
self.mGraph.loadJSON(Metamaps.JIT.vizData, rootIndex); self.mGraph.loadJSON(Metamaps.JIT.vizData, rootIndex);
//compute positions and plot. //compute positions and plot.
self.computePositions(); self.computePositions();
self.mGraph.busy = true;
if (self.type == "RGraph") { if (self.type == "RGraph") {
self.mGraph.fx.animate(Metamaps.JIT.RGraph.animate); self.mGraph.fx.animate(Metamaps.JIT.RGraph.animate);
} else if (self.type == "ForceDirected") { } else if (self.type == "ForceDirected") {
@ -1494,7 +1560,7 @@ Metamaps.Realtime = {
}); });
$('body').click(self.close); $('body').click(self.close);
self.socket = io.connect('http://gentle-savannah-1303.herokuapp.com'); self.socket = io.connect('http://gentle-savannah-1303.herokuapp.com'); // io.connect('http://localhost:5001');
self.startActiveMap(); self.startActiveMap();
}, },
toggleBox: function (event) { toggleBox: function (event) {
@ -2128,6 +2194,19 @@ Metamaps.Control = {
Metamaps.Selected.Nodes.splice( Metamaps.Selected.Nodes.splice(
Metamaps.Selected.Nodes.indexOf(node), 1); Metamaps.Selected.Nodes.indexOf(node), 1);
}, },
deleteSelected: function () {
var n = Metamaps.Selected.Nodes.length;
var e = Metamaps.Selected.Edges.length;
var ntext = n == 1 ? "1 topic" : n + " topics";
var etext = e == 1 ? "1 synapse" : e + " synapses";
var text = "You have " + ntext + " and " + etext + " selected. ";
var r = confirm(text + "Are you sure you want to permanently delete them all? This will remove them from all maps they appear on.");
if (r == true) {
Metamaps.Control.deleteSelectedEdges();
Metamaps.Control.deleteSelectedNodes();
}
},
deleteSelectedNodes: function () { // refers to deleting topics permanently deleteSelectedNodes: function () { // refers to deleting topics permanently
var l = Metamaps.Selected.Nodes.length; var l = Metamaps.Selected.Nodes.length;
for (var i = l - 1; i >= 0; i -= 1) { for (var i = l - 1; i >= 0; i -= 1) {
@ -2222,7 +2301,7 @@ Metamaps.Control = {
} }
Metamaps.Visualize.mGraph.plot(); Metamaps.Visualize.mGraph.plot();
}, },
deselectEdge: function (edge, quick) { deselectEdge: function (edge) {
edge.setData('showDesc', false, 'current'); edge.setData('showDesc', false, 'current');
edge.setDataset('current', { edge.setDataset('current', {
@ -2233,8 +2312,7 @@ Metamaps.Control = {
if (Metamaps.Mouse.edgeHoveringOver == edge) { if (Metamaps.Mouse.edgeHoveringOver == edge) {
edge.setDataset('current', { edge.setDataset('current', {
showDesc: true, showDesc: true,
lineWidth: 4, lineWidth: 4
color: Metamaps.Settings.colors.synapses.hover
}); });
} }
@ -2256,9 +2334,23 @@ Metamaps.Control = {
// TODO make it so that you select which one, of multiple possible synapses you want to delete // TODO make it so that you select which one, of multiple possible synapses you want to delete
//var id = edge.getData("id"); if (edge.getData("synapses").length - 1 === 0) {
//Metamaps.Synapses.get(id).destroy(); Metamaps.Control.hideEdge(edge);
//Metamaps.Control.hideEdge(edge); }
var index = edge.getData("displayIndex") ? edge.getData("displayIndex") : 0;
var synapse = edge.getData("synapses")[index];
var mapping = edge.getData("mappings")[index];
synapse.destroy();
// the server will destroy the mapping, we just need to remove it here
Metamaps.Mappings.remove(mapping);
edge.getData("mappings").splice(index, 1);
edge.getData("synapses").splice(index, 1);
if (edge.getData("displayIndex")) {
delete edge.data.$displayIndex;
}
}, },
removeSelectedEdges: function () { removeSelectedEdges: function () {
var l = Metamaps.Selected.Edges.length, var l = Metamaps.Selected.Edges.length,
@ -2277,9 +2369,23 @@ Metamaps.Control = {
// TODO make it so that you select which one, of multiple possible synapses you want // TODO make it so that you select which one, of multiple possible synapses you want
//var mappingid = edge.getData("mappingid"); if (edge.getData("mappings").length - 1 === 0) {
//Metamaps.Mappings.get(mappingid).destroy(); Metamaps.Control.hideEdge(edge);
//Metamaps.Control.hideEdge(edge); }
var index = edge.getData("displayIndex") ? edge.getData("displayIndex") : 0;
var synapse = edge.getData("synapses")[index];
var mapping = edge.getData("mappings")[index];
mapping.destroy();
Metamaps.Synapses.remove(synapse);
edge.getData("mappings").splice(index, 1);
edge.getData("synapses").splice(index, 1);
if (edge.getData("displayIndex")) {
delete edge.data.$displayIndex;
}
}, },
hideSelectedEdges: function () { hideSelectedEdges: function () {
var edge, var edge,
@ -2295,6 +2401,7 @@ Metamaps.Control = {
var from = edge.nodeFrom.id; var from = edge.nodeFrom.id;
var to = edge.nodeTo.id; var to = edge.nodeTo.id;
edge.setData('alpha', 0, 'end'); edge.setData('alpha', 0, 'end');
Metamaps.Control.deselectEdge(edge);
Metamaps.Visualize.mGraph.fx.animate({ Metamaps.Visualize.mGraph.fx.animate({
modes: ['edge-property:alpha'], modes: ['edge-property:alpha'],
duration: 500 duration: 500
@ -2728,22 +2835,65 @@ Metamaps.Listeners = {
init: function () { init: function () {
$(document).on('keydown', function (e) { $(document).on('keydown', function (e) {
if (!(Metamaps.Active.Map || Metamaps.Active.Topic)) return;
switch (e.which) { switch (e.which) {
case 13: case 13: // if enter key is pressed
if (Metamaps.Active.Map) Metamaps.JIT.enterKeyHandler(); Metamaps.JIT.enterKeyHandler();
e.preventDefault(); e.preventDefault();
break; break;
case 27: case 27: // if esc key is pressed
if (Metamaps.Active.Map) Metamaps.JIT.escKeyHandler(); Metamaps.JIT.escKeyHandler();
break;
case 65: //if a or A is pressed
if (e.ctrlKey){
Metamaps.Control.deselectAllNodes();
Metamaps.Control.deselectAllEdges();
e.preventDefault();
Metamaps.Visualize.mGraph.graph.eachNode(function (n) {
Metamaps.Control.selectNode(n,e);
});
Metamaps.Visualize.mGraph.plot();
}
break;
case 69: //if e or E is pressed
if (e.ctrlKey){
e.preventDefault();
Metamaps.JIT.zoomExtents();
}
break;
case 77: //if m or M is pressed
if (e.ctrlKey){
e.preventDefault();
Metamaps.Control.removeSelectedNodes();
Metamaps.Control.removeSelectedEdges();
}
break;
case 68: //if d or D is pressed
if (e.ctrlKey){
e.preventDefault();
Metamaps.Control.deleteSelected();
}
break;
case 72: //if h or H is pressed
if (e.ctrlKey){
e.preventDefault();
Metamaps.Control.hideSelectedNodes();
Metamaps.Control.hideSelectedEdges();
}
break; break;
default: default:
break; //alert(e.which); break; //alert(e.which);
} }
}); });
//$(window).resize(function () { $(window).resize(function () {
// Metamaps.Visualize.mGraph.canvas.resize($(window).width(), $(window).height()); if (Metamaps.Visualize && Metamaps.Visualize.mGraph) Metamaps.Visualize.mGraph.canvas.resize($(window).width(), $(window).height());
//}); if (Metamaps.Famous && Metamaps.Famous.maps.surf) Metamaps.Famous.maps.hide();
});
} }
}; // end Metamaps.Listeners }; // end Metamaps.Listeners
@ -2924,6 +3074,9 @@ Metamaps.Topic = {
// update filters // update filters
Metamaps.Filter.reset(); Metamaps.Filter.reset();
// reset selected arrays
Metamaps.Selected.reset();
// these three update the actual filter box with the right list items // these three update the actual filter box with the right list items
Metamaps.Filter.checkMetacodes(); Metamaps.Filter.checkMetacodes();
Metamaps.Filter.checkSynapses(); Metamaps.Filter.checkSynapses();
@ -2942,6 +3095,18 @@ Metamaps.Topic = {
Metamaps.SynapseCard.hideCard(); Metamaps.SynapseCard.hideCard();
} }
}, },
centerOn: function (nodeid) {
if (!Metamaps.Visualize.mGraph.busy) {
var node = Metamaps.Visualize.mGraph.graph.getNode(nodeid);
Metamaps.Visualize.mGraph.onClick(node.id, {
hideLabels: false,
duration: 1000,
onComplete: function () {
}
});
}
},
/* /*
* *
* *
@ -3163,9 +3328,8 @@ Metamaps.Synapse = {
Metamaps.Visualize.mGraph.graph.addAdjacence(node1, node2, newedge.data); Metamaps.Visualize.mGraph.graph.addAdjacence(node1, node2, newedge.data);
edgeOnViz = Metamaps.Visualize.mGraph.graph.getAdjacence(node1.id, node2.id); edgeOnViz = Metamaps.Visualize.mGraph.graph.getAdjacence(node1.id, node2.id);
synapse.set('edge', edgeOnViz); synapse.set('edge', edgeOnViz);
synapse.updateEdge(); // links the topic and the mapping to the node synapse.updateEdge(); // links the synapse and the mapping to the edge
Metamaps.Visualize.mGraph.fx.plotLine(edgeOnViz, Metamaps.Visualize.mGraph.canvas);
Metamaps.Control.selectEdge(edgeOnViz); Metamaps.Control.selectEdge(edgeOnViz);
var mappingSuccessCallback = function (mappingModel, response) { var mappingSuccessCallback = function (mappingModel, response) {
@ -3261,7 +3425,7 @@ Metamaps.Synapse = {
topic1 = Metamaps.Topics.get(Metamaps.Create.newSynapse.topic1id); topic1 = Metamaps.Topics.get(Metamaps.Create.newSynapse.topic1id);
node1 = topic1.get('node'); node1 = topic1.get('node');
topic1 = Metamaps.Topics.get(Metamaps.Create.newSynapse.topic2id); topic2 = Metamaps.Topics.get(Metamaps.Create.newSynapse.topic2id);
node2 = topic2.get('node'); node2 = topic2.get('node');
Metamaps.Create.newSynapse.hide(); Metamaps.Create.newSynapse.hide();
@ -3310,6 +3474,9 @@ Metamaps.Map = {
// update filters // update filters
Metamaps.Filter.reset(); Metamaps.Filter.reset();
// reset selected arrays
Metamaps.Selected.reset();
// set the proper mapinfobox content // set the proper mapinfobox content
Metamaps.Map.InfoBox.load(); Metamaps.Map.InfoBox.load();
@ -3661,3 +3828,4 @@ Metamaps.Admin = {
} }
} }
}; };

View file

@ -31,21 +31,4 @@ function fetchRelatives(node) {
alert('failure'); alert('failure');
} }
}); });
}
function centerOn(nodeid) {
if (!Mconsole.busy) {
var node = Mconsole.graph.getNode(nodeid);
$('div.index img').attr('src', imgArray[node.getData('metacode')].src);
$('div.index .mapName').html(node.name);
$(document).attr('title', node.name + ' | Metamaps');
window.history.pushState(node.name, "Metamaps", "/topics/" + node.id);
Mconsole.onClick(node.id, {
hideLabels: false,
duration: 1000,
onComplete: function () {
fetchRelatives(node);
}
});
}
} }

View file

@ -2425,15 +2425,6 @@ float: left;
height: 100%; height: 100%;
} }
#edit_synapse label,
#edit_synapse_left,
#edit_synapse_right {
display: inline-block;
}
#edit_synapse label.left {
margin-right: 0.5em;
}
.templates { .templates {
display: none; display: none;
} }

View file

@ -67,6 +67,7 @@
background-image: url(edit.png); background-image: url(edit.png);
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: bottom right; background-position: bottom right;
cursor: text;
} }
.best_in_place_name textarea, .best_in_place_name input { .best_in_place_name textarea, .best_in_place_name input {
@ -136,6 +137,7 @@ background: none;
background-image: url(edit.png); background-image: url(edit.png);
background-position: top right; background-position: top right;
background-repeat: no-repeat; background-repeat: no-repeat;
cursor: text;
} }
#edit_synapse .best_in_place_desc { #edit_synapse .best_in_place_desc {
@ -219,7 +221,7 @@ background: none;
.linkItem.synapseCount:hover .synapseCountIcon { .linkItem.synapseCount:hover .synapseCountIcon {
background-position: 0 -32px; background-position: 0 -32px;
} }
.linkItem.mapPerm { .mapPerm {
width: 32px; width: 32px;
height: 32px; height: 32px;
padding: 0; padding: 0;
@ -228,22 +230,22 @@ background: none;
background-image: url(permissions32_sprite.png); background-image: url(permissions32_sprite.png);
background-position: 0 0; background-position: 0 0;
} }
.linkItem.mapPerm.co { .mapPerm.co {
background-position: 0 0; background-position: 0 0;
} }
.linkItem.mapPerm.pu { .mapPerm.pu {
background-position: -64px 0; background-position: -64px 0;
} }
.linkItem.mapPerm.pr { .mapPerm.pr {
background-position: -32px 0; background-position: -32px 0;
} }
.showcard .yourTopic .mapPerm:hover { .yourTopic .mapPerm:hover, .yourEdge .mapPerm:hover {
background-image: url(arrowperms_sprite.png); background-image: url(arrowperms_sprite.png);
background-position-x: -32px; background-position-x: -32px;
cursor:pointer; cursor:pointer;
} }
.showcard .yourTopic .mapPerm.minimize { .yourTopic .mapPerm.minimize, .yourEdge .mapPerm.minimize {
background-image: url(arrowperms_sprite.png) !important; background-image: url(arrowperms_sprite.png) !important;
background-position-x: 0px; background-position-x: 0px;
cursor: pointer; cursor: pointer;
@ -555,69 +557,107 @@ font-family: 'din-regular', helvetica, sans-serif;
display: inline-block; display: inline-block;
} }
.permActivator {
width: 16px;
height: 16px;
background: url('settings.png') no-repeat 0 0;
overflow:hidden;
position: absolute;
left: 0px;
top: 30px;
}
#edit_synapse .mapPerm,
#edit_synapse .permActivator {
position: static;
display: inline-block;
color: #000;
}
#edit_synapse .mapPerm {
width: 20px;
height:20px;
background-repeat: no-repeat;
background-size: 20px 20px;
margin: 10px 12px 0 12px;
}
#edit_synapse .mapPerm.co {
background-image: url("CO32.png");
}
#edit_synapse .mapPerm.pu {
background-image: url("PU32.png");
}
#edit_synapse .mapPerm.pr {
background-image: url("PR32.png");
}
#edit_synapse .permActivator {
position: absolute;
margin-top: -1.3em;
}
#edit_synapse { #edit_synapse {
background: url("synapse32.png") no-repeat scroll 0 center / 30px 30px #FFFFFF; border-radius: 2px;
border-radius: 5px; width: 270px;
padding: 5px 5px 5px 30px; box-shadow: 0px 3px 3px rgba(0,0,0,0.23), 0 3px 3px rgba(0,0,0,0.16);
color: #000;
} }
#edit_synapse_name { #editSynUpperBar {
margin-left: 0.4em; background: #FFFFFF url(synapse32.png) no-repeat 8px center;
border-bottom: 1px solid black; min-height: 48px;
text-align:center; border-bottom: 1px solid #222222;
max-width: 160px; display: table;
width: 100%;
}
#editSynLowerBar {
background-color: #E0E0E0;
height: 48px;
position: relative;
}
#synapseCardCount {
font-size: 18px;
display: table-cell;
vertical-align: middle;
padding-left: 44px;
width: 20px;
line-height: 18px;
}
#edit_synapse_desc {
font-size: 14px;
font-family: 'din-regular', helvetica, sans-serif;
padding: 8px 38px 8px 4px;
display: table-cell;
vertical-align: middle;
line-height: 16px;
}
.canEdit #edit_synapse_desc:hover {
background-image: url(edit.png);
background-repeat: no-repeat;
background-position: 164px center;
cursor: text;
}
#edit_synapse .best_in_place_desc textarea {
font-family: 'din-regular', sans-serif;
color: #424242;
font-size: 14px;
line-height: 16px;
width: 100%;
height: auto;
margin: 0;
padding: 0;
border: 0;
outline: none;
background: none;
resize: none;
}
#dropdownSynapses {
position: absolute;
width: 24px;
height: 24px;
top: 12px;
right: 8px;
background-image: url(arrowdown_sprite.png);
background-repeat: no-repeat;
background-position: 4px -12px;
}
#dropdownSynapses:hover {
background-position: 4px -28px;
cursor: pointer;
}
#switchSynapseList {
display: none;
list-style: none;
width: 270px;
position: absolute;
z-index: 1;
background: #FFFFFF;
border-bottom: 1px solid #BBBBBB;
}
#switchSynapseList li {
padding: 8px;
cursor: pointer;
font-family: 'din-regular';
font-size: 14px;
line-height: 16px;
}
#switchSynapseList li:hover {
background: #E0E0E0;
} }
#edgeUser { #edgeUser {
display:inline-block; display:inline-block;
background-position: center center;
background-repeat: no-repeat;
background-size: 20px 20px;
height: 20px;
min-width: 20px;
position: relative; position: relative;
background-image: url("MMCCicon_mapper_black.png"); margin: 12px 0 0 11px;
margin: 10px 0 0 10px; }
#edgeUser img {
border-radius: 12px;
} }
#edgeUser.hoverForTip:hover .tip { #edgeUser.hoverForTip:hover .tip {
display:block; display:block;
@ -637,39 +677,36 @@ font-family: 'din-regular', helvetica, sans-serif;
z-index: 100; z-index: 100;
} }
#edit_synapse .click-to-edit { #edit_synapse .mapPerm {
margin-left: 0.3em; position: absolute;
top: 0px;
left: 40px;
} }
#edit_synapse.yourEdge .mapPerm:hover { #edit_synapse_left, #edit_synapse_right {
background-image: url(MMCCicon_maximize_arrow_black.png); position: absolute;
background-size: 24px 17px; height: 24px;
background-position: 0px 2px; width: 24px;
cursor:pointer; top: 12px;
}
#edit_synapse.yourEdge .mapPerm.minimize {
background-image: url(MMCCicon_minimize_arrow_black.png) !important;
background-size: 24px 17px;
background-position: 0px 2px;
cursor: pointer;
}
#edit_synapse .mapPerm .permissionSelect {
list-style: none;
width: 26px;
height: 52px;
position: relative;
top: 20px;
left:-3px;
}
#edit_synapse .mapPerm .permissionSelect li {
width: 26px;
height: 26px;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center center;
background-size: 20px 20px;
background-color:white;
} }
#edit_synapse_right {
background-image: url(synapsedirectionright_sprite.png);
right: 16px;
}
#edit_synapse_left {
background-image: url(synapsedirectionleft_sprite.png);
right: 56px;
}
#edit_synapse_left.checked, #edit_synapse_right.checked {
background-position-y: -48px;
}
.canEdit #edit_synapse_left, .canEdit #edit_synapse_right {
cursor: pointer;
}
.canEdit #edit_synapse_left:not(.checked):hover, .canEdit #edit_synapse_right:not(.checked):hover {
background-position-y: -24px;
}
/* Map Cards */ /* Map Cards */

View file

@ -678,13 +678,15 @@
/* infoAndHelp */ /* infoAndHelp */
.mapPage .infoAndHelp, .topicPage .infoAndHelp{
right: 70px;
}
.infoAndHelp { .infoAndHelp {
position: fixed; position: fixed;
bottom: 24px; bottom: 20px;
right: 66px; right: 20px;
z-index: 3; z-index: 3;
width: auto; width: auto;
padding: 1px 10px 0px 10px;
font-style: italic; font-style: italic;
height: 32px; height: 32px;
} }

View file

@ -1,23 +1,21 @@
/* =Barometer feedback tab /* =USERVOICE ICON DEFINE
--------------------------------------------------------*/ --------------------------------------------------------*/
a#barometer_tab { div.uv-icon.uv-bottom-left {
background-image:url(../images/feedback_tab.png); background-image:url(feedback_sprite.png);
background-color:#222222; background-color:#222222;
color:#FFFFFF; color:#FFFFFF;
cursor:pointer; cursor:pointer;
height:102px; height:108px;
left:0; left:0;
margin-left:-7px; margin-left:0px;
overflow:hidden;
position:fixed;
text-indent:-100000px; text-indent:-100000px;
top:25%; top:25%;
width:42px; width:25px;
z-index:100000; z-index:100000;
} }
/* =Barometer Overlay /* =NOTHING AFTER THIS POINT IS BEING USED
--------------------------------------------------------*/ --------------------------------------------------------*/
#barometer_overlay { #barometer_overlay {

View file

@ -54,10 +54,7 @@ class SynapsesController < ApplicationController
@synapse.mappings.each do |m| @synapse.mappings.each do |m|
m.map.touch(:updated_at) m.map.touch(:updated_at)
#push notify to anyone viewing same map in realtime (see mapping.rb to understand the 'message' action)
m.message 'destroy',@current.id
m.delete m.delete
end end

View file

@ -108,9 +108,6 @@ class TopicsController < ApplicationController
@map = m.map @map = m.map
@map.touch(:updated_at) @map.touch(:updated_at)
#push notify to anyone viewing same map in realtime (see mapping.rb to understand the 'message' action)
m.message 'destroy',@current.id
m.delete m.delete
end end
@ -122,9 +119,6 @@ class TopicsController < ApplicationController
@map = mapping.map @map = mapping.map
@map.touch(:updated_at) @map.touch(:updated_at)
#push notify to anyone viewing a map with this topic in realtime (see mapping.rb to understand the 'message' action)
mapping.message 'destroy',@current.id
mapping.delete mapping.delete
end end

View file

@ -17,31 +17,5 @@ class Mapping < ActiveRecord::Base
def as_json(options={}) def as_json(options={})
super(:methods =>[:user_name, :user_image]) super(:methods =>[:user_name, :user_image])
end end
# sends push updates through redis to websockets for realtime updates
def message action, origin_user_id
if self.category == "Topic"
return if self.topic.permission == "private" and action == "create"
msg = { origin: origin_user_id,
mapid: self.map.id,
resource: self.category,
action: action,
id: self.topic.id,
obj: self.topic.selfonmap_as_json(self.map.id).html_safe }
elsif self.category == "Synapse"
return if self.synapse.permission == "private" and action == "create"
msg = { origin: origin_user_id,
mapid: self.map.id,
resource: self.category,
action: action,
id: self.synapse.id,
obj: self.synapse.self_as_json.html_safe }
end
$redis.publish 'maps', msg.to_json
end
end end

View file

@ -20,25 +20,6 @@ class Synapse < ActiveRecord::Base
super(:methods =>[:user_name, :user_image]) super(:methods =>[:user_name, :user_image])
end end
# sends push updates through redis to websockets for realtime updates
def message action, origin_user_id
return if self.permission == "private" and action == "create"
#get array of all maps topic appears in
@maps = self.maps
#sends update to all maps that topic appears in who have realtime on
@maps.each do |map|
msg = { origin: origin_user_id,
mapid: map.id,
resource: 'Synapse',
action: action,
id: self.id,
obj: self.self_as_json.html_safe }
$redis.publish 'maps', msg.to_json
end
end
##### PERMISSIONS ###### ##### PERMISSIONS ######
# returns false if user not allowed to 'show' Topic, Synapse, or Map # returns false if user not allowed to 'show' Topic, Synapse, or Map

View file

@ -58,25 +58,6 @@ class Topic < ActiveRecord::Base
super(:methods =>[:user_name, :user_image, :map_count, :synapse_count]) super(:methods =>[:user_name, :user_image, :map_count, :synapse_count])
end end
# sends push updates through redis to websockets for realtime updates
def message action, origin_user_id
return if self.permission == "private" and action == "create"
#get array of all maps topic appears in
@maps = self.maps
#sends update to all maps that topic appears in who have realtime on
@maps.each do |map|
msg = { origin: origin_user_id,
mapid: map.id,
resource: 'Topic',
action: action,
id: self.id,
obj: self.selfonmap_as_json(map.id).html_safe }
$redis.publish 'maps', msg.to_json
end
end
def topic_autocomplete_method def topic_autocomplete_method
"Get: #{self.name}" "Get: #{self.name}"
end end

View file

@ -66,8 +66,8 @@
<%= render :partial => 'layouts/templates' %> <%= render :partial => 'layouts/templates' %>
<%= render :partial => 'shared/metacodeBgColors' %> <%= render :partial => 'shared/metacodeBgColors' %>
<script type="text/javascript" charset="utf-8"> <script type="text/javascript" charset="utf-8">
BAROMETER.load('Scqak8nyHdFEkezKMNeQp'); //BAROMETER.load('Scqak8nyHdFEkezKMNeQp');
USERVOICE.load();
<% if authenticated? %> <% if authenticated? %>
Metamaps.Active.Mapper = <%= user.to_json.html_safe %> Metamaps.Active.Mapper = <%= user.to_json.html_safe %>
<% else %> <% else %>

View file

@ -138,7 +138,7 @@
<div id="moreResources"> <div id="moreResources">
<p>For more information about Metamaps.cc, visit our Knowledge Base or skip directly to a section by clicking on one of the categories below.</p> <p>For more information about Metamaps.cc, visit our Knowledge Base or skip directly to a section by clicking on one of the categories below.</p>
<div class="resourcesColumnOne resourcesColumn"> <div class="resourcesColumnOne resourcesColumn">
<a href="#" target="_blank" data-bypass="true" class="button">Feedback Forums</a> <a href="http://support.metamaps.cc/forums/262715-general" target="_blank" data-bypass="true" class="button">Feedback Forums</a>
<ul> <ul>
<li> <li>
<a href="http://support.metamaps.cc/knowledgebase/topics/61031-getting-started" target="_blank" data-bypass="true">Getting Started</a> <a href="http://support.metamaps.cc/knowledgebase/topics/61031-getting-started" target="_blank" data-bypass="true">Getting Started</a>

View file

@ -1,134 +1,134 @@
# encoding: UTF-8 # encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to # of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition. # incrementally modify your database, and then regenerate this schema definition.
# #
# Note that this schema.rb definition is the authoritative source for your # Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another # database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations # system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations # from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues). # you'll amass, the slower it'll run and the greater likelihood for issues).
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20140930013020) do ActiveRecord::Schema.define(:version => 20140930013020) do
create_table "in_metacode_sets", :force => true do |t| create_table "in_metacode_sets", :force => true do |t|
t.integer "metacode_id" t.integer "metacode_id"
t.integer "metacode_set_id" t.integer "metacode_set_id"
t.datetime "created_at", :null => false t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
end end
add_index "in_metacode_sets", ["metacode_id"], :name => "index_in_metacode_sets_on_metacode_id" add_index "in_metacode_sets", ["metacode_id"], :name => "index_in_metacode_sets_on_metacode_id"
add_index "in_metacode_sets", ["metacode_set_id"], :name => "index_in_metacode_sets_on_metacode_set_id" add_index "in_metacode_sets", ["metacode_set_id"], :name => "index_in_metacode_sets_on_metacode_set_id"
create_table "mappings", :force => true do |t| create_table "mappings", :force => true do |t|
t.text "category" t.text "category"
t.integer "xloc" t.integer "xloc"
t.integer "yloc" t.integer "yloc"
t.integer "topic_id" t.integer "topic_id"
t.integer "synapse_id" t.integer "synapse_id"
t.integer "map_id" t.integer "map_id"
t.integer "user_id" t.integer "user_id"
t.datetime "created_at", :null => false t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
end end
create_table "maps", :force => true do |t| create_table "maps", :force => true do |t|
t.text "name" t.text "name"
t.boolean "arranged" t.boolean "arranged"
t.text "desc" t.text "desc"
t.text "permission" t.text "permission"
t.integer "user_id" t.integer "user_id"
t.datetime "created_at", :null => false t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
t.boolean "featured" t.boolean "featured"
t.string "screenshot_file_name" t.string "screenshot_file_name"
t.string "screenshot_content_type" t.string "screenshot_content_type"
t.integer "screenshot_file_size" t.integer "screenshot_file_size"
t.datetime "screenshot_updated_at" t.datetime "screenshot_updated_at"
end end
create_table "metacode_sets", :force => true do |t| create_table "metacode_sets", :force => true do |t|
t.string "name" t.string "name"
t.text "desc" t.text "desc"
t.integer "user_id" t.integer "user_id"
t.boolean "mapperContributed" t.boolean "mapperContributed"
t.datetime "created_at", :null => false t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
end end
add_index "metacode_sets", ["user_id"], :name => "index_metacode_sets_on_user_id" add_index "metacode_sets", ["user_id"], :name => "index_metacode_sets_on_user_id"
create_table "metacodes", :force => true do |t| create_table "metacodes", :force => true do |t|
t.text "name" t.text "name"
t.string "icon" t.string "icon"
t.datetime "created_at", :null => false t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
t.string "color" t.string "color"
end end
create_table "synapses", :force => true do |t| create_table "synapses", :force => true do |t|
t.text "desc" t.text "desc"
t.text "category" t.text "category"
t.text "weight" t.text "weight"
t.text "permission" t.text "permission"
t.integer "node1_id" t.integer "node1_id"
t.integer "node2_id" t.integer "node2_id"
t.integer "user_id" t.integer "user_id"
t.datetime "created_at", :null => false t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
end end
create_table "topics", :force => true do |t| create_table "topics", :force => true do |t|
t.text "name" t.text "name"
t.text "desc" t.text "desc"
t.text "link" t.text "link"
t.text "permission" t.text "permission"
t.integer "user_id" t.integer "user_id"
t.integer "metacode_id" t.integer "metacode_id"
t.datetime "created_at", :null => false t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
t.string "image_file_name" t.string "image_file_name"
t.string "image_content_type" t.string "image_content_type"
t.integer "image_file_size" t.integer "image_file_size"
t.datetime "image_updated_at" t.datetime "image_updated_at"
t.string "audio_file_name" t.string "audio_file_name"
t.string "audio_content_type" t.string "audio_content_type"
t.integer "audio_file_size" t.integer "audio_file_size"
t.datetime "audio_updated_at" t.datetime "audio_updated_at"
end end
create_table "users", :force => true do |t| create_table "users", :force => true do |t|
t.string "name" t.string "name"
t.string "email" t.string "email"
t.text "settings" t.text "settings"
t.string "code", :limit => 8 t.string "code", :limit => 8
t.string "joinedwithcode", :limit => 8 t.string "joinedwithcode", :limit => 8
t.string "crypted_password" t.string "crypted_password"
t.string "password_salt" t.string "password_salt"
t.string "persistence_token" t.string "persistence_token"
t.string "perishable_token" t.string "perishable_token"
t.datetime "created_at", :null => false t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
t.string "encrypted_password", :limit => 128, :default => "" t.string "encrypted_password", :limit => 128, :default => ""
t.string "remember_token" t.string "remember_token"
t.datetime "remember_created_at" t.datetime "remember_created_at"
t.string "reset_password_token" t.string "reset_password_token"
t.datetime "last_sign_in_at" t.datetime "last_sign_in_at"
t.string "last_sign_in_ip" t.string "last_sign_in_ip"
t.integer "sign_in_count", :default => 0 t.integer "sign_in_count", :default => 0
t.datetime "current_sign_in_at" t.datetime "current_sign_in_at"
t.string "current_sign_in_ip" t.string "current_sign_in_ip"
t.datetime "reset_password_sent_at" t.datetime "reset_password_sent_at"
t.boolean "admin" t.boolean "admin"
t.string "image_file_name" t.string "image_file_name"
t.string "image_content_type" t.string "image_content_type"
t.integer "image_file_size" t.integer "image_file_size"
t.datetime "image_updated_at" t.datetime "image_updated_at"
end end
add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
end end

View file

@ -45,13 +45,14 @@
margin-bottom: 24px; margin-bottom: 24px;
} }
div.dialog { div.dialog {
width: 500px; width: 380px;
border: 0px; border: 0px;
border-right-color: #999; border-right-color: #999;
border-bottom-color: #999; border-bottom-color: #999;
float: left; float: left;
margin-right: 100px; margin-right: 50px;
padding-top: 150px; padding-top: 70px;
padding-bottom: 70px;
} }
.picture { .picture {
width: 450px; width: 450px;
@ -64,12 +65,12 @@
float: left; float: left;
background-position:50% 20%; background-position:50% 20%;
background-size: 100%; background-size: 100%;
margin-top: 162px; margin-top: 110px;
} }
.wrapper { .wrapper {
margin: 0 auto; margin: 0 auto;
width: 1100px; width: 900px;
} }
.button { .button {