diff --git a/Gemfile b/Gemfile
index 9e2acc35..65988ca4 100644
--- a/Gemfile
+++ b/Gemfile
@@ -14,7 +14,7 @@ gem 'formtastic'
gem 'json'
gem 'rails3-jquery-autocomplete'
gem 'best_in_place'
-gem 'therubyracer' #optional
+#gem 'therubyracer' #optional
#gem 'rb-readline'
# Gems used only for assets and not required
diff --git a/Gemfile.lock b/Gemfile.lock
index f29e0c99..3346fa26 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -64,7 +64,6 @@ GEM
railties (>= 3.1.0, < 5.0)
thor (~> 0.14)
json (1.8.1)
- libv8 (3.16.14.3)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
@@ -112,9 +111,6 @@ GEM
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
- therubyracer (0.12.1)
- libv8 (~> 3.16.14.0)
- ref
thor (0.19.1)
thread_safe (0.3.3)
tilt (1.4.1)
@@ -147,5 +143,4 @@ DEPENDENCIES
rails3-jquery-autocomplete
redis
sass-rails
- therubyracer
uglifier (>= 1.0.3)
diff --git a/Gemfile~ b/Gemfile~
new file mode 100644
index 00000000..9e2acc35
--- /dev/null
+++ b/Gemfile~
@@ -0,0 +1,47 @@
+source 'https://rubygems.org'
+
+gem 'rails', '3.2.17'
+
+# Bundle edge Rails instead:
+# gem 'rails', :git => 'git://github.com/rails/rails.git'
+
+gem 'devise'
+gem 'redis'
+gem 'pg'
+gem 'cancan'
+gem 'formula'
+gem 'formtastic'
+gem 'json'
+gem 'rails3-jquery-autocomplete'
+gem 'best_in_place'
+gem 'therubyracer' #optional
+#gem 'rb-readline'
+
+# Gems used only for assets and not required
+# in production environments by default.
+group :assets do
+ gem 'sass-rails'
+ gem 'coffee-rails', '~> 3.2.1'
+
+ # See https://github.com/sstephenson/execjs#readme for more supported runtimes
+ # gem 'therubyracer'
+
+ gem 'uglifier', '>= 1.0.3'
+end
+
+gem 'jquery-rails', '2.1.2'
+
+# To use ActiveModel has_secure_password
+# gem 'bcrypt-ruby', '~> 3.0.0'
+
+# To use Jbuilder templates for JSON
+ gem 'jbuilder', '0.8.2'
+
+# Use unicorn as the web server
+# gem 'unicorn'
+
+# Deploy with Capistrano
+# gem 'capistrano'
+
+# To use debugger
+# gem 'ruby-debug19', :require => 'ruby-debug'
diff --git a/app/assets/javascripts/Jit/graphsettings.js b/app/assets/javascripts/Jit/graphsettings.js
index 77fb09b8..7614f32f 100644
--- a/app/assets/javascripts/Jit/graphsettings.js
+++ b/app/assets/javascripts/Jit/graphsettings.js
@@ -144,16 +144,7 @@ function graphSettings(type, embed) {
//Number of iterations for the FD algorithm
iterations: 200,
//Edge length
- 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);
- //},
- // Change node styles when DOM labels are placed or moved.
- //onPlaceLabel: function (domElement, node) {
- // onPlaceLabelHandler(domElement, node);
- //}
+ levelDistance: 200
};
if (embed) {
@@ -177,24 +168,6 @@ function graphSettings(type, embed) {
//different because we're centred
onDragCancelHandler(node, eventInfo, e, true);
};
- /*t.Events.onClick = function(node, eventInfo, e) {
- //this is handled mostly differently than in arranged/chaotic
- if (e.target.id != "infovis-canvas") return false;
-
- //hide synapse and topic editing dialog
- hideCards();
-
- //clicking on an edge, a node, or clicking on blank part of canvas?
- if (node.nodeFrom) {
- selectEdgeOnClickHandler(node, e);
- } else if (node && !node.nodeFrom) {
- //node is actually a node :)
- selectNodeOnClickHandler(node, e);
-
- } else {
- canvasDoubleClickHandler(eventInfo.getPos(), e);
- }
- };*/
}//if
return t;
@@ -258,18 +231,9 @@ var nodeSettings = {
var pos = node.pos.getc(true),
dim = node.getData('dim'),
cat = node.getData('metacode'),
- greenCircle = node.getData('greenCircle'),
whiteCircle = node.getData('whiteCircle'),
ctx = canvas.getCtx();
- // if the topic is from the Commons draw a green circle around it
- if (greenCircle) {
- ctx.beginPath();
- ctx.arc(pos.x, pos.y, dim+3, 0, 2 * Math.PI, false);
- ctx.strokeStyle = '#67be5f'; // green
- ctx.lineWidth = 2;
- ctx.stroke();
- }
// if the topic is on the Canvas draw a white circle around it
if (whiteCircle) {
ctx.beginPath();
@@ -591,31 +555,6 @@ function onDragCancelHandler(node, eventInfo, e, centred) {
Mconsole.plot();
}
-function onPlaceLabelHandler(domElement, node) {
- var style = domElement.style;
- var left = parseInt(style.left);
- var top = parseInt(style.top);
- var w = $('#topic_' + node.id + '_label').width();
- style.left = (left - w / 2) + 'px';
- style.top = (top+20) + 'px';
- style.display = '';
-
- // now position the showcard
- if (MetamapsModel.showcardInUse != null) {
- top = $('#' + MetamapsModel.showcardInUse).css('top');
- left = parseInt($('#' + MetamapsModel.showcardInUse).css('left'));
- if (0 != $('#topic_' + MetamapsModel.showcardInUse + '_label').width()) {
- MetamapsModel.widthOfLabel = $('#topic_' + MetamapsModel.showcardInUse + '_label').width();
- }
- w = MetamapsModel.widthOfLabel/2;
- left = (left + w) + 'px';
- $('#showcard').css('top', top);
- $('#showcard').css('left', left);
-
- Mconsole.labels.hideLabel(Mconsole.graph.getNode(MetamapsModel.showcardInUse));
- }
-}
-
// thanks to http://stackoverflow.com/questions/4338963/
// convert-html-character-entities-back-to-regular-text-using-javascript
function decodeEntities(desc) {
@@ -624,5 +563,4 @@ function decodeEntities(desc) {
str = temp.textContent || temp.innerText;
temp = null; //delete the element;
return str;
-}//decodeEntities
-
+}//decodeEntities
\ No newline at end of file
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
index b0f0d680..99aceeac 100644
--- a/app/assets/javascripts/application.js
+++ b/app/assets/javascripts/application.js
@@ -25,144 +25,163 @@
// other options are 'graph'
var viewMode = "list";
-var labelType, useGradients, nativeTextSupport, animate, json, Mconsole = null, gType, tempNode = null, tempInit = false, tempNode2 = null, metacodeIMGinit = false, goRealtime = false, mapid = null, mapperm = false, touchPos, touchDragNode, mouseIsDown = false;
+var labelType, useGradients, nativeTextSupport, animate, json, Mconsole = null,
+ gType, tempNode = null,
+ tempInit = false,
+ tempNode2 = null,
+ metacodeIMGinit = false,
+ goRealtime = false,
+ mapid = null,
+ mapperm = false,
+ touchPos, touchDragNode, mouseIsDown = false;
- $(document).ready(function() {
-
- function bindMainMenuHover() {
-
- var menuIsOpen = false
-
- // controls the sliding hover of the bottom left menu
- var sliding1 = false;
- var lT;
-
- var closeMenu = function() {
- lT = setTimeout(function() {
- if (! sliding1) {
- 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'
- }, 200);
- $('.footer .menu').fadeOut(200, function() {
- sliding1 = false;
- menuIsOpen = false;
- });
- }
- },500);
- }
-
- var openMenu = function() {
- 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'
- }, 200);
- $('.footer .menu').fadeIn(200, function() {
- sliding1 = false;
- });
- }
- }
- // bind the hover events
- $(".logo").hover(openMenu, closeMenu);
-
- // when on touch screen, make touching on the logo do what hovering does on desktop
- $("#mainTitle a").bind('touchend', function(evt) {
- if (!menuIsOpen) {
- openMenu();
- evt.preventDefault();
- evt.stopPropagation();
- }
- });
- }
-
- function bindSearchHover() {
-
- var searchIsOpen = false
-
- // controls the sliding hover of the search
- var sliding1 = false;
- var lT;
-
- var openSearch = function() {
- clearTimeout(lT);
- if (!sliding1 && !searchIsOpen) {
- hideCards();
- sliding1 = true;
- $('.sidebarSearch .twitter-typeahead, .sidebarSearch .tt-hint, .sidebarSearchField').animate({
- width: '200px'
- }, 200, function() {
- $('.sidebarSearchField, .sidebarSearch .tt-hint').css({padding:'5px 10px', width:'180px'});
- $('.sidebarSearchField').focus();
- sliding1 = false
- searchIsOpen = true;
- });
- }
- }
- var closeSearch = function(closeAfter) {
- lT = setTimeout(function() {
- if (!sliding1 && searchIsOpen && $('.sidebarSearchField').val() == '') {
- sliding1 = true;
- $('.sidebarSearchField, .sidebarSearch .tt-hint').css({padding:'5px 0', width:'200px'});
- $('.sidebarSearch .twitter-typeahead, .sidebarSearch .tt-hint, .sidebarSearchField').animate({
- width: '0'
- }, 200, function() {
- $('.sidebarSearchField').typeahead('setQuery','');
- sliding1 = false;
- searchIsOpen = false;
- });
- }
- },closeAfter);
- }
+$(document).ready(function () {
- // bind the hover events
- $(".sidebarSearch").hover(function(){ openSearch() }, function() { closeSearch(800) });
-
- $('.sidebarSearchIcon').click(function(e) {
- $('.sidebarSearchField').focus();
- });
- $('.sidebarSearch').click(function(e) {
- e.stopPropagation();
- });
- $('body').click(function(e) {
- closeSearch(0);
- });
-
- // if the search is closed and user hits SHIFT+S
- $('body').bind('keydown', function(e) {
- switch(e.which) {
- case 191:
- if (e.ctrlKey && !searchIsOpen) {
- openSearch();
+ function bindMainMenuHover() {
+
+ var menuIsOpen = false
+
+ // controls the sliding hover of the bottom left menu
+ var sliding1 = false;
+ var lT;
+
+ var closeMenu = function () {
+ lT = setTimeout(function () {
+ if (!sliding1) {
+ 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'
+ }, 200);
+ $('.footer .menu').fadeOut(200, function () {
+ sliding1 = false;
+ menuIsOpen = false;
+ });
+ }
+ }, 500);
+ }
+
+ var openMenu = function () {
+ 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'
+ }, 200);
+ $('.footer .menu').fadeIn(200, function () {
+ sliding1 = false;
+ });
+ }
+ }
+ // bind the hover events
+ $(".logo").hover(openMenu, closeMenu);
+
+ // when on touch screen, make touching on the logo do what hovering does on desktop
+ $("#mainTitle a").bind('touchend', function (evt) {
+ if (!menuIsOpen) {
+ openMenu();
+ evt.preventDefault();
+ evt.stopPropagation();
+ }
+ });
+ }
+
+ function bindSearchHover() {
+
+ var searchIsOpen = false
+
+ // controls the sliding hover of the search
+ var sliding1 = false;
+ var lT;
+
+ var openSearch = function () {
+ clearTimeout(lT);
+ if (!sliding1 && !searchIsOpen) {
+ hideCards();
+ sliding1 = true;
+ $('.sidebarSearch .twitter-typeahead, .sidebarSearch .tt-hint, .sidebarSearchField').animate({
+ width: '200px'
+ }, 200, function () {
+ $('.sidebarSearchField, .sidebarSearch .tt-hint').css({
+ padding: '5px 10px',
+ width: '180px'
+ });
+ $('.sidebarSearchField').focus();
+ sliding1 = false
+ searchIsOpen = true;
+ });
}
- break;
- default: break; //console.log(e.which);
}
- });
-
- // initialize the search box autocomplete results
- var mapheader = userid ? '
' : '';
- var topicheader = userid ? '' : '';
- $('.sidebarSearchField').typeahead([
- {
+ var closeSearch = function (closeAfter) {
+ lT = setTimeout(function () {
+ if (!sliding1 && searchIsOpen && $('.sidebarSearchField').val() == '') {
+ sliding1 = true;
+ $('.sidebarSearchField, .sidebarSearch .tt-hint').css({
+ padding: '5px 0',
+ width: '200px'
+ });
+ $('.sidebarSearch .twitter-typeahead, .sidebarSearch .tt-hint, .sidebarSearchField').animate({
+ width: '0'
+ }, 200, function () {
+ $('.sidebarSearchField').typeahead('setQuery', '');
+ sliding1 = false;
+ searchIsOpen = false;
+ });
+ }
+ }, closeAfter);
+ }
+
+ // bind the hover events
+ $(".sidebarSearch").hover(function () {
+ openSearch()
+ }, function () {
+ closeSearch(800)
+ });
+
+ $('.sidebarSearchIcon').click(function (e) {
+ $('.sidebarSearchField').focus();
+ });
+ $('.sidebarSearch').click(function (e) {
+ e.stopPropagation();
+ });
+ $('body').click(function (e) {
+ closeSearch(0);
+ });
+
+ // if the search is closed and user hits SHIFT+S
+ $('body').bind('keydown', function (e) {
+ switch (e.which) {
+ case 191:
+ if (e.ctrlKey && !searchIsOpen) {
+ openSearch();
+ }
+ break;
+ default:
+ break; //console.log(e.which);
+ }
+ });
+
+ // initialize the search box autocomplete results
+ var mapheader = userid ? '' : '';
+ var topicheader = userid ? '' : '';
+ $('.sidebarSearchField').typeahead([
+ {
name: 'topics',
- dupChecker: function (datum1,datum2) {
- return false;
+ dupChecker: function (datum1, datum2) {
+ return false;
},
template: $('.topicTemplate').html(),
remote: {
@@ -174,25 +193,25 @@ var labelType, useGradients, nativeTextSupport, animate, json, Mconsole = null,
}
return q;
},
- filter: function(dataset) {
- if (dataset.length == 0) {
- dataset.push({
- value: "No results",
- label: "No results",
- typeImageURL: "/assets/wildcard.png",
- rtype: "noresult"
- });
- }
- return dataset;
+ filter: function (dataset) {
+ if (dataset.length == 0) {
+ dataset.push({
+ value: "No results",
+ label: "No results",
+ typeImageURL: "/assets/icons/wildcard.png",
+ rtype: "noresult"
+ });
+ }
+ return dataset;
}
},
engine: Hogan,
header: topicheader
},
- {
+ {
name: 'maps',
- dupChecker: function (datum1,datum2) {
- return false;
+ dupChecker: function (datum1, datum2) {
+ return false;
},
template: $('.mapTemplate').html(),
remote: {
@@ -204,180 +223,203 @@ var labelType, useGradients, nativeTextSupport, animate, json, Mconsole = null,
}
return q;
},
- filter: function(dataset) {
- if (dataset.length == 0) {
- dataset.push({
- value: "No results",
- label: "No results",
- rtype: "noresult"
- });
- }
- return dataset;
+ filter: function (dataset) {
+ if (dataset.length == 0) {
+ dataset.push({
+ value: "No results",
+ label: "No results",
+ rtype: "noresult"
+ });
+ }
+ return dataset;
}
},
engine: Hogan,
header: mapheader
},
- {
+ {
name: 'mappers',
- dupChecker: function (datum1,datum2) {
- return false;
+ dupChecker: function (datum1, datum2) {
+ return false;
},
template: $('.mapperTemplate').html(),
remote: {
url: '/search/mappers?term=%QUERY',
- filter: function(dataset) {
- if (dataset.length == 0) {
- dataset.push({
- value: "No results",
- label: "No results",
- rtype: "noresult"
- });
- }
- return dataset;
+ filter: function (dataset) {
+ if (dataset.length == 0) {
+ dataset.push({
+ value: "No results",
+ label: "No results",
+ rtype: "noresult"
+ });
+ }
+ return dataset;
}
},
engine: Hogan,
header: ''
}
]);
- // tell the autocomplete to launch a new tab with the topic, map, or mapper you clicked on
- $('.sidebarSearchField').bind('typeahead:selected', function (event, datum, dataset) {
- console.log(event);
- if (datum.rtype != "noresult") {
- var win;
- if (dataset == "topics") {
- win=window.open('/topics/' + datum.id, '_blank');
+ // tell the autocomplete to launch a new tab with the topic, map, or mapper you clicked on
+ $('.sidebarSearchField').bind('typeahead:selected', function (event, datum, dataset) {
+ console.log(event);
+ if (datum.rtype != "noresult") {
+ var win;
+ if (dataset == "topics") {
+ win = window.open('/topics/' + datum.id, '_blank');
+ } else if (dataset == "maps") {
+ win = window.open('/maps/' + datum.id, '_blank');
+ } else if (dataset == "mappers") {
+ win = window.open('/maps/mappers/' + datum.id, '_blank');
+ }
+ win.focus();
+ closeSearch(0);
}
- else if (dataset == "maps") {
- win=window.open('/maps/' + datum.id, '_blank');
+ });
+
+
+ var checkboxChangeInit = false,
+ minimizeInit = false;
+
+ $('.sidebarSearchField').bind('keyup', function () {
+
+ // when the user selects 'added by me' resend the query with their userid attached
+ if (!checkboxChangeInit) {
+ $('.limitToMe').bind("change", function (e) {
+ // set the value of the search equal to itself to retrigger the autocomplete event
+ searchIsOpen = false;
+ $('.sidebarSearchField').typeahead('setQuery', $('.sidebarSearchField').val());
+ setTimeout(function () {
+ searchIsOpen = true;
+ }, 2000);
+ });
+ checkboxChangeInit = true;
}
- else if (dataset == "mappers") {
- win=window.open('/maps/mappers/' + datum.id, '_blank');
+
+ // when the user clicks minimize section, hide the results for that section
+ if (!minimizeInit) {
+ $('.minimizeMapperResults').click(function (e) {
+ var s = $('.tt-dataset-mappers .tt-suggestions');
+ console.log(s.css('height'));
+ if (s.css('height') == '0px') {
+ $('.tt-dataset-mappers .tt-suggestions').css({
+ 'height': 'auto',
+ 'overflow': 'visible'
+ });
+ $(this).removeClass('maximizeResults').addClass('minimizeResults');
+ } else {
+ $('.tt-dataset-mappers .tt-suggestions').css({
+ 'height': '0',
+ 'overflow': 'hidden'
+ });
+ $(this).removeClass('minimizeResults').addClass('maximizeResults');
+ }
+ });
+ $('.minimizeTopicResults').click(function (e) {
+ var s = $('.tt-dataset-topics .tt-suggestions');
+ console.log(s.css('height'));
+ if (s.css('height') == '0px') {
+ s.css({
+ 'height': 'auto',
+ 'border-top': 'none',
+ 'overflow': 'visible'
+ });
+ $(this).removeClass('maximizeResults').addClass('minimizeResults');
+ } else {
+ s.css({
+ 'height': '0',
+ 'border-top': '1px solid rgb(56, 56, 56)',
+ 'overflow': 'hidden'
+ });
+ $(this).removeClass('minimizeResults').addClass('maximizeResults');
+ }
+ });
+ $('.minimizeMapResults').click(function (e) {
+ var s = $('.tt-dataset-maps .tt-suggestions');
+ console.log(s.css('height'));
+ if (s.css('height') == '0px') {
+ s.css({
+ 'height': 'auto',
+ 'border-top': 'none',
+ 'overflow': 'visible'
+ });
+ $(this).removeClass('maximizeResults').addClass('minimizeResults');
+ } else {
+ s.css({
+ 'height': '0',
+ 'border-top': '1px solid rgb(56, 56, 56)',
+ 'overflow': 'hidden'
+ });
+ $(this).removeClass('minimizeResults').addClass('maximizeResults');
+ }
+ });
+ minimizeInit = true;
}
- win.focus();
- closeSearch(0);
- }
- });
-
-
- var checkboxChangeInit = false, minimizeInit = false;
-
- $('.sidebarSearchField').bind('keyup', function () {
-
- // when the user selects 'added by me' resend the query with their userid attached
- if (!checkboxChangeInit) {
- $('.limitToMe').bind("change", function(e) {
- // set the value of the search equal to itself to retrigger the autocomplete event
- searchIsOpen = false;
- $('.sidebarSearchField').typeahead('setQuery',$('.sidebarSearchField').val());
- setTimeout(function() { searchIsOpen = true; }, 2000);
- });
- checkboxChangeInit = true;
- }
-
- // when the user clicks minimize section, hide the results for that section
- if (!minimizeInit) {
- $('.minimizeMapperResults').click(function(e) {
- var s = $('.tt-dataset-mappers .tt-suggestions');
- console.log(s.css('height'));
- if (s.css('height') == '0px') {
- $('.tt-dataset-mappers .tt-suggestions').css({'height':'auto','overflow':'visible'});
- $(this).removeClass('maximizeResults').addClass('minimizeResults');
- } else {
- $('.tt-dataset-mappers .tt-suggestions').css({'height':'0','overflow':'hidden'});
- $(this).removeClass('minimizeResults').addClass('maximizeResults');
- }
- });
- $('.minimizeTopicResults').click(function(e) {
- var s = $('.tt-dataset-topics .tt-suggestions');
- console.log(s.css('height'));
- if (s.css('height') == '0px') {
- s.css({'height':'auto','border-top':'none','overflow':'visible'});
- $(this).removeClass('maximizeResults').addClass('minimizeResults');
- } else {
- s.css({'height':'0','border-top':'1px solid rgb(56, 56, 56)','overflow':'hidden'});
- $(this).removeClass('minimizeResults').addClass('maximizeResults');
- }
- });
- $('.minimizeMapResults').click(function(e) {
- var s = $('.tt-dataset-maps .tt-suggestions');
- console.log(s.css('height'));
- if (s.css('height') == '0px') {
- s.css({'height':'auto','border-top':'none','overflow':'visible'});
- $(this).removeClass('maximizeResults').addClass('minimizeResults');
- } else {
- s.css({'height':'0','border-top':'1px solid rgb(56, 56, 56)','overflow':'hidden'});
- $(this).removeClass('minimizeResults').addClass('maximizeResults');
- }
- });
- minimizeInit = true;
- }
- });
-
- //
-
- $('.sidebarSearch button.addToMap').click(function(event){
- event.stopPropagation();
- });
- } // end bindSearchHover
-
- function bindAccountHover() {
-
- var accountIsOpen = false
-
- // controls the sliding hover of the bottom left menu
- var sliding1 = false;
- var lT;
-
- var closeAccount = function() {
- lT = setTimeout(function() {
- if (! sliding1) {
- sliding1 = true;
- $('.sidebarAccountIcon').css('background-color','#0F1519');
- $('.sidebarAccountBox').fadeOut(200, function() {
- sliding1 = false;
- accountIsOpen = false;
- });
- }
- },300);
- }
-
- var openAccount = function() {
- clearTimeout(lT);
- if (! sliding1) {
- sliding1 = true;
-
- // hide the other two
- $('.sidebarFilterBox').hide();
- $('.sidebarWandBox').hide();
- $('.sidebarFilterIcon').css('background-color','#0F1519');
- $('.sidebarWandIcon').css('background-color','#0F1519');
-
- $('.sidebarAccountIcon').css('background-color','#000');
- $('.sidebarAccountBox').fadeIn(200, function() {
- sliding1 = false;
- accountIsOpen = true;
- });
+ });
+
+ //
+
+ $('.sidebarSearch button.addToMap').click(function (event) {
+ event.stopPropagation();
+ });
+ } // end bindSearchHover
+
+ function bindAccountHover() {
+
+ var accountIsOpen = false
+
+ // controls the sliding hover of the bottom left menu
+ var sliding1 = false;
+ var lT;
+
+ var closeAccount = function () {
+ lT = setTimeout(function () {
+ if (!sliding1) {
+ sliding1 = true;
+ $('.sidebarAccountIcon').css('background-color', '#0F1519');
+ $('.sidebarAccountBox').fadeOut(200, function () {
+ sliding1 = false;
+ accountIsOpen = false;
+ });
+ }
+ }, 300);
}
- }
- // bind the hover events
+
+ var openAccount = function () {
+ clearTimeout(lT);
+ if (!sliding1) {
+ sliding1 = true;
+
+ // hide the other two
+ $('.sidebarFilterBox').hide();
+ $('.sidebarWandBox').hide();
+ $('.sidebarFilterIcon').css('background-color', '#0F1519');
+ $('.sidebarWandIcon').css('background-color', '#0F1519');
+
+ $('.sidebarAccountIcon').css('background-color', '#000');
+ $('.sidebarAccountBox').fadeIn(200, function () {
+ sliding1 = false;
+ accountIsOpen = true;
+ });
+ }
+ }
+ // bind the hover events
$(".sidebarAccount").hover(openAccount, closeAccount);
- } // end bindAccountHover
-
- // bind hover events
- bindMainMenuHover();
- bindSearchHover();
- bindAccountHover();
-
- // disable right click events on the new topic and new synapse input fields
- $('#new_topic, #new_synapse').bind('contextmenu', function(e){
- return false;
- });
-
- // initialize the autocomplete results for the metacode spinner
- $('#topic_name').typeahead([
- {
+ } // end bindAccountHover
+
+ // bind hover events
+ bindMainMenuHover();
+ bindSearchHover();
+ bindAccountHover();
+
+ // disable right click events on the new topic and new synapse input fields
+ $('#new_topic, #new_synapse').bind('contextmenu', function (e) {
+ return false;
+ });
+
+ // initialize the autocomplete results for the metacode spinner
+ $('#topic_name').typeahead([
+ {
name: 'topic_autocomplete',
limit: 8,
template: '
{{label}}
{{originator}}
',
@@ -387,281 +429,292 @@ var labelType, useGradients, nativeTextSupport, animate, json, Mconsole = null,
engine: Hogan
}
]);
- // tell the autocomplete to submit the form with the topic you clicked on if you pick from the autocomplete
- $('#topic_name').bind('typeahead:selected', function (event, datum, dataset) {
+ // tell the autocomplete to submit the form with the topic you clicked on if you pick from the autocomplete
+ $('#topic_name').bind('typeahead:selected', function (event, datum, dataset) {
$('#topic_grabTopic').val(datum.id);
- event.preventDefault();
- event.stopPropagation();
- });
- // bind keyboard handlers
- $('#topic_name').bind('keyup', function(e) {
- switch(e.which) {
- case 13:
- $('.new_topic').submit();
- break;
- default: break;
- }
- });
-
- // initialize the autocomplete results for the metacode spinner
- $('#synapse_desc').typeahead([
- {
- name: 'synapse_autocomplete',
- template: "{{label}}",
- remote: {
- url: '/search/synapses?term=%QUERY'
- },
- engine: Hogan
- },
- {
- name: 'existing_synapses',
- limit: 50,
- template: $('.synapseTemplate').html(),
- remote: {
- url: '/search/synapses',
- replace: function () {
- var q = '/search/synapses?topic1id=' + $('#synapse_topic1id').val() + '&topic2id=' + $('#synapse_topic2id').val();
- return q;
- }
- },
- engine: Hogan,
- header: "Existing Synapses
"
- },
- ]);
- // tell the autocomplete to submit the form with the topic you clicked on if you pick from the autocomplete
- $('#synapse_desc').bind('typeahead:selected', function (event, datum, dataset) {
- if (datum.id) { // if they clicked on an existing synapse get it
- $('#synapse_grabSynapse').val(datum.id);
- }
event.preventDefault();
event.stopPropagation();
- });
- // bind keyboard handlers
- $('#synapse_desc').bind('keyup', function(e) {
- switch(e.which) {
- case 13:
- $('.new_synapse').submit();
- break;
- default: break;
- }
- });
-
- // when either form submits, don't leave the page
- $('.new_topic, .new_synapse').bind('submit', function(event, data){
- event.preventDefault();
- });
-
-
- //$(".scroll").mCustomScrollbar();
-
- // initialize scroll bar for filter by metacode, then hide it and position it correctly again
- $("#filter_by_metacode").mCustomScrollbar({advanced: { updateOnContentResize: true }});
- $('.sidebarFilterBox').hide().css({
- position:'absolute',
- top: '35px',
- right: '-36px'
- });
-
- // initialize metacode spinner and then hide it
- $("#metacodeImg").CloudCarousel( {
- titleBox: $('#metacodeImgTitle'),
- yRadius:40,
- xPos: 150,
- yPos: 40,
- speed:0.3,
- mouseWheel:true,
- bringToFront: true
- });
- $('.new_topic').hide();
-
-
- $('.notice.metamaps').delay(10000).fadeOut('fast');
- $('.alert.metamaps').delay(10000).fadeOut('fast');
-
- $('#center-container').bind('contextmenu', function(e){
- return false;
- });
-
- addHoverForSettings();
-
- //bind best_in_place ajax callbacks
- $('.best_in_place_desc').bind("ajax:success", function() {
- $(this).parents('.CardOnGraph').find('.scroll').mCustomScrollbar("update");
- });
- $('.best_in_place_link').bind("ajax:success", function() {
- var link = $(this).html();
- $(this).parents('.CardOnGraph').find('.go-link').attr('href', link);
- });
-
- //bind lightbox clicks
- $('.openLightbox').click(function(event) {
- openLightbox($(this).attr('data-open'));
- event.preventDefault();
- return false;
- });
-
- // bind permission changer events
- $('.permIcon').click(function() {
- $(this).siblings('#map_permission').val( $(this).attr('data-permission') );
- $(this).siblings('.permIcon').find('.mapPermIcon').removeClass('selected');
- $(this).find('.mapPermIcon').addClass('selected');
- });
-
- // bind keyboard handlers
- $('body').bind('keyup', function(e) {
- switch(e.which) {
- case 13: enterKeyHandler(e); break;
- case 27: escKeyHandler(); break;
- default: break; //console.log(e.which);
- }
- });
-
-}); // end document.ready
+ });
+ // bind keyboard handlers
+ $('#topic_name').bind('keyup', function (e) {
+ switch (e.which) {
+ case 13:
+ $('.new_topic').submit();
+ break;
+ default:
+ break;
+ }
+ });
+
+ // initialize the autocomplete results for the metacode spinner
+ $('#synapse_desc').typeahead([
+ {
+ name: 'synapse_autocomplete',
+ template: "{{label}}",
+ remote: {
+ url: '/search/synapses?term=%QUERY'
+ },
+ engine: Hogan
+ },
+ {
+ name: 'existing_synapses',
+ limit: 50,
+ template: $('.synapseTemplate').html(),
+ remote: {
+ url: '/search/synapses',
+ replace: function () {
+ var q = '/search/synapses?topic1id=' + $('#synapse_topic1id').val() + '&topic2id=' + $('#synapse_topic2id').val();
+ return q;
+ }
+ },
+ engine: Hogan,
+ header: "Existing Synapses
"
+ },
+ ]);
+ // tell the autocomplete to submit the form with the topic you clicked on if you pick from the autocomplete
+ $('#synapse_desc').bind('typeahead:selected', function (event, datum, dataset) {
+ if (datum.id) { // if they clicked on an existing synapse get it
+ $('#synapse_grabSynapse').val(datum.id);
+ }
+ event.preventDefault();
+ event.stopPropagation();
+ });
+ // bind keyboard handlers
+ $('#synapse_desc').bind('keyup', function (e) {
+ switch (e.which) {
+ case 13:
+ $('.new_synapse').submit();
+ break;
+ default:
+ break;
+ }
+ });
+
+ // when either form submits, don't leave the page
+ $('.new_topic, .new_synapse').bind('submit', function (event, data) {
+ event.preventDefault();
+ });
+
+
+ //$(".scroll").mCustomScrollbar();
+
+ // initialize scroll bar for filter by metacode, then hide it and position it correctly again
+ $("#filter_by_metacode").mCustomScrollbar({
+ advanced: {
+ updateOnContentResize: true
+ }
+ });
+ $('.sidebarFilterBox').hide().css({
+ position: 'absolute',
+ top: '35px',
+ right: '-36px'
+ });
+
+ // initialize metacode spinner and then hide it
+ $("#metacodeImg").CloudCarousel({
+ titleBox: $('#metacodeImgTitle'),
+ yRadius: 40,
+ xPos: 150,
+ yPos: 40,
+ speed: 0.3,
+ mouseWheel: true,
+ bringToFront: true
+ });
+ $('.new_topic').hide();
+
+
+ $('.notice.metamaps').delay(10000).fadeOut('fast');
+ $('.alert.metamaps').delay(10000).fadeOut('fast');
+
+ $('#center-container').bind('contextmenu', function (e) {
+ return false;
+ });
+
+ addHoverForSettings();
+
+ //bind best_in_place ajax callbacks
+ $('.best_in_place_desc').bind("ajax:success", function () {
+ $(this).parents('.CardOnGraph').find('.scroll').mCustomScrollbar("update");
+ });
+ $('.best_in_place_link').bind("ajax:success", function () {
+ var link = $(this).html();
+ $(this).parents('.CardOnGraph').find('.go-link').attr('href', link);
+ });
+
+ //bind lightbox clicks
+ $('.openLightbox').click(function (event) {
+ openLightbox($(this).attr('data-open'));
+ event.preventDefault();
+ return false;
+ });
+
+ // bind permission changer events
+ $('.permIcon').click(function () {
+ $(this).siblings('#map_permission').val($(this).attr('data-permission'));
+ $(this).siblings('.permIcon').find('.mapPermIcon').removeClass('selected');
+ $(this).find('.mapPermIcon').addClass('selected');
+ });
+
+ // bind keyboard handlers
+ $('body').bind('keyup', function (e) {
+ switch (e.which) {
+ case 13:
+ enterKeyHandler(e);
+ break;
+ case 27:
+ escKeyHandler();
+ break;
+ default:
+ break; //console.log(e.which);
+ }
+ });
+
+}); // end document.ready
function addHoverForSettings() {
- // controls the sliding hover of the settings for cards
- $(".permActivator").unbind('mouseover');
- $(".permActivator").unbind('mouseout');
- var sliding2 = false;
- var lT1,lT2;
- $(".permActivator").bind('mouseover',
- function () {
- clearTimeout(lT2);
- that = this;
- lT1 = setTimeout(function() {
- if (! sliding2) {
- sliding2 = true;
- $(that).animate({
- width: '203px',
- height: '37px'
- }, 300, function() {
- sliding2 = false;
- });
- }
- }, 300);
- });
-
- $(".permActivator").bind('mouseout',
+ // controls the sliding hover of the settings for cards
+ $(".permActivator").unbind('mouseover');
+ $(".permActivator").unbind('mouseout');
+ var sliding2 = false;
+ var lT1, lT2;
+ $(".permActivator").bind('mouseover',
function () {
- clearTimeout(lT1);
- that = this;
- lT2 = setTimeout(function() {
- if (! sliding2) {
- sliding2 = true;
- $(that).animate({
- height: '16px',
- width: '16px'
- }, 300, function() {
- sliding2 = false;
- });
- }
- },800);
- }
+ clearTimeout(lT2);
+ that = this;
+ lT1 = setTimeout(function () {
+ if (!sliding2) {
+ sliding2 = true;
+ $(that).animate({
+ width: '203px',
+ height: '37px'
+ }, 300, function () {
+ sliding2 = false;
+ });
+ }
+ }, 300);
+ });
+
+ $(".permActivator").bind('mouseout',
+ function () {
+ clearTimeout(lT1);
+ that = this;
+ lT2 = setTimeout(function () {
+ if (!sliding2) {
+ sliding2 = true;
+ $(that).animate({
+ height: '16px',
+ width: '16px'
+ }, 300, function () {
+ sliding2 = false;
+ });
+ }
+ }, 800);
+ }
);
-
- $('.best_in_place_permission').unbind("ajax:success");
+
+ $('.best_in_place_permission').unbind("ajax:success");
//bind best_in_place ajax callbacks
- $('.best_in_place_permission').bind("ajax:success", function() {
- var permission = $(this).html();
- var el = $(this).parents('.cardSettings').find('.mapPerm');
- el.attr('title', permission);
- if (permission == "commons") el.html("co");
- else if (permission == "public") el.html("pu");
- else if (permission == "private") el.html("pr");
- });
-}
+ $('.best_in_place_permission').bind("ajax:success", function () {
+ var permission = $(this).html();
+ var el = $(this).parents('.cardSettings').find('.mapPerm');
+ el.attr('title', permission);
+ if (permission == "commons") el.html("co");
+ else if (permission == "public") el.html("pu");
+ else if (permission == "private") el.html("pr");
+ });
+} // end addHoverForSettings
// this is to save the layout of a map
function saveLayoutAll() {
- $('.sidebarSave .tip').html('Saving...');
- var coor = "";
- if (gType == "arranged" || gType == "chaotic") {
- Mconsole.graph.eachNode(function(n) {
- coor = coor + n.getData("mappingid") + '/' + n.pos.x + '/' + n.pos.y + ',';
- });
- coor = coor.slice(0, -1);
- $('#map_coordinates').val(coor);
- $('#saveMapLayout').submit();
- }
+ $('.sidebarSave .tip').html('Saving...');
+ var coor = "";
+ if (gType == "arranged" || gType == "chaotic") {
+ Mconsole.graph.eachNode(function (n) {
+ coor = coor + n.getData("mappingid") + '/' + n.pos.x + '/' + n.pos.y + ',';
+ });
+ coor = coor.slice(0, -1);
+ $('#map_coordinates').val(coor);
+ $('#saveMapLayout').submit();
+ }
}
// this is to update the location coordinate of a single node on a map
function saveLayout(id) {
- var n = Mconsole.graph.getNode(id);
- $('#map_coordinates').val(n.getData("mappingid") + '/' + n.pos.x + '/' + n.pos.y);
- $('#saveMapLayout').submit();
- dragged = 0;
- //$('.wandSaveLayout').html('Saved!');
- //setTimeout(function(){$('.wandSaveLayout').html('Save Layout')},1500);
+ var n = Mconsole.graph.getNode(id);
+ $('#map_coordinates').val(n.getData("mappingid") + '/' + n.pos.x + '/' + n.pos.y);
+ $('#saveMapLayout').submit();
+ dragged = 0;
+ //$('.wandSaveLayout').html('Saved!');
+ //setTimeout(function(){$('.wandSaveLayout').html('Save Layout')},1500);
}
// this is to save your console to a map
function saveToMap() {
- var nodes_data = "", synapses_data = "";
- var synapses_array = new Array();
- Mconsole.graph.eachNode(function(n) {
- //don't add to the map if it was filtered out
- if (categoryVisible[n.getData('metacode')] == false) {
- return;
- }
+ var nodes_data = "",
+ synapses_data = "";
+ var synapses_array = new Array();
+ Mconsole.graph.eachNode(function (n) {
+ //don't add to the map if it was filtered out
+ if (categoryVisible[n.getData('metacode')] == false) {
+ return;
+ }
- var x, y;
- if (n.pos.x && n.pos.y) {
- x = n.pos.x;
- y = n.pos.y;
- } else {
- var x = Math.cos(n.pos.theta) * n.pos.rho;
- var y = Math.sin(n.pos.theta) * n.pos.rho;
- }
- nodes_data += n.id + '/' + x + '/' + y + ',';
- n.eachAdjacency(function(adj) {
- synapses_array.push(adj.getData("id"));
+ var x, y;
+ if (n.pos.x && n.pos.y) {
+ x = n.pos.x;
+ y = n.pos.y;
+ } else {
+ var x = Math.cos(n.pos.theta) * n.pos.rho;
+ var y = Math.sin(n.pos.theta) * n.pos.rho;
+ }
+ nodes_data += n.id + '/' + x + '/' + y + ',';
+ n.eachAdjacency(function (adj) {
+ synapses_array.push(adj.getData("id"));
+ });
});
- });
- //get unique values only
- synapses_array = $.grep(synapses_array, function(value, key){
- return $.inArray(value, synapses_array) === key;
- });
+ //get unique values only
+ synapses_array = $.grep(synapses_array, function (value, key) {
+ return $.inArray(value, synapses_array) === key;
+ });
- synapses_data = synapses_array.join();
- nodes_data = nodes_data.slice(0, -1);
+ synapses_data = synapses_array.join();
+ nodes_data = nodes_data.slice(0, -1);
- $('#map_topicsToMap').val(nodes_data);
- $('#map_synapsesToMap').val(synapses_data);
- openLightbox('forkmap');
+ $('#map_topicsToMap').val(nodes_data);
+ $('#map_synapsesToMap').val(synapses_data);
+ openLightbox('forkmap');
}
function fetchRelatives(node) {
- var myA = $.ajax({
- type: "Get",
- url: "/topics/" + node.id + "?format=json",
- success: function(data) {
- if (gType == "centered") {
- Mconsole.busy = true;
- Mconsole.op.sum(data, {
- type: 'fade',
- duration: 500,
- hideLabels: false
- });
- Mconsole.graph.eachNode(function (n) {
- n.eachAdjacency(function (a) {
- if (!a.getData('showDesc')) {
- a.setData('alpha', 0.4, 'start');
- a.setData('alpha', 0.4, 'current');
- a.setData('alpha', 0.4, 'end');
+ var myA = $.ajax({
+ type: "Get",
+ url: "/topics/" + node.id + "?format=json",
+ success: function (data) {
+ if (gType == "centered") {
+ Mconsole.busy = true;
+ Mconsole.op.sum(data, {
+ type: 'fade',
+ duration: 500,
+ hideLabels: false
+ });
+ Mconsole.graph.eachNode(function (n) {
+ n.eachAdjacency(function (a) {
+ if (!a.getData('showDesc')) {
+ a.setData('alpha', 0.4, 'start');
+ a.setData('alpha', 0.4, 'current');
+ a.setData('alpha', 0.4, 'end');
+ }
+ });
+ });
+ Mconsole.busy = false;
+ } else {
+ Mconsole.op.sum(data, {
+ type: 'nothing',
+ });
+ Mconsole.plot();
}
- });
- });
- Mconsole.busy = false;
- }
- else {
- Mconsole.op.sum(data, {
- type: 'nothing',
- });
- Mconsole.plot();
- }
- /*Mconsole.op.contract(node, {
+ /*Mconsole.op.contract(node, {
type: 'replot'
});
Mconsole.op.expand(node, {
@@ -669,136 +722,155 @@ function fetchRelatives(node) {
transition: $jit.Trans.Elastic.easeOut,
duration: 1000
});*/
- },
- error: function(){
- alert('failure');
- }
- });
+ },
+ error: function () {
+ alert('failure');
+ }
+ });
}
// @param node = JIT node object
// @param metacode = STRING like "Idea", "Action", etc.
function updateMetacode(node, metacode) {
- var mdata = { "topic": { "metacode": metacode } };
- $.ajax({
- type: "PUT",
- dataType: 'json',
- url: "/topics/" + node.id,
- data: mdata,
- success: function(data) {
- $('.CardOnGraph').find('.metacodeTitle').text(metacode);
- $('.CardOnGraph').find('.metacodeImage').css('background-image', 'url(' + imgArray[metacode].src + ')');
- node.setData("metacode", metacode);
- Mconsole.plot();
- $('.metacodeTitle').removeClass('minimize'); // this line flips the pull up arrow to a drop down arrow
- $('.metacodeSelect').hide();
- setTimeout(function() { $('.metacodeTitle').hide(); $('.showcard .icon').css('z-index','1'); }, 500);
- },
- error: function(){
- alert('failed to update metacode');
- }
- });
+ var mdata = {
+ "topic": {
+ "metacode": metacode
+ }
+ };
+ $.ajax({
+ type: "PUT",
+ dataType: 'json',
+ url: "/topics/" + node.id,
+ data: mdata,
+ success: function (data) {
+ $('.CardOnGraph').find('.metacodeTitle').text(metacode);
+ $('.CardOnGraph').find('.metacodeImage').css('background-image', 'url(' + imgArray[metacode].src + ')');
+ node.setData("metacode", metacode);
+ Mconsole.plot();
+ $('.metacodeTitle').removeClass('minimize'); // this line flips the pull up arrow to a drop down arrow
+ $('.metacodeSelect').hide();
+ setTimeout(function () {
+ $('.metacodeTitle').hide();
+ $('.showcard .icon').css('z-index', '1');
+ }, 500);
+ },
+ error: function () {
+ alert('failed to update metacode');
+ }
+ });
}
function updateTopicPermission(node, permission) {
- var mdata = { "topic": { "permission": permission } };
- $.ajax({
- type: "PUT",
- dataType: 'json',
- url: "/topics/" + node.id,
- data: mdata,
- success: function(data) {
- $('.showcard .mapPerm').removeClass('co pu pr minimize').addClass( permission.substring(0,2) );
- $('.permissionSelect').remove();
- node.setData("permission", permission);
- },
- error: function(){
- alert('failed to update permission');
- }
- });
+ var mdata = {
+ "topic": {
+ "permission": permission
+ }
+ };
+ $.ajax({
+ type: "PUT",
+ dataType: 'json',
+ url: "/topics/" + node.id,
+ data: mdata,
+ success: function (data) {
+ $('.showcard .mapPerm').removeClass('co pu pr minimize').addClass(permission.substring(0, 2));
+ $('.permissionSelect').remove();
+ node.setData("permission", permission);
+ },
+ error: function () {
+ alert('failed to update permission');
+ }
+ });
}
function updateSynapsePermission(edge, permission) {
- var mdata = { "synapse": { "permission": permission } };
- $.ajax({
- type: "PUT",
- dataType: 'json',
- url: "/synapses/" + edge.data.$id,
- data: mdata,
- success: function(data) {
- $('#edit_synapse .mapPerm').removeClass('co pu pr minimize').addClass( permission.substring(0,2) );
- $('#edit_synapse .permissionSelect').remove();
- edge.setData("permission", permission);
- },
- error: function(){
- alert('failed to update permission');
- }
- });
+ var mdata = {
+ "synapse": {
+ "permission": permission
+ }
+ };
+ $.ajax({
+ type: "PUT",
+ dataType: 'json',
+ url: "/synapses/" + edge.data.$id,
+ data: mdata,
+ success: function (data) {
+ $('#edit_synapse .mapPerm').removeClass('co pu pr minimize').addClass(permission.substring(0, 2));
+ $('#edit_synapse .permissionSelect').remove();
+ edge.setData("permission", permission);
+ },
+ error: function () {
+ alert('failed to update permission');
+ }
+ });
}
function updateMapPermission(mapid, permission) {
- var mdata = { "map": { "permission": permission } };
- $.ajax({
- type: "PUT",
- dataType: 'json',
- url: "/maps/" + mapid,
- data: mdata,
- success: function(data) {
- $('.mapPermission').removeClass('commons public private minimize').addClass( permission );
- $('.mapPermission .permissionSelect').remove();
- },
- error: function(){
- alert('failed to update permission');
- }
- });
+ var mdata = {
+ "map": {
+ "permission": permission
+ }
+ };
+ $.ajax({
+ type: "PUT",
+ dataType: 'json',
+ url: "/maps/" + mapid,
+ data: mdata,
+ success: function (data) {
+ $('.mapPermission').removeClass('commons public private minimize').addClass(permission);
+ $('.mapPermission .permissionSelect').remove();
+ },
+ error: function () {
+ alert('failed to update permission');
+ }
+ });
}
function MconsoleReset() {
-
- var tX = Mconsole.canvas.translateOffsetX;
- var tY = Mconsole.canvas.translateOffsetY;
- Mconsole.canvas.translate(-tX,-tY);
-
- var mX = Mconsole.canvas.scaleOffsetX;
- var mY = Mconsole.canvas.scaleOffsetY;
- Mconsole.canvas.scale((1/mX),(1/mY));
+
+ var tX = Mconsole.canvas.translateOffsetX;
+ var tY = Mconsole.canvas.translateOffsetY;
+ Mconsole.canvas.translate(-tX, -tY);
+
+ var mX = Mconsole.canvas.scaleOffsetX;
+ var mY = Mconsole.canvas.scaleOffsetY;
+ Mconsole.canvas.scale((1 / mX), (1 / mY));
}
function openNodeShowcard(node) {
- //populate the card that's about to show with the right topics data
- populateShowCard(node);
+ //populate the card that's about to show with the right topics data
+ populateShowCard(node);
- $('.showcard').fadeIn('fast');
- var s = $('.showcard').find('.scroll');
- s.height( s.height() ).mCustomScrollbar();
- //node.setData('dim', 1, 'current');
- MetamapsModel.showcardInUse = node.id;
+ $('.showcard').fadeIn('fast');
+ var s = $('.showcard').find('.scroll');
+ s.height(s.height()).mCustomScrollbar();
+ //node.setData('dim', 1, 'current');
+ MetamapsModel.showcardInUse = node.id;
}
function openLightbox(which) {
- $('.lightboxContent').hide();
- $('#' + which).show();
-
- $('#lightbox_overlay').show();
- $('#lightbox_main').css('margin-top', '-' + ($('#lightbox_main').height() / 2) + 'px' );
+ $('.lightboxContent').hide();
+ $('#' + which).show();
+
+ $('#lightbox_overlay').show();
+ $('#lightbox_main').css('margin-top', '-' + ($('#lightbox_main').height() / 2) + 'px');
}
function cancelMapCreate(id) {
- $('#lightbox_overlay').hide();
-
- var form = $('#' + id);
+ $('#lightbox_overlay').hide();
- form.find('#map_name').val('');
- form.find('#map_desc').val('');
- form.find('#map_permission').val('commons');
+ var form = $('#' + id);
- if (id == "fork_map") {
- form.find('#map_topicsToMap').val('0');
- form.find('#map_synapsesToMap').val('0');
- }
- form.find('.mapPermIcon').removeClass('selected');
- form.find('.mapCommonsIcon').addClass('selected');
-
- return false;
-}
+ form.find('#map_name').val('');
+ form.find('#map_desc').val('');
+ form.find('#map_permission').val('commons');
+
+ if (id == "fork_map") {
+ form.find('#map_topicsToMap').val('0');
+ form.find('#map_synapsesToMap').val('0');
+ }
+ form.find('.mapPermIcon').removeClass('selected');
+ form.find('.mapCommonsIcon').addClass('selected');
+
+ return false;
+}
\ No newline at end of file
diff --git a/app/assets/javascripts/realtime/realtime.js b/app/assets/javascripts/realtime/realtime.js
new file mode 100644
index 00000000..97bc9850
--- /dev/null
+++ b/app/assets/javascripts/realtime/realtime.js
@@ -0,0 +1,75 @@
+window.realtime = {};
+
+window.realtime.addTopicToMap = function(topic) {
+ var newPos, tempForT;
+ Mconsole.graph.addNode(topic);
+ tempForT = Mconsole.graph.getNode(topic.id);
+ tempForT.setData('dim', 1, 'start');
+ tempForT.setData('dim', 25, 'end');
+ newPos = new $jit.Complex();
+ newPos.x = tempForT.data.$xloc;
+ newPos.y = tempForT.data.$yloc;
+ tempForT.setPos(newPos, 'start');
+ tempForT.setPos(newPos, 'current');
+ tempForT.setPos(newPos, 'end');
+ Mconsole.fx.plotNode(tempForT, Mconsole.canvas);
+ return Mconsole.labels.plotLabel(Mconsole.canvas, tempForT, Mconsole.config);
+};
+
+window.realtime.updateTopicOnMap = function(topic) {
+ var newPos, tempForT;
+ tempForT = Mconsole.graph.getNode(topic.id);
+ tempForT.data = topic.data;
+ tempForT.name = topic.name;
+ if (MetamapsModel.showcardInUse === topic.id) {
+ populateShowCard(tempForT);
+ }
+ newPos = new $jit.Complex();
+ newPos.x = tempForT.data.$xloc;
+ newPos.y = tempForT.data.$yloc;
+ tempForT.setPos(newPos, 'start');
+ tempForT.setPos(newPos, 'current');
+ tempForT.setPos(newPos, 'end');
+ return Mconsole.fx.animate({
+ modes: ['linear', 'node-property:dim', 'edge-property:lineWidth'],
+ transition: $jit.Trans.Quad.easeInOut,
+ duration: 500
+ });
+};
+
+window.realtime.addSynapseToMap = function(synapse) {
+ var Node1, Node2, tempForS;
+ Node1 = Mconsole.graph.getNode(synapse.data.$direction[0]);
+ Node2 = Mconsole.graph.getNode(synapse.data.$direction[1]);
+ Mconsole.graph.addAdjacence(Node1, Node2, {});
+ tempForS = Mconsole.graph.getAdjacence(Node1.id, Node2.id);
+ tempForS.setDataset('start', {
+ lineWidth: 0.4
+ });
+ tempForS.setDataset('end', {
+ lineWidth: 2
+ });
+ tempForS.data = synapse.data;
+ Mconsole.fx.plotLine(tempForS, Mconsole.canvas);
+ return Mconsole.fx.animate({
+ modes: ['linear', 'node-property:dim', 'edge-property:lineWidth'],
+ transition: $jit.Trans.Quad.easeInOut,
+ duration: 500
+ });
+};
+
+window.realtime.updateSynapseOnMap = function(synapse) {
+ var k, tempForS, v, wasShowDesc, _ref;
+ tempForS = Mconsole.graph.getAdjacence(synapse.data.$direction[0], synapse.data.$direction[1]);
+ wasShowDesc = tempForS.data.$showDesc;
+ _ref = synapse.data;
+ for (k in _ref) {
+ v = _ref[k];
+ tempForS.data[k] = v;
+ }
+ tempForS.data.$showDesc = wasShowDesc;
+ if (MetamapsModel.edgecardInUse === synapse.data.$id) {
+ editEdge(tempForS, false);
+ }
+ return Mconsole.plot();
+};
\ No newline at end of file
diff --git a/app/helpers/topics_helper.rb b/app/helpers/topics_helper.rb
index a97ce8b5..d89f1c9c 100644
--- a/app/helpers/topics_helper.rb
+++ b/app/helpers/topics_helper.rb
@@ -10,7 +10,7 @@ module TopicsHelper
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['typeImageURL'] = t.metacode.icon
topic['permission'] = t.permission
topic['mapCount'] = t.maps.count
topic['synapseCount'] = t.synapses.count
diff --git a/app/views/maps/show.html.erb b/app/views/maps/show.html.erb
index d7296222..306abe4f 100644
--- a/app/views/maps/show.html.erb
+++ b/app/views/maps/show.html.erb
@@ -77,7 +77,7 @@
$(document).ready(function() {
function bindFilterHover() {
- var filterIsOpen = false
+ var filterIsOpen = false;
// controls the sliding hover of the bottom left menu
var sliding1 = false;
@@ -121,7 +121,7 @@
function bindInfoHover() {
- var infoIsOpen = false
+ var infoIsOpen = false;
// controls the sliding hover of the bottom left menu
var sliding1 = false;
@@ -254,9 +254,9 @@
initialize("chaotic", true);
});
}
- window.realtime.socket = io.connect('http://gentle-savannah-1303.herokuapp.com'); // this is for the heroku staging environment
+ //window.realtime.socket = io.connect('http://gentle-savannah-1303.herokuapp.com'); // this is for the heroku staging environment
//window.realtime.socket = io.connect('http://metamaps.cc:5001'); // this is for metamaps.cc
- //window.realtime.socket = io.connect('http://localhost:5001'); // this is for localhost development
+ window.realtime.socket = io.connect('http://localhost:5001'); // this is for localhost development
window.realtime.socket.on('connect', function() {
subscribeToRooms();
diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb
index 33faa7e8..b5cbef16 100644
--- a/app/views/users/edit.html.erb
+++ b/app/views/users/edit.html.erb
@@ -5,8 +5,8 @@
#%>
<% content_for :title, @user.name + "'s Settings | Metamaps" %>
-<%= formula_form_for @user, url: user_url do |form| %>
Your Settings
+<%= formula_form_for @user, url: user_url do |form| %>
Edit Account
<%= form.input :name, label: "Name", class: "name" %>
<%= form.input :email, label: "Email", class: "email" %>
diff --git a/config/database.yml.default b/config/database.yml.default
new file mode 100644
index 00000000..06bfae01
--- /dev/null
+++ b/config/database.yml.default
@@ -0,0 +1,10 @@
+development:
+ min_messages: WARNING
+ adapter: postgresql
+ host: 127.0.0.1
+ port: 5432
+ encoding: unicode
+ database: metamap002_development
+ pool: 5
+ username: postgres
+ password: "3112"
\ No newline at end of file
diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb
index 37323a01..2924b11e 100644
--- a/config/initializers/devise.rb
+++ b/config/initializers/devise.rb
@@ -10,8 +10,8 @@ Devise.setup do |config|
# config.mailer = "Devise::Mailer"
- if Rails.env.development?
- #config.secret_key = 'f71c467e526f23d614b3b08866cad4788c502bed869c282f06e73ee6c94675b62fe1f6d52fa7ba8196b33031f0d2f3b67e27ea07693c52ecebccb01700cad614'
+ if Rails.env.development? # this is for Connors localhost
+ config.secret_key = 'f71c467e526f23d614b3b08866cad4788c502bed869c282f06e73ee6c94675b62fe1f6d52fa7ba8196b33031f0d2f3b67e27ea07693c52ecebccb01700cad614'
end
if Rails.env.production? # this is for the heroku staging environment
config.secret_key = 'd91ba0da95749174ee2b8922034783cbde4945409ed28b13383e18e72844beb74467f8199e9e216f0687cd2290c6e46bf74da24486d14bba3671d76c5b10c753'