focus on topic creator after selecting metacode set

This commit is contained in:
Connor Turland 2014-06-04 16:24:13 -04:00
parent c2b21ecc13
commit cac3a7c93b
2 changed files with 55 additions and 49 deletions

View file

@ -276,6 +276,7 @@ function updateMetacodeSet(set, index, custom) {
}); });
$('#lightbox_overlay').hide(); $('#lightbox_overlay').hide();
$('#topic_name').focus();
var mdata = { var mdata = {
"metacodes": { "metacodes": {
@ -288,14 +289,10 @@ function updateMetacodeSet(set, index, custom) {
url: "/user/updatemetacodes", url: "/user/updatemetacodes",
data: mdata, data: mdata,
success: function (data) { success: function (data) {
console.log('success updating metacodes'); console.log('selected metacodes saved');
//setTimeout(function () {
// $('.metacodeTitle').hide();
// $('.showcard .icon').css('z-index', '1');
//}, 500);
}, },
error: function () { error: function () {
alert('failed to update metacodes'); console.log('failed to save selected metacodes');
} }
}); });
} }

View file

@ -17,7 +17,7 @@ app.configure(function() {
}); */ }); */
//var rtg = require("url").parse("redis://redistogo:0ca046a3d56533cc162e2447db383192@pearlfish.redistogo.com:9060/"), //var rtg = require("url").parse("redis://redistogo:0ca046a3d56533cc162e2447db383192@pearlfish.redistogo.com:9060/"),
//redis = require('redis').createClient(rtg.port, rtg.hostname, {no_ready_check: true}); //redis = require('redis').createClient(rtg.port, rtg.hostname, {no_ready_check: true});
var io = require('socket.io').listen(5001); var io = require('socket.io').listen(5001);
var redis = require('redis').createClient(); var redis = require('redis').createClient();
@ -29,10 +29,10 @@ var redis = require('redis').createClient();
function start() { function start() {
redis.subscribe('maps'); redis.subscribe('maps');
io.on('connection', function(socket){ io.on('connection', function (socket) {
// this will ping everyone on a map with updates to the map // this will ping everyone on a map with updates to the map
redis.on('message', function(channel, message){ redis.on('message', function (channel, message) {
console.log(message); console.log(message);
var m = JSON.parse(message); var m = JSON.parse(message);
var room = 'maps-' + m.mapid; var room = 'maps-' + m.mapid;
@ -41,8 +41,11 @@ function start() {
}); });
// this will ping a new person with awareness of who's already on the map // this will ping a new person with awareness of who's already on the map
socket.on('updateNewMapperList', function(data) { socket.on('updateNewMapperList', function (data) {
var existingUser = { userid: data.userid, username: data.username }; var existingUser = {
userid: data.userid,
username: data.username
};
socket.broadcast.emit(data.userToNotify + '-' + data.mapid + '-UpdateMapperList', existingUser); socket.broadcast.emit(data.userToNotify + '-' + data.mapid + '-UpdateMapperList', existingUser);
}); });
@ -52,7 +55,10 @@ function start() {
socket.set('userid', data.userid); socket.set('userid', data.userid);
socket.set('username', data.username); socket.set('username', data.username);
var newUser = { userid: data.userid, username: data.username }; var newUser = {
userid: data.userid,
username: data.username
};
socket.broadcast.emit('maps-' + data.mapid + '-newmapper', newUser); socket.broadcast.emit('maps-' + data.mapid + '-newmapper', newUser);
}); });
@ -66,7 +72,10 @@ function start() {
socket.get('username', function (err, name) { socket.get('username', function (err, name) {
socketUserName = name; socketUserName = name;
}); });
var data = { username: socketUserName, userid: socketUserID }; var data = {
username: socketUserName,
userid: socketUserID
};
socket.get('mapid', function (err, mapid) { socket.get('mapid', function (err, mapid) {
socket.broadcast.emit('maps-' + mapid + '-lostmapper', data); socket.broadcast.emit('maps-' + mapid + '-lostmapper', data);
}); });