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
|
||||
$(".sidebarCollaborateIcon").click(function (event) {
|
||||
if (!goRealtime) {
|
||||
window.realtime.sendRealtimeOn();
|
||||
$('.sidebarCollaborate .tip').html('Stop Realtime Collaboration');
|
||||
} else {
|
||||
window.realtime.sendRealtimeOff();
|
||||
$('.sidebarCollaborate .tip').html('Start Realtime Collaboration');
|
||||
}
|
||||
goRealtime = !goRealtime;
|
||||
|
|
|
@ -34,9 +34,9 @@ window.realtime.setupSocket = function () {
|
|||
// data.userid
|
||||
// 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 = {
|
||||
userToNotify: data.userid,
|
||||
username: username,
|
||||
|
@ -46,11 +46,27 @@ window.realtime.setupSocket = function () {
|
|||
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) {
|
||||
// data.userid
|
||||
// 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) {
|
||||
|
@ -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) {
|
||||
var newPos, tempForT;
|
||||
Mconsole.graph.addNode(topic);
|
||||
|
|
|
@ -290,7 +290,8 @@ input[type="submit"]:hover {
|
|||
display: block;
|
||||
height: 20px;
|
||||
width: 20px;
|
||||
background: #0FFF2B;
|
||||
background-image: url('MMCCicon_metacode_set_change.png');
|
||||
background-size:contain;
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
top: 20px;
|
||||
|
@ -579,6 +580,9 @@ li.accountMaps {
|
|||
li.accountSettings {
|
||||
background-image: url('MMCCicon_settings.png');
|
||||
}
|
||||
li.accountAdmin {
|
||||
background-image: url('MMCCicon_admin.png');
|
||||
}
|
||||
li.accountInvite {
|
||||
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 accountSettings"><%= link_to "Account", edit_user_url(account) %></li>
|
||||
<% if account.admin %>
|
||||
<li class="accountIcon accountSettings"><%= link_to "Admin", metacodes_path %></li>
|
||||
<li class="accountIcon accountAdmin"><%= link_to "Admin", metacodes_path %></li>
|
||||
<% end %>
|
||||
<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>
|
||||
|
|
|
@ -104,13 +104,13 @@ if (json.length > 0) {
|
|||
|
||||
<% if authenticated? && (@map.permission == "commons" || @map.user == user) %>
|
||||
// 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
|
||||
//window.realtime.socket = io.connect('http://metamaps.cc:5001');
|
||||
|
||||
// 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 () {
|
||||
console.log('socket connected');
|
||||
|
|
|
@ -81,6 +81,26 @@ function start() {
|
|||
});
|
||||
});
|
||||
|
||||
// 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