added new images and made realtime send more relevant messages including one when someone turns on realtime
This commit is contained in:
parent
2f969bb29e
commit
8760cf0280
10 changed files with 70 additions and 8 deletions
BIN
app/assets/images/MMCCicon_admin.png
Normal file
BIN
app/assets/images/MMCCicon_admin.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.7 KiB |
BIN
app/assets/images/MMCCicon_metacode_set_change.png
Normal file
BIN
app/assets/images/MMCCicon_metacode_set_change.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 477 B |
Binary file not shown.
Before Width: | Height: | Size: 554 B After Width: | Height: | Size: 3.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 9.9 KiB After Width: | Height: | Size: 4 KiB |
|
@ -10,8 +10,10 @@ $(document).ready(function () {
|
||||||
// because anyone who can edit the map can collaborate on it in realtime
|
// because anyone who can edit the map can collaborate on it in realtime
|
||||||
$(".sidebarCollaborateIcon").click(function (event) {
|
$(".sidebarCollaborateIcon").click(function (event) {
|
||||||
if (!goRealtime) {
|
if (!goRealtime) {
|
||||||
|
window.realtime.sendRealtimeOn();
|
||||||
$('.sidebarCollaborate .tip').html('Stop Realtime Collaboration');
|
$('.sidebarCollaborate .tip').html('Stop Realtime Collaboration');
|
||||||
} else {
|
} else {
|
||||||
|
window.realtime.sendRealtimeOff();
|
||||||
$('.sidebarCollaborate .tip').html('Start Realtime Collaboration');
|
$('.sidebarCollaborate .tip').html('Start Realtime Collaboration');
|
||||||
}
|
}
|
||||||
goRealtime = !goRealtime;
|
goRealtime = !goRealtime;
|
||||||
|
|
|
@ -6,7 +6,7 @@ window.realtime.notifyUser = function (message) {
|
||||||
$('body').prepend('<div class="notice metamaps" />');
|
$('body').prepend('<div class="notice metamaps" />');
|
||||||
}
|
}
|
||||||
$('.notice.metamaps').hide().html(message).fadeIn('fast');
|
$('.notice.metamaps').hide().html(message).fadeIn('fast');
|
||||||
|
|
||||||
clearTimeout(window.realtime.notifyTimeOut);
|
clearTimeout(window.realtime.notifyTimeOut);
|
||||||
window.realtime.notifyTimeOut = setTimeout(function () {
|
window.realtime.notifyTimeOut = setTimeout(function () {
|
||||||
$('.notice.metamaps').fadeOut('fast');
|
$('.notice.metamaps').fadeOut('fast');
|
||||||
|
@ -34,9 +34,9 @@ window.realtime.setupSocket = function () {
|
||||||
// data.userid
|
// data.userid
|
||||||
// data.username
|
// data.username
|
||||||
|
|
||||||
window.realtime.notifyUser(data.username + ' just came online');
|
window.realtime.notifyUser(data.username + ' just joined the map');
|
||||||
|
|
||||||
// send this new mapper back your details, and the awareness that you're online
|
// send this new mapper back your details, and the awareness that you've loaded the map
|
||||||
var update = {
|
var update = {
|
||||||
userToNotify: data.userid,
|
userToNotify: data.userid,
|
||||||
username: username,
|
username: username,
|
||||||
|
@ -45,12 +45,28 @@ window.realtime.setupSocket = function () {
|
||||||
};
|
};
|
||||||
socket.emit('updateNewMapperList', update);
|
socket.emit('updateNewMapperList', update);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// receive word that there's a mapper turned on realtime
|
||||||
|
socket.on('maps-' + mapid + '-newrealtime', function (data) {
|
||||||
|
// data.userid
|
||||||
|
// data.username
|
||||||
|
|
||||||
|
window.realtime.notifyUser(data.username + ' just turned on realtime');
|
||||||
|
});
|
||||||
|
|
||||||
|
// receive word that there's a mapper turned on realtime
|
||||||
|
socket.on('maps-' + mapid + '-lostrealtime', function (data) {
|
||||||
|
// data.userid
|
||||||
|
// data.username
|
||||||
|
|
||||||
|
window.realtime.notifyUser(data.username + ' just turned off realtime');
|
||||||
|
});
|
||||||
|
|
||||||
socket.on('maps-' + mapid + '-lostmapper', function (data) {
|
socket.on('maps-' + mapid + '-lostmapper', function (data) {
|
||||||
// data.userid
|
// data.userid
|
||||||
// data.username
|
// data.username
|
||||||
|
|
||||||
window.realtime.notifyUser(data.username + ' just went offline');
|
window.realtime.notifyUser(data.username + ' just left the map');
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on('maps-' + mapid, function (data) {
|
socket.on('maps-' + mapid, function (data) {
|
||||||
|
@ -91,6 +107,26 @@ window.realtime.setupSocket = function () {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
window.realtime.sendRealtimeOn = function () {
|
||||||
|
// send this new mapper back your details, and the awareness that you're online
|
||||||
|
var update = {
|
||||||
|
username: username,
|
||||||
|
userid: userid,
|
||||||
|
mapid: mapid
|
||||||
|
};
|
||||||
|
window.realtime.socket.emit('notifyStartRealtime', update);
|
||||||
|
}
|
||||||
|
|
||||||
|
window.realtime.sendRealtimeOff = function () {
|
||||||
|
// send this new mapper back your details, and the awareness that you're online
|
||||||
|
var update = {
|
||||||
|
username: username,
|
||||||
|
userid: userid,
|
||||||
|
mapid: mapid
|
||||||
|
};
|
||||||
|
window.realtime.socket.emit('notifyStopRealtime', update);
|
||||||
|
}
|
||||||
|
|
||||||
window.realtime.addTopicToMap = function (topic) {
|
window.realtime.addTopicToMap = function (topic) {
|
||||||
var newPos, tempForT;
|
var newPos, tempForT;
|
||||||
Mconsole.graph.addNode(topic);
|
Mconsole.graph.addNode(topic);
|
||||||
|
|
|
@ -290,7 +290,8 @@ input[type="submit"]:hover {
|
||||||
display: block;
|
display: block;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
width: 20px;
|
width: 20px;
|
||||||
background: #0FFF2B;
|
background-image: url('MMCCicon_metacode_set_change.png');
|
||||||
|
background-size:contain;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
top: 20px;
|
top: 20px;
|
||||||
|
@ -579,6 +580,9 @@ li.accountMaps {
|
||||||
li.accountSettings {
|
li.accountSettings {
|
||||||
background-image: url('MMCCicon_settings.png');
|
background-image: url('MMCCicon_settings.png');
|
||||||
}
|
}
|
||||||
|
li.accountAdmin {
|
||||||
|
background-image: url('MMCCicon_admin.png');
|
||||||
|
}
|
||||||
li.accountInvite {
|
li.accountInvite {
|
||||||
background-image: url('MMCCicon_invite.png');
|
background-image: url('MMCCicon_invite.png');
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<li class="accountIcon accountMaps"><a href="/maps/mappers/<%= account.id %>">My Maps</a></li>
|
<li class="accountIcon accountMaps"><a href="/maps/mappers/<%= account.id %>">My Maps</a></li>
|
||||||
<li class="accountIcon accountSettings"><%= link_to "Account", edit_user_url(account) %></li>
|
<li class="accountIcon accountSettings"><%= link_to "Account", edit_user_url(account) %></li>
|
||||||
<% if account.admin %>
|
<% if account.admin %>
|
||||||
<li class="accountIcon accountSettings"><%= link_to "Admin", metacodes_path %></li>
|
<li class="accountIcon accountAdmin"><%= link_to "Admin", metacodes_path %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
<li class="accountIcon accountInvite openLightbox" data-open="invite"><span>Share Invite</span></li>
|
<li class="accountIcon accountInvite openLightbox" data-open="invite"><span>Share Invite</span></li>
|
||||||
<li class="accountIcon accountLogout"><%= link_to "Logout", "/sign_out", id: "Logout" %></li>
|
<li class="accountIcon accountLogout"><%= link_to "Logout", "/sign_out", id: "Logout" %></li>
|
||||||
|
|
|
@ -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');
|
||||||
|
|
|
@ -80,6 +80,26 @@ function start() {
|
||||||
socket.broadcast.emit('maps-' + mapid + '-lostmapper', data);
|
socket.broadcast.emit('maps-' + mapid + '-lostmapper', data);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// this will ping everyone on a map that someone just turned on realtime
|
||||||
|
socket.on('notifyStartRealtime', function (data) {
|
||||||
|
var newUser = {
|
||||||
|
userid: data.userid,
|
||||||
|
username: data.username
|
||||||
|
};
|
||||||
|
|
||||||
|
socket.broadcast.emit('maps-' + data.mapid + '-newrealtime', newUser);
|
||||||
|
});
|
||||||
|
|
||||||
|
// this will ping everyone on a map that someone just turned on realtime
|
||||||
|
socket.on('notifyStopRealtime', function (data) {
|
||||||
|
var newUser = {
|
||||||
|
userid: data.userid,
|
||||||
|
username: data.username
|
||||||
|
};
|
||||||
|
|
||||||
|
socket.broadcast.emit('maps-' + data.mapid + '-lostrealtime', newUser);
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue