fixed right click menu and also added change metacodes to it
This commit is contained in:
parent
1557c7d4e9
commit
2d338bb785
5 changed files with 58 additions and 58 deletions
49
Gemfile.lock
49
Gemfile.lock
|
@ -39,8 +39,6 @@ GEM
|
||||||
rails (~> 3.1)
|
rails (~> 3.1)
|
||||||
builder (3.0.4)
|
builder (3.0.4)
|
||||||
cancan (1.6.10)
|
cancan (1.6.10)
|
||||||
childprocess (0.5.3)
|
|
||||||
ffi (~> 1.0, >= 1.0.11)
|
|
||||||
climate_control (0.0.3)
|
climate_control (0.0.3)
|
||||||
activesupport (>= 3.0)
|
activesupport (>= 3.0)
|
||||||
cocaine (0.5.4)
|
cocaine (0.5.4)
|
||||||
|
@ -52,7 +50,6 @@ GEM
|
||||||
coffee-script-source
|
coffee-script-source
|
||||||
execjs
|
execjs
|
||||||
coffee-script-source (1.7.0)
|
coffee-script-source (1.7.0)
|
||||||
commonwatir (4.0.0)
|
|
||||||
devise (3.2.4)
|
devise (3.2.4)
|
||||||
bcrypt (~> 3.0)
|
bcrypt (~> 3.0)
|
||||||
orm_adapter (~> 0.1)
|
orm_adapter (~> 0.1)
|
||||||
|
@ -61,8 +58,6 @@ GEM
|
||||||
warden (~> 1.2.3)
|
warden (~> 1.2.3)
|
||||||
erubis (2.7.0)
|
erubis (2.7.0)
|
||||||
execjs (2.0.2)
|
execjs (2.0.2)
|
||||||
ffi (1.9.0)
|
|
||||||
ffi (1.9.0-x86-mingw32)
|
|
||||||
formtastic (2.2.1)
|
formtastic (2.2.1)
|
||||||
actionpack (>= 3.0)
|
actionpack (>= 3.0)
|
||||||
formula (1.0.1)
|
formula (1.0.1)
|
||||||
|
@ -80,8 +75,6 @@ GEM
|
||||||
mime-types (~> 1.16)
|
mime-types (~> 1.16)
|
||||||
treetop (~> 1.4.8)
|
treetop (~> 1.4.8)
|
||||||
mime-types (1.25.1)
|
mime-types (1.25.1)
|
||||||
mini_magick (3.5.0)
|
|
||||||
subexec (~> 0.2.1)
|
|
||||||
mini_portile (0.6.0)
|
mini_portile (0.6.0)
|
||||||
multi_json (1.10.0)
|
multi_json (1.10.0)
|
||||||
nokogiri (1.6.2.1)
|
nokogiri (1.6.2.1)
|
||||||
|
@ -96,7 +89,6 @@ GEM
|
||||||
mime-types
|
mime-types
|
||||||
pg (0.17.1)
|
pg (0.17.1)
|
||||||
pg (0.17.1-x86-mingw32)
|
pg (0.17.1-x86-mingw32)
|
||||||
phantomjs (1.9.7.1)
|
|
||||||
polyglot (0.3.4)
|
polyglot (0.3.4)
|
||||||
rack (1.4.5)
|
rack (1.4.5)
|
||||||
rack-cache (1.2)
|
rack-cache (1.2)
|
||||||
|
@ -123,28 +115,19 @@ GEM
|
||||||
rdoc (~> 3.4)
|
rdoc (~> 3.4)
|
||||||
thor (>= 0.14.6, < 2.0)
|
thor (>= 0.14.6, < 2.0)
|
||||||
rake (10.3.2)
|
rake (10.3.2)
|
||||||
rautomation (0.15.0)
|
|
||||||
ffi (= 1.9.0)
|
|
||||||
rdoc (3.12.2)
|
rdoc (3.12.2)
|
||||||
json (~> 1.4)
|
json (~> 1.4)
|
||||||
redis (2.2.2)
|
redis (2.2.2)
|
||||||
rubyzip (1.1.6)
|
|
||||||
sass (3.3.7)
|
sass (3.3.7)
|
||||||
sass-rails (3.2.6)
|
sass-rails (3.2.6)
|
||||||
railties (~> 3.2.0)
|
railties (~> 3.2.0)
|
||||||
sass (>= 3.1.10)
|
sass (>= 3.1.10)
|
||||||
tilt (~> 1.3)
|
tilt (~> 1.3)
|
||||||
selenium-webdriver (2.42.0)
|
|
||||||
childprocess (>= 0.5.0)
|
|
||||||
multi_json (~> 1.0)
|
|
||||||
rubyzip (~> 1.0)
|
|
||||||
websocket (~> 1.0.4)
|
|
||||||
sprockets (2.2.2)
|
sprockets (2.2.2)
|
||||||
hike (~> 1.2)
|
hike (~> 1.2)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
rack (~> 1.0)
|
rack (~> 1.0)
|
||||||
tilt (~> 1.1, != 1.3.0)
|
tilt (~> 1.1, != 1.3.0)
|
||||||
subexec (0.2.3)
|
|
||||||
thor (0.19.1)
|
thor (0.19.1)
|
||||||
thread_safe (0.3.3)
|
thread_safe (0.3.3)
|
||||||
tilt (1.4.1)
|
tilt (1.4.1)
|
||||||
|
@ -157,36 +140,6 @@ GEM
|
||||||
json (>= 1.8.0)
|
json (>= 1.8.0)
|
||||||
warden (1.2.3)
|
warden (1.2.3)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
watir (5.0.0)
|
|
||||||
commonwatir (~> 4)
|
|
||||||
watir-webdriver
|
|
||||||
watir (5.0.0-x86-mingw32)
|
|
||||||
commonwatir (~> 4)
|
|
||||||
watir-classic (~> 4.0)
|
|
||||||
watir-webdriver
|
|
||||||
watir-classic (4.0.1)
|
|
||||||
ffi (~> 1.0)
|
|
||||||
multi_json
|
|
||||||
nokogiri (>= 1.5.7.rc3)
|
|
||||||
rautomation (~> 0.7)
|
|
||||||
win32-process (>= 0.5.5)
|
|
||||||
win32screenshot (~> 1.0.9)
|
|
||||||
windows-pr (>= 0.6.6)
|
|
||||||
watir-webdriver (0.6.10)
|
|
||||||
selenium-webdriver (>= 2.18.0)
|
|
||||||
websocket (1.0.7)
|
|
||||||
win32-api (1.5.1-x86-mingw32)
|
|
||||||
win32-process (0.7.4)
|
|
||||||
ffi (>= 1.0.0)
|
|
||||||
win32screenshot (1.0.10)
|
|
||||||
ffi (~> 1.0)
|
|
||||||
mini_magick (~> 3.5.0)
|
|
||||||
rautomation (~> 0.7)
|
|
||||||
windows-api (0.4.2)
|
|
||||||
win32-api (>= 1.4.5)
|
|
||||||
windows-pr (1.2.3)
|
|
||||||
win32-api (>= 1.4.5)
|
|
||||||
windows-api (>= 0.4.0)
|
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
|
@ -205,10 +158,8 @@ DEPENDENCIES
|
||||||
json
|
json
|
||||||
paperclip
|
paperclip
|
||||||
pg
|
pg
|
||||||
phantomjs
|
|
||||||
rails (= 3.2.17)
|
rails (= 3.2.17)
|
||||||
rails3-jquery-autocomplete
|
rails3-jquery-autocomplete
|
||||||
redis (= 2.2.2)
|
redis (= 2.2.2)
|
||||||
sass-rails
|
sass-rails
|
||||||
uglifier (>= 1.0.3)
|
uglifier (>= 1.0.3)
|
||||||
watir
|
|
||||||
|
|
|
@ -1128,6 +1128,10 @@ Metamaps.JIT = {
|
||||||
</ul>';
|
</ul>';
|
||||||
|
|
||||||
menustring += '<li class="rc-permission">Change permissions' + options + '</li>';
|
menustring += '<li class="rc-permission">Change permissions' + options + '</li>';
|
||||||
|
|
||||||
|
var metacodeOptions = $('#metacodeOptions').html();
|
||||||
|
|
||||||
|
menustring += '<li class="rc-metacode">Change metacode' + metacodeOptions + '</li>';
|
||||||
}
|
}
|
||||||
|
|
||||||
menustring += '</ul>';
|
menustring += '</ul>';
|
||||||
|
@ -1139,7 +1143,7 @@ Metamaps.JIT = {
|
||||||
top: e.clientY
|
top: e.clientY
|
||||||
});
|
});
|
||||||
//add the menu to the page
|
//add the menu to the page
|
||||||
$('#center-container').append(rightclickmenu);
|
$('#wrapper').append(rightclickmenu);
|
||||||
|
|
||||||
|
|
||||||
// attach events to clicks on the list items
|
// attach events to clicks on the list items
|
||||||
|
@ -1194,6 +1198,13 @@ Metamaps.JIT = {
|
||||||
Metamaps.Control.updateSelectedPermissions($(this).text());
|
Metamaps.Control.updateSelectedPermissions($(this).text());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// change the metacode of all the selected nodes that you have edit permission for
|
||||||
|
$('.rc-metacode li').click(function () {
|
||||||
|
$('.rightclickmenu').remove();
|
||||||
|
//
|
||||||
|
Metamaps.Control.updateSelectedMetacodes($(this).attr('data-id'));
|
||||||
|
});
|
||||||
|
|
||||||
}, //selectNodeOnRightClickHandler
|
}, //selectNodeOnRightClickHandler
|
||||||
selectEdgeOnClickHandler: function (adj, e) {
|
selectEdgeOnClickHandler: function (adj, e) {
|
||||||
if (Metamaps.Visualize.mGraph.busy) return;
|
if (Metamaps.Visualize.mGraph.busy) return;
|
||||||
|
@ -1258,12 +1269,12 @@ Metamaps.JIT = {
|
||||||
}
|
}
|
||||||
menustring += '<li class="rc-hide">Hide until refresh</li>';
|
menustring += '<li class="rc-hide">Hide until refresh</li>';
|
||||||
if (Metamaps.Active.Mapper) {
|
if (Metamaps.Active.Mapper) {
|
||||||
var options = '<ul><li class="changeP toCommons">commons</li> \
|
var permOptions = '<ul><li class="changeP toCommons">commons</li> \
|
||||||
<li class="changeP toPublic">public</li> \
|
<li class="changeP toPublic">public</li> \
|
||||||
<li class="changeP toPrivate">private</li> \
|
<li class="changeP toPrivate">private</li> \
|
||||||
</ul>';
|
</ul>';
|
||||||
|
|
||||||
menustring += '<li class="rc-permission">Change permissions' + options + '</li>';
|
menustring += '<li class="rc-permission">Change permissions' + permOptions + '</li>';
|
||||||
}
|
}
|
||||||
|
|
||||||
menustring += '</ul>';
|
menustring += '</ul>';
|
||||||
|
@ -1275,7 +1286,7 @@ Metamaps.JIT = {
|
||||||
top: e.clientY
|
top: e.clientY
|
||||||
});
|
});
|
||||||
//add the menu to the page
|
//add the menu to the page
|
||||||
$('#center-container').append(rightclickmenu);
|
$('#wrapper').append(rightclickmenu);
|
||||||
|
|
||||||
|
|
||||||
// attach events to clicks on the list items
|
// attach events to clicks on the list items
|
||||||
|
|
|
@ -1391,7 +1391,7 @@ Metamaps.Realtime = {
|
||||||
var mapperm = Metamaps.Active.Map && Metamaps.Active.Map.authorizeToEdit(Metamaps.Active.Mapper);
|
var mapperm = Metamaps.Active.Map && Metamaps.Active.Map.authorizeToEdit(Metamaps.Active.Mapper);
|
||||||
|
|
||||||
if (mapperm) {
|
if (mapperm) {
|
||||||
self.socket = io.connect('http://gentle-savannah-1303.herokuapp.com');
|
self.socket = io.connect('http://localhost:5001');
|
||||||
self.socket.on('connect', function () {
|
self.socket.on('connect', function () {
|
||||||
console.log('socket connected');
|
console.log('socket connected');
|
||||||
self.setupSocket();
|
self.setupSocket();
|
||||||
|
@ -1981,6 +1981,37 @@ Metamaps.Control = {
|
||||||
var message = nString + sString + ' you created updated to ' + permission;
|
var message = nString + sString + ' you created updated to ' + permission;
|
||||||
Metamaps.GlobalUI.notifyUser(message);
|
Metamaps.GlobalUI.notifyUser(message);
|
||||||
},
|
},
|
||||||
|
updateSelectedMetacodes: function (metacode_id) {
|
||||||
|
|
||||||
|
var node, topic;
|
||||||
|
|
||||||
|
Metamaps.GlobalUI.notifyUser('Working...');
|
||||||
|
|
||||||
|
var metacode = Metamaps.Metacodes.get(metacode_id);
|
||||||
|
|
||||||
|
// variables to keep track of how many nodes and synapses you had the ability to change the permission of
|
||||||
|
var nCount = 0;
|
||||||
|
|
||||||
|
// change the permission of the selected topics, if logged in user is the original creator
|
||||||
|
var l = Metamaps.Selected.Nodes.length;
|
||||||
|
for (var i = l - 1; i >= 0; i -= 1) {
|
||||||
|
node = Metamaps.Selected.Nodes[i];
|
||||||
|
topic = node.getData('topic');
|
||||||
|
|
||||||
|
if (topic.authorizeToEdit(Metamaps.Active.Mapper)) {
|
||||||
|
topic.save({
|
||||||
|
'metacode_id': metacode_id
|
||||||
|
});
|
||||||
|
nCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var nString = nCount == 1 ? (nCount.toString() + ' topic') : (nCount.toString() + ' topics');
|
||||||
|
|
||||||
|
var message = nString + ' you can edit updated to ' + metacode.get('name');
|
||||||
|
Metamaps.GlobalUI.notifyUser(message);
|
||||||
|
Metamaps.Visualize.mGraph.plot();
|
||||||
|
},
|
||||||
}; // end Metamaps.Control
|
}; // end Metamaps.Control
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -834,7 +834,14 @@ h3.realtimeBoxTitle {
|
||||||
background-image: url(MMCCicon_edit_permission_black.png);
|
background-image: url(MMCCicon_edit_permission_black.png);
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
.rightclickmenu .rc-permission ul {
|
.rightclickmenu .rc-metacode {
|
||||||
|
background-image: url(blank.png);
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.rc-metacode li img {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
.rightclickmenu .rc-permission ul, .rightclickmenu .rc-metacode ul {
|
||||||
display: none;
|
display: none;
|
||||||
background: white;
|
background: white;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
@ -844,7 +851,7 @@ h3.realtimeBoxTitle {
|
||||||
border-bottom-right-radius: 2px;
|
border-bottom-right-radius: 2px;
|
||||||
border-top-right-radius: 2px;
|
border-top-right-radius: 2px;
|
||||||
}
|
}
|
||||||
.rightclickmenu .rc-permission:hover ul {
|
.rightclickmenu .rc-permission:hover ul, .rightclickmenu .rc-metacode:hover ul {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
.rightclickmenu .rc-permission .toCommons {
|
.rightclickmenu .rc-permission .toCommons {
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<div id="metacodeOptions">
|
<div id="metacodeOptions">
|
||||||
<ul>
|
<ul>
|
||||||
<% Metacode.order("name").all.each do |m| %>
|
<% Metacode.order("name").all.each do |m| %>
|
||||||
<li>
|
<li data-id="<%= m.id.to_s %>">
|
||||||
<img width="30" height="30" src="<%= m.icon %>" alt="<%= m.name %>" />
|
<img width="16" height="16" src="<%= m.icon %>" alt="<%= m.name %>" />
|
||||||
<span class="mSelectName"><%= m.name %></span>
|
<span class="mSelectName"><%= m.name %></span>
|
||||||
<div class="clearfloat"></div>
|
<div class="clearfloat"></div>
|
||||||
</li>
|
</li>
|
||||||
|
|
Loading…
Reference in a new issue