diff --git a/Gemfile.lock b/Gemfile.lock index a8354dc6..b4efab8d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -39,8 +39,6 @@ GEM rails (~> 3.1) builder (3.0.4) cancan (1.6.10) - childprocess (0.5.3) - ffi (~> 1.0, >= 1.0.11) climate_control (0.0.3) activesupport (>= 3.0) cocaine (0.5.4) @@ -52,7 +50,6 @@ GEM coffee-script-source execjs coffee-script-source (1.7.0) - commonwatir (4.0.0) devise (3.2.4) bcrypt (~> 3.0) orm_adapter (~> 0.1) @@ -61,8 +58,6 @@ GEM warden (~> 1.2.3) erubis (2.7.0) execjs (2.0.2) - ffi (1.9.0) - ffi (1.9.0-x86-mingw32) formtastic (2.2.1) actionpack (>= 3.0) formula (1.0.1) @@ -80,8 +75,6 @@ GEM mime-types (~> 1.16) treetop (~> 1.4.8) mime-types (1.25.1) - mini_magick (3.5.0) - subexec (~> 0.2.1) mini_portile (0.6.0) multi_json (1.10.0) nokogiri (1.6.2.1) @@ -96,7 +89,6 @@ GEM mime-types pg (0.17.1) pg (0.17.1-x86-mingw32) - phantomjs (1.9.7.1) polyglot (0.3.4) rack (1.4.5) rack-cache (1.2) @@ -123,28 +115,19 @@ GEM rdoc (~> 3.4) thor (>= 0.14.6, < 2.0) rake (10.3.2) - rautomation (0.15.0) - ffi (= 1.9.0) rdoc (3.12.2) json (~> 1.4) redis (2.2.2) - rubyzip (1.1.6) sass (3.3.7) sass-rails (3.2.6) railties (~> 3.2.0) sass (>= 3.1.10) 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) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - subexec (0.2.3) thor (0.19.1) thread_safe (0.3.3) tilt (1.4.1) @@ -157,36 +140,6 @@ GEM json (>= 1.8.0) warden (1.2.3) 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 ruby @@ -205,10 +158,8 @@ DEPENDENCIES json paperclip pg - phantomjs rails (= 3.2.17) rails3-jquery-autocomplete redis (= 2.2.2) sass-rails uglifier (>= 1.0.3) - watir diff --git a/app/assets/javascripts/metamaps/Metamaps.JIT.js b/app/assets/javascripts/metamaps/Metamaps.JIT.js index 7a8c8362..f0e1d876 100644 --- a/app/assets/javascripts/metamaps/Metamaps.JIT.js +++ b/app/assets/javascripts/metamaps/Metamaps.JIT.js @@ -1128,6 +1128,10 @@ Metamaps.JIT = { '; menustring += '
  • Change permissions' + options + '
  • '; + + var metacodeOptions = $('#metacodeOptions').html(); + + menustring += '
  • Change metacode' + metacodeOptions + '
  • '; } menustring += ''; @@ -1139,7 +1143,7 @@ Metamaps.JIT = { top: e.clientY }); //add the menu to the page - $('#center-container').append(rightclickmenu); + $('#wrapper').append(rightclickmenu); // attach events to clicks on the list items @@ -1194,6 +1198,13 @@ Metamaps.JIT = { 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 selectEdgeOnClickHandler: function (adj, e) { if (Metamaps.Visualize.mGraph.busy) return; @@ -1258,12 +1269,12 @@ Metamaps.JIT = { } menustring += '
  • Hide until refresh
  • '; if (Metamaps.Active.Mapper) { - var options = ''; @@ -1275,7 +1286,7 @@ Metamaps.JIT = { top: e.clientY }); //add the menu to the page - $('#center-container').append(rightclickmenu); + $('#wrapper').append(rightclickmenu); // attach events to clicks on the list items diff --git a/app/assets/javascripts/metamaps/Metamaps.js b/app/assets/javascripts/metamaps/Metamaps.js index 2e80877a..7bacea0b 100644 --- a/app/assets/javascripts/metamaps/Metamaps.js +++ b/app/assets/javascripts/metamaps/Metamaps.js @@ -1391,7 +1391,7 @@ Metamaps.Realtime = { var mapperm = Metamaps.Active.Map && Metamaps.Active.Map.authorizeToEdit(Metamaps.Active.Mapper); if (mapperm) { - self.socket = io.connect('http://gentle-savannah-1303.herokuapp.com'); + self.socket = io.connect('http://localhost:5001'); self.socket.on('connect', function () { console.log('socket connected'); self.setupSocket(); @@ -1981,6 +1981,37 @@ Metamaps.Control = { var message = nString + sString + ' you created updated to ' + permission; 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 diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 08b7389c..389a0ec2 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -834,7 +834,14 @@ h3.realtimeBoxTitle { background-image: url(MMCCicon_edit_permission_black.png); 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; background: white; top: 0; @@ -844,7 +851,7 @@ h3.realtimeBoxTitle { border-bottom-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; } .rightclickmenu .rc-permission .toCommons { diff --git a/app/views/shared/_metacodeoptions.html.erb b/app/views/shared/_metacodeoptions.html.erb index 9fbf3b51..75915159 100644 --- a/app/views/shared/_metacodeoptions.html.erb +++ b/app/views/shared/_metacodeoptions.html.erb @@ -6,8 +6,8 @@