closes #202, closes #301, closes #320, closes #337

This commit is contained in:
Connor Turland 2014-06-09 13:36:23 -04:00
parent 6f0150cca1
commit 31817d31a5
6 changed files with 55 additions and 25 deletions

View file

@ -264,14 +264,14 @@ function updateMetacodeSet(set, index, custom) {
$('#metacodeImg').removeData('cloudcarousel'); $('#metacodeImg').removeData('cloudcarousel');
var newMetacodes = ""; var newMetacodes = "";
for (var i = 0; i < codesToSwitchTo.length; i++) { for (var i = 0; i < codesToSwitchTo.length; i++) {
newMetacodes += '<img class="cloudcarousel" width="40" height="40" src="' + imgArray[codesToSwitchTo[i]].src + '" title="' + codesToSwitchTo[i] + '"/>'; newMetacodes += '<img class="cloudcarousel" width="40" height="40" src="' + imgArray[codesToSwitchTo[i]].src + '" title="' + codesToSwitchTo[i] + '" alt="' + codesToSwitchTo[i] + '"/>';
}; };
$('#metacodeImg').empty().append(newMetacodes).CloudCarousel({ $('#metacodeImg').empty().append(newMetacodes).CloudCarousel({
titleBox: $('#metacodeImgTitle'), titleBox: $('#metacodeImgTitle'),
yRadius: 40, yRadius: 40,
xPos: 150, xPos: 150,
yPos: 40, yPos: 40,
speed: 0.15, speed: 0.3,
mouseWheel: true, mouseWheel: true,
bringToFront: true bringToFront: true
}); });

View file

@ -163,18 +163,15 @@ jQuery.browser = browser;
// Add code that makes tab and shift+tab scroll through metacodes // Add code that makes tab and shift+tab scroll through metacodes
$('.new_topic').bind('keydown',this,function(event){ $('.new_topic').bind('keydown',this,function(event){
if (event.keyCode == 9 || (event.keyCode == 9 && event.shiftKey)) { if (event.keyCode == 9 && event.shiftKey) {
event.preventDefault();
}
});
$('.new_topic').bind('keyup',this,function(event){
//console.log(event);
/*key navigation through elements*/
if (event.keyCode == 9 && event.shiftKey) {
event.data.rotate(-1); event.data.rotate(-1);
event.preventDefault();
event.stopPropagation();
} else if (event.keyCode == 9) { } else if (event.keyCode == 9) {
event.data.rotate(1); event.data.rotate(1);
} event.preventDefault();
event.stopPropagation();
}
}); });
// You will need this plugin for the mousewheel to work: http://plugins.jquery.com/project/mousewheel // You will need this plugin for the mousewheel to work: http://plugins.jquery.com/project/mousewheel

View file

@ -25,19 +25,25 @@ $(document).ready(function () {
engine: Hogan engine: Hogan
} }
]); ]);
var topicTypeahead = false;
// tell the autocomplete to submit the form with the topic you clicked on if you pick from the autocomplete // tell the autocomplete to submit the form with the topic you clicked on if you pick from the autocomplete
$('#topic_name').bind('typeahead:selected', function (event, datum, dataset) { $('#topic_name').bind('typeahead:selected', function (event, datum, dataset) {
$('#topic_grabTopic').val(datum.id); $('#topic_grabTopic').val(datum.id);
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
$('.new_topic').submit();
topicTypeahead = true;
});
$('#topic_name').bind('typeahead:opened', function () {
topicTypeahead = false;
}); });
// bind keyboard handlers // bind keyboard handlers
$('#topic_name').bind('keyup', function (e) { $('#topic_name').bind('keyup', function (e) {
switch (e.which) { switch (e.which) {
case 13: case 13:
$('.new_topic').submit(); if (!topicTypeahead) $('.new_topic').submit();
break; break;
default: default:
break; break;
@ -65,7 +71,7 @@ $(document).ready(function () {
$('#synapse_desc').typeahead([ $('#synapse_desc').typeahead([
{ {
name: 'synapse_autocomplete', name: 'synapse_autocomplete',
template: "{{label}}", template: "<div>{{label}}</div>",
remote: { remote: {
url: '/search/synapses?term=%QUERY' url: '/search/synapses?term=%QUERY'
}, },
@ -86,6 +92,8 @@ $(document).ready(function () {
header: "<h3>Existing Synapses</h3>" header: "<h3>Existing Synapses</h3>"
}, },
]); ]);
var synapseTypeahead = false;
// tell the autocomplete to submit the form with the topic you clicked on if you pick from the autocomplete // tell the autocomplete to submit the form with the topic you clicked on if you pick from the autocomplete
$('#synapse_desc').bind('typeahead:selected', function (event, datum, dataset) { $('#synapse_desc').bind('typeahead:selected', function (event, datum, dataset) {
if (datum.id) { // if they clicked on an existing synapse get it if (datum.id) { // if they clicked on an existing synapse get it
@ -93,12 +101,17 @@ $(document).ready(function () {
} }
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
$('.new_synapse').submit();
synapseTypeahead = true;
});
$('#synapse_desc').bind('typeahead:opened', function () {
synapseTypeahead = false;
}); });
// bind keyboard handlers // bind keyboard handlers
$('#synapse_desc').bind('keyup', function (e) { $('#synapse_desc').bind('keyup', function (e) {
switch (e.which) { switch (e.which) {
case 13: case 13:
$('.new_synapse').submit(); if (!synapseTypeahead) $('.new_synapse').submit();
break; break;
default: default:
break; break;

View file

@ -566,7 +566,9 @@
var that = this; var that = this;
utils.bindAll(this); utils.bindAll(this);
this.specialKeyCodeMap = { this.specialKeyCodeMap = {
9: "tab", // START METAMAPS CODE
//9: "tab",
// END METAMAPS CODE
27: "esc", 27: "esc",
37: "left", 37: "left",
39: "right", 39: "right",
@ -714,11 +716,19 @@
}, },
_handleMouseleave: function() { _handleMouseleave: function() {
this.isMouseOverDropdown = false; this.isMouseOverDropdown = false;
// START METAMAPS CODE
this._getSuggestions().removeClass("tt-is-under-cursor");
this._getSuggestions().removeClass("tt-is-under-mouse-cursor");
// END METAMAPS CODE
}, },
_handleMouseover: function($e) { _handleMouseover: function($e) {
var $suggestion = $($e.currentTarget); var $suggestion = $($e.currentTarget);
this._getSuggestions().removeClass("tt-is-under-cursor"); this._getSuggestions().removeClass("tt-is-under-cursor");
$suggestion.addClass("tt-is-under-cursor"); // START METAMAPS CODE
this._getSuggestions().removeClass("tt-is-under-mouse-cursor");
$suggestion.addClass("tt-is-under-mouse-cursor");
// ORIGINAL CODE $suggestion.addClass("tt-is-under-cursor");
}, },
_handleSelection: function($e) { _handleSelection: function($e) {
var $suggestion = $($e.currentTarget); var $suggestion = $($e.currentTarget);

View file

@ -309,6 +309,12 @@ input[type="submit"]:hover {
} }
/* synapse autocomplete */ /* synapse autocomplete */
.new_topic #topic_name {
color: white;
}
.new_topic .tt-hint {
color: grey;
}
.new_topic #topic_name, .new_topic #topic_name,
.new_topic .tt-hint { .new_topic .tt-hint {
width: 190px; width: 190px;
@ -320,9 +326,14 @@ input[type="submit"]:hover {
outline: none; outline: none;
font-size: 18px; font-size: 18px;
line-height: 35px; line-height: 35px;
color: white;
font-family: 'LatoRegular'; font-family: 'LatoRegular';
} }
.new_synapse #synapse_desc {
color: rgba(255, 255, 255, 0.7);
}
.new_synapse .tt-hint {
color: rgba(255, 255, 255, 0.4);
}
.new_synapse #synapse_desc, .new_synapse #synapse_desc,
.new_synapse .tt-hint { .new_synapse .tt-hint {
width: 200px; width: 200px;
@ -334,7 +345,6 @@ input[type="submit"]:hover {
outline: none; outline: none;
font-size: 16px; font-size: 16px;
line-height: 20px; line-height: 20px;
color: rgba(255, 255, 255, 0.7);
font-family: 'LatoRegular'; font-family: 'LatoRegular';
} }
label, label,
@ -1283,13 +1293,13 @@ h3.filterByMetacode {
/* topic autocomplete */ /* topic autocomplete */
#new_topic .tt-suggestion.tt-is-under-cursor { #new_topic .tt-suggestion.tt-is-under-cursor, #new_topic .tt-suggestion.tt-is-under-mouse-cursor {
background: #0E161D; background: #0E161D;
} }
#new_topic .tt-suggestion { #new_topic .tt-suggestion {
padding: 5px; padding: 5px;
font-family: 'LatoLight'; font-family: 'LatoLight';
background: #2A343C; background: rgba(42, 52, 60, 0.9);;
} }
#new_topic .autocompleteSection { #new_topic .autocompleteSection {
float: left; float: left;
@ -1342,7 +1352,7 @@ h3.filterByMetacode {
padding: 2px 5px 2px; padding: 2px 5px 2px;
z-index: 100; z-index: 100;
} }
/* topic autocomplete */ /* synapse autocomplete */
#new_synapse .tt-dropdown-menu { #new_synapse .tt-dropdown-menu {
width: 212px; width: 212px;
@ -1356,7 +1366,7 @@ h3.filterByMetacode {
line-height: 16px; line-height: 16px;
margin: 3px; margin: 3px;
} }
#new_synapse .tt-suggestion.tt-is-under-cursor { #new_synapse .tt-suggestion.tt-is-under-cursor, #new_synapse .tt-suggestion.tt-is-under-mouse-cursor {
background: #0E161D; background: #0E161D;
} }
#new_synapse .tt-suggestion { #new_synapse .tt-suggestion {

View file

@ -104,13 +104,13 @@ if (json.length > 0) {
<% if authenticated? && (@map.permission == "commons" || @map.user == user) %> <% if authenticated? && (@map.permission == "commons" || @map.user == user) %>
// this is for the heroku staging environment // this is for the heroku staging environment
window.realtime.socket = io.connect('http://gentle-savannah-1303.herokuapp.com'); //window.realtime.socket = io.connect('http://gentle-savannah-1303.herokuapp.com');
// this is for metamaps.cc // this is for metamaps.cc
//window.realtime.socket = io.connect('http://metamaps.cc:5001'); //window.realtime.socket = io.connect('http://metamaps.cc:5001');
// this is for localhost development // this is for localhost development
//window.realtime.socket = io.connect('http://localhost:5001'); window.realtime.socket = io.connect('http://localhost:5001');
window.realtime.socket.on('connect', function () { window.realtime.socket.on('connect', function () {
console.log('socket connected'); console.log('socket connected');