Merge branch 'develop' of https://github.com/Connoropolous/metamaps_gen002
This commit is contained in:
commit
427fa99a0c
34 changed files with 1418 additions and 501 deletions
BIN
app/assets/images/arrow_sprite-alt.png
Normal file
BIN
app/assets/images/arrow_sprite-alt.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 715 B |
BIN
app/assets/images/arrowpermswhite_sprite.png
Normal file
BIN
app/assets/images/arrowpermswhite_sprite.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 540 B |
|
@ -22,4 +22,7 @@
|
||||||
//= require ./src/Metamaps.Views
|
//= require ./src/Metamaps.Views
|
||||||
//= require ./src/JIT
|
//= require ./src/JIT
|
||||||
//= require ./src/Metamaps
|
//= require ./src/Metamaps
|
||||||
//= require ./src/Metamaps.JIT
|
//= require ./src/Metamaps.JIT
|
||||||
|
//= require_directory ./shims
|
||||||
|
//= require_directory ./require
|
||||||
|
//= require_directory ./famous
|
50
app/assets/javascripts/famous/famous.min.js
vendored
Normal file
50
app/assets/javascripts/famous/famous.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
32
app/assets/javascripts/lib/barometer.js
Normal file
32
app/assets/javascripts/lib/barometer.js
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
var BAROMETER;
|
||||||
|
if(BAROMETER == undefined) {
|
||||||
|
BAROMETER = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
BAROMETER.load = function(barometer_id) {
|
||||||
|
this.barometer_id = barometer_id;
|
||||||
|
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.tab_html = '<a id="barometer_tab" onclick="BAROMETER.show();" href="#">Feedback</a>';
|
||||||
|
this.overlay_html = '<div id="barometer_overlay" style="display: none;">' +
|
||||||
|
'<div id="barometer_main" style="top: 130.95px;">' +
|
||||||
|
'<a id="barometer_close" onclick="document.getElementById(\'barometer_overlay\').style.display = \'none\';return false" href="#"/></a>' +
|
||||||
|
'<div id="overlay_header">' +
|
||||||
|
'<a href="http://getbarometer.com">Powered by Barometer</a>' +
|
||||||
|
'</div>' +
|
||||||
|
'<iframe src="' + this.empty_url + '" id="barometer_iframe" allowTransparency="true" scrolling="no" frameborder="0" class="loading"></iframe>' +
|
||||||
|
'</div>' +
|
||||||
|
'<div id="barometer_screen" onclick="document.getElementById(\'barometer_overlay\').style.display = \'none\';return false" style="height: 100%;"/>' +
|
||||||
|
'</div>' +
|
||||||
|
'</div>';
|
||||||
|
|
||||||
|
document.write(this.tab_html);
|
||||||
|
document.write(this.overlay_html);
|
||||||
|
};
|
||||||
|
|
||||||
|
BAROMETER.show = function() {
|
||||||
|
document.getElementById('barometer_iframe').setAttribute("src", this.feedback_url);
|
||||||
|
document.getElementById('barometer_overlay').style.display = "block";
|
||||||
|
return false;
|
||||||
|
};
|
|
@ -922,10 +922,17 @@
|
||||||
this.dropdownView = new DropdownView({
|
this.dropdownView = new DropdownView({
|
||||||
menu: $menu
|
menu: $menu
|
||||||
}).on("suggestionSelected", this._handleSelection).on("cursorMoved", this._clearHint).on("cursorMoved", this._setInputValueToSuggestionUnderCursor).on("cursorRemoved", this._setInputValueToQuery).on("cursorRemoved", this._updateHint).on("suggestionsRendered", this._updateHint).on("opened", this._updateHint).on("closed", this._clearHint).on("opened closed", this._propagateEvent);
|
}).on("suggestionSelected", this._handleSelection).on("cursorMoved", this._clearHint).on("cursorMoved", this._setInputValueToSuggestionUnderCursor).on("cursorRemoved", this._setInputValueToQuery).on("cursorRemoved", this._updateHint).on("suggestionsRendered", this._updateHint).on("opened", this._updateHint).on("closed", this._clearHint).on("opened closed", this._propagateEvent);
|
||||||
|
// START METAMAPS CODE
|
||||||
|
this.dropdownView.on('suggestionsRendered', this._suggestionsRendered);
|
||||||
|
// END METAMAPS CODE
|
||||||
|
|
||||||
this.inputView = new InputView({
|
this.inputView = new InputView({
|
||||||
input: $input,
|
input: $input,
|
||||||
hint: $hint
|
hint: $hint
|
||||||
}).on("focused", this._openDropdown).on("blured", this._closeDropdown).on("blured", this._setInputValueToQuery).on("enterKeyed tabKeyed", this._handleSelection).on("queryChanged", this._clearHint).on("queryChanged", this._clearSuggestions).on("queryChanged", this._getSuggestions).on("whitespaceChanged", this._updateHint).on("queryChanged whitespaceChanged", this._openDropdown).on("queryChanged whitespaceChanged", this._setLanguageDirection).on("escKeyed", this._closeDropdown).on("escKeyed", this._setInputValueToQuery).on("tabKeyed upKeyed downKeyed", this._managePreventDefault).on("upKeyed downKeyed", this._moveDropdownCursor).on("upKeyed downKeyed", this._openDropdown).on("tabKeyed leftKeyed rightKeyed", this._autocomplete);
|
}).on("focused", this._openDropdown).on("blured", this._closeDropdown).on("blured", this._setInputValueToQuery).on("enterKeyed tabKeyed", this._handleSelection).on("queryChanged", this._clearHint).on("queryChanged", this._clearSuggestions).on("queryChanged", this._getSuggestions).on("whitespaceChanged", this._updateHint).on("queryChanged whitespaceChanged", this._openDropdown).on("queryChanged whitespaceChanged", this._setLanguageDirection).on("escKeyed", this._closeDropdown).on("escKeyed", this._setInputValueToQuery).on("tabKeyed upKeyed downKeyed", this._managePreventDefault).on("upKeyed downKeyed", this._moveDropdownCursor).on("upKeyed downKeyed", this._openDropdown).on("tabKeyed leftKeyed rightKeyed", this._autocomplete);
|
||||||
|
// START METAMAPS CODE
|
||||||
|
this.inputView.on('queryChanged', this._queryChanged);
|
||||||
|
// END METAMAPS CODE
|
||||||
}
|
}
|
||||||
utils.mixin(TypeaheadView.prototype, EventTarget, {
|
utils.mixin(TypeaheadView.prototype, EventTarget, {
|
||||||
_managePreventDefault: function(e) {
|
_managePreventDefault: function(e) {
|
||||||
|
@ -952,6 +959,14 @@
|
||||||
this.dropdownView.setLanguageDirection(dir);
|
this.dropdownView.setLanguageDirection(dir);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// START METAMAPS CODE
|
||||||
|
_suggestionsRendered: function() {
|
||||||
|
this.eventBus.trigger('suggestionsRendered');
|
||||||
|
},
|
||||||
|
_queryChanged: function() {
|
||||||
|
this.eventBus.trigger('queryChanged');
|
||||||
|
},
|
||||||
|
// END METAMAPS CODE
|
||||||
_updateHint: function() {
|
_updateHint: function() {
|
||||||
var suggestion = this.dropdownView.getFirstSuggestion(), hint = suggestion ? suggestion.value : null, dropdownIsVisible = this.dropdownView.isVisible(), inputHasOverflow = this.inputView.isOverflow(), inputValue, query, escapedQuery, beginsWithQuery, match;
|
var suggestion = this.dropdownView.getFirstSuggestion(), hint = suggestion ? suggestion.value : null, dropdownIsVisible = this.dropdownView.isVisible(), inputHasOverflow = this.inputView.isOverflow(), inputValue, query, escapedQuery, beginsWithQuery, match;
|
||||||
if (hint && dropdownIsVisible && !inputHasOverflow) {
|
if (hint && dropdownIsVisible && !inputHasOverflow) {
|
||||||
|
|
36
app/assets/javascripts/require/require.js
Normal file
36
app/assets/javascripts/require/require.js
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
/*
|
||||||
|
RequireJS 2.1.11 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved.
|
||||||
|
Available via the MIT or new BSD license.
|
||||||
|
see: http://github.com/jrburke/requirejs for details
|
||||||
|
*/
|
||||||
|
var requirejs,require,define;
|
||||||
|
(function(ca){function G(b){return"[object Function]"===M.call(b)}function H(b){return"[object Array]"===M.call(b)}function v(b,c){if(b){var d;for(d=0;d<b.length&&(!b[d]||!c(b[d],d,b));d+=1);}}function U(b,c){if(b){var d;for(d=b.length-1;-1<d&&(!b[d]||!c(b[d],d,b));d-=1);}}function s(b,c){return ga.call(b,c)}function j(b,c){return s(b,c)&&b[c]}function B(b,c){for(var d in b)if(s(b,d)&&c(b[d],d))break}function V(b,c,d,g){c&&B(c,function(c,h){if(d||!s(b,h))g&&"object"===typeof c&&c&&!H(c)&&!G(c)&&!(c instanceof
|
||||||
|
RegExp)?(b[h]||(b[h]={}),V(b[h],c,d,g)):b[h]=c});return b}function t(b,c){return function(){return c.apply(b,arguments)}}function da(b){throw b;}function ea(b){if(!b)return b;var c=ca;v(b.split("."),function(b){c=c[b]});return c}function C(b,c,d,g){c=Error(c+"\nhttp://requirejs.org/docs/errors.html#"+b);c.requireType=b;c.requireModules=g;d&&(c.originalError=d);return c}function ha(b){function c(a,e,b){var f,n,c,d,g,h,i,I=e&&e.split("/");n=I;var m=l.map,k=m&&m["*"];if(a&&"."===a.charAt(0))if(e){n=
|
||||||
|
I.slice(0,I.length-1);a=a.split("/");e=a.length-1;l.nodeIdCompat&&R.test(a[e])&&(a[e]=a[e].replace(R,""));n=a=n.concat(a);d=n.length;for(e=0;e<d;e++)if(c=n[e],"."===c)n.splice(e,1),e-=1;else if(".."===c)if(1===e&&(".."===n[2]||".."===n[0]))break;else 0<e&&(n.splice(e-1,2),e-=2);a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if(b&&m&&(I||k)){n=a.split("/");e=n.length;a:for(;0<e;e-=1){d=n.slice(0,e).join("/");if(I)for(c=I.length;0<c;c-=1)if(b=j(m,I.slice(0,c).join("/")))if(b=j(b,d)){f=b;
|
||||||
|
g=e;break a}!h&&(k&&j(k,d))&&(h=j(k,d),i=e)}!f&&h&&(f=h,g=i);f&&(n.splice(0,g,f),a=n.join("/"))}return(f=j(l.pkgs,a))?f:a}function d(a){z&&v(document.getElementsByTagName("script"),function(e){if(e.getAttribute("data-requiremodule")===a&&e.getAttribute("data-requirecontext")===i.contextName)return e.parentNode.removeChild(e),!0})}function g(a){var e=j(l.paths,a);if(e&&H(e)&&1<e.length)return e.shift(),i.require.undef(a),i.require([a]),!0}function u(a){var e,b=a?a.indexOf("!"):-1;-1<b&&(e=a.substring(0,
|
||||||
|
b),a=a.substring(b+1,a.length));return[e,a]}function m(a,e,b,f){var n,d,g=null,h=e?e.name:null,l=a,m=!0,k="";a||(m=!1,a="_@r"+(M+=1));a=u(a);g=a[0];a=a[1];g&&(g=c(g,h,f),d=j(p,g));a&&(g?k=d&&d.normalize?d.normalize(a,function(a){return c(a,h,f)}):c(a,h,f):(k=c(a,h,f),a=u(k),g=a[0],k=a[1],b=!0,n=i.nameToUrl(k)));b=g&&!d&&!b?"_unnormalized"+(Q+=1):"";return{prefix:g,name:k,parentMap:e,unnormalized:!!b,url:n,originalName:l,isDefine:m,id:(g?g+"!"+k:k)+b}}function q(a){var e=a.id,b=j(k,e);b||(b=k[e]=new i.Module(a));
|
||||||
|
return b}function r(a,e,b){var f=a.id,n=j(k,f);if(s(p,f)&&(!n||n.defineEmitComplete))"defined"===e&&b(p[f]);else if(n=q(a),n.error&&"error"===e)b(n.error);else n.on(e,b)}function w(a,e){var b=a.requireModules,f=!1;if(e)e(a);else if(v(b,function(e){if(e=j(k,e))e.error=a,e.events.error&&(f=!0,e.emit("error",a))}),!f)h.onError(a)}function x(){S.length&&(ia.apply(A,[A.length,0].concat(S)),S=[])}function y(a){delete k[a];delete W[a]}function F(a,e,b){var f=a.map.id;a.error?a.emit("error",a.error):(e[f]=
|
||||||
|
!0,v(a.depMaps,function(f,c){var d=f.id,g=j(k,d);g&&(!a.depMatched[c]&&!b[d])&&(j(e,d)?(a.defineDep(c,p[d]),a.check()):F(g,e,b))}),b[f]=!0)}function D(){var a,e,b=(a=1E3*l.waitSeconds)&&i.startTime+a<(new Date).getTime(),f=[],c=[],h=!1,k=!0;if(!X){X=!0;B(W,function(a){var i=a.map,m=i.id;if(a.enabled&&(i.isDefine||c.push(a),!a.error))if(!a.inited&&b)g(m)?h=e=!0:(f.push(m),d(m));else if(!a.inited&&(a.fetched&&i.isDefine)&&(h=!0,!i.prefix))return k=!1});if(b&&f.length)return a=C("timeout","Load timeout for modules: "+
|
||||||
|
f,null,f),a.contextName=i.contextName,w(a);k&&v(c,function(a){F(a,{},{})});if((!b||e)&&h)if((z||fa)&&!Y)Y=setTimeout(function(){Y=0;D()},50);X=!1}}function E(a){s(p,a[0])||q(m(a[0],null,!0)).init(a[1],a[2])}function K(a){var a=a.currentTarget||a.srcElement,e=i.onScriptLoad;a.detachEvent&&!Z?a.detachEvent("onreadystatechange",e):a.removeEventListener("load",e,!1);e=i.onScriptError;(!a.detachEvent||Z)&&a.removeEventListener("error",e,!1);return{node:a,id:a&&a.getAttribute("data-requiremodule")}}function L(){var a;
|
||||||
|
for(x();A.length;){a=A.shift();if(null===a[0])return w(C("mismatch","Mismatched anonymous define() module: "+a[a.length-1]));E(a)}}var X,$,i,N,Y,l={waitSeconds:7,baseUrl:"./",paths:{},bundles:{},pkgs:{},shim:{},config:{}},k={},W={},aa={},A=[],p={},T={},ba={},M=1,Q=1;N={require:function(a){return a.require?a.require:a.require=i.makeRequire(a.map)},exports:function(a){a.usingExports=!0;if(a.map.isDefine)return a.exports?p[a.map.id]=a.exports:a.exports=p[a.map.id]={}},module:function(a){return a.module?
|
||||||
|
a.module:a.module={id:a.map.id,uri:a.map.url,config:function(){return j(l.config,a.map.id)||{}},exports:a.exports||(a.exports={})}}};$=function(a){this.events=j(aa,a.id)||{};this.map=a;this.shim=j(l.shim,a.id);this.depExports=[];this.depMaps=[];this.depMatched=[];this.pluginMaps={};this.depCount=0};$.prototype={init:function(a,e,b,f){f=f||{};if(!this.inited){this.factory=e;if(b)this.on("error",b);else this.events.error&&(b=t(this,function(a){this.emit("error",a)}));this.depMaps=a&&a.slice(0);this.errback=
|
||||||
|
b;this.inited=!0;this.ignore=f.ignore;f.enabled||this.enabled?this.enable():this.check()}},defineDep:function(a,e){this.depMatched[a]||(this.depMatched[a]=!0,this.depCount-=1,this.depExports[a]=e)},fetch:function(){if(!this.fetched){this.fetched=!0;i.startTime=(new Date).getTime();var a=this.map;if(this.shim)i.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],t(this,function(){return a.prefix?this.callPlugin():this.load()}));else return a.prefix?this.callPlugin():this.load()}},load:function(){var a=
|
||||||
|
this.map.url;T[a]||(T[a]=!0,i.load(this.map.id,a))},check:function(){if(this.enabled&&!this.enabling){var a,e,b=this.map.id;e=this.depExports;var f=this.exports,c=this.factory;if(this.inited)if(this.error)this.emit("error",this.error);else{if(!this.defining){this.defining=!0;if(1>this.depCount&&!this.defined){if(G(c)){if(this.events.error&&this.map.isDefine||h.onError!==da)try{f=i.execCb(b,c,e,f)}catch(d){a=d}else f=i.execCb(b,c,e,f);this.map.isDefine&&void 0===f&&((e=this.module)?f=e.exports:this.usingExports&&
|
||||||
|
(f=this.exports));if(a)return a.requireMap=this.map,a.requireModules=this.map.isDefine?[this.map.id]:null,a.requireType=this.map.isDefine?"define":"require",w(this.error=a)}else f=c;this.exports=f;if(this.map.isDefine&&!this.ignore&&(p[b]=f,h.onResourceLoad))h.onResourceLoad(i,this.map,this.depMaps);y(b);this.defined=!0}this.defining=!1;this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else this.fetch()}},callPlugin:function(){var a=
|
||||||
|
this.map,b=a.id,d=m(a.prefix);this.depMaps.push(d);r(d,"defined",t(this,function(f){var d,g;g=j(ba,this.map.id);var J=this.map.name,u=this.map.parentMap?this.map.parentMap.name:null,p=i.makeRequire(a.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){if(f.normalize&&(J=f.normalize(J,function(a){return c(a,u,!0)})||""),f=m(a.prefix+"!"+J,this.map.parentMap),r(f,"defined",t(this,function(a){this.init([],function(){return a},null,{enabled:!0,ignore:!0})})),g=j(k,f.id)){this.depMaps.push(f);
|
||||||
|
if(this.events.error)g.on("error",t(this,function(a){this.emit("error",a)}));g.enable()}}else g?(this.map.url=i.nameToUrl(g),this.load()):(d=t(this,function(a){this.init([],function(){return a},null,{enabled:!0})}),d.error=t(this,function(a){this.inited=!0;this.error=a;a.requireModules=[b];B(k,function(a){0===a.map.id.indexOf(b+"_unnormalized")&&y(a.map.id)});w(a)}),d.fromText=t(this,function(f,c){var g=a.name,J=m(g),k=O;c&&(f=c);k&&(O=!1);q(J);s(l.config,b)&&(l.config[g]=l.config[b]);try{h.exec(f)}catch(j){return w(C("fromtexteval",
|
||||||
|
"fromText eval for "+b+" failed: "+j,j,[b]))}k&&(O=!0);this.depMaps.push(J);i.completeLoad(g);p([g],d)}),f.load(a.name,p,d,l))}));i.enable(d,this);this.pluginMaps[d.id]=d},enable:function(){W[this.map.id]=this;this.enabling=this.enabled=!0;v(this.depMaps,t(this,function(a,b){var c,f;if("string"===typeof a){a=m(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap);this.depMaps[b]=a;if(c=j(N,a.id)){this.depExports[b]=c(this);return}this.depCount+=1;r(a,"defined",t(this,function(a){this.defineDep(b,
|
||||||
|
a);this.check()}));this.errback&&r(a,"error",t(this,this.errback))}c=a.id;f=k[c];!s(N,c)&&(f&&!f.enabled)&&i.enable(a,this)}));B(this.pluginMaps,t(this,function(a){var b=j(k,a.id);b&&!b.enabled&&i.enable(a,this)}));this.enabling=!1;this.check()},on:function(a,b){var c=this.events[a];c||(c=this.events[a]=[]);c.push(b)},emit:function(a,b){v(this.events[a],function(a){a(b)});"error"===a&&delete this.events[a]}};i={config:l,contextName:b,registry:k,defined:p,urlFetched:T,defQueue:A,Module:$,makeModuleMap:m,
|
||||||
|
nextTick:h.nextTick,onError:w,configure:function(a){a.baseUrl&&"/"!==a.baseUrl.charAt(a.baseUrl.length-1)&&(a.baseUrl+="/");var b=l.shim,c={paths:!0,bundles:!0,config:!0,map:!0};B(a,function(a,b){c[b]?(l[b]||(l[b]={}),V(l[b],a,!0,!0)):l[b]=a});a.bundles&&B(a.bundles,function(a,b){v(a,function(a){a!==b&&(ba[a]=b)})});a.shim&&(B(a.shim,function(a,c){H(a)&&(a={deps:a});if((a.exports||a.init)&&!a.exportsFn)a.exportsFn=i.makeShimExports(a);b[c]=a}),l.shim=b);a.packages&&v(a.packages,function(a){var b,
|
||||||
|
a="string"===typeof a?{name:a}:a;b=a.name;a.location&&(l.paths[b]=a.location);l.pkgs[b]=a.name+"/"+(a.main||"main").replace(ja,"").replace(R,"")});B(k,function(a,b){!a.inited&&!a.map.unnormalized&&(a.map=m(b))});if(a.deps||a.callback)i.require(a.deps||[],a.callback)},makeShimExports:function(a){return function(){var b;a.init&&(b=a.init.apply(ca,arguments));return b||a.exports&&ea(a.exports)}},makeRequire:function(a,e){function g(f,c,d){var j,l;e.enableBuildCallback&&(c&&G(c))&&(c.__requireJsBuild=
|
||||||
|
!0);if("string"===typeof f){if(G(c))return w(C("requireargs","Invalid require call"),d);if(a&&s(N,f))return N[f](k[a.id]);if(h.get)return h.get(i,f,a,g);j=m(f,a,!1,!0);j=j.id;return!s(p,j)?w(C("notloaded",'Module name "'+j+'" has not been loaded yet for context: '+b+(a?"":". Use require([])"))):p[j]}L();i.nextTick(function(){L();l=q(m(null,a));l.skipMap=e.skipMap;l.init(f,c,d,{enabled:!0});D()});return g}e=e||{};V(g,{isBrowser:z,toUrl:function(b){var e,d=b.lastIndexOf("."),g=b.split("/")[0];if(-1!==
|
||||||
|
d&&(!("."===g||".."===g)||1<d))e=b.substring(d,b.length),b=b.substring(0,d);return i.nameToUrl(c(b,a&&a.id,!0),e,!0)},defined:function(b){return s(p,m(b,a,!1,!0).id)},specified:function(b){b=m(b,a,!1,!0).id;return s(p,b)||s(k,b)}});a||(g.undef=function(b){x();var c=m(b,a,!0),e=j(k,b);d(b);delete p[b];delete T[c.url];delete aa[b];U(A,function(a,c){a[0]===b&&A.splice(c,1)});e&&(e.events.defined&&(aa[b]=e.events),y(b))});return g},enable:function(a){j(k,a.id)&&q(a).enable()},completeLoad:function(a){var b,
|
||||||
|
c,f=j(l.shim,a)||{},d=f.exports;for(x();A.length;){c=A.shift();if(null===c[0]){c[0]=a;if(b)break;b=!0}else c[0]===a&&(b=!0);E(c)}c=j(k,a);if(!b&&!s(p,a)&&c&&!c.inited){if(l.enforceDefine&&(!d||!ea(d)))return g(a)?void 0:w(C("nodefine","No define call for "+a,null,[a]));E([a,f.deps||[],f.exportsFn])}D()},nameToUrl:function(a,b,c){var f,d,g;(f=j(l.pkgs,a))&&(a=f);if(f=j(ba,a))return i.nameToUrl(f,b,c);if(h.jsExtRegExp.test(a))f=a+(b||"");else{f=l.paths;a=a.split("/");for(d=a.length;0<d;d-=1)if(g=a.slice(0,
|
||||||
|
d).join("/"),g=j(f,g)){H(g)&&(g=g[0]);a.splice(0,d,g);break}f=a.join("/");f+=b||(/^data\:|\?/.test(f)||c?"":".js");f=("/"===f.charAt(0)||f.match(/^[\w\+\.\-]+:/)?"":l.baseUrl)+f}return l.urlArgs?f+((-1===f.indexOf("?")?"?":"&")+l.urlArgs):f},load:function(a,b){h.load(i,a,b)},execCb:function(a,b,c,d){return b.apply(d,c)},onScriptLoad:function(a){if("load"===a.type||ka.test((a.currentTarget||a.srcElement).readyState))P=null,a=K(a),i.completeLoad(a.id)},onScriptError:function(a){var b=K(a);if(!g(b.id))return w(C("scripterror",
|
||||||
|
"Script error for: "+b.id,a,[b.id]))}};i.require=i.makeRequire();return i}var h,x,y,D,K,E,P,L,q,Q,la=/(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,ma=/[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,R=/\.js$/,ja=/^\.\//;x=Object.prototype;var M=x.toString,ga=x.hasOwnProperty,ia=Array.prototype.splice,z=!!("undefined"!==typeof window&&"undefined"!==typeof navigator&&window.document),fa=!z&&"undefined"!==typeof importScripts,ka=z&&"PLAYSTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/,
|
||||||
|
Z="undefined"!==typeof opera&&"[object Opera]"===opera.toString(),F={},r={},S=[],O=!1;if("undefined"===typeof define){if("undefined"!==typeof requirejs){if(G(requirejs))return;r=requirejs;requirejs=void 0}"undefined"!==typeof require&&!G(require)&&(r=require,require=void 0);h=requirejs=function(b,c,d,g){var u,m="_";!H(b)&&"string"!==typeof b&&(u=b,H(c)?(b=c,c=d,d=g):b=[]);u&&u.context&&(m=u.context);(g=j(F,m))||(g=F[m]=h.s.newContext(m));u&&g.configure(u);return g.require(b,c,d)};h.config=function(b){return h(b)};
|
||||||
|
h.nextTick="undefined"!==typeof setTimeout?function(b){setTimeout(b,4)}:function(b){b()};require||(require=h);h.version="2.1.11";h.jsExtRegExp=/^\/|:|\?|\.js$/;h.isBrowser=z;x=h.s={contexts:F,newContext:ha};h({});v(["toUrl","undef","defined","specified"],function(b){h[b]=function(){var c=F._;return c.require[b].apply(c,arguments)}});if(z&&(y=x.head=document.getElementsByTagName("head")[0],D=document.getElementsByTagName("base")[0]))y=x.head=D.parentNode;h.onError=da;h.createNode=function(b){var c=
|
||||||
|
b.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");c.type=b.scriptType||"text/javascript";c.charset="utf-8";c.async=!0;return c};h.load=function(b,c,d){var g=b&&b.config||{};if(z)return g=h.createNode(g,c,d),g.setAttribute("data-requirecontext",b.contextName),g.setAttribute("data-requiremodule",c),g.attachEvent&&!(g.attachEvent.toString&&0>g.attachEvent.toString().indexOf("[native code"))&&!Z?(O=!0,g.attachEvent("onreadystatechange",b.onScriptLoad)):
|
||||||
|
(g.addEventListener("load",b.onScriptLoad,!1),g.addEventListener("error",b.onScriptError,!1)),g.src=d,L=g,D?y.insertBefore(g,D):y.appendChild(g),L=null,g;if(fa)try{importScripts(d),b.completeLoad(c)}catch(j){b.onError(C("importscripts","importScripts failed for "+c+" at "+d,j,[c]))}};z&&!r.skipDataMain&&U(document.getElementsByTagName("script"),function(b){y||(y=b.parentNode);if(K=b.getAttribute("data-main"))return q=K,r.baseUrl||(E=q.split("/"),q=E.pop(),Q=E.length?E.join("/")+"/":"./",r.baseUrl=
|
||||||
|
Q),q=q.replace(R,""),h.jsExtRegExp.test(q)&&(q=K),r.deps=r.deps?r.deps.concat(q):[q],!0});define=function(b,c,d){var g,h;"string"!==typeof b&&(d=c,c=b,b=null);H(c)||(d=c,c=null);!c&&G(d)&&(c=[],d.length&&(d.toString().replace(la,"").replace(ma,function(b,d){c.push(d)}),c=(1===d.length?["require"]:["require","exports","module"]).concat(c)));if(O){if(!(g=L))P&&"interactive"===P.readyState||U(document.getElementsByTagName("script"),function(b){if("interactive"===b.readyState)return P=b}),g=P;g&&(b||
|
||||||
|
(b=g.getAttribute("data-requiremodule")),h=F[g.getAttribute("data-requirecontext")])}(h?h.defQueue:S).push([b,c,d])};define.amd={jQuery:!0};h.exec=function(b){return eval(b)};h(r)}})(this);
|
138
app/assets/javascripts/shims/classList.js
Normal file
138
app/assets/javascripts/shims/classList.js
Normal file
|
@ -0,0 +1,138 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
* classList.js: Cross-browser full element.classList implementation.
|
||||||
|
* 2011-06-15
|
||||||
|
*
|
||||||
|
* By Eli Grey, http://eligrey.com
|
||||||
|
* Public Domain.
|
||||||
|
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*global self, document, DOMException */
|
||||||
|
|
||||||
|
/*! @source http://purl.eligrey.com/github/classList.js/blob/master/classList.js*/
|
||||||
|
|
||||||
|
if (typeof document !== "undefined" && !("classList" in document.createElement("a"))) {
|
||||||
|
|
||||||
|
(function (view) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var
|
||||||
|
classListProp = "classList"
|
||||||
|
, protoProp = "prototype"
|
||||||
|
, elemCtrProto = (view.HTMLElement || view.Element)[protoProp]
|
||||||
|
, objCtr = Object
|
||||||
|
, strTrim = String[protoProp].trim || function () {
|
||||||
|
return this.replace(/^\s+|\s+$/g, "");
|
||||||
|
}
|
||||||
|
, arrIndexOf = Array[protoProp].indexOf || function (item) {
|
||||||
|
var
|
||||||
|
i = 0
|
||||||
|
, len = this.length
|
||||||
|
;
|
||||||
|
for (; i < len; i++) {
|
||||||
|
if (i in this && this[i] === item) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
// Vendors: please allow content code to instantiate DOMExceptions
|
||||||
|
, DOMEx = function (type, message) {
|
||||||
|
this.name = type;
|
||||||
|
this.code = DOMException[type];
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
, checkTokenAndGetIndex = function (classList, token) {
|
||||||
|
if (token === "") {
|
||||||
|
throw new DOMEx(
|
||||||
|
"SYNTAX_ERR"
|
||||||
|
, "An invalid or illegal string was specified"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (/\s/.test(token)) {
|
||||||
|
throw new DOMEx(
|
||||||
|
"INVALID_CHARACTER_ERR"
|
||||||
|
, "String contains an invalid character"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return arrIndexOf.call(classList, token);
|
||||||
|
}
|
||||||
|
, ClassList = function (elem) {
|
||||||
|
var
|
||||||
|
trimmedClasses = strTrim.call(elem.className)
|
||||||
|
, classes = trimmedClasses ? trimmedClasses.split(/\s+/) : []
|
||||||
|
, i = 0
|
||||||
|
, len = classes.length
|
||||||
|
;
|
||||||
|
for (; i < len; i++) {
|
||||||
|
this.push(classes[i]);
|
||||||
|
}
|
||||||
|
this._updateClassName = function () {
|
||||||
|
elem.className = this.toString();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
, classListProto = ClassList[protoProp] = []
|
||||||
|
, classListGetter = function () {
|
||||||
|
return new ClassList(this);
|
||||||
|
}
|
||||||
|
;
|
||||||
|
// Most DOMException implementations don't allow calling DOMException's toString()
|
||||||
|
// on non-DOMExceptions. Error's toString() is sufficient here.
|
||||||
|
DOMEx[protoProp] = Error[protoProp];
|
||||||
|
classListProto.item = function (i) {
|
||||||
|
return this[i] || null;
|
||||||
|
};
|
||||||
|
classListProto.contains = function (token) {
|
||||||
|
token += "";
|
||||||
|
return checkTokenAndGetIndex(this, token) !== -1;
|
||||||
|
};
|
||||||
|
classListProto.add = function (token) {
|
||||||
|
token += "";
|
||||||
|
if (checkTokenAndGetIndex(this, token) === -1) {
|
||||||
|
this.push(token);
|
||||||
|
this._updateClassName();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
classListProto.remove = function (token) {
|
||||||
|
token += "";
|
||||||
|
var index = checkTokenAndGetIndex(this, token);
|
||||||
|
if (index !== -1) {
|
||||||
|
this.splice(index, 1);
|
||||||
|
this._updateClassName();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
classListProto.toggle = function (token) {
|
||||||
|
token += "";
|
||||||
|
if (checkTokenAndGetIndex(this, token) === -1) {
|
||||||
|
this.add(token);
|
||||||
|
} else {
|
||||||
|
this.remove(token);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
classListProto.toString = function () {
|
||||||
|
return this.join(" ");
|
||||||
|
};
|
||||||
|
|
||||||
|
if (objCtr.defineProperty) {
|
||||||
|
var classListPropDesc = {
|
||||||
|
get: classListGetter
|
||||||
|
, enumerable: true
|
||||||
|
, configurable: true
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc);
|
||||||
|
} catch (ex) { // IE 8 doesn't support enumerable:true
|
||||||
|
if (ex.number === -0x7FF5EC54) {
|
||||||
|
classListPropDesc.enumerable = false;
|
||||||
|
objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (objCtr[protoProp].__defineGetter__) {
|
||||||
|
elemCtrProto.__defineGetter__(classListProp, classListGetter);
|
||||||
|
}
|
||||||
|
|
||||||
|
}(self));
|
||||||
|
|
||||||
|
}
|
23
app/assets/javascripts/shims/functionPrototypeBind.js
Normal file
23
app/assets/javascripts/shims/functionPrototypeBind.js
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
if (!Function.prototype.bind) {
|
||||||
|
Function.prototype.bind = function (oThis) {
|
||||||
|
if (typeof this !== "function") {
|
||||||
|
// closest thing possible to the ECMAScript 5 internal IsCallable function
|
||||||
|
throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
|
||||||
|
}
|
||||||
|
|
||||||
|
var aArgs = Array.prototype.slice.call(arguments, 1),
|
||||||
|
fToBind = this,
|
||||||
|
fNOP = function () {},
|
||||||
|
fBound = function () {
|
||||||
|
return fToBind.apply(this instanceof fNOP && oThis
|
||||||
|
? this
|
||||||
|
: oThis,
|
||||||
|
aArgs.concat(Array.prototype.slice.call(arguments)));
|
||||||
|
};
|
||||||
|
|
||||||
|
fNOP.prototype = this.prototype;
|
||||||
|
fBound.prototype = new fNOP();
|
||||||
|
|
||||||
|
return fBound;
|
||||||
|
};
|
||||||
|
}
|
13
app/assets/javascripts/shims/requestAnimationFrame.js
Normal file
13
app/assets/javascripts/shims/requestAnimationFrame.js
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
// adds requestAnimationFrame functionality
|
||||||
|
// Source: http://strd6.com/2011/05/better-window-requestanimationframe-shim/
|
||||||
|
|
||||||
|
window.requestAnimationFrame || (window.requestAnimationFrame =
|
||||||
|
window.webkitRequestAnimationFrame ||
|
||||||
|
window.mozRequestAnimationFrame ||
|
||||||
|
window.oRequestAnimationFrame ||
|
||||||
|
window.msRequestAnimationFrame ||
|
||||||
|
function(callback, element) {
|
||||||
|
return window.setTimeout(function() {
|
||||||
|
callback(+new Date());
|
||||||
|
}, 1000 / 60);
|
||||||
|
});
|
|
@ -2498,7 +2498,11 @@ Extras.Classes.Navigation = new Class({
|
||||||
if (!Metamaps.Mouse.boxStartCoordinates && (e.shiftKey || rightClick)) {
|
if (!Metamaps.Mouse.boxStartCoordinates && (e.shiftKey || rightClick)) {
|
||||||
Metamaps.Mouse.boxStartCoordinates = eventInfo.getPos();
|
Metamaps.Mouse.boxStartCoordinates = eventInfo.getPos();
|
||||||
}
|
}
|
||||||
|
|
||||||
Metamaps.Mouse.didPan = false;
|
Metamaps.Mouse.didPan = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// END METAMAPS CODE
|
// END METAMAPS CODE
|
||||||
|
|
||||||
this.pos = eventInfo.getPos();
|
this.pos = eventInfo.getPos();
|
||||||
|
@ -2570,6 +2574,8 @@ Extras.Classes.Navigation = new Class({
|
||||||
|
|
||||||
// START METAMAPS CODE
|
// START METAMAPS CODE
|
||||||
if (Metamaps.Mouse.didPan) Metamaps.JIT.SmoothPanning();
|
if (Metamaps.Mouse.didPan) Metamaps.JIT.SmoothPanning();
|
||||||
|
|
||||||
|
|
||||||
// END METAMAPS CODE
|
// END METAMAPS CODE
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7075,7 +7081,8 @@ Graph.Plot = {
|
||||||
var l = Metamaps.Mouse.synapseStartCoordinates.length;
|
var l = Metamaps.Mouse.synapseStartCoordinates.length;
|
||||||
for (var i = l - 1; i >= 0; i -= 1) {
|
for (var i = l - 1; i >= 0; i -= 1) {
|
||||||
start = Metamaps.Mouse.synapseStartCoordinates[i];
|
start = Metamaps.Mouse.synapseStartCoordinates[i];
|
||||||
Metamaps.JIT.renderMidArrow(start, end, 13, false, canvas, 0.5, true);
|
Metamaps.JIT.renderMidArrow(start, end, 13, false, canvas, 0.3, true);
|
||||||
|
Metamaps.JIT.renderMidArrow(start, end, 13, false, canvas, 0.7, true);
|
||||||
}
|
}
|
||||||
ctx.restore();
|
ctx.restore();
|
||||||
}
|
}
|
||||||
|
|
|
@ -335,6 +335,13 @@ Metamaps.GlobalUI.Search = {
|
||||||
init: function () {
|
init: function () {
|
||||||
var self = Metamaps.GlobalUI.Search;
|
var self = Metamaps.GlobalUI.Search;
|
||||||
|
|
||||||
|
var loader = new CanvasLoader('searchLoading');
|
||||||
|
loader.setColor('#4fb5c0'); // default is '#000000'
|
||||||
|
loader.setDiameter(24); // default is 40
|
||||||
|
loader.setDensity(41); // default is 40
|
||||||
|
loader.setRange(0.9); // default is 1.3
|
||||||
|
loader.show(); // Hidden by default
|
||||||
|
|
||||||
// bind the hover events
|
// bind the hover events
|
||||||
$(".sidebarSearch").hover(function () {
|
$(".sidebarSearch").hover(function () {
|
||||||
self.open()
|
self.open()
|
||||||
|
@ -366,6 +373,29 @@ 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);
|
||||||
}
|
}
|
||||||
|
@ -399,7 +429,7 @@ Metamaps.GlobalUI.Search = {
|
||||||
self.isOpen = true;
|
self.isOpen = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (self.locked) $('.sidebarSearchField').focus();
|
//else if (self.locked) $('.sidebarSearchField').focus();
|
||||||
},
|
},
|
||||||
close: function (closeAfter, bypass) {
|
close: function (closeAfter, bypass) {
|
||||||
var self = Metamaps.GlobalUI.Search;
|
var self = Metamaps.GlobalUI.Search;
|
||||||
|
@ -422,16 +452,16 @@ Metamaps.GlobalUI.Search = {
|
||||||
}
|
}
|
||||||
}, closeAfter);
|
}, closeAfter);
|
||||||
|
|
||||||
if (self.locked) {
|
/*if (self.locked) {
|
||||||
$('.sidebarSearchField').typeahead('setQuery', '');
|
$('.sidebarSearchField').typeahead('setQuery', '');
|
||||||
$('.sidebarSearchField').blur();
|
$('.sidebarSearchField').blur();
|
||||||
}
|
}*/
|
||||||
},
|
},
|
||||||
startTypeahead: function () {
|
startTypeahead: function () {
|
||||||
var self = Metamaps.GlobalUI.Search;
|
var self = Metamaps.GlobalUI.Search;
|
||||||
|
|
||||||
var mapheader = Metamaps.Active.Mapper ? '<div class="searchTopicsHeader searchHeader"><h3 class="search-heading">Maps</h3><input type="checkbox" class="limitToMe" id="limitMapsToMe"></input><label for="limitMapsToMe" class="limitToMeLabel">added by me</label><div class="minimizeResults minimizeMapResults"></div><div class="clearfloat"></div></div>' : '<div class="searchTopicsHeader searchHeader"><h3 class="search-heading">Maps</h3><div class="minimizeResults minimizeMapResults"></div><div class="clearfloat"></div></div>';
|
var mapheader = Metamaps.Active.Mapper ? '<div class="searchMapsHeader searchHeader"><h3 class="search-heading">Maps</h3><input type="checkbox" class="limitToMe" id="limitMapsToMe"></input><label for="limitMapsToMe" class="limitToMeLabel">added by me</label><div class="minimizeResults minimizeMapResults"></div><div class="clearfloat"></div></div>' : '<div class="searchMapsHeader searchHeader"><h3 class="search-heading">Maps</h3><div class="minimizeResults minimizeMapResults"></div><div class="clearfloat"></div></div>';
|
||||||
var topicheader = Metamaps.Active.Mapper ? '<div class="searchMapsHeader searchHeader"><h3 class="search-heading">Topics</h3><input type="checkbox" class="limitToMe" id="limitTopicsToMe"></input><label for="limitTopicsToMe" class="limitToMeLabel">added by me</label><div class="minimizeResults minimizeTopicResults"></div><div class="clearfloat"></div></div>' : '<div class="searchMapsHeader searchHeader"><h3 class="search-heading">Topics</h3><div class="minimizeResults minimizeTopicResults"></div><div class="clearfloat"></div></div>';
|
var topicheader = Metamaps.Active.Mapper ? '<div class="searchTopicsHeader searchHeader"><h3 class="search-heading">Topics</h3><input type="checkbox" class="limitToMe" id="limitTopicsToMe"></input><label for="limitTopicsToMe" class="limitToMeLabel">added by me</label><div class="minimizeResults minimizeTopicResults"></div><div class="clearfloat"></div></div>' : '<div class="searchTopicsHeader searchHeader"><h3 class="search-heading">Topics</h3><div class="minimizeResults minimizeTopicResults"></div><div class="clearfloat"></div></div>';
|
||||||
var mapperheader = '<div class="searchMappersHeader searchHeader"><h3 class="search-heading">Mappers</h3><div class="minimizeResults minimizeMapperResults"></div><div class="clearfloat"></div></div>';
|
var mapperheader = '<div class="searchMappersHeader searchHeader"><h3 class="search-heading">Mappers</h3><div class="minimizeResults minimizeMapperResults"></div><div class="clearfloat"></div></div>';
|
||||||
|
|
||||||
var topics = {
|
var topics = {
|
||||||
|
@ -510,6 +540,7 @@ Metamaps.GlobalUI.Search = {
|
||||||
if (dataset.length == 0) {
|
if (dataset.length == 0) {
|
||||||
dataset.push({
|
dataset.push({
|
||||||
profile: "/assets/user.png",
|
profile: "/assets/user.png",
|
||||||
|
|
||||||
value: "No results",
|
value: "No results",
|
||||||
label: "No results",
|
label: "No results",
|
||||||
rtype: "noresult"
|
rtype: "noresult"
|
||||||
|
@ -524,7 +555,9 @@ Metamaps.GlobalUI.Search = {
|
||||||
$('.sidebarSearchField').typeahead([topics, maps, mappers]);
|
$('.sidebarSearchField').typeahead([topics, maps, mappers]);
|
||||||
|
|
||||||
//Set max height of the search results box to prevent it from covering bottom left footer
|
//Set max height of the search results box to prevent it from covering bottom left footer
|
||||||
$('.sidebarSearchField').bind('typeahead:opened', function (event) {
|
$('.sidebarSearchField').bind('typeahead:suggestionsRendered', function (event) {
|
||||||
|
self.initSearchOptions();
|
||||||
|
self.hideLoader();
|
||||||
var h = $(window).height();
|
var h = $(window).height();
|
||||||
$(".tt-dropdown-menu").css('max-height', h - 100);
|
$(".tt-dropdown-menu").css('max-height', h - 100);
|
||||||
});
|
});
|
||||||
|
@ -535,13 +568,21 @@ Metamaps.GlobalUI.Search = {
|
||||||
|
|
||||||
// tell the autocomplete to launch a new tab with the topic, map, or mapper you clicked on
|
// tell the autocomplete to launch a new tab with the topic, map, or mapper you clicked on
|
||||||
$('.sidebarSearchField').bind('typeahead:selected', self.handleResultClick);
|
$('.sidebarSearchField').bind('typeahead:selected', self.handleResultClick);
|
||||||
|
|
||||||
// don't do it, if they clicked on a 'addToMap' button
|
// don't do it, if they clicked on a 'addToMap' button
|
||||||
$('.sidebarSearch button.addToMap').click(function (event) {
|
$('.sidebarSearch button.addToMap').click(function (event) {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
});
|
});
|
||||||
|
|
||||||
// make sure that when you click on 'limit to me' or 'toggle section' it works
|
// make sure that when you click on 'limit to me' or 'toggle section' it works
|
||||||
$('.sidebarSearchField').bind('keyup', self.initSearchOptions);
|
$('.sidebarSearchField').bind('typeahead:queryChanged', function(){
|
||||||
|
if ($(this).val() === "") {
|
||||||
|
self.hideLoader();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
self.showLoader();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
handleResultClick: function (event, datum, dataset) {
|
handleResultClick: function (event, datum, dataset) {
|
||||||
|
@ -568,14 +609,12 @@ Metamaps.GlobalUI.Search = {
|
||||||
if (s.css('height') == '0px') {
|
if (s.css('height') == '0px') {
|
||||||
s.css({
|
s.css({
|
||||||
'height': 'auto',
|
'height': 'auto',
|
||||||
'border-top': 'none',
|
|
||||||
'overflow': 'visible'
|
'overflow': 'visible'
|
||||||
});
|
});
|
||||||
$(this).removeClass('maximizeResults').addClass('minimizeResults');
|
$(this).removeClass('maximizeResults').addClass('minimizeResults');
|
||||||
} else {
|
} else {
|
||||||
s.css({
|
s.css({
|
||||||
'height': '0',
|
'height': '0',
|
||||||
'border-top': '1px solid rgb(56, 56, 56)',
|
|
||||||
'overflow': 'hidden'
|
'overflow': 'hidden'
|
||||||
});
|
});
|
||||||
$(this).removeClass('minimizeResults').addClass('maximizeResults');
|
$(this).removeClass('minimizeResults').addClass('maximizeResults');
|
||||||
|
@ -606,5 +645,11 @@ Metamaps.GlobalUI.Search = {
|
||||||
|
|
||||||
self.optionsInitialized = true;
|
self.optionsInitialized = true;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
hideLoader: function () {
|
||||||
|
$('#searchLoading').hide();
|
||||||
|
},
|
||||||
|
showLoader: function () {
|
||||||
|
$('#searchLoading').show();
|
||||||
}
|
}
|
||||||
};
|
};
|
|
@ -1,6 +1,11 @@
|
||||||
Metamaps.JIT = {
|
Metamaps.JIT = {
|
||||||
events: {
|
events: {
|
||||||
mouseMove: 'Metamaps:JIT:events:mouseMove',
|
mouseMove: 'Metamaps:JIT:events:mouseMove',
|
||||||
|
topicDrag: 'Metamaps:JIT:events:topicDrag',
|
||||||
|
newTopic: 'Metamaps:JIT:events:newTopic',
|
||||||
|
removeTopic: 'Metamaps:JIT:events:removeTopic',
|
||||||
|
newSynapse: 'Metamaps:JIT:events:newSynapse',
|
||||||
|
removeSynapse: 'Metamaps:JIT:events:removeSynapse',
|
||||||
pan: 'Metamaps:JIT:events:pan',
|
pan: 'Metamaps:JIT:events:pan',
|
||||||
zoom: 'Metamaps:JIT:events:zoom'
|
zoom: 'Metamaps:JIT:events:zoom'
|
||||||
},
|
},
|
||||||
|
@ -20,6 +25,7 @@ Metamaps.JIT = {
|
||||||
*/
|
*/
|
||||||
prepareVizData: function () {
|
prepareVizData: function () {
|
||||||
var self = Metamaps.JIT;
|
var self = Metamaps.JIT;
|
||||||
|
var synapsesToRemove = [];
|
||||||
var topic;
|
var topic;
|
||||||
var mapping;
|
var mapping;
|
||||||
var node;
|
var node;
|
||||||
|
@ -39,7 +45,12 @@ Metamaps.JIT = {
|
||||||
Metamaps.Synapses.each(function (s) {
|
Metamaps.Synapses.each(function (s) {
|
||||||
edge = s.createEdge();
|
edge = s.createEdge();
|
||||||
|
|
||||||
if (nodes[edge.nodeFrom] && nodes[edge.nodeTo]) {
|
if(Metamaps.Topics.get(s.get('node1_id')) === undefined || Metamaps.Topics.get(s.get('node2_id')) === undefined) {
|
||||||
|
// this means it's an invalid synapse
|
||||||
|
synapsesToRemove.push(s);
|
||||||
|
}
|
||||||
|
else if (nodes[edge.nodeFrom] && nodes[edge.nodeTo]) {
|
||||||
|
|
||||||
existingEdge = _.findWhere(edges, {
|
existingEdge = _.findWhere(edges, {
|
||||||
nodeFrom: edge.nodeFrom,
|
nodeFrom: edge.nodeFrom,
|
||||||
nodeTo: edge.nodeTo
|
nodeTo: edge.nodeTo
|
||||||
|
@ -53,15 +64,24 @@ Metamaps.JIT = {
|
||||||
// for when you're dealing with multiple relationships between the same two topics
|
// for when you're dealing with multiple relationships between the same two topics
|
||||||
if (Metamaps.Active.Map) {
|
if (Metamaps.Active.Map) {
|
||||||
mapping = s.getMapping();
|
mapping = s.getMapping();
|
||||||
existingEdge['$mappingIDs'].push(mapping.isNew() ? mapping.cid : mapping.id);
|
existingEdge.data['$mappingIDs'].push(mapping.id);
|
||||||
}
|
}
|
||||||
existingEdge['$synapseIDs'].push(s.id);
|
existingEdge.data['$synapseIDs'].push(s.id);
|
||||||
} else {
|
} else {
|
||||||
// for when you're dealing with a topic that has relationships to many different nodes
|
// for when you're dealing with a topic that has relationships to many different nodes
|
||||||
nodes[edge.nodeFrom].adjacencies.push(edge);
|
nodes[edge.nodeFrom].adjacencies.push(edge);
|
||||||
|
edges.push(edge);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// clean up the synapses array in case of any faulty data
|
||||||
|
_.each(synapsesToRemove, function (synapse) {
|
||||||
|
mapping = synapse.getMapping();
|
||||||
|
Metamaps.Synapses.remove(synapse);
|
||||||
|
Metamaps.Mappings.remove(mapping);
|
||||||
|
});
|
||||||
|
|
||||||
_.each(nodes, function (node) {
|
_.each(nodes, function (node) {
|
||||||
self.vizData.push(node);
|
self.vizData.push(node);
|
||||||
});
|
});
|
||||||
|
@ -319,7 +339,7 @@ Metamaps.JIT = {
|
||||||
if (Metamaps.Mouse.boxStartCoordinates) {
|
if (Metamaps.Mouse.boxStartCoordinates) {
|
||||||
Metamaps.Visualize.mGraph.busy = false;
|
Metamaps.Visualize.mGraph.busy = false;
|
||||||
Metamaps.Mouse.boxEndCoordinates = eventInfo.getPos();
|
Metamaps.Mouse.boxEndCoordinates = eventInfo.getPos();
|
||||||
Metamaps.JIT.selectWithBox(e);
|
Metamaps.JIT.zoomToBox(e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -672,8 +692,6 @@ Metamaps.JIT = {
|
||||||
|
|
||||||
var scale = dist / lastDist;
|
var scale = dist / lastDist;
|
||||||
|
|
||||||
console.log(scale);
|
|
||||||
|
|
||||||
if (8 >= Metamaps.Visualize.mGraph.canvas.scaleOffsetX * scale && Metamaps.Visualize.mGraph.canvas.scaleOffsetX * scale >= 1) {
|
if (8 >= Metamaps.Visualize.mGraph.canvas.scaleOffsetX * scale && Metamaps.Visualize.mGraph.canvas.scaleOffsetX * scale >= 1) {
|
||||||
Metamaps.Visualize.mGraph.canvas.scale(scale, scale);
|
Metamaps.Visualize.mGraph.canvas.scale(scale, scale);
|
||||||
}
|
}
|
||||||
|
@ -690,6 +708,11 @@ Metamaps.JIT = {
|
||||||
|
|
||||||
var self = Metamaps.JIT;
|
var self = Metamaps.JIT;
|
||||||
|
|
||||||
|
// this is used to send nodes that are moving to
|
||||||
|
// other realtime collaborators on the same map
|
||||||
|
var positionsToSend = {};
|
||||||
|
var topic;
|
||||||
|
|
||||||
if (node && !node.nodeFrom) {
|
if (node && !node.nodeFrom) {
|
||||||
var pos = eventInfo.getPos();
|
var pos = eventInfo.getPos();
|
||||||
// if it's a left click, or a touch, move the node
|
// if it's a left click, or a touch, move the node
|
||||||
|
@ -697,13 +720,23 @@ Metamaps.JIT = {
|
||||||
//if the node dragged isn't already selected, select it
|
//if the node dragged isn't already selected, select it
|
||||||
var whatToDo = self.handleSelectionBeforeDragging(node, e);
|
var whatToDo = self.handleSelectionBeforeDragging(node, e);
|
||||||
if (node.pos.rho || node.pos.rho === 0) {
|
if (node.pos.rho || node.pos.rho === 0) {
|
||||||
|
// this means we're in topic view
|
||||||
var rho = Math.sqrt(pos.x * pos.x + pos.y * pos.y);
|
var rho = Math.sqrt(pos.x * pos.x + pos.y * pos.y);
|
||||||
var theta = Math.atan2(pos.y, pos.x);
|
var theta = Math.atan2(pos.y, pos.x);
|
||||||
node.pos.setp(theta, rho);
|
node.pos.setp(theta, rho);
|
||||||
} else if (whatToDo == 'only-drag-this-one') {
|
} else if (whatToDo == 'only-drag-this-one') {
|
||||||
node.pos.setc(pos.x, pos.y);
|
node.pos.setc(pos.x, pos.y);
|
||||||
node.setData('xloc', pos.x);
|
|
||||||
node.setData('yloc', pos.y);
|
if (Metamaps.Active.Map) {
|
||||||
|
topic = node.getData('topic');
|
||||||
|
// we use the topic ID not the node id
|
||||||
|
// because we can't depend on the node id
|
||||||
|
// to be the same as on other collaborators
|
||||||
|
// maps
|
||||||
|
positionsToSend[topic.id] = pos;
|
||||||
|
$(document).trigger(Metamaps.JIT.events.topicDrag, [positionsToSend]);
|
||||||
|
$(document).trigger(Metamaps.JIT.events.mouseMove, [pos]);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
var len = Metamaps.Selected.Nodes.length;
|
var len = Metamaps.Selected.Nodes.length;
|
||||||
|
|
||||||
|
@ -721,9 +754,21 @@ Metamaps.JIT = {
|
||||||
var x = pos.x + xOffset[i];
|
var x = pos.x + xOffset[i];
|
||||||
var y = pos.y + yOffset[i];
|
var y = pos.y + yOffset[i];
|
||||||
n.pos.setc(x, y);
|
n.pos.setc(x, y);
|
||||||
n.setData('xloc', x);
|
|
||||||
n.setData('yloc', y);
|
if (Metamaps.Active.Map) {
|
||||||
|
topic = n.getData('topic');
|
||||||
|
// we use the topic ID not the node id
|
||||||
|
// because we can't depend on the node id
|
||||||
|
// to be the same as on other collaborators
|
||||||
|
// maps
|
||||||
|
positionsToSend[topic.id] = n.pos;
|
||||||
|
}
|
||||||
} //for
|
} //for
|
||||||
|
|
||||||
|
if (Metamaps.Active.Map) {
|
||||||
|
$(document).trigger(Metamaps.JIT.events.topicDrag, [positionsToSend]);
|
||||||
|
$(document).trigger(Metamaps.JIT.events.mouseMove, [pos]);
|
||||||
|
}
|
||||||
} //if
|
} //if
|
||||||
|
|
||||||
if (whatToDo == 'deselect') {
|
if (whatToDo == 'deselect') {
|
||||||
|
@ -794,6 +839,7 @@ Metamaps.JIT = {
|
||||||
x: pos.x,
|
x: pos.x,
|
||||||
y: pos.y
|
y: pos.y
|
||||||
};
|
};
|
||||||
|
$(document).trigger(Metamaps.JIT.events.mouseMove, [pos]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -818,8 +864,8 @@ Metamaps.JIT = {
|
||||||
} else if (tempInit && tempNode2 != null) {
|
} else if (tempInit && tempNode2 != null) {
|
||||||
// this means you want to create a synapse between two existing topics
|
// this means you want to create a synapse between two existing topics
|
||||||
Metamaps.Create.newTopic.addSynapse = false;
|
Metamaps.Create.newTopic.addSynapse = false;
|
||||||
Metamaps.Create.newSynapse.topic1id = tempNode.id;
|
Metamaps.Create.newSynapse.topic1id = tempNode.getData('topic').id;
|
||||||
Metamaps.Create.newSynapse.topic2id = tempNode2.id;
|
Metamaps.Create.newSynapse.topic2id = tempNode2.getData('topic').id;
|
||||||
tempNode2.setData('dim', 25, 'current');
|
tempNode2.setData('dim', 25, 'current');
|
||||||
Metamaps.Visualize.mGraph.plot();
|
Metamaps.Visualize.mGraph.plot();
|
||||||
midpoint.x = tempNode.pos.getc().x + (tempNode2.pos.getc().x - tempNode.pos.getc().x) / 2;
|
midpoint.x = tempNode.pos.getc().x + (tempNode2.pos.getc().x - tempNode.pos.getc().x) / 2;
|
||||||
|
@ -940,7 +986,7 @@ Metamaps.JIT = {
|
||||||
Metamaps.Control.deselectAllEdges();
|
Metamaps.Control.deselectAllEdges();
|
||||||
}
|
}
|
||||||
|
|
||||||
//select all nodes, and their edges, that are within the box
|
//select all nodes that are within the box
|
||||||
Metamaps.Visualize.mGraph.graph.eachNode(function (n) {
|
Metamaps.Visualize.mGraph.graph.eachNode(function (n) {
|
||||||
var x = n.pos.x,
|
var x = n.pos.x,
|
||||||
y = n.pos.y;
|
y = n.pos.y;
|
||||||
|
@ -969,8 +1015,8 @@ Metamaps.JIT = {
|
||||||
var fromNodeY = -1 * synapse.get('edge').nodeFrom.pos.y;
|
var fromNodeY = -1 * synapse.get('edge').nodeFrom.pos.y;
|
||||||
var toNodeX = synapse.get('edge').nodeTo.pos.x;
|
var toNodeX = synapse.get('edge').nodeTo.pos.x;
|
||||||
var toNodeY = -1 * synapse.get('edge').nodeTo.pos.y;
|
var toNodeY = -1 * synapse.get('edge').nodeTo.pos.y;
|
||||||
|
|
||||||
var maxX = fromNodeX;
|
var maxX = fromNodeX;
|
||||||
var maxY = fromNodeY;
|
var maxY = fromNodeY;
|
||||||
var minX = fromNodeX;
|
var minX = fromNodeX;
|
||||||
var minY = fromNodeY;
|
var minY = fromNodeY;
|
||||||
|
@ -988,7 +1034,7 @@ Metamaps.JIT = {
|
||||||
(eX > maxBoxX) ? (maxBoxX = eX):(minBoxX = eX);
|
(eX > maxBoxX) ? (maxBoxX = eX):(minBoxX = eX);
|
||||||
(eY > maxBoxY) ? (maxBoxY = eY):(minBoxY = eY);
|
(eY > maxBoxY) ? (maxBoxY = eY):(minBoxY = eY);
|
||||||
|
|
||||||
//Fins the slopes from the synapse fromNode to the 4 corners of the selection box
|
//Find the slopes from the synapse fromNode to the 4 corners of the selection box
|
||||||
var slopes = [];
|
var slopes = [];
|
||||||
slopes.push( (sY - fromNodeY) / (sX - fromNodeX) );
|
slopes.push( (sY - fromNodeY) / (sX - fromNodeX) );
|
||||||
slopes.push( (sY - fromNodeY) / (eX - fromNodeX) );
|
slopes.push( (sY - fromNodeY) / (eX - fromNodeX) );
|
||||||
|
@ -1005,40 +1051,44 @@ Metamaps.JIT = {
|
||||||
//Find synapse-in-question's slope
|
//Find synapse-in-question's slope
|
||||||
var synSlope = (toNodeY - fromNodeY) / (toNodeX - fromNodeX);
|
var synSlope = (toNodeY - fromNodeY) / (toNodeX - fromNodeX);
|
||||||
var b = fromNodeY - synSlope * fromNodeX;
|
var b = fromNodeY - synSlope * fromNodeX;
|
||||||
|
|
||||||
|
//Use the selection box edges as test cases for synapse intersection
|
||||||
|
var testX = sX;
|
||||||
|
var testY = synSlope * testX + b;
|
||||||
|
|
||||||
|
var selectTest;
|
||||||
|
|
||||||
var selectTest = false;
|
if(testX >= minX && testX <= maxX && testY >= minY && testY <= maxY && testY >= minBoxY && testY <= maxBoxY){
|
||||||
|
selectTest = true;
|
||||||
//if the synapse slope is within a range that would intersect with the selection box
|
|
||||||
if (synSlope <= maxSlope && synSlope >= minSlope){
|
|
||||||
var testX = sX;
|
|
||||||
var testY = synSlope * testX + b;
|
|
||||||
|
|
||||||
if(testX >= minX && testX <= maxX && testY >= minY && testY <= maxY && testY >= minBoxY && testY <= maxBoxY){
|
|
||||||
selectTest = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
testX = eX;
|
|
||||||
testY = synSlope * testX + b;
|
|
||||||
|
|
||||||
if(testX >= minX && testX <= maxX && testY >= minY && testY <= maxY && testY >= minBoxY && testY <= maxBoxY){
|
|
||||||
selectTest = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
testY = sY;
|
|
||||||
testX = (testY - b)/synSlope;
|
|
||||||
|
|
||||||
if(testX >= minX && testX <= maxX && testY >= minY && testY <= maxY && testX >= minBoxX && testY <= maxBoxX){
|
|
||||||
selectTest = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
testY = eY;
|
|
||||||
testX = (testY - b)/synSlope;
|
|
||||||
|
|
||||||
if(testX >= minX && testX <= maxX && testY >= minY && testY <= maxY && testX >= minBoxX && testY <= maxBoxX){
|
|
||||||
selectTest = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//The test synapse was selected!
|
|
||||||
|
testX = eX;
|
||||||
|
testY = synSlope * testX + b;
|
||||||
|
|
||||||
|
if(testX >= minX && testX <= maxX && testY >= minY && testY <= maxY && testY >= minBoxY && testY <= maxBoxY){
|
||||||
|
selectTest = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
testY = sY;
|
||||||
|
testX = (testY - b)/synSlope;
|
||||||
|
|
||||||
|
if(testX >= minX && testX <= maxX && testY >= minY && testY <= maxY && testX >= minBoxX && testX <= maxBoxX){
|
||||||
|
selectTest = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
testY = eY;
|
||||||
|
testX = (testY - b)/synSlope;
|
||||||
|
|
||||||
|
if(testX >= minX && testX <= maxX && testY >= minY && testY <= maxY && testX >= minBoxX && testX <= maxBoxX){
|
||||||
|
selectTest = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Case where the synapse is wholly enclosed in the seldction box
|
||||||
|
if(fromNodeX >= minBoxX && fromNodeX <= maxBoxX && fromNodeY >= minBoxY && fromNodeY <= maxBoxY && toNodeX >= minBoxX && toNodeX <= maxBoxX && toNodeY >= minBoxY && toNodeY <= maxBoxY){
|
||||||
|
selectTest = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//The test synapse was selected!
|
||||||
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 ){
|
||||||
|
@ -1102,15 +1152,23 @@ Metamaps.JIT = {
|
||||||
// wait a certain length of time, then check again, then run this code
|
// wait a certain length of time, then check again, then run this code
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
if (!Metamaps.JIT.nodeWasDoubleClicked()) {
|
if (!Metamaps.JIT.nodeWasDoubleClicked()) {
|
||||||
if (!e.shiftKey) {
|
if (!e.shiftKey && !e.ctrlKey) {
|
||||||
Metamaps.Control.deselectAllNodes();
|
Metamaps.Control.deselectAllNodes();
|
||||||
Metamaps.Control.deselectAllEdges();
|
Metamaps.Control.deselectAllEdges();
|
||||||
}
|
}
|
||||||
if (node.selected) {
|
if(e.ctrlKey || e.shiftKey){
|
||||||
Metamaps.Control.deselectNode(node);
|
if (node.selected) {
|
||||||
} else {
|
Metamaps.Control.deselectNode(node);
|
||||||
|
} else {
|
||||||
|
Metamaps.Control.selectNode(node,e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
Metamaps.Control.deselectAllNodes();
|
||||||
|
Metamaps.Control.deselectAllEdges();
|
||||||
Metamaps.Control.selectNode(node,e);
|
Metamaps.Control.selectNode(node,e);
|
||||||
}
|
}
|
||||||
|
|
||||||
//trigger animation to final styles
|
//trigger animation to final styles
|
||||||
Metamaps.Visualize.mGraph.fx.animate({
|
Metamaps.Visualize.mGraph.fx.animate({
|
||||||
modes: ['edge-property:lineWidth:color:alpha'],
|
modes: ['edge-property:lineWidth:color:alpha'],
|
||||||
|
@ -1138,7 +1196,6 @@ Metamaps.JIT = {
|
||||||
// create new menu for clicked on node
|
// create new menu for clicked on node
|
||||||
var rightclickmenu = document.createElement("div");
|
var rightclickmenu = document.createElement("div");
|
||||||
rightclickmenu.className = "rightclickmenu";
|
rightclickmenu.className = "rightclickmenu";
|
||||||
|
|
||||||
// add the proper options to the menu
|
// add the proper options to the menu
|
||||||
var menustring = '<ul>';
|
var menustring = '<ul>';
|
||||||
|
|
||||||
|
@ -1170,8 +1227,7 @@ Metamaps.JIT = {
|
||||||
top: e.clientY
|
top: e.clientY
|
||||||
});
|
});
|
||||||
//add the menu to the page
|
//add the menu to the page
|
||||||
$('#wrapper').append(rightclickmenu);
|
$('#infovis-canvaswidget').append(rightclickmenu);
|
||||||
|
|
||||||
|
|
||||||
// attach events to clicks on the list items
|
// attach events to clicks on the list items
|
||||||
|
|
||||||
|
@ -1406,9 +1462,9 @@ Metamaps.JIT = {
|
||||||
var v2 = intermediatePoint.$add(normal.$scale(-1));
|
var v2 = intermediatePoint.$add(normal.$scale(-1));
|
||||||
|
|
||||||
if (newSynapse) {
|
if (newSynapse) {
|
||||||
ctx.strokeStyle = "#222222";
|
ctx.strokeStyle = "#4fc059";
|
||||||
ctx.lineWidth = 2;
|
ctx.lineWidth = 2;
|
||||||
ctx.globalAlpha = 0.4;
|
ctx.globalAlpha = 1;
|
||||||
}
|
}
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.moveTo(from.x, from.y);
|
ctx.moveTo(from.x, from.y);
|
||||||
|
@ -1457,8 +1513,7 @@ Metamaps.JIT = {
|
||||||
y: posChild.y
|
y: posChild.y
|
||||||
}, 13, false, canvas, 0.7);
|
}, 13, false, canvas, 0.7);
|
||||||
} else if (directionCat == "from-to") {
|
} else if (directionCat == "from-to") {
|
||||||
var direction = adj.data.$direction;
|
var inv = (direction[0] != adj.nodeFrom.id);
|
||||||
var inv = (direction && direction.length > 1 && direction[0] != adj.nodeFrom.id);
|
|
||||||
self.renderMidArrow({
|
self.renderMidArrow({
|
||||||
x: pos.x,
|
x: pos.x,
|
||||||
y: pos.y
|
y: pos.y
|
||||||
|
@ -1494,133 +1549,163 @@ Metamaps.JIT = {
|
||||||
|
|
||||||
canvas.translate(-1*offsetX,-1*offsetY);
|
canvas.translate(-1*offsetX,-1*offsetY);
|
||||||
},
|
},
|
||||||
|
zoomToBox: function (event) {
|
||||||
|
var sX = Metamaps.Mouse.boxStartCoordinates.x,
|
||||||
|
sY = Metamaps.Mouse.boxStartCoordinates.y,
|
||||||
|
eX = Metamaps.Mouse.boxEndCoordinates.x,
|
||||||
|
eY = Metamaps.Mouse.boxEndCoordinates.y;
|
||||||
|
|
||||||
|
Metamaps.JIT.centerMap();
|
||||||
|
|
||||||
|
var height = $(document).height(),
|
||||||
|
width = $(document).width();
|
||||||
|
|
||||||
|
var spanX = Math.abs(sX - eX);
|
||||||
|
var spanY = Math.abs(sY - eY);
|
||||||
|
var ratioX = width / spanX;
|
||||||
|
var ratioY = height / spanY;
|
||||||
|
|
||||||
|
var newRatio = Math.min(ratioX,ratioY);
|
||||||
|
|
||||||
|
var canvas = Metamaps.Visualize.mGraph.canvas;
|
||||||
|
|
||||||
|
if(canvas.scaleOffsetX *newRatio<= 5 && canvas.scaleOffsetX*newRatio >= 0.2){
|
||||||
|
canvas.scale(newRatio,newRatio);
|
||||||
|
}
|
||||||
|
else if(canvas.scaleOffsetX * newRatio > 5){
|
||||||
|
newRatio = 5/ canvas.scaleOffsetX;
|
||||||
|
canvas.scale(newRatio,newRatio);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
newRatio = 0.2/ canvas.scaleOffsetX;
|
||||||
|
canvas.scale(newRatio,newRatio);
|
||||||
|
}
|
||||||
|
|
||||||
|
var cogX = (sX + eX)/2;
|
||||||
|
var cogY = (sY + eY)/2;
|
||||||
|
|
||||||
|
canvas.translate(-1* cogX, -1* cogY);
|
||||||
|
$(document).trigger(Metamaps.JIT.events.zoom, [event]);
|
||||||
|
|
||||||
|
Metamaps.Mouse.boxStartCoordinates = false;
|
||||||
|
Metamaps.Mouse.boxEndCoordinates = false;
|
||||||
|
Metamaps.Visualize.mGraph.plot();
|
||||||
|
|
||||||
|
},
|
||||||
zoomExtents: function (event) {
|
zoomExtents: function (event) {
|
||||||
Metamaps.JIT.centerMap();
|
Metamaps.JIT.centerMap();
|
||||||
var height = $(document).height(),
|
var height = $(document).height(),
|
||||||
width = $(document).width(),
|
width = $(document).width(),
|
||||||
maxX, minX, maxY, minY, counter = 0;
|
maxX, minX, maxY, minY, counter = 0;
|
||||||
|
var canvas = Metamaps.Visualize.mGraph.canvas;
|
||||||
|
|
||||||
|
|
||||||
if (Metamaps.Selected.Nodes.length > 0) {
|
if (Metamaps.Selected.Nodes.length > 0) {
|
||||||
var nodes = Metamaps.Selected.Nodes;
|
var nodes = Metamaps.Selected.Nodes;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var nodes = _.values(Metamaps.Visualize.mGraph.graph.nodes);
|
||||||
|
}
|
||||||
|
|
||||||
if(nodes.length > 1){
|
if(nodes.length > 1){
|
||||||
nodes.forEach(function (n) {
|
nodes.forEach(function (n) {
|
||||||
var x = n.pos.x,
|
var x = n.pos.x,
|
||||||
y = n.pos.y;
|
y = n.pos.y;
|
||||||
|
|
||||||
if (counter == 0){
|
if (counter == 0){
|
||||||
maxX = x;
|
maxX = x;
|
||||||
minX = x;
|
minX = x;
|
||||||
maxY = y;
|
maxY = y;
|
||||||
minY = y;
|
minY = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
maxX = Math.max(x,maxX);
|
var arrayOfLabelLines = Metamaps.Util.splitLine(n.name, 30).split('\n'),
|
||||||
maxY = Math.max(y,maxY);
|
dim = n.getData('dim'),
|
||||||
minX = Math.min(x,minX);
|
ctx = canvas.getCtx();
|
||||||
minY = Math.min(y,minY);
|
|
||||||
|
|
||||||
counter++;
|
var height = 25 * arrayOfLabelLines.length;
|
||||||
});
|
|
||||||
|
|
||||||
var spanX = maxX - minX;
|
var index, lineWidths = [];
|
||||||
var spanY = maxY - minY;
|
for (index = 0; index < arrayOfLabelLines.length; ++index) {
|
||||||
var ratioX = spanX / width;
|
lineWidths.push(ctx.measureText(arrayOfLabelLines[index]).width)
|
||||||
var ratioY = spanY / height;
|
}
|
||||||
|
var width = Math.max.apply(null, lineWidths) + 8;
|
||||||
|
|
||||||
var newRatio = Math.max(ratioX,ratioY);
|
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);
|
||||||
|
|
||||||
var canvas = Metamaps.Visualize.mGraph.canvas;
|
counter++;
|
||||||
|
});
|
||||||
|
|
||||||
canvas.scale(1/newRatio*0.8,1/newRatio*0.8);
|
var spanX = maxX - minX;
|
||||||
|
var spanY = maxY - minY;
|
||||||
|
var ratioX = spanX / width;
|
||||||
|
var ratioY = spanY / height;
|
||||||
|
|
||||||
counter = 0;
|
var newRatio = Math.max(ratioX,ratioY);
|
||||||
|
var scaleMultiplier = 1/newRatio*0.9;
|
||||||
|
|
||||||
nodes.forEach(function (n) {
|
if(canvas.scaleOffsetX *scaleMultiplier<= 3 && canvas.scaleOffsetX*scaleMultiplier >= 0.2){
|
||||||
var x = n.pos.x,
|
canvas.scale(scaleMultiplier,scaleMultiplier);
|
||||||
y = n.pos.y;
|
|
||||||
|
|
||||||
if (counter == 0){
|
|
||||||
maxX = x;
|
|
||||||
minX = x;
|
|
||||||
maxY = y;
|
|
||||||
minY = y;
|
|
||||||
}
|
|
||||||
|
|
||||||
maxX = Math.max(x,maxX);
|
|
||||||
maxY = Math.max(y,maxY);
|
|
||||||
minX = Math.min(x,minX);
|
|
||||||
minY = Math.min(y,minY);
|
|
||||||
|
|
||||||
counter++;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
else if(canvas.scaleOffsetX * scaleMultiplier > 3){
|
||||||
|
scaleMultiplier = 3/ canvas.scaleOffsetX;
|
||||||
|
canvas.scale(scaleMultiplier,scaleMultiplier);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
scaleMultiplier = 0.2/ canvas.scaleOffsetX;
|
||||||
|
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]);
|
||||||
}
|
}
|
||||||
else{
|
else if(nodes.length == 1){
|
||||||
var nodes = Metamaps.Visualize.mGraph.graph;
|
nodes.forEach(function (n) {
|
||||||
|
var x = n.pos.x,
|
||||||
|
y = n.pos.y;
|
||||||
|
|
||||||
if(Object.keys(nodes).length >1){
|
canvas.translate(-1* x, -1* y);
|
||||||
nodes.eachNode(function (n) {
|
$(document).trigger(Metamaps.JIT.events.zoom, [event]);
|
||||||
var x = n.pos.x,
|
});
|
||||||
y = n.pos.y;
|
|
||||||
|
|
||||||
if (counter == 0){
|
|
||||||
maxX = x;
|
|
||||||
minX = x;
|
|
||||||
maxY = y;
|
|
||||||
minY = y;
|
|
||||||
}
|
|
||||||
|
|
||||||
maxX = Math.max(x,maxX);
|
|
||||||
maxY = Math.max(y,maxY);
|
|
||||||
minX = Math.min(x,minX);
|
|
||||||
minY = Math.min(y,minY);
|
|
||||||
|
|
||||||
counter++;
|
|
||||||
});
|
|
||||||
|
|
||||||
var spanX = maxX - minX;
|
|
||||||
var spanY = maxY - minY;
|
|
||||||
var ratioX = spanX / width;
|
|
||||||
var ratioY = spanY / height;
|
|
||||||
|
|
||||||
var newRatio = Math.max(ratioX,ratioY);
|
|
||||||
|
|
||||||
var canvas = Metamaps.Visualize.mGraph.canvas;
|
|
||||||
|
|
||||||
canvas.scale(1/newRatio*0.8,1/newRatio*0.8);
|
|
||||||
|
|
||||||
counter = 0;
|
|
||||||
|
|
||||||
nodes.eachNode(function (n) {
|
|
||||||
var x = n.pos.x,
|
|
||||||
y = n.pos.y;
|
|
||||||
|
|
||||||
if (counter == 0){
|
|
||||||
maxX = x;
|
|
||||||
minX = x;
|
|
||||||
maxY = y;
|
|
||||||
minY = y;
|
|
||||||
}
|
|
||||||
|
|
||||||
maxX = Math.max(x,maxX);
|
|
||||||
maxY = Math.max(y,maxY);
|
|
||||||
minX = Math.min(x,minX);
|
|
||||||
minY = Math.min(y,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]);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
|
@ -130,6 +130,7 @@
|
||||||
Metamaps.GlobalUI.Search.unlock();
|
Metamaps.GlobalUI.Search.unlock();
|
||||||
Metamaps.GlobalUI.Search.close(0, true);
|
Metamaps.GlobalUI.Search.close(0, true);
|
||||||
|
|
||||||
|
Metamaps.Loading.show();
|
||||||
Metamaps.Map.end();
|
Metamaps.Map.end();
|
||||||
Metamaps.Map.launch(id);
|
Metamaps.Map.launch(id);
|
||||||
},
|
},
|
||||||
|
|
|
@ -47,6 +47,7 @@ Metamaps.Touch = {
|
||||||
|
|
||||||
Metamaps.Mouse = {
|
Metamaps.Mouse = {
|
||||||
didPan: false,
|
didPan: false,
|
||||||
|
didBoxZoom: false,
|
||||||
changeInX: 0,
|
changeInX: 0,
|
||||||
changeInY: 0,
|
changeInY: 0,
|
||||||
edgeHoveringOver: false,
|
edgeHoveringOver: false,
|
||||||
|
@ -216,15 +217,15 @@ Metamaps.Backbone.init = function () {
|
||||||
else return false;
|
else return false;
|
||||||
},
|
},
|
||||||
getTopic1: function () {
|
getTopic1: function () {
|
||||||
return Metamaps.Topic.get(this.get('node1_id'));
|
return Metamaps.Topics.get(this.get('node1_id'));
|
||||||
},
|
},
|
||||||
getTopic2: function () {
|
getTopic2: function () {
|
||||||
return Metamaps.Topic.get(this.get('node2_id'));
|
return Metamaps.Topics.get(this.get('node2_id'));
|
||||||
},
|
},
|
||||||
getDirection: function () {
|
getDirection: function () {
|
||||||
return [
|
return [
|
||||||
this.get('node1_id'),
|
this.getTopic1().get('node').id,
|
||||||
this.get('node2_id')
|
this.getTopic2().get('node').id
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
getMapping: function () {
|
getMapping: function () {
|
||||||
|
@ -1231,11 +1232,15 @@ Metamaps.Visualize = {
|
||||||
topic.updateNode();
|
topic.updateNode();
|
||||||
|
|
||||||
n.eachAdjacency(function (edge) {
|
n.eachAdjacency(function (edge) {
|
||||||
l = edge.getData('synapseIDs').length;
|
if(!edge.getData('init')) {
|
||||||
for (i = 0; i < l; i++) {
|
edge.setData('init', true);
|
||||||
synapse = Metamaps.Synapses.get(edge.getData('synapseIDs')[i]);
|
|
||||||
synapse.set('edge', edge);
|
l = edge.getData('synapseIDs').length;
|
||||||
synapse.updateEdge();
|
for (i = 0; i < l; i++) {
|
||||||
|
synapse = Metamaps.Synapses.get(edge.getData('synapseIDs')[i]);
|
||||||
|
synapse.set('edge', edge);
|
||||||
|
synapse.updateEdge();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1253,11 +1258,15 @@ Metamaps.Visualize = {
|
||||||
mapping = topic.getMapping();
|
mapping = topic.getMapping();
|
||||||
|
|
||||||
n.eachAdjacency(function (edge) {
|
n.eachAdjacency(function (edge) {
|
||||||
l = edge.getData('synapseIDs').length;
|
if(!edge.getData('init')) {
|
||||||
for (i = 0; i < l; i++) {
|
edge.setData('init', true);
|
||||||
synapse = Metamaps.Synapses.get(edge.getData('synapseIDs')[i]);
|
|
||||||
synapse.set('edge', edge);
|
l = edge.getData('synapseIDs').length;
|
||||||
synapse.updateEdge();
|
for (i = 0; i < l; i++) {
|
||||||
|
synapse = Metamaps.Synapses.get(edge.getData('synapseIDs')[i]);
|
||||||
|
synapse.set('edge', edge);
|
||||||
|
synapse.updateEdge();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1273,7 +1282,6 @@ Metamaps.Visualize = {
|
||||||
/**
|
/**
|
||||||
* render does the heavy lifting of creating the engine that renders the graph with the properties we desire
|
* render does the heavy lifting of creating the engine that renders the graph with the properties we desire
|
||||||
*
|
*
|
||||||
* @param vizData a json structure containing the data to be rendered.
|
|
||||||
*/
|
*/
|
||||||
render: function () {
|
render: function () {
|
||||||
var self = Metamaps.Visualize, RGraphSettings, FDSettings;
|
var self = Metamaps.Visualize, RGraphSettings, FDSettings;
|
||||||
|
@ -1498,7 +1506,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');
|
||||||
self.startActiveMap();
|
self.startActiveMap();
|
||||||
},
|
},
|
||||||
toggleBox: function (event) {
|
toggleBox: function (event) {
|
||||||
|
@ -1611,14 +1619,30 @@ Metamaps.Realtime = {
|
||||||
// receive word that there's a mapper turned on realtime
|
// receive word that there's a mapper turned on realtime
|
||||||
socket.on('maps-' + Metamaps.Active.Map.id + '-lostrealtime', self.lostCollaborator);
|
socket.on('maps-' + Metamaps.Active.Map.id + '-lostrealtime', self.lostCollaborator);
|
||||||
|
|
||||||
socket.on('maps-' + Metamaps.Active.Map.id, self.contentUpdate);
|
//
|
||||||
|
socket.on('maps-' + Metamaps.Active.Map.id + '-topicDrag', self.topicDrag);
|
||||||
|
|
||||||
|
//
|
||||||
|
socket.on('maps-' + Metamaps.Active.Map.id + '-newTopic', self.newTopic);
|
||||||
|
|
||||||
|
//
|
||||||
|
socket.on('maps-' + Metamaps.Active.Map.id + '-removeTopic', self.removeTopic);
|
||||||
|
|
||||||
|
//
|
||||||
|
socket.on('maps-' + Metamaps.Active.Map.id + '-newSynapse', self.newSynapse);
|
||||||
|
|
||||||
|
//
|
||||||
|
socket.on('maps-' + Metamaps.Active.Map.id + '-removeSynapse', self.removeSynapse);
|
||||||
|
|
||||||
// update mapper compass position
|
// update mapper compass position
|
||||||
socket.on('maps-' + Metamaps.Active.Map.id + '-updatePeerCoords', self.updatePeerCoords);
|
socket.on('maps-' + Metamaps.Active.Map.id + '-updatePeerCoords', self.updatePeerCoords);
|
||||||
|
|
||||||
|
// local event listeners that trigger events
|
||||||
var sendCoords = function (event, coords) {
|
var sendCoords = function (event, coords) {
|
||||||
self.sendCoords(coords);
|
self.sendCoords(coords);
|
||||||
};
|
};
|
||||||
|
$(document).on(Metamaps.JIT.events.mouseMove, sendCoords);
|
||||||
|
|
||||||
var zoom = function (event, e) {
|
var zoom = function (event, e) {
|
||||||
if (e) {
|
if (e) {
|
||||||
var pixels = {
|
var pixels = {
|
||||||
|
@ -1630,9 +1654,35 @@ Metamaps.Realtime = {
|
||||||
}
|
}
|
||||||
self.positionPeerIcons();
|
self.positionPeerIcons();
|
||||||
};
|
};
|
||||||
$(document).on(Metamaps.JIT.events.mouseMove, sendCoords);
|
|
||||||
$(document).on(Metamaps.JIT.events.zoom, zoom);
|
$(document).on(Metamaps.JIT.events.zoom, zoom);
|
||||||
|
|
||||||
$(document).on(Metamaps.JIT.events.pan, self.positionPeerIcons);
|
$(document).on(Metamaps.JIT.events.pan, self.positionPeerIcons);
|
||||||
|
|
||||||
|
var sendTopicDrag = function (event, positions) {
|
||||||
|
self.sendTopicDrag(positions);
|
||||||
|
};
|
||||||
|
$(document).on(Metamaps.JIT.events.topicDrag, sendTopicDrag);
|
||||||
|
|
||||||
|
var sendNewTopic = function (event, data) {
|
||||||
|
self.sendNewTopic(data);
|
||||||
|
};
|
||||||
|
$(document).on(Metamaps.JIT.events.newTopic, sendNewTopic);
|
||||||
|
|
||||||
|
var sendRemoveTopic = function (event, data) {
|
||||||
|
self.sendRemoveTopic(data);
|
||||||
|
};
|
||||||
|
$(document).on(Metamaps.JIT.events.removeTopic, sendRemoveTopic);
|
||||||
|
|
||||||
|
var sendNewSynapse = function (event, data) {
|
||||||
|
self.sendNewSynapse(data);
|
||||||
|
};
|
||||||
|
$(document).on(Metamaps.JIT.events.newSynapse, sendNewSynapse);
|
||||||
|
|
||||||
|
var sendRemoveSynapse = function (event, data) {
|
||||||
|
self.sendRemoveSynapse(data);
|
||||||
|
};
|
||||||
|
$(document).on(Metamaps.JIT.events.removeSynapse, sendRemoveSynapse);
|
||||||
|
|
||||||
},
|
},
|
||||||
sendRealtimeOn: function () {
|
sendRealtimeOn: function () {
|
||||||
var self = Metamaps.Realtime;
|
var self = Metamaps.Realtime;
|
||||||
|
@ -1891,120 +1941,169 @@ Metamaps.Realtime = {
|
||||||
socket.emit('updateMapperCoords', update);
|
socket.emit('updateMapperCoords', update);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
contentUpdate: function (data) {
|
sendTopicDrag: function (positions) {
|
||||||
var self = Metamaps.Realtime;
|
var self = Metamaps.Realtime;
|
||||||
var socket = Metamaps.Realtime.socket;
|
var socket = self.socket;
|
||||||
var graph = Metamaps.Visualize.mGraph.graph;
|
|
||||||
|
|
||||||
//as long as you weren't the origin of the changes, update your map
|
if (Metamaps.Active.Map && self.status) {
|
||||||
if (data.origin != Metamaps.Active.Mapper.id && self.status) {
|
positions.mapid = Metamaps.Active.Map.id;
|
||||||
if (data.resource == 'Topic') {
|
socket.emit('topicDrag', positions);
|
||||||
topic = $.parseJSON(data.obj);
|
}
|
||||||
|
},
|
||||||
|
topicDrag: function (positions) {
|
||||||
|
var self = Metamaps.Realtime;
|
||||||
|
var socket = self.socket;
|
||||||
|
|
||||||
if (data.action == 'create') {
|
var topic;
|
||||||
self.addTopicToMap(topic);
|
var node;
|
||||||
} else if (data.action == 'update' && graph.getNode(topic.id) != 'undefined') {
|
|
||||||
self.updateTopicOnMap(topic);
|
|
||||||
} else if (data.action == 'destroy' && graph.getNode(topic.id) != 'undefined') {
|
|
||||||
Metamaps.Control.hideNode(topic.id)
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
if (Metamaps.Active.Map && self.status) {
|
||||||
} else if (data.resource == 'Synapse') {
|
for (var key in positions) {
|
||||||
synapse = $.parseJSON(data.obj);
|
topic = Metamaps.Topics.get(key);
|
||||||
|
if (topic) node = topic.get('node');
|
||||||
|
if (node) node.pos.setc(positions[key].x, positions[key].y);
|
||||||
|
} //for
|
||||||
|
Metamaps.Visualize.mGraph.plot();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// newTopic
|
||||||
|
sendNewTopic: function (data) {
|
||||||
|
var self = Metamaps.Realtime;
|
||||||
|
var socket = self.socket;
|
||||||
|
|
||||||
if (data.action == 'create') {
|
if (Metamaps.Active.Map && self.status) {
|
||||||
self.addSynapseToMap(synapse);
|
data.mapperid = Metamaps.Active.Mapper.id;
|
||||||
} else if (data.action == 'update' &&
|
data.mapid = Metamaps.Active.Map.id;
|
||||||
graph.getAdjacence(synapse.data.$direction['0'], synapse.data.$direction['1']) != 'undefined') {
|
socket.emit('newTopic', data);
|
||||||
self.updateSynapseOnMap(synapse);
|
}
|
||||||
} else if (data.action == 'destroy' &&
|
},
|
||||||
graph.getAdjacence(synapse.data.$direction['0'], synapse.data.$direction['1']) != 'undefined') {
|
newTopic: function (data) {
|
||||||
var edge = graph.getAdjacence(synapse.data.$direction['0'], synapse.data.$direction['1']);
|
var topic, mapping, mapper, mapperCallback, cancel;
|
||||||
Metamaps.Control.hideEdge(edge);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
function test() {
|
||||||
|
if (topic && mapping && mapper) {
|
||||||
|
Metamaps.Topic.renderTopic(mapping, topic, false, false);
|
||||||
|
}
|
||||||
|
else if (!cancel) {
|
||||||
|
setTimeout(test, 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
addTopicToMap: function (topic) {
|
|
||||||
|
|
||||||
// TODO
|
mapper = Metamaps.Mappers.get(data.mapperid);
|
||||||
var newPos, tempForT;
|
if (mapper === undefined) {
|
||||||
Metamaps.Visualize.mGraph.graph.addNode(topic);
|
mapperCallback = function (m) {
|
||||||
tempForT = Metamaps.Visualize.mGraph.graph.getNode(topic.id);
|
Metamaps.Mappers.add(m);
|
||||||
tempForT.setData('dim', 1, 'start');
|
mapper = m;
|
||||||
tempForT.setData('dim', 25, 'end');
|
};
|
||||||
newPos = new $jit.Complex();
|
Metamaps.Mapper.get(data.mapperid, mapperCallback);
|
||||||
newPos.x = tempForT.data.$xloc;
|
|
||||||
newPos.y = tempForT.data.$yloc;
|
|
||||||
tempForT.setPos(newPos, 'start');
|
|
||||||
tempForT.setPos(newPos, 'current');
|
|
||||||
tempForT.setPos(newPos, 'end');
|
|
||||||
Metamaps.Visualize.mGraph.fx.plotNode(tempForT, Metamaps.Visualize.mGraph.canvas);
|
|
||||||
},
|
|
||||||
updateTopicOnMap: function (topic) {
|
|
||||||
|
|
||||||
// TODO
|
|
||||||
var newPos, tempForT;
|
|
||||||
tempForT = Metamaps.Visualize.mGraph.graph.getNode(topic.id);
|
|
||||||
tempForT.data = topic.data;
|
|
||||||
tempForT.name = topic.name;
|
|
||||||
if (MetamapsModel.showcardInUse === topic.id) {
|
|
||||||
populateShowCard(tempForT);
|
|
||||||
}
|
}
|
||||||
newPos = new $jit.Complex();
|
$.ajax({
|
||||||
newPos.x = tempForT.data.$xloc;
|
url: "/topics/" + data.topicid + ".json",
|
||||||
newPos.y = tempForT.data.$yloc;
|
success: function (response) {
|
||||||
tempForT.setPos(newPos, 'start');
|
Metamaps.Topics.add(response);
|
||||||
tempForT.setPos(newPos, 'current');
|
topic = Metamaps.Topics.get(response.id);
|
||||||
tempForT.setPos(newPos, 'end');
|
},
|
||||||
return Metamaps.Visualize.mGraph.fx.animate({
|
error: function () {
|
||||||
modes: ['linear', 'node-property:dim', 'edge-property:lineWidth'],
|
cancel = true;
|
||||||
transition: $jit.Trans.Quad.easeInOut,
|
}
|
||||||
duration: 500
|
});
|
||||||
|
$.ajax({
|
||||||
|
url: "/mappings/" + data.mappingid + ".json",
|
||||||
|
success: function (response) {
|
||||||
|
Metamaps.Mappings.add(response);
|
||||||
|
mapping = Metamaps.Mappings.get(response.id);
|
||||||
|
},
|
||||||
|
error: function () {
|
||||||
|
cancel = true;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
|
||||||
addSynapseToMap: function (synapse) {
|
|
||||||
|
|
||||||
// TODO
|
test();
|
||||||
var Node1, Node2, tempForS;
|
|
||||||
Node1 = Metamaps.Visualize.mGraph.graph.getNode(synapse.data.$direction[0]);
|
|
||||||
Node2 = Metamaps.Visualize.mGraph.graph.getNode(synapse.data.$direction[1]);
|
|
||||||
Metamaps.Visualize.mGraph.graph.addAdjacence(Node1, Node2, {});
|
|
||||||
tempForS = Metamaps.Visualize.mGraph.graph.getAdjacence(Node1.id, Node2.id);
|
|
||||||
tempForS.setDataset('start', {
|
|
||||||
lineWidth: 0.4
|
|
||||||
});
|
|
||||||
tempForS.setDataset('end', {
|
|
||||||
lineWidth: 2
|
|
||||||
});
|
|
||||||
tempForS.data = synapse.data;
|
|
||||||
Metamaps.Visualize.mGraph.fx.plotLine(tempForS, Metamaps.Visualize.mGraph.canvas);
|
|
||||||
return Metamaps.Visualize.mGraph.fx.animate({
|
|
||||||
modes: ['linear', 'node-property:dim', 'edge-property:lineWidth'],
|
|
||||||
transition: $jit.Trans.Quad.easeInOut,
|
|
||||||
duration: 500
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
updateSynapseOnMap: function (synapse) {
|
// removeTopic
|
||||||
|
sendRemoveTopic: function (data) {
|
||||||
|
var self = Metamaps.Realtime;
|
||||||
|
var socket = self.socket;
|
||||||
|
|
||||||
// TODO
|
if (Metamaps.Active.Map && self.status) {
|
||||||
var k, tempForS, v, wasShowDesc, _ref;
|
data.mapid = Metamaps.Active.Map.id;
|
||||||
tempForS = Metamaps.Visualize.mGraph.graph.getAdjacence(synapse.data.$direction[0], synapse.data.$direction[1]);
|
socket.emit('removeTopic', data);
|
||||||
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) { // TODO
|
removeTopic: function (data) {
|
||||||
editEdge(tempForS, false);
|
|
||||||
|
},
|
||||||
|
// newSynapse
|
||||||
|
sendNewSynapse: function (data) {
|
||||||
|
var self = Metamaps.Realtime;
|
||||||
|
var socket = self.socket;
|
||||||
|
|
||||||
|
if (Metamaps.Active.Map && self.status) {
|
||||||
|
data.mapperid = Metamaps.Active.Mapper.id;
|
||||||
|
data.mapid = Metamaps.Active.Map.id;
|
||||||
|
socket.emit('newSynapse', data);
|
||||||
}
|
}
|
||||||
return Metamaps.Visualize.mGraph.plot();
|
},
|
||||||
}
|
newSynapse: function (data) {
|
||||||
|
var topic1, topic2, node1, node2, synapse, mapping, cancel;
|
||||||
|
|
||||||
|
function test() {
|
||||||
|
if (synapse && mapping && mapper) {
|
||||||
|
topic1 = synapse.getTopic1();
|
||||||
|
node1 = topic1.get('node');
|
||||||
|
topic2 = synapse.getTopic2();
|
||||||
|
node2 = topic2.get('node');
|
||||||
|
|
||||||
|
Metamaps.Synapse.renderSynapse(mapping, synapse, node1, node2, false);
|
||||||
|
}
|
||||||
|
else if (!cancel) {
|
||||||
|
setTimeout(test, 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mapper = Metamaps.Mappers.get(data.mapperid);
|
||||||
|
if (mapper === undefined) {
|
||||||
|
mapperCallback = function (m) {
|
||||||
|
Metamaps.Mappers.add(m);
|
||||||
|
mapper = m;
|
||||||
|
};
|
||||||
|
Metamaps.Mapper.get(data.mapperid, mapperCallback);
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
url: "/synapses/" + data.synapseid + ".json",
|
||||||
|
success: function (response) {
|
||||||
|
Metamaps.Synapses.add(response);
|
||||||
|
synapse = Metamaps.Synapses.get(response.id);
|
||||||
|
},
|
||||||
|
error: function () {
|
||||||
|
cancel = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$.ajax({
|
||||||
|
url: "/mappings/" + data.mappingid + ".json",
|
||||||
|
success: function (response) {
|
||||||
|
Metamaps.Mappings.add(response);
|
||||||
|
mapping = Metamaps.Mappings.get(response.id);
|
||||||
|
},
|
||||||
|
error: function () {
|
||||||
|
cancel = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
test();
|
||||||
|
},
|
||||||
|
// removeSynapse
|
||||||
|
sendRemoveSynapse: function (data) {
|
||||||
|
var self = Metamaps.Realtime;
|
||||||
|
var socket = self.socket;
|
||||||
|
|
||||||
|
if (Metamaps.Active.Map && self.status) {
|
||||||
|
data.mapid = Metamaps.Active.Map.id;
|
||||||
|
socket.emit('removeSynapse', data);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
removeSynapse: function (data) {
|
||||||
|
|
||||||
|
},
|
||||||
}; // end Metamaps.Realtime
|
}; // end Metamaps.Realtime
|
||||||
|
|
||||||
|
|
||||||
|
@ -2021,11 +2120,13 @@ Metamaps.Control = {
|
||||||
if (Metamaps.Selected.Nodes.indexOf(node) != -1) return;
|
if (Metamaps.Selected.Nodes.indexOf(node) != -1) return;
|
||||||
node.selected = true;
|
node.selected = true;
|
||||||
node.setData('dim', 30, 'current');
|
node.setData('dim', 30, 'current');
|
||||||
|
/*
|
||||||
if(!(e.ctrlKey) && !(e.altKey)){
|
if(!(e.ctrlKey) && !(e.altKey)){
|
||||||
node.eachAdjacency(function (adj) {
|
node.eachAdjacency(function (adj) {
|
||||||
Metamaps.Control.selectEdge(adj);
|
Metamaps.Control.selectEdge(adj);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
Metamaps.Selected.Nodes.push(node);
|
Metamaps.Selected.Nodes.push(node);
|
||||||
},
|
},
|
||||||
|
@ -2406,21 +2507,6 @@ Metamaps.Filter = {
|
||||||
$('#filter_by_mapper ul').empty();
|
$('#filter_by_mapper ul').empty();
|
||||||
$('#filter_by_synapse ul').empty();
|
$('#filter_by_synapse ul').empty();
|
||||||
},
|
},
|
||||||
initializeFilterData: function () {
|
|
||||||
var self = Metamaps.Filter;
|
|
||||||
|
|
||||||
var check = function (filtersToUse, topicsOrSynapses, propertyToCheck) {
|
|
||||||
Metamaps[topicsOrSynapses].each(function(model) {
|
|
||||||
var prop = model.get(propertyToCheck) ? model.get(propertyToCheck).toString() : false;
|
|
||||||
if (prop && self.visible[filtersToUse].indexOf(prop) === -1) {
|
|
||||||
self.visible[filtersToUse].push(prop);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
check('metacodes', 'Topics', 'metacode_id');
|
|
||||||
check('mappers', 'Mappings', 'user_id');
|
|
||||||
check('synapses', 'Synapses', 'desc');
|
|
||||||
},
|
|
||||||
/*
|
/*
|
||||||
Most of this data essentially depends on the ruby function which are happening for filter inside view filterBox
|
Most of this data essentially depends on the ruby function which are happening for filter inside view filterBox
|
||||||
But what these function do is load this data into three accessible array within java : metacodes, mappers and synapses
|
But what these function do is load this data into three accessible array within java : metacodes, mappers and synapses
|
||||||
|
@ -2868,7 +2954,6 @@ Metamaps.Topic = {
|
||||||
|
|
||||||
// update filters
|
// update filters
|
||||||
Metamaps.Filter.reset();
|
Metamaps.Filter.reset();
|
||||||
Metamaps.Filter.initializeFilterData(); // this sets all the visible filters to true
|
|
||||||
|
|
||||||
// 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();
|
||||||
|
@ -2892,13 +2977,15 @@ Metamaps.Topic = {
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
renderTopic: function (mapping, topic, createNewInDB) {
|
renderTopic: function (mapping, topic, createNewInDB, permitCreateSynapseAfter) {
|
||||||
var self = Metamaps.Topic;
|
var self = Metamaps.Topic;
|
||||||
|
|
||||||
var nodeOnViz, tempPos;
|
var nodeOnViz, tempPos;
|
||||||
|
|
||||||
var newnode = topic.createNode();
|
var newnode = topic.createNode();
|
||||||
|
|
||||||
|
var midpoint = {}, pixelPos;
|
||||||
|
|
||||||
if (!$.isEmptyObject(Metamaps.Visualize.mGraph.graph.nodes)) {
|
if (!$.isEmptyObject(Metamaps.Visualize.mGraph.graph.nodes)) {
|
||||||
Metamaps.Visualize.mGraph.graph.addNode(newnode);
|
Metamaps.Visualize.mGraph.graph.addNode(newnode);
|
||||||
Metamaps.Visualize.mGraph.graph.eachNode(function (n) {
|
Metamaps.Visualize.mGraph.graph.eachNode(function (n) {
|
||||||
|
@ -2923,9 +3010,16 @@ Metamaps.Topic = {
|
||||||
nodeOnViz.setPos(new $jit.Complex(mapping.get('xloc'), mapping.get('yloc')), "start");
|
nodeOnViz.setPos(new $jit.Complex(mapping.get('xloc'), mapping.get('yloc')), "start");
|
||||||
nodeOnViz.setPos(new $jit.Complex(mapping.get('xloc'), mapping.get('yloc')), "end");
|
nodeOnViz.setPos(new $jit.Complex(mapping.get('xloc'), mapping.get('yloc')), "end");
|
||||||
}
|
}
|
||||||
if (Metamaps.Create.newTopic.addSynapse) {
|
if (Metamaps.Create.newTopic.addSynapse && permitCreateSynapseAfter) {
|
||||||
Metamaps.Create.newSynapse.topic1id = tempNode.id;
|
Metamaps.Create.newSynapse.topic1id = tempNode.getData('topic').id;
|
||||||
Metamaps.Create.newSynapse.topic2id = nodeOnViz.id;
|
|
||||||
|
// position the form
|
||||||
|
midpoint.x = tempNode.pos.getc().x + (nodeOnViz.pos.getc().x - tempNode.pos.getc().x) / 2;
|
||||||
|
midpoint.y = tempNode.pos.getc().y + (nodeOnViz.pos.getc().y - tempNode.pos.getc().y) / 2;
|
||||||
|
pixelPos = Metamaps.Util.coordsToPixels(midpoint);
|
||||||
|
$('#new_synapse').css('left', pixelPos.x + "px");
|
||||||
|
$('#new_synapse').css('top', pixelPos.y + "px");
|
||||||
|
// show the form
|
||||||
Metamaps.Create.newSynapse.open();
|
Metamaps.Create.newSynapse.open();
|
||||||
Metamaps.Visualize.mGraph.fx.animate({
|
Metamaps.Visualize.mGraph.fx.animate({
|
||||||
modes: ["node-property:dim"],
|
modes: ["node-property:dim"],
|
||||||
|
@ -2967,20 +3061,41 @@ Metamaps.Topic = {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var mappingSuccessCallback = function (mappingModel, response) {
|
||||||
|
var newTopicData = {
|
||||||
|
mappingid: mappingModel.id,
|
||||||
|
topicid: mappingModel.get('topic_id')
|
||||||
|
};
|
||||||
|
|
||||||
|
$(document).trigger(Metamaps.JIT.events.newTopic, [newTopicData]);
|
||||||
|
};
|
||||||
|
var topicSuccessCallback = function (topicModel, response) {
|
||||||
|
if (Metamaps.Active.Map) {
|
||||||
|
mapping.save({ topic_id: topicModel.id }, {
|
||||||
|
success: mappingSuccessCallback,
|
||||||
|
error: function (model, response) {
|
||||||
|
console.log('error saving mapping to database');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Metamaps.Create.newTopic.addSynapse) {
|
||||||
|
Metamaps.Create.newSynapse.topic2id = topicModel.id;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
if (!Metamaps.Settings.sandbox && createNewInDB) {
|
if (!Metamaps.Settings.sandbox && createNewInDB) {
|
||||||
if (topic.isNew()) {
|
if (topic.isNew()) {
|
||||||
topic.save(null, {
|
topic.save(null, {
|
||||||
success: function (topicModel, response) {
|
success: topicSuccessCallback,
|
||||||
if (Metamaps.Active.Map) {
|
|
||||||
mapping.save({ topic_id: topicModel.id });
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function (model, response) {
|
error: function (model, response) {
|
||||||
console.log('error saving topic to database');
|
console.log('error saving topic to database');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (!topic.isNew() && Metamaps.Active.Map) {
|
} else if (!topic.isNew() && Metamaps.Active.Map) {
|
||||||
mapping.save();
|
mapping.save(null, {
|
||||||
|
success: mappingSuccessCallback
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -3008,7 +3123,7 @@ Metamaps.Topic = {
|
||||||
//these can't happen until the value is retrieved, which happens in the line above
|
//these can't happen until the value is retrieved, which happens in the line above
|
||||||
Metamaps.Create.newTopic.hide();
|
Metamaps.Create.newTopic.hide();
|
||||||
|
|
||||||
self.renderTopic(mapping, topic, true); // this function also includes the creation of the topic in the database
|
self.renderTopic(mapping, topic, true, true); // this function also includes the creation of the topic in the database
|
||||||
},
|
},
|
||||||
getTopicFromAutocomplete: function (id) {
|
getTopicFromAutocomplete: function (id) {
|
||||||
var self = Metamaps.Topic;
|
var self = Metamaps.Topic;
|
||||||
|
@ -3025,7 +3140,7 @@ Metamaps.Topic = {
|
||||||
});
|
});
|
||||||
Metamaps.Mappings.add(mapping);
|
Metamaps.Mappings.add(mapping);
|
||||||
|
|
||||||
self.renderTopic(mapping, topic, true);
|
self.renderTopic(mapping, topic, true, true);
|
||||||
}
|
}
|
||||||
}; // end Metamaps.Topic
|
}; // end Metamaps.Topic
|
||||||
|
|
||||||
|
@ -3084,20 +3199,34 @@ Metamaps.Synapse = {
|
||||||
Metamaps.Visualize.mGraph.fx.plotLine(edgeOnViz, Metamaps.Visualize.mGraph.canvas);
|
Metamaps.Visualize.mGraph.fx.plotLine(edgeOnViz, Metamaps.Visualize.mGraph.canvas);
|
||||||
Metamaps.Control.selectEdge(edgeOnViz);
|
Metamaps.Control.selectEdge(edgeOnViz);
|
||||||
|
|
||||||
|
var mappingSuccessCallback = function (mappingModel, response) {
|
||||||
|
var newSynapseData = {
|
||||||
|
mappingid: mappingModel.id,
|
||||||
|
synapseid: mappingModel.get('synapse_id')
|
||||||
|
};
|
||||||
|
|
||||||
|
$(document).trigger(Metamaps.JIT.events.newSynapse, [newSynapseData]);
|
||||||
|
};
|
||||||
|
var synapseSuccessCallback = function (synapseModel, response) {
|
||||||
|
if (Metamaps.Active.Map) {
|
||||||
|
mapping.save({ synapse_id: synapseModel.id }, {
|
||||||
|
success: mappingSuccessCallback
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
if (!Metamaps.Settings.sandbox && createNewInDB) {
|
if (!Metamaps.Settings.sandbox && createNewInDB) {
|
||||||
if (synapse.isNew()) {
|
if (synapse.isNew()) {
|
||||||
synapse.save(null, {
|
synapse.save(null, {
|
||||||
success: function (synapseModel, response) {
|
success: synapseSuccessCallback,
|
||||||
if (Metamaps.Active.Map) {
|
|
||||||
mapping.save({ synapse_id: synapseModel.id });
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function (model, response) {
|
error: function (model, response) {
|
||||||
console.log('error saving synapse to database');
|
console.log('error saving synapse to database');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (!synapse.isNew() && Metamaps.Active.Map) {
|
} else if (!synapse.isNew() && Metamaps.Active.Map) {
|
||||||
mapping.save();
|
mapping.save(null, {
|
||||||
|
success: mappingSuccessCallback
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -3113,12 +3242,13 @@ Metamaps.Synapse = {
|
||||||
//for each node in this array we will create a synapse going to the position2 node.
|
//for each node in this array we will create a synapse going to the position2 node.
|
||||||
var synapsesToCreate = [];
|
var synapsesToCreate = [];
|
||||||
|
|
||||||
node2 = Metamaps.Visualize.mGraph.graph.getNode(Metamaps.Create.newSynapse.topic2id);
|
topic2 = Metamaps.Topics.get(Metamaps.Create.newSynapse.topic2id);
|
||||||
topic2 = node2.getData('topic');
|
node2 = topic2.get('node');
|
||||||
|
|
||||||
var len = Metamaps.Selected.Nodes.length;
|
var len = Metamaps.Selected.Nodes.length;
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
synapsesToCreate[0] = Metamaps.Visualize.mGraph.graph.getNode(Metamaps.Create.newSynapse.topic1id);
|
topic1 = Metamaps.Topics.get(Metamaps.Create.newSynapse.topic1id);
|
||||||
|
synapsesToCreate[0] = topic1.get('node');
|
||||||
} else if (len > 0) {
|
} else if (len > 0) {
|
||||||
synapsesToCreate = Metamaps.Selected.Nodes;
|
synapsesToCreate = Metamaps.Selected.Nodes;
|
||||||
}
|
}
|
||||||
|
@ -3147,6 +3277,8 @@ Metamaps.Synapse = {
|
||||||
},
|
},
|
||||||
getSynapseFromAutocomplete: function (id) {
|
getSynapseFromAutocomplete: function (id) {
|
||||||
var self = Metamaps.Synapse,
|
var self = Metamaps.Synapse,
|
||||||
|
topic1,
|
||||||
|
topic2,
|
||||||
node1,
|
node1,
|
||||||
node2;
|
node2;
|
||||||
|
|
||||||
|
@ -3158,8 +3290,10 @@ Metamaps.Synapse = {
|
||||||
});
|
});
|
||||||
Metamaps.Mappings.add(mapping);
|
Metamaps.Mappings.add(mapping);
|
||||||
|
|
||||||
node1 = Metamaps.Visualize.mGraph.graph.getNode(Metamaps.Create.newSynapse.topic1id);
|
topic1 = Metamaps.Topics.get(Metamaps.Create.newSynapse.topic1id);
|
||||||
node2 = Metamaps.Visualize.mGraph.graph.getNode(Metamaps.Create.newSynapse.topic2id);
|
node1 = topic1.get('node');
|
||||||
|
topic1 = Metamaps.Topics.get(Metamaps.Create.newSynapse.topic2id);
|
||||||
|
node2 = topic2.get('node');
|
||||||
Metamaps.Create.newSynapse.hide();
|
Metamaps.Create.newSynapse.hide();
|
||||||
|
|
||||||
self.renderSynapse(mapping, synapse, node1, node2, true);
|
self.renderSynapse(mapping, synapse, node1, node2, true);
|
||||||
|
@ -3206,7 +3340,6 @@ Metamaps.Map = {
|
||||||
|
|
||||||
// update filters
|
// update filters
|
||||||
Metamaps.Filter.reset();
|
Metamaps.Filter.reset();
|
||||||
Metamaps.Filter.initializeFilterData(); // this sets all the visible filters to true
|
|
||||||
|
|
||||||
// set the proper mapinfobox content
|
// set the proper mapinfobox content
|
||||||
Metamaps.Map.InfoBox.load();
|
Metamaps.Map.InfoBox.load();
|
||||||
|
@ -3217,6 +3350,7 @@ Metamaps.Map = {
|
||||||
Metamaps.Filter.checkMappers();
|
Metamaps.Filter.checkMappers();
|
||||||
|
|
||||||
Metamaps.Realtime.startActiveMap();
|
Metamaps.Realtime.startActiveMap();
|
||||||
|
Metamaps.Loading.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
|
|
@ -10,9 +10,6 @@
|
||||||
*
|
*
|
||||||
*= require_self
|
*= require_self
|
||||||
*= require_tree .
|
*= require_tree .
|
||||||
*= require base
|
|
||||||
*= require jquery.mCustomScrollbar
|
|
||||||
*= require jquery-ui
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* clear styles */
|
/* clear styles */
|
||||||
|
@ -130,6 +127,9 @@ body,
|
||||||
position: relative;
|
position: relative;
|
||||||
margin-top: 32px;
|
margin-top: 32px;
|
||||||
}
|
}
|
||||||
|
.edit_user .userImage img {
|
||||||
|
border-radius: 42px;
|
||||||
|
}
|
||||||
.edit_user .editPhoto {
|
.edit_user .editPhoto {
|
||||||
display: none;
|
display: none;
|
||||||
width: 40px;
|
width: 40px;
|
||||||
|
@ -862,7 +862,7 @@ label[for="user_remember_me"] {
|
||||||
|
|
||||||
.sidebarFilterBox {
|
.sidebarFilterBox {
|
||||||
display:none;
|
display:none;
|
||||||
width: 304px;
|
width: 319px;
|
||||||
padding: 16px 0;
|
padding: 16px 0;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
@ -2151,6 +2151,9 @@ float: left;
|
||||||
.blackBox td.iconURL {
|
.blackBox td.iconURL {
|
||||||
max-width: 415px;
|
max-width: 415px;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
|
}
|
||||||
|
.blackBox td.iconColor {
|
||||||
|
|
||||||
}
|
}
|
||||||
.blackBox .field {
|
.blackBox .field {
|
||||||
margin: 15px 0 5px;
|
margin: 15px 0 5px;
|
||||||
|
|
151
app/assets/stylesheets/barometer.css
Normal file
151
app/assets/stylesheets/barometer.css
Normal file
|
@ -0,0 +1,151 @@
|
||||||
|
/* =Barometer feedback tab
|
||||||
|
--------------------------------------------------------*/
|
||||||
|
|
||||||
|
a#barometer_tab {
|
||||||
|
background-image:url(../images/feedback_tab.png);
|
||||||
|
background-color:#222222;
|
||||||
|
color:#FFFFFF;
|
||||||
|
cursor:pointer;
|
||||||
|
height:102px;
|
||||||
|
left:0;
|
||||||
|
margin-left:-7px;
|
||||||
|
overflow:hidden;
|
||||||
|
position:fixed;
|
||||||
|
text-indent:-100000px;
|
||||||
|
top:25%;
|
||||||
|
width:42px;
|
||||||
|
z-index:100000;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* =Barometer Overlay
|
||||||
|
--------------------------------------------------------*/
|
||||||
|
|
||||||
|
#barometer_overlay {
|
||||||
|
top:0;
|
||||||
|
left:0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
position: fixed;
|
||||||
|
_position: absolute;
|
||||||
|
z-index: 1000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
#barometer_overlay * {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
font-family: Arial, Helvetica, sans-serif;
|
||||||
|
font-style:normal;
|
||||||
|
font-variant:normal;
|
||||||
|
font-size: 12px;
|
||||||
|
color:#333;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* =Barometer Overlay -> Main
|
||||||
|
--------------------------------------------------------*/
|
||||||
|
|
||||||
|
#barometer_main {
|
||||||
|
width: 550px;
|
||||||
|
height: 100%;
|
||||||
|
margin: 0 auto;
|
||||||
|
z-index:2;
|
||||||
|
position:relative;
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
#barometer_main div {
|
||||||
|
padding: 5px 20px 0 20px;
|
||||||
|
margin:0;
|
||||||
|
background: #EEE;
|
||||||
|
overflow:none;
|
||||||
|
border-right: solid 2px #000;
|
||||||
|
border-left: solid 2px #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
#barometer_overlay #barometer_main #overlay_loading h2 {
|
||||||
|
padding: 10px 0;
|
||||||
|
font-size:28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#barometer_overlay #barometer_main #barometer_close:hover {
|
||||||
|
background-position:-42px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#barometer_overlay #barometer_main a#barometer_close {
|
||||||
|
background-image:url(../images/barometer_close.png);
|
||||||
|
cursor:pointer;
|
||||||
|
height:42px;
|
||||||
|
outline-color:-moz-use-text-color;
|
||||||
|
outline-style:none;
|
||||||
|
outline-width:medium;
|
||||||
|
overflow:hidden;
|
||||||
|
position:absolute;
|
||||||
|
top:-23px;
|
||||||
|
right:-22px;
|
||||||
|
width:42px;
|
||||||
|
z-index:4;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#barometer_overlay #barometer_main span {
|
||||||
|
background:url(../images/close.png) no-repeat scroll 33px 0 transparent;
|
||||||
|
color:#FFFFFF;
|
||||||
|
cursor:pointer;
|
||||||
|
float:right;
|
||||||
|
font-size:11px;
|
||||||
|
height:20px;
|
||||||
|
padding-right:20px;
|
||||||
|
text-decoration:underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
#barometer_iframe {
|
||||||
|
width: 550px;
|
||||||
|
height: 100%;
|
||||||
|
background: transparent url(../images/barometer_loading.png) no-repeat;
|
||||||
|
}
|
||||||
|
#barometer_iframe.loaded {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* =Barometer Overlay -> Main -> Overlay header
|
||||||
|
--------------------------------------------------------*/
|
||||||
|
|
||||||
|
#barometer_overlay #barometer_main #overlay_header {
|
||||||
|
padding:6px 5px 1px 0;
|
||||||
|
background-color:#333;
|
||||||
|
font-weight: bold;
|
||||||
|
height:18px;
|
||||||
|
border: solid 2px #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
#barometer_overlay #barometer_main #overlay_header a {
|
||||||
|
color:#fff;
|
||||||
|
float:left;
|
||||||
|
font-size:15px;
|
||||||
|
margin-left:5px;
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
#barometer_overlay #barometer_main #overlay_header span {
|
||||||
|
float:right;
|
||||||
|
height:20px;
|
||||||
|
padding-right:20px;
|
||||||
|
background: transparent url(../images/close.png) no-repeat 33px 0;
|
||||||
|
text-decoration:underline;
|
||||||
|
font-size:11px;
|
||||||
|
cursor:pointer;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* =Barometer screen id - used to close barometer
|
||||||
|
--------------------------------------------------------*/
|
||||||
|
|
||||||
|
#barometer_screen {
|
||||||
|
top:0;
|
||||||
|
left:0;
|
||||||
|
z-index:1;
|
||||||
|
width: 100%;
|
||||||
|
position: absolute;
|
||||||
|
background-color: #000;
|
||||||
|
opacity: 0.42; filter:alpha(opacity=42); -moz-opacity: 0.42;
|
||||||
|
}
|
|
@ -292,7 +292,7 @@ cursor: pointer;
|
||||||
display: none;
|
display: none;
|
||||||
width: 90%;
|
width: 90%;
|
||||||
padding: 13px 0 9px 10%;
|
padding: 13px 0 9px 10%;
|
||||||
background-color: #64BC61;
|
background-color: #E0E0E0;
|
||||||
color: #424242;
|
color: #424242;
|
||||||
}
|
}
|
||||||
.permission.canEdit .metacodeTitle {
|
.permission.canEdit .metacodeTitle {
|
||||||
|
|
|
@ -154,6 +154,16 @@
|
||||||
.sidebarSearch {
|
.sidebarSearch {
|
||||||
float:left;
|
float:left;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
#searchLoading {
|
||||||
|
height: 24px;
|
||||||
|
width: 24px;
|
||||||
|
position: absolute;
|
||||||
|
top: 4px;
|
||||||
|
right: 76px;
|
||||||
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.unauthenticated .homePage .sidebarSearchIcon {
|
.unauthenticated .homePage .sidebarSearchIcon {
|
||||||
|
@ -184,6 +194,12 @@
|
||||||
padding: 7px 10px 3px 10px;
|
padding: 7px 10px 3px 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sidebarSearchField {
|
||||||
|
color: #424242;
|
||||||
|
}
|
||||||
|
.sidebarSearch .tt-hint {
|
||||||
|
color: transparent;
|
||||||
|
}
|
||||||
.sidebarSearchField,
|
.sidebarSearchField,
|
||||||
.sidebarSearch .tt-hint {
|
.sidebarSearch .tt-hint {
|
||||||
height: 20px;
|
height: 20px;
|
||||||
|
@ -198,7 +214,6 @@
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
line-height: 14px;
|
line-height: 14px;
|
||||||
background: #FFFFFF;
|
background: #FFFFFF;
|
||||||
color: #BDBDBD;
|
|
||||||
font-family: 'din-medium', helvetica, sans-serif;
|
font-family: 'din-medium', helvetica, sans-serif;
|
||||||
}
|
}
|
||||||
.sidebarSearch .tt-dropdown-menu {
|
.sidebarSearch .tt-dropdown-menu {
|
||||||
|
@ -212,6 +227,7 @@
|
||||||
.searchHeader {
|
.searchHeader {
|
||||||
height: 42px;
|
height: 42px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
.searchTopicsHeader {
|
.searchTopicsHeader {
|
||||||
background: #4fc4a8;
|
background: #4fc4a8;
|
||||||
|
@ -227,62 +243,83 @@
|
||||||
color: #F5F5F5;
|
color: #F5F5F5;
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
line-height: 18px;
|
line-height: 18px;
|
||||||
margin: 10px 0 3px 10px;
|
margin: 12px 0 3px 16px;
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
.sidebarSearch .tt-dropdown-menu .limitToMe {
|
.sidebarSearch .tt-dropdown-menu .limitToMe {
|
||||||
float: left;
|
float: left;
|
||||||
width: 15px;
|
width: 12px;
|
||||||
height: 15px;
|
height: 12px;
|
||||||
margin-top: 11px;
|
border: 1px;
|
||||||
margin-left: 15px;
|
color: #000000;
|
||||||
|
position: absolute;
|
||||||
|
top: 15px;
|
||||||
|
left: 136px;
|
||||||
}
|
}
|
||||||
.sidebarSearch .tt-dropdown-menu .limitToMeLabel {
|
.sidebarSearch .tt-dropdown-menu .limitToMeLabel {
|
||||||
float: left;
|
float: left;
|
||||||
margin-top: 11px;
|
font-family: 'din-medium', helvetica, sans-serif;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #f5f5f5;
|
||||||
|
margin: 0;
|
||||||
|
position: absolute;
|
||||||
|
top: 15px;
|
||||||
|
left: 156px;
|
||||||
|
}
|
||||||
|
.sidebarSearch .tt-dropdown-menu .minimizeResults, .sidebarSearch .tt-dropdown-menu .maximizeResults {
|
||||||
|
float: right;
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
background-image: url(arrowpermswhite_sprite.png);
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
cursor: pointer;
|
||||||
|
margin-top: 5px;
|
||||||
|
margin-right: 20px;
|
||||||
}
|
}
|
||||||
.sidebarSearch .tt-dropdown-menu .minimizeResults {
|
.sidebarSearch .tt-dropdown-menu .minimizeResults {
|
||||||
float: right;
|
background-position-x: 0;
|
||||||
width: 35px;
|
|
||||||
height: 35px;
|
|
||||||
background: url('/assets/MMCCicon_minimize_arrow.png') no-repeat center center;
|
|
||||||
background-size: 25px 25px;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
}
|
||||||
.sidebarSearch .tt-dropdown-menu .maximizeResults {
|
.sidebarSearch .tt-dropdown-menu .maximizeResults {
|
||||||
float: right;
|
background-position-x: -32px;
|
||||||
width: 35px;
|
|
||||||
height: 35px;
|
|
||||||
background: url('/assets/MMCCicon_maximize_arrow.png') no-repeat center center;
|
|
||||||
background-size: 25px 25px;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
}
|
||||||
.sidebarSearch .tt-suggestions {
|
.sidebarSearch .tt-suggestions {
|
||||||
overflow: visible;
|
overflow: visible;
|
||||||
}
|
}
|
||||||
.sidebarSearch .tt-suggestion {
|
.sidebarSearch .tt-suggestion {
|
||||||
|
position: relative;
|
||||||
background: #FFF;
|
background: #FFF;
|
||||||
|
padding: 8px 0;
|
||||||
}
|
}
|
||||||
.sidebarSearch .tt-is-under-cursor,
|
.sidebarSearch .tt-is-under-cursor,
|
||||||
.sidebarSearch .tt-is-under-mouse-cursor {
|
.sidebarSearch .tt-is-under-mouse-cursor {
|
||||||
background: #E0E0E0;
|
background: #E0E0E0;
|
||||||
}
|
}
|
||||||
.sidebarSearch .tt-dataset-maps .tt-is-under-cursor .resultmap,
|
|
||||||
|
.resultmap, .resulttopic, .resultmapper, .resultnoresult {
|
||||||
|
min-height: 48px;
|
||||||
|
display: table;
|
||||||
|
}
|
||||||
|
/*.sidebarSearch .tt-dataset-maps .tt-is-under-cursor .resultmap,
|
||||||
.sidebarSearch .tt-dataset-maps .tt-is-under-mouse-cursor .resultmap,
|
.sidebarSearch .tt-dataset-maps .tt-is-under-mouse-cursor .resultmap,
|
||||||
.sidebarSearch .tt-dataset-topics .tt-is-under-cursor .resulttopic,
|
.sidebarSearch .tt-dataset-topics .tt-is-under-cursor .resulttopic,
|
||||||
.sidebarSearch .tt-dataset-topics .tt-is-under-mouse-cursor .resulttopic {
|
.sidebarSearch .tt-dataset-topics .tt-is-under-mouse-cursor .resulttopic {
|
||||||
min-height: 57px;
|
min-height: 48px;
|
||||||
|
}*/
|
||||||
|
.sidebarSearch .tt-suggestion .searchResIconWrapper {
|
||||||
|
display: table-cell;
|
||||||
|
vertical-align: middle;
|
||||||
|
height: 32px;
|
||||||
|
padding: 0 8px;
|
||||||
}
|
}
|
||||||
.sidebarSearch .tt-suggestion .icon {
|
.sidebarSearch .tt-suggestion .icon {
|
||||||
float: left;
|
|
||||||
width: 32px;
|
width: 32px;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
margin-right: 5px;
|
|
||||||
border-radius:16px;
|
border-radius:16px;
|
||||||
}
|
}
|
||||||
.sidebarSearch .topicMetacode {
|
.sidebarSearch .topicMetacode {
|
||||||
float: left;
|
display: table-cell;
|
||||||
margin-right: 5px;
|
vertical-align: middle;
|
||||||
|
padding: 0 0 0 8px;
|
||||||
max-width: 70px;
|
max-width: 70px;
|
||||||
}
|
}
|
||||||
.sidebarSearch .tt-dataset-topics .topicIcon {
|
.sidebarSearch .tt-dataset-topics .topicIcon {
|
||||||
|
@ -292,7 +329,6 @@
|
||||||
.sidebarSearch .tt-dataset-topics .tt-is-under-cursor .topicIcon,
|
.sidebarSearch .tt-dataset-topics .tt-is-under-cursor .topicIcon,
|
||||||
.sidebarSearch .tt-dataset-topics .tt-is-under-mouse-cursor .topicIcon {
|
.sidebarSearch .tt-dataset-topics .tt-is-under-mouse-cursor .topicIcon {
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
padding-left: 2px
|
|
||||||
}
|
}
|
||||||
.sidebarSearch .tt-dataset-topics .metacodeTip {
|
.sidebarSearch .tt-dataset-topics .metacodeTip {
|
||||||
display: none;
|
display: none;
|
||||||
|
@ -311,32 +347,39 @@
|
||||||
margin: 4px 9px 4px 4px;
|
margin: 4px 9px 4px 4px;
|
||||||
}
|
}
|
||||||
.sidebarSearch .resultText {
|
.sidebarSearch .resultText {
|
||||||
width: 225px;
|
width: 260px;
|
||||||
display: block;
|
display: table-cell;
|
||||||
float: left;
|
padding-left: 8px;
|
||||||
|
vertical-align: middle;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
.sidebarSearch .resultTitle {
|
.sidebarSearch .resultTitle {
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
font-size: 18px;
|
font-size: 16px;
|
||||||
line-height: 22px;
|
line-height: 20px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding-top: 8px;
|
font-family: 'din-regular', helvetica, sans-serif;
|
||||||
}
|
}
|
||||||
.sidebarSearch .resultDesc {
|
.sidebarSearch .resultDesc {
|
||||||
font-size: 14px;
|
font-size: 12px;
|
||||||
line-height: 16px;
|
line-height: 16px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 3px 0 6px 0;
|
font-style: italic;
|
||||||
|
font-family: helvetica, sans-serif;
|
||||||
}
|
}
|
||||||
.sidebarSearch .tip {
|
.sidebarSearch .tip {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
.sidebarSearch div.autoOptions {
|
.sidebarSearch div.autoOptions {
|
||||||
width: 122px;
|
width: 114px;
|
||||||
float: right;
|
height: 48px;
|
||||||
position: relative;
|
position: absolute;
|
||||||
display: none;
|
display: none;
|
||||||
|
top: 8px;
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
.tt-dataset-maps div.autoOptions {
|
||||||
|
width: 84px;
|
||||||
}
|
}
|
||||||
.sidebarSearch .tt-is-under-cursor .autoOptions,
|
.sidebarSearch .tt-is-under-cursor .autoOptions,
|
||||||
.sidebarSearch .tt-is-under-mouse-cursor .autoOptions {
|
.sidebarSearch .tt-is-under-mouse-cursor .autoOptions {
|
||||||
|
@ -355,127 +398,120 @@
|
||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
.sidebarSearch button.addToMap {
|
.sidebarSearch button.addToMap {
|
||||||
width: 20px;
|
width: 24px;
|
||||||
height: 20px;
|
height: 24px;
|
||||||
background: url(/assets/MMCCicon_add.png) no-repeat center center;
|
background: url(addtopic_sprite.png);
|
||||||
background-size: 18px 18px;
|
background-repeat: no-repeat;
|
||||||
top: 30px;
|
background-size: 48px 24px;
|
||||||
left: 84px;
|
top: 12px;
|
||||||
|
left: 80px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
.sidebarSearch div.goTo {
|
.sidebarSearch button.addToMap:hover {
|
||||||
width: 20px;
|
background-position: -24px;
|
||||||
height: 20px;
|
|
||||||
background: url(/assets/MMCCicon_pop-out.png) no-repeat center center;
|
|
||||||
background-size: 18px 18px;
|
|
||||||
top: 7px;
|
|
||||||
left: 84px;
|
|
||||||
}
|
|
||||||
.sidebarSearch div.mapCount {
|
|
||||||
width: 20px;
|
|
||||||
height: 20px;
|
|
||||||
background: url(/assets/MMCCicon_map.png) no-repeat 0px center;
|
|
||||||
background-size: 14px 14px;
|
|
||||||
top: 7px;
|
|
||||||
left: 38px;
|
|
||||||
padding-left: 18px;
|
|
||||||
font-size: 12px;
|
|
||||||
line-height: 20px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebarSearch div.topicCount {
|
.sidebarSearch div.topicCount {
|
||||||
width: 20px;
|
width: 24px;
|
||||||
height: 20px;
|
height: 24px;
|
||||||
background: url(/assets/MMCCicon_topic.png) no-repeat 0px center;
|
background: url(topic16.png);
|
||||||
background-size: 14px 14px;
|
background-repeat: no-repeat;
|
||||||
top: 7px;
|
background-position-y: center;
|
||||||
left: 39px;
|
top: 0;
|
||||||
|
left: 0;
|
||||||
padding-left: 18px;
|
padding-left: 18px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
line-height: 20px;
|
line-height: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebarSearch div.mapCount {
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
background: url(metamap16.png);
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position-y: center;
|
||||||
|
left: 0;
|
||||||
|
padding-left: 20px;
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 24px;
|
||||||
}
|
}
|
||||||
.sidebarSearch div.synapseCount {
|
.sidebarSearch div.synapseCount {
|
||||||
width: 20px;
|
width: 24px;
|
||||||
height: 20px;
|
height: 24px;
|
||||||
background: url(/assets/MMCCicon_synapse.png) no-repeat 0px center;
|
background: url(synapse16.png);
|
||||||
background-size: 15px 15px;
|
background-repeat: no-repeat;
|
||||||
top: 30px;
|
background-position-y: center;
|
||||||
left: 38px;
|
top: 24px;
|
||||||
padding-left: 19px;
|
left: 0;
|
||||||
|
padding-left: 20px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
line-height: 20px;
|
line-height: 24px;
|
||||||
}
|
}
|
||||||
.sidebarSearch div.topicOriginatorIcon {
|
.sidebarSearch div.topicOriginatorIcon {
|
||||||
width: 20px;
|
width: 18px;
|
||||||
height: 20px;
|
height: 18px;
|
||||||
background: url(/assets/MMCCicon_mapper.png) no-repeat center center;
|
padding: 3px;
|
||||||
background-size: 17px 17px;
|
top: 0;
|
||||||
top: 7px;
|
left: 44px;
|
||||||
left: 13px;
|
}
|
||||||
|
.sidebarSearch .topicOriginatorIcon img {
|
||||||
|
border-radius: 9px;
|
||||||
}
|
}
|
||||||
.sidebarSearch .tip {
|
.sidebarSearch .tip {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
background: white;
|
background: #424242;
|
||||||
width: auto;
|
width: auto;
|
||||||
bottom: 0;
|
top: 2px;
|
||||||
right: 25px;
|
right: 25px;
|
||||||
color: black;
|
color: white;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
border-radius: 4px;
|
border-radius: 2px;
|
||||||
font-size: 15px !important;
|
font-size: 12px !important;
|
||||||
font-family: 'LatoRegular';
|
font-family: 'din-regular';
|
||||||
line-height: 17px;
|
line-height: 12px;
|
||||||
padding: 3px 5px 2px;
|
padding: 4px 4px 4px;
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
}
|
}
|
||||||
.sidebarSearch .mapCount .tip,
|
|
||||||
.sidebarSearch .synapseCount .tip,
|
|
||||||
.sidebarSearch .topicCount .tip {
|
|
||||||
right: -3px;
|
|
||||||
bottom: 24px;
|
|
||||||
}
|
|
||||||
.sidebarSearch .hoverForTip:hover .tip {
|
.sidebarSearch .hoverForTip:hover .tip {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
.sidebarSearch .mapContributorsIcon .mapContributors {
|
.sidebarSearch .mapContributorsIcon .mapContributors {
|
||||||
|
top: auto;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 21px;
|
bottom: 21px;
|
||||||
white-space: normal;
|
white-space: normal;
|
||||||
width: 200px;
|
width: 200px;
|
||||||
}
|
}
|
||||||
.sidebarSearch div.mapContributorsIcon {
|
.sidebarSearch div.mapContributorsIcon {
|
||||||
height: 20px;
|
height: 24px;
|
||||||
background: url(/assets/MMCCicon_mapper.png) no-repeat 0px center;
|
top: 0;
|
||||||
background-size: 17px 17px;
|
left: 44px;
|
||||||
top: 7px;
|
|
||||||
right: 85px;
|
|
||||||
padding-left: 19px;
|
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
line-height: 20px;
|
line-height: 24px;
|
||||||
padding-right: 5px;
|
|
||||||
}
|
}
|
||||||
.sidebarSearch div.topicPermission,
|
.sidebarSearch div.topicPermission,
|
||||||
.sidebarSearch div.mapPermission {
|
.sidebarSearch div.mapPermission {
|
||||||
width: 20px;
|
width: 24px;
|
||||||
height: 20px;
|
height: 24px;
|
||||||
background-size: 19px 19px !important;
|
background-image: url(permissions32_sprite.png);
|
||||||
top: 30px;
|
background-repeat: no-repeat;
|
||||||
left: 13px;
|
background-size: 72px 48px !important;
|
||||||
|
top: 24px;
|
||||||
|
left: 44px;
|
||||||
}
|
}
|
||||||
.sidebarSearch div.topicPermission.commons,
|
.sidebarSearch div.topicPermission.commons,
|
||||||
.sidebarSearch div.mapPermission.commons {
|
.sidebarSearch div.mapPermission.commons {
|
||||||
background: url(/assets/MMCCicon_commons.png) no-repeat center center;
|
background-position: 0 0;
|
||||||
}
|
}
|
||||||
.sidebarSearch div.topicPermission.public,
|
.sidebarSearch div.topicPermission.public,
|
||||||
.sidebarSearch div.mapPermission.public {
|
.sidebarSearch div.mapPermission.public {
|
||||||
background: url(/assets/MMCCicon_public.png) no-repeat center center;
|
background-position: -48px 0;
|
||||||
}
|
}
|
||||||
.sidebarSearch div.topicPermission.private,
|
.sidebarSearch div.topicPermission.private,
|
||||||
.sidebarSearch div.mapPermission.private {
|
.sidebarSearch div.mapPermission.private {
|
||||||
background: url(/assets/MMCCicon_private.png) no-repeat center center;
|
background-position: -24px 0;
|
||||||
}
|
|
||||||
.sidebarSearch .tt-dataset-mappers a.goTo {
|
|
||||||
top: 7px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebarSearch .tt-dataset-mappers div.mapCount {
|
.sidebarSearch .tt-dataset-mappers div.mapCount {
|
||||||
top: 8px;
|
top: 8px;
|
||||||
}
|
}
|
||||||
|
@ -606,6 +642,14 @@
|
||||||
background-color: #9150bc;
|
background-color: #9150bc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.github-fork-ribbon-wrapper {
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.homePage .github-fork-ribbon-wrapper {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
/* end home page */
|
/* end home page */
|
||||||
|
|
||||||
/* infoAndHelp */
|
/* infoAndHelp */
|
||||||
|
|
77
app/assets/stylesheets/famous.css
Normal file
77
app/assets/stylesheets/famous.css
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*
|
||||||
|
* Owner: mark@famo.us
|
||||||
|
* @license MPL 2.0
|
||||||
|
* @copyright Famous Industries, Inc. 2014
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
html {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
margin: 0px;
|
||||||
|
padding: 0px;
|
||||||
|
overflow: hidden;
|
||||||
|
-webkit-transform-style: preserve-3d;
|
||||||
|
transform-style: preserve-3d;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
margin: 0px;
|
||||||
|
padding: 0px;
|
||||||
|
-webkit-transform-style: preserve-3d;
|
||||||
|
transform-style: preserve-3d;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-webkit-tap-highlight-color: transparent;
|
||||||
|
-webkit-perspective: 0;
|
||||||
|
perspective: none;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.famous-container, .famous-group {
|
||||||
|
position: absolute;
|
||||||
|
top: 0px;
|
||||||
|
left: 0px;
|
||||||
|
bottom: 0px;
|
||||||
|
right: 0px;
|
||||||
|
overflow: visible;
|
||||||
|
-webkit-transform-style: preserve-3d;
|
||||||
|
transform-style: preserve-3d;
|
||||||
|
-webkit-backface-visibility: visible;
|
||||||
|
backface-visibility: visible;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.famous-group {
|
||||||
|
width: 0px;
|
||||||
|
height: 0px;
|
||||||
|
margin: 0px;
|
||||||
|
padding: 0px;
|
||||||
|
-webkit-transform-style: preserve-3d;
|
||||||
|
transform-style: preserve-3d;
|
||||||
|
}
|
||||||
|
|
||||||
|
.famous-surface {
|
||||||
|
position: absolute;
|
||||||
|
-webkit-transform-origin: center center;
|
||||||
|
transform-origin: center center;
|
||||||
|
-webkit-backface-visibility: hidden;
|
||||||
|
backface-visibility: hidden;
|
||||||
|
-webkit-transform-style: flat;
|
||||||
|
transform-style: preserve-3d; /* performance */
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
-moz-box-sizing: border-box;
|
||||||
|
-webkit-tap-highlight-color: transparent;
|
||||||
|
pointer-events: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.famous-container-group {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
|
@ -8,7 +8,7 @@ module TopicsHelper
|
||||||
topic['id'] = t.id
|
topic['id'] = t.id
|
||||||
topic['label'] = t.name
|
topic['label'] = t.name
|
||||||
topic['value'] = t.name
|
topic['value'] = t.name
|
||||||
topic['description'] = t.desc.truncate(35) # make this return matched results
|
topic['description'] = t.desc.truncate(70) # make this return matched results
|
||||||
topic['type'] = t.metacode.name
|
topic['type'] = t.metacode.name
|
||||||
topic['typeImageURL'] = t.metacode.icon
|
topic['typeImageURL'] = t.metacode.icon
|
||||||
topic['permission'] = t.permission
|
topic['permission'] = t.permission
|
||||||
|
|
|
@ -83,22 +83,17 @@
|
||||||
<span class="tip">add to map</span>
|
<span class="tip">add to map</span>
|
||||||
</button>
|
</button>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="goTo hoverForTip">
|
<div class="mapCount">
|
||||||
<span class="tip">open in new tab</span>
|
|
||||||
</div>
|
|
||||||
<div class="mapCount hoverForTip">
|
|
||||||
<span class="tip">appears on this # of maps</span>
|
|
||||||
{{mapCount}}
|
{{mapCount}}
|
||||||
</div>
|
</div>
|
||||||
<div class="synapseCount hoverForTip">
|
<div class="synapseCount">
|
||||||
<span class="tip"> has this # of synapses</span>
|
|
||||||
{{synapseCount}}
|
{{synapseCount}}
|
||||||
</div>
|
</div>
|
||||||
<div class="topicOriginatorIcon hoverForTip">
|
<div class="topicOriginatorIcon hoverForTip">
|
||||||
<span class="tip topicOriginator">created by {{originator}}</span>
|
<img width="18" height="18" src="{{originatorImage}}">
|
||||||
|
<span class="tip topicOriginator">created by {{originator}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="topicPermission {{permission}} hoverForTip">
|
<div class="topicPermission {{permission}}">
|
||||||
<span class="tip">topic is {{permission}}</span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="clearfloat"></div>
|
<div class="clearfloat"></div>
|
||||||
|
@ -107,29 +102,25 @@
|
||||||
|
|
||||||
<script type="text/template" id="mapSearchTemplate">
|
<script type="text/template" id="mapSearchTemplate">
|
||||||
<div class="result{{rtype}}">
|
<div class="result{{rtype}}">
|
||||||
<img class="icon" src="/assets/metamap32c.png">
|
<div class="searchResIconWrapper">
|
||||||
|
<img class="icon" src="/assets/metamap32c.png">
|
||||||
|
</div>
|
||||||
<div class="resultText">
|
<div class="resultText">
|
||||||
<p class="resultTitle">{{label}}</p>
|
<p class="resultTitle">{{label}}</p>
|
||||||
<p class="resultDesc">{{description}}</p>
|
<p class="resultDesc">{{description}}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="autoOptions">
|
<div class="autoOptions">
|
||||||
<div class="goTo hoverForTip">
|
<div class="topicCount">
|
||||||
<span class="tip">open in new tab</span>
|
|
||||||
</div>
|
|
||||||
<div class="topicCount hoverForTip">
|
|
||||||
<span class="tip">has this # of topics</span>
|
|
||||||
{{topicCount}}
|
{{topicCount}}
|
||||||
</div>
|
</div>
|
||||||
<div class="synapseCount hoverForTip">
|
<div class="synapseCount">
|
||||||
<span class="tip">has this # of synapses</span>
|
|
||||||
{{synapseCount}}
|
{{synapseCount}}
|
||||||
</div>
|
</div>
|
||||||
<div class="mapContributorsIcon hoverForTip">
|
<div class="mapContributorsIcon hoverForTip">
|
||||||
<span class="tip mapContributors">{{contributorList}}</span>
|
<span class="tip mapContributors">{{contributorList}}</span>
|
||||||
{{contributorCount}}
|
{{contributorCount}}
|
||||||
</div>
|
</div>
|
||||||
<div class="mapPermission {{permission}} hoverForTip">
|
<div class="mapPermission {{permission}}">
|
||||||
<span class="tip">map is {{permission}}</span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="clearfloat"></div>
|
<div class="clearfloat"></div>
|
||||||
|
@ -138,16 +129,20 @@
|
||||||
|
|
||||||
<script type="text/template" id="mapperSearchTemplate">
|
<script type="text/template" id="mapperSearchTemplate">
|
||||||
<div class="result{{rtype}}">
|
<div class="result{{rtype}}">
|
||||||
<img class="icon" width="32" height="32" src="{{profile}}">
|
<div class="searchResIconWrapper">
|
||||||
|
<img class="icon" width="32" height="32" src="{{profile}}">
|
||||||
|
</div>
|
||||||
<div class="resultText">
|
<div class="resultText">
|
||||||
<p class="resultTitle">{{label}}</p>
|
<p class="resultTitle">{{label}}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="autoOptions">
|
<div class="autoOptions">
|
||||||
<div class="goTo hoverForTip">
|
<div class="mapperCreated">
|
||||||
<span class="tip">open in new tab</span>
|
<span>Mapping since: {{created_at}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="mapCount hoverForTip">
|
<div class="mapperGeneration">
|
||||||
<span class="tip">created this # of maps</span>
|
<span>Generation {{generation}}</span>
|
||||||
|
</div>
|
||||||
|
<div class="mapCount">
|
||||||
{{mapCount}}
|
{{mapCount}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
<!-- search box -->
|
<!-- search box -->
|
||||||
<div class="sidebarSearch">
|
<div class="sidebarSearch">
|
||||||
<input type="text" class="sidebarSearchField" placeholder="Search for topics, maps, and mappers..."></input>
|
<input type="text" class="sidebarSearchField" placeholder="Search for topics, maps, and mappers..."></input>
|
||||||
|
<div id="searchLoading"></div>
|
||||||
<div class="sidebarSearchIcon"></div>
|
<div class="sidebarSearchIcon"></div>
|
||||||
<div class="clearfloat"></div>
|
<div class="clearfloat"></div>
|
||||||
</div> <!-- end sidebarSearch -->
|
</div> <!-- end sidebarSearch -->
|
||||||
|
|
|
@ -18,18 +18,6 @@
|
||||||
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
|
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
|
||||||
<script type="text/javascript" src="//use.typekit.net/obp7wss.js"></script>
|
<script type="text/javascript" src="//use.typekit.net/obp7wss.js"></script>
|
||||||
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
|
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
|
||||||
|
|
||||||
<!-- shims for backwards compatibility -->
|
|
||||||
<script type="text/javascript" src="http://code.famo.us/lib/functionPrototypeBind.js"></script>
|
|
||||||
<script type="text/javascript" src="http://code.famo.us/lib/classList.js"></script>
|
|
||||||
<script type="text/javascript" src="http://code.famo.us/lib/requestAnimationFrame.js"></script>
|
|
||||||
|
|
||||||
<!-- module loader -->
|
|
||||||
<script type="text/javascript" src="http://code.famo.us/lib/require.js"></script>
|
|
||||||
|
|
||||||
<!-- famous -->
|
|
||||||
<link rel="stylesheet" type="text/css" href="http://code.famo.us/famous/0.2/famous.css" />
|
|
||||||
<script type="text/javascript" src="http://code.famo.us/famous/0.2/famous.min.js"></script>
|
|
||||||
|
|
||||||
<!-- app code -->
|
<!-- app code -->
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
@ -76,10 +64,7 @@
|
||||||
|
|
||||||
<%= render :partial => 'layouts/lightboxes' %>
|
<%= render :partial => 'layouts/lightboxes' %>
|
||||||
<%= render :partial => 'layouts/templates' %>
|
<%= render :partial => 'layouts/templates' %>
|
||||||
|
<%= render :partial => 'shared/metacodeBgColors' %>
|
||||||
<style type='text/css'>@import url('http://getbarometer.s3.amazonaws.com/assets/barometer/css/barometer.css');</style>
|
|
||||||
<script src='http://getbarometer.s3.amazonaws.com/assets/barometer/javascripts/barometer.js'
|
|
||||||
type='text/javascript'></script>
|
|
||||||
<script type="text/javascript" charset="utf-8">
|
<script type="text/javascript" charset="utf-8">
|
||||||
BAROMETER.load('Scqak8nyHdFEkezKMNeQp');
|
BAROMETER.load('Scqak8nyHdFEkezKMNeQp');
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,11 @@
|
||||||
<%= f.text_field :icon %>
|
<%= f.text_field :icon %>
|
||||||
<div class="clearfloat"></div>
|
<div class="clearfloat"></div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<%= f.label :color, "Color (hex with # sign)" %>
|
||||||
|
<%= f.text_field :color %>
|
||||||
|
<div class="clearfloat"></div>
|
||||||
|
</div>
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<%= link_to 'Cancel', metacodes_path, { :class => 'button', 'data-bypass' => 'true' } %>
|
<%= link_to 'Cancel', metacodes_path, { :class => 'button', 'data-bypass' => 'true' } %>
|
||||||
<%= f.submit :class => 'add' %>
|
<%= f.submit :class => 'add' %>
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Icon</th>
|
<th>Icon</th>
|
||||||
|
<th>Color</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -14,6 +15,13 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= metacode.name %></td>
|
<td><%= metacode.name %></td>
|
||||||
<td class="iconURL"><%= metacode.icon %></td>
|
<td class="iconURL"><%= metacode.icon %></td>
|
||||||
|
<% if metacode.color %>
|
||||||
|
<td class="iconColor" style="background-color: <%= metacode.color %>">
|
||||||
|
<%= metacode.color %>
|
||||||
|
</td>
|
||||||
|
<% else %>
|
||||||
|
<td></td>
|
||||||
|
<% end %>
|
||||||
<td><img width='40' src='<%= metacode.icon %>' /></td>
|
<td><img width='40' src='<%= metacode.icon %>' /></td>
|
||||||
<td><%= link_to 'Edit', edit_metacode_path(metacode), :data => { :bypass => 'true'} %></td>
|
<td><%= link_to 'Edit', edit_metacode_path(metacode), :data => { :bypass => 'true'} %></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -33,9 +33,21 @@
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@metacodes.sort! {|x,y| x.name <=> y.name }
|
@metacodes.sort! {|x,y|
|
||||||
@synapses.sort! {|x,y| x.desc <=> y.desc }
|
n1 = x.name || ""
|
||||||
@mappers.sort! {|x,y| x.name <=> y.name }
|
n2 = y.name || ""
|
||||||
|
n1 <=> n2
|
||||||
|
}
|
||||||
|
@synapses.sort! {|x,y|
|
||||||
|
d1 = x.desc || ""
|
||||||
|
d2 = y.desc || ""
|
||||||
|
d1 <=> d2
|
||||||
|
}
|
||||||
|
@mappers.sort! {|x,y|
|
||||||
|
n1 = x.name || ""
|
||||||
|
n2 = y.name || ""
|
||||||
|
n1 <=> n2
|
||||||
|
}
|
||||||
|
|
||||||
@metacodes.each_with_index do |metacode, index|
|
@metacodes.each_with_index do |metacode, index|
|
||||||
@metacodelist += '<li data-id="' + metacode.id.to_s + '">'
|
@metacodelist += '<li data-id="' + metacode.id.to_s + '">'
|
||||||
|
@ -43,8 +55,9 @@
|
||||||
@metacodelist += '<p>' + metacode.name.downcase + '</p></li>'
|
@metacodelist += '<p>' + metacode.name.downcase + '</p></li>'
|
||||||
end
|
end
|
||||||
@synapses.each_with_index do |synapse, index|
|
@synapses.each_with_index do |synapse, index|
|
||||||
@synapselist += '<li data-id="' + synapse.desc + '">'
|
d = synapse.desc || ""
|
||||||
@synapselist += '<img src="/assets/synapse16.png" alt="synapse icon" /><p>' + synapse.desc
|
@synapselist += '<li data-id="' + d + '">'
|
||||||
|
@synapselist += '<img src="/assets/synapse16.png" alt="synapse icon" /><p>' + d
|
||||||
@synapselist += '</p></li>'
|
@synapselist += '</p></li>'
|
||||||
end
|
end
|
||||||
@mappers.each_with_index do |mapper, index|
|
@mappers.each_with_index do |mapper, index|
|
||||||
|
|
9
app/views/shared/_metacodeBgColors.html.erb
Normal file
9
app/views/shared/_metacodeBgColors.html.erb
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<style>
|
||||||
|
<% Metacode.all.each do |m| %>
|
||||||
|
<% if m.color %>
|
||||||
|
<%= ".mbg" + m.name.gsub(/\s+/, "") + "{" %>
|
||||||
|
<%= "background-color:" + m.color + " !important;" %>
|
||||||
|
<%= "}" %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</style>
|
|
@ -15,8 +15,10 @@
|
||||||
<div class="accountName" onclick="Metamaps.Account.changeName()">
|
<div class="accountName" onclick="Metamaps.Account.changeName()">
|
||||||
<div class="nameEdit"><%= @user.name %></div>
|
<div class="nameEdit"><%= @user.name %></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="changeName"><%= form.label :name, "Name:", :class => "firstFieldText" %>
|
<div class="changeName">
|
||||||
<%= form.email_field :name %></div>
|
<%= form.label :name, "Name:", :class => "firstFieldText" %>
|
||||||
|
<%= form.text_field :name %>
|
||||||
|
</div>
|
||||||
<div><%= form.label :email, "Email:", :class => "firstFieldText" %>
|
<div><%= form.label :email, "Email:", :class => "firstFieldText" %>
|
||||||
<%= form.email_field :email %></div>
|
<%= form.email_field :email %></div>
|
||||||
<div class="changePass" onclick="Metamaps.Account.showPass()">Change Password</div>
|
<div class="changePass" onclick="Metamaps.Account.showPass()">Change Password</div>
|
||||||
|
|
5
db/migrate/20140930013020_add_color_to_metacodes.rb
Normal file
5
db/migrate/20140930013020_add_color_to_metacodes.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class AddColorToMetacodes < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :metacodes, :color, :string
|
||||||
|
end
|
||||||
|
end
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# 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 => 20140815162253) 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"
|
||||||
|
@ -66,6 +66,7 @@ ActiveRecord::Schema.define(:version => 20140815162253) do
|
||||||
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"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "synapses", :force => true do |t|
|
create_table "synapses", :force => true do |t|
|
||||||
|
|
|
@ -113,6 +113,41 @@ function start() {
|
||||||
socket.broadcast.emit('maps-' + data.mapid + '-updatePeerCoords', peer);
|
socket.broadcast.emit('maps-' + data.mapid + '-updatePeerCoords', peer);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
socket.on('topicDrag', function (data) {
|
||||||
|
var mapId = data.mapid;
|
||||||
|
delete data.mapid;
|
||||||
|
|
||||||
|
socket.broadcast.emit('maps-' + mapId + '-topicDrag', data);
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.on('newTopic', function (data) {
|
||||||
|
var mapId = data.mapid;
|
||||||
|
delete data.mapid;
|
||||||
|
|
||||||
|
socket.broadcast.emit('maps-' + mapId + '-newTopic', data);
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.on('removeTopic', function (data) {
|
||||||
|
var mapId = data.mapid;
|
||||||
|
delete data.mapid;
|
||||||
|
|
||||||
|
socket.broadcast.emit('maps-' + mapId + '-removeTopic', data);
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.on('newSynapse', function (data) {
|
||||||
|
var mapId = data.mapid;
|
||||||
|
delete data.mapid;
|
||||||
|
|
||||||
|
socket.broadcast.emit('maps-' + mapId + '-newSynapse', data);
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.on('removeSynapse', function (data) {
|
||||||
|
var mapId = data.mapid;
|
||||||
|
delete data.mapid;
|
||||||
|
|
||||||
|
socket.broadcast.emit('maps-' + mapId + '-removeSynapse', data);
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1
test/fixtures/metacodes.yml
vendored
1
test/fixtures/metacodes.yml
vendored
|
@ -7,6 +7,7 @@
|
||||||
one:
|
one:
|
||||||
name: Action
|
name: Action
|
||||||
icon: /assets/icons/action.png
|
icon: /assets/icons/action.png
|
||||||
|
color: #bd6c85
|
||||||
|
|
||||||
two:
|
two:
|
||||||
name: Activity
|
name: Activity
|
||||||
|
|
Loading…
Reference in a new issue