diff --git a/app/assets/javascripts/Jit/graphsettings-event-handlers.js b/app/assets/javascripts/Jit/graphsettings-event-handlers.js
index b0c64c85..439594a2 100644
--- a/app/assets/javascripts/Jit/graphsettings-event-handlers.js
+++ b/app/assets/javascripts/Jit/graphsettings-event-handlers.js
@@ -29,6 +29,77 @@ function selectEdgeOnClickHandler(adj, e) {
Mconsole.plot();
}//selectEdgeOnClickHandler
+function selectEdgeOnRightClickHandler(adj, e) {
+ // the 'node' variable is a JIT node, the one that was clicked on
+ // the 'e' variable is the click event
+
+ e.preventDefault();
+ e.stopPropagation();
+
+ if (Mconsole.busy) return;
+
+ selectEdge(adj);
+
+ // delete old right click menu
+ $('.rightclickmenu').remove();
+ // create new menu for clicked on node
+ var rightclickmenu = document.createElement("div");
+ rightclickmenu.className = "rightclickmenu";
+
+ // add the proper options to the menu
+ var menustring = '
';
+
+ if (userid != null) menustring += '- Delete
';
+ if (mapid && userid != null) menustring += '- Remove from Map
';
+ menustring += '- Hide until refresh
';
+
+ menustring += '
';
+ rightclickmenu.innerHTML = menustring;
+
+ // position the menu where the click happened
+ $(rightclickmenu).css({
+ left: e.clientX,
+ top: e.clientY
+ });
+ //add the menu to the page
+ $('#center-container').append(rightclickmenu);
+
+
+ // attach events to clicks on the list items
+
+ // delete the selected things from the database
+ $('.rc-delete').click(function() {
+ $('.rightclickmenu').remove();
+ var n = MetamapsModel.selectedNodes.length;
+ var e = MetamapsModel.selectedEdges.length;
+ var ntext = n == 1 ? "1 topic" : n + " topics";
+ var etext = e == 1 ? "1 synapse" : e + " synapses";
+ var text = "You have " + ntext + " and " + etext + " selected. ";
+
+ var r=confirm(text + "Are you sure you want to permanently delete them all? This will remove them from all maps they appear on.");
+ if (r == true) {
+ deleteSelectedEdges();
+ deleteSelectedNodes();
+ }
+ });
+
+ // remove the selected things from the map
+ $('.rc-remove').click(function() {
+ $('.rightclickmenu').remove();
+ removeSelectedEdges();
+ removeSelectedNodes();
+ });
+
+ // hide selected nodes and synapses until refresh
+ $('.rc-hide').click(function() {
+ $('.rightclickmenu').remove();
+ hideSelectedEdges();
+ hideSelectedNodes();
+ });
+
+ } //selectEdgeOnRightClickHandler
+
+
function synapseDoubleClickHandler(adj, e) {
editEdge(adj, e);
}
@@ -194,8 +265,8 @@ function selectNodeOnClickHandler(node, e) {
// remove the selected things from the map
$('.rc-remove').click(function() {
$('.rightclickmenu').remove();
- hideSelectedEdges();
- hideSelectedNodes();
+ removeSelectedEdges();
+ removeSelectedNodes();
});
// hide selected nodes and synapses until refresh
diff --git a/app/assets/javascripts/Jit/graphsettings.js b/app/assets/javascripts/Jit/graphsettings.js
index dbe2ed42..a6554380 100644
--- a/app/assets/javascripts/Jit/graphsettings.js
+++ b/app/assets/javascripts/Jit/graphsettings.js
@@ -134,6 +134,7 @@ function graphSettings(type, embed) {
}
else if (node && node.nodeFrom) { // the variable 'node' is actually an edge/adjacency
// open right click menu
+ selectEdgeOnRightClickHandler(node, e);
}
else {
// right click on open canvas, options here?
diff --git a/app/assets/javascripts/Jit/onCreateLabelHandler.js b/app/assets/javascripts/Jit/onCreateLabelHandler.js
index 1bd2bdc9..8b0ec4c6 100644
--- a/app/assets/javascripts/Jit/onCreateLabelHandler.js
+++ b/app/assets/javascripts/Jit/onCreateLabelHandler.js
@@ -36,10 +36,13 @@ function generateShowcardHTML() {
\
Created by $_username_$ on $_date_$
\
\
- $_map_count_$
\
+ \
+ $_map_count_$ \
+ \
$_synapse_count_$
\
\
- \
+ \
\
\
$_metacode_select_$
\
@@ -230,15 +233,31 @@ function populateShowCard(node) {
}
});
+
+ // when you're typing a description, resize the scroll box to have space
+ $('.best_in_place_desc textarea').bind('keyup', function() {
+ var s = $('.showcard').find('.scroll');
+ s.height( s.height() ).mCustomScrollbar('update');
+ console.log('working');
+ });
+
//bind best_in_place ajax callbacks
$(showCard).find('.best_in_place_name').bind("ajax:success", function() {
+
+ var s = $('.showcard').find('.scroll');
+ s.height( s.height() ).mCustomScrollbar('update');
+
var name = $(this).html();
node.name = name;
+ Mconsole.plot();
});
$(showCard).find('.best_in_place_desc').bind("ajax:success", function() {
this.innerHTML = this.innerHTML.replace(/\r/g, '')
- $(showCard).find('.scroll').mCustomScrollbar("update");
+
+ var s = $('.showcard').find('.scroll');
+ s.height( s.height() ).mCustomScrollbar('update');
+
var desc = $(this).html();
node.setData("desc", desc);
});
@@ -294,7 +313,5 @@ function populateShowCard(node) {
else if (permission == "private") el.html("pr");
node.setData("permission", permission);
});
-
- $('.showcard').find('.scroll').mCustomScrollbar();
-
+
}
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
index 205a0ac4..b72fce39 100644
--- a/app/assets/javascripts/application.js
+++ b/app/assets/javascripts/application.js
@@ -449,7 +449,7 @@ var labelType, useGradients, nativeTextSupport, animate, json, Mconsole = null,
});
- $(".scroll").mCustomScrollbar();
+ //$(".scroll").mCustomScrollbar();
// initialize scroll bar for filter by metacode, then hide it and position it correctly again
$("#filter_by_metacode").mCustomScrollbar();
@@ -568,7 +568,7 @@ function addHoverForSettings() {
// this is to save the layout of a map
function saveLayoutAll() {
- $('.wandSaveLayout').html('Saving...');
+ $('.sidebarSave .tip').html('Saving...');
var coor = "";
if (gType == "arranged" || gType == "chaotic") {
Mconsole.graph.eachNode(function(n) {
@@ -586,8 +586,8 @@ function saveLayout(id) {
$('#map_coordinates').val(n.getData("mappingid") + '/' + n.pos.x + '/' + n.pos.y);
$('#saveMapLayout').submit();
dragged = 0;
- $('.wandSaveLayout').html('Saved!');
- setTimeout(function(){$('.wandSaveLayout').html('Save Layout')},1500);
+ //$('.wandSaveLayout').html('Saved!');
+ //setTimeout(function(){$('.wandSaveLayout').html('Save Layout')},1500);
}
// this is to save your console to a map
@@ -711,6 +711,8 @@ function openNodeShowcard(node) {
populateShowCard(node);
$('.showcard').fadeIn('fast');
+ var s = $('.showcard').find('.scroll');
+ s.height( s.height() ).mCustomScrollbar();
//node.setData('dim', 1, 'current');
MetamapsModel.showcardInUse = node.id;
}
diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css
index c2fe6274..97cb8dcd 100644
--- a/app/assets/stylesheets/application.css
+++ b/app/assets/stylesheets/application.css
@@ -657,6 +657,29 @@ cursor:pointer;
font-family: 'LatoLight', helvetica, sans-serif;
}
+.sidebarFork .hoverForTip:hover .tip {
+ display:block;
+}
+
+.sidebarFork .tip {
+display: none;
+position: absolute;
+background: white;
+min-width: 180px;
+max-width: 250px;
+text-align: center;
+top: 36px;
+right: 0;
+color: black;
+border-radius: 4px;
+font-size: 15px !important;
+font-family: 'LatoLight';
+line-height: 17px;
+padding: 3px 5px 2px;
+border: 1px solid black;
+z-index: 100;
+}
+
/* end Save To New Map */
/* Save Layout */
@@ -695,6 +718,29 @@ cursor:pointer;
font-family: 'LatoLight', helvetica, sans-serif;
}
+.sidebarSave .hoverForTip:hover .tip {
+ display:block;
+}
+
+.sidebarSave .tip {
+display: none;
+position: absolute;
+background: white;
+min-width: 180px;
+max-width: 250px;
+text-align: center;
+top: 36px;
+right: 0;
+color: black;
+border-radius: 4px;
+font-size: 15px !important;
+font-family: 'LatoLight';
+line-height: 17px;
+padding: 3px 5px 2px;
+border: 1px solid black;
+z-index: 100;
+}
+
/* Filter */
.sidebarFilter {
@@ -832,6 +878,29 @@ background-size: 26px 25px;
font-family: 'LatoLight', helvetica, sans-serif;
}
+.sidebarCollaborate .hoverForTip:hover .tip {
+ display:block;
+}
+
+.sidebarCollaborate .tip {
+display: none;
+position: absolute;
+background: white;
+min-width: 180px;
+max-width: 250px;
+text-align: center;
+top: 36px;
+right: 0;
+color: black;
+border-radius: 4px;
+font-size: 15px !important;
+font-family: 'LatoLight';
+line-height: 17px;
+padding: 3px 5px 2px;
+border: 1px solid black;
+z-index: 100;
+}
+
/* end collaborate */
/* search */
@@ -1758,8 +1827,8 @@ font-family:arial;
}
.buttonWrapper {
- margin: 10px auto 0;
- width: 252px;
+ margin: 10px 0 0 131px;
+ width: 254px;
}
.onConsole .new_map button {
diff --git a/app/assets/stylesheets/base.css b/app/assets/stylesheets/base.css
index 2874ebc1..d94545cb 100644
--- a/app/assets/stylesheets/base.css
+++ b/app/assets/stylesheets/base.css
@@ -51,11 +51,14 @@
height:100%;
color:#000;
z-index: 25;
+ display:flex;
+ flex-direction:column;
}
.CardOnGraph .scroll {
display:block;
- padding:5px 10px;
+ padding:5px 0 0 10px;
+ flex:1;
}
.CardOnGraph .type {
@@ -75,6 +78,7 @@
padding:5px;
font-weight: bold;
text-align: center;
+ flex:none;
}
.best_in_place_name {
@@ -138,6 +142,7 @@ font-family: 'LatoLight';
position:relative;
border-bottom: 1px solid #AAAAAA;
border-top: 1px solid #AAAAAA;
+ flex:none;
}
.linkItem {
@@ -168,6 +173,7 @@ background-position: 0px center;
line-height: 40px;
min-width: 16px;
padding-left: 24px;
+color:black;
}
.linkItem.synapseCount {
background-image: url(MMCCicon_synapse_black.png);
@@ -275,8 +281,8 @@ float:left;
position: absolute;
background: white;
width: 155px;
- bottom: 0;
- left: 38px;
+ top: 35px;
+ left: 0;
color: black;
border-radius: 4px;
font-size:15px !important;
@@ -289,28 +295,24 @@ float:left;
.CardOnGraph .link {
- position:absolute;
- bottom:5px;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
+ flex:1;
+ display:flex;
+ flex-direction:row;
border-top: 1px solid #AAAAAA;
- padding-top:8px;
width:100%;
- height:25px;
- background: url(MMCCicon_link.png) no-repeat 6px 6px;
+ max-height:34px;
+ background: url(MMCCicon_link.png) no-repeat 6px 5px;
background-size:24px 24px;
}
.CardOnGraph .best_in_place_link {
- width: 80%;
+ flex:1;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: block;
- float: left;
- padding-left: 40px;
- padding-top:2px;
+ margin-left: 40px;
+ padding-top:9px;
font-size: 16px;
line-height: 16px;
}
@@ -329,13 +331,12 @@ font-family: 'LatoLight';
}
.CardOnGraph .go-link {
- position: absolute;
- width: 34px;
- height: 36px;
+ max-width: 34px;
+ height: 34px;
background: url(MMCCicon_go.png) no-repeat center center;
background-size: 20px 20px;
- top: 0;
- right: 12px;
+ flex:1;
+ margin-right:12px;
}
.cardSettings {
@@ -422,10 +423,11 @@ font-family: 'LatoLight';
}
.mapCard {
- display:block;
+ display:flex;
+ flex-direction:column;
position:relative;
width:100%;
- height:100%;
+ height:320px;
color:#000;
z-index: 25;
}
@@ -443,8 +445,13 @@ background-repeat: no-repeat;
.mapCard .scroll {
display:block;
- padding:5px 10px;
+ flex:1;
+ overflow:hidden;
+ padding:5px 0 5px 10px;
}
+.mCS_no_scrollbar {
+ padding-right: 5px;
+}
.mapCard .type {
position: absolute;
@@ -463,12 +470,14 @@ background-repeat: no-repeat;
padding:5px;
font-weight: bold;
text-align: center;
+ flex:none;
}
.mapCard .links {
position:relative;
border-bottom: 1px solid #AAAAAA;
border-top: 1px solid #AAAAAA;
+ flex:none;
}
.mapCard .icon {
diff --git a/app/controllers/maps_controller.rb b/app/controllers/maps_controller.rb
index 4f038ece..efda6f47 100644
--- a/app/controllers/maps_controller.rb
+++ b/app/controllers/maps_controller.rb
@@ -20,27 +20,35 @@ class MapsController < ApplicationController
@user = nil
if request.path =="/maps/active"
- @maps = Map.visibleToUser(@current, nil).sort! { |a,b| b.last_edited <=> a.last_edited }
- @maps = @maps.slice(0,20)
+ @maps = Map.order("updated_at DESC").limit(20)
@request = "active"
elsif request.path =="/maps/featured"
@maps = Map.order("name ASC").find_all_by_featured(true)
@request = "featured"
- elsif request.path =="/maps/new"
- @maps = Map.visibleToUser(@current, nil).sort! { |a,b| b.created_at <=> a.created_at }
- @maps = @maps.slice(0,20)
+ elsif request.path == "/maps/new"
+ @maps = Map.order("created_at DESC").limit(20)
@request = "new"
- elsif params[:id] # looking for maps by a mapper
+ elsif request.path.index('/maps/mappers/') != nil # looking for maps by a mapper
@user = User.find(params[:id])
- @maps = Map.order("name ASC").visibleToUser(@current, @user)
+ @maps = Map.order("name ASC").find_all_by_user_id(@user.id)
@request = "you" if authenticated? && @user == @current
@request = "other" if authenticated? && @user != @current
+ elsif request.path.index('/maps/topics/') != nil # looking for maps by a certain topic they include
+ @topic = Topic.find(params[:id]).authorize_to_show(@current)
+ if !@topic
+ redirect_to featuredmaps_url, notice: "Access denied." and return
+ end
+ @maps = @topic.maps
+ @request = "topic"
end
+ #read this next line as 'delete a map if its private and you're either 1. logged out or 2. logged in but not the map creator
+ @maps.delete_if {|m| m.permission == "private" && (!authenticated? || (authenticated? && @current.id != m.user_id)) }
+
respond_with(@maps, @request, @user)
end
@@ -215,6 +223,8 @@ class MapsController < ApplicationController
# DELETE maps/:id
def destroy
+ @current = current_user
+
@map = Map.find(params[:id])
@mappings = @map.mappings
@@ -226,7 +236,7 @@ class MapsController < ApplicationController
@map.delete
respond_to do |format|
- format.js
+ format.html { redirect_to "/maps/mappers/" + @current.id.to_s }
end
end
end
diff --git a/app/models/map.rb b/app/models/map.rb
index b06fa7cd..5d305b41 100644
--- a/app/models/map.rb
+++ b/app/models/map.rb
@@ -74,8 +74,11 @@ end
end
@inmaps = Array.new
- topic.maps.each do |map|
+ @mapsString = ""
+ topic.maps.each_with_index do |map, index|
@inmaps.push(map.id)
+ @mapsString += map.name
+ @mapsString += (index+1) == topic.maps.count ? "" : ", "
end
@topicdata = Hash.new
@@ -83,6 +86,7 @@ end
@topicdata['$link'] = topic.link
@topicdata['$metacode'] = topic.metacode.name
@topicdata['$inmaps'] = @inmaps
+ @topicdata['$inmapsString'] = @mapsString
@topicdata['$synapseCount'] = topic.synapses.count
@topicdata['$userid'] = topic.user.id
@topicdata['$username'] = topic.user.name
diff --git a/app/models/topic.rb b/app/models/topic.rb
index e5e151f1..149321c9 100644
--- a/app/models/topic.rb
+++ b/app/models/topic.rb
@@ -71,8 +71,11 @@ belongs_to :metacode
def self_as_json
Jbuilder.encode do |json|
@inmaps = Array.new
- self.maps.each do |map|
+ @mapsString = ""
+ self.maps.each_with_index do |map, index|
@inmaps.push(map.id)
+ @mapsString += map.name
+ @mapsString += (index+1) == self.maps.count ? "" : ", "
end
@topicdata = Hash.new
@@ -80,6 +83,7 @@ belongs_to :metacode
@topicdata['$link'] = self.link
@topicdata['$metacode'] = self.metacode.name
@topicdata['$inmaps'] = @inmaps
+ @topicdata['$inmapsString'] = @mapsString
@topicdata['$synapseCount'] = self.synapses.count
@topicdata['$userid'] = self.user.id
@topicdata['$username'] = self.user.name
@@ -94,8 +98,11 @@ belongs_to :metacode
def selfonmap_as_json(mapid)
Jbuilder.encode do |json|
@inmaps = Array.new
- self.maps.each do |map|
+ @mapsString = ""
+ self.maps.each_with_index do |map, index|
@inmaps.push(map.id)
+ @mapsString += map.name
+ @mapsString += (index+1) == self.maps.count ? "" : ", "
end
@topicdata = Hash.new
@@ -103,6 +110,7 @@ belongs_to :metacode
@topicdata['$link'] = self.link
@topicdata['$metacode'] = self.metacode.name
@topicdata['$inmaps'] = @inmaps
+ @topicdata['$inmapsString'] = @mapsString
@topicdata['$synapseCount'] = self.synapses.count
@topicdata['$userid'] = self.user.id
@topicdata['$username'] = self.user.name
@@ -144,8 +152,11 @@ belongs_to :metacode
end
@inmaps = Array.new
- topic.maps.each do |map|
+ @mapsString = ""
+ topic.maps.each_with_index do |map, index|
@inmaps.push(map.id)
+ @mapsString += map.name
+ @mapsString += (index+1) == topic.maps.count ? "" : ", "
end
@topicdata = Hash.new
@@ -153,6 +164,7 @@ belongs_to :metacode
@topicdata['$link'] = topic.link
@topicdata['$metacode'] = topic.metacode.name
@topicdata['$inmaps'] = @inmaps
+ @topicdata['$inmapsString'] = @mapsString
@topicdata['$synapseCount'] = topic.synapses.count
@topicdata['$userid'] = topic.user.id
@topicdata['$username'] = topic.user.name
@@ -165,8 +177,11 @@ belongs_to :metacode
elsif @topics.count == 1
json.array!(@topics) do |topic|
@inmaps = Array.new
- topic.maps.each do |map|
+ @mapsString = ""
+ topic.maps.each_with_index do |map, index|
@inmaps.push(map.id)
+ @mapsString += map.name
+ @mapsString += (index+1) == topic.maps.count ? "" : ", "
end
@topicdata = Hash.new
@@ -174,6 +189,7 @@ belongs_to :metacode
@topicdata['$link'] = topic.link
@topicdata['$metacode'] = topic.metacode.name
@topicdata['$inmaps'] = @inmaps
+ @topicdata['$inmapsString'] = @mapsString
@topicdata['$synapseCount'] = topic.synapses.count
@topicdata['$userid'] = topic.user.id
@topicdata['$username'] = topic.user.name
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index 33684bf2..4758631b 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -70,7 +70,7 @@
ABOUT
TUTORIAL
- <%= link_to "EXPLORE MAPS", activemaps_url %>
+ <%= link_to "EXPLORE MAPS", featuredmaps_url %>
<%= link_to "metamaps", root_url %>
diff --git a/app/views/maps/_mapinfobox.html.erb b/app/views/maps/_mapinfobox.html.erb
index 29931ae8..3771aeb3 100644
--- a/app/views/maps/_mapinfobox.html.erb
+++ b/app/views/maps/_mapinfobox.html.erb
@@ -13,6 +13,9 @@
@map.contributors.each_with_index do |c, index|
comma = (index+1) == @map.contributors.count ? '' : ', '
contributorList += c.name + comma
+ end
+ if @map.contributors.count == 0
+ contributorList = 'No one has added anything yet.'
end %>
<%= contributorList %>
@@ -39,7 +42,7 @@
<% if @map.user == user %>
- <%= link_to 'Delete', map_path(@map), :class => 'delete', :confirm => 'Delete this map (nodes and synapses will remain)?', :method => :delete, :remote => true %>
+ <%= link_to 'Delete', map_path(@map), :class => 'delete', :confirm => 'Delete this map (nodes and synapses will remain)?', :method => :delete %>
<% end %>
diff --git a/app/views/maps/index.html.erb b/app/views/maps/index.html.erb
index 61d2bbe8..8d188751 100644
--- a/app/views/maps/index.html.erb
+++ b/app/views/maps/index.html.erb
@@ -15,12 +15,18 @@
<% if @request == "other" %>
By <%= @user.name %> /
<% end %>
+ <% if @request == "topic" %>
+ Maps Containing Topic <%= @topic.id.to_s %>: "<%= @topic.name.truncate(30) %>"
+ <% end %>
+
+ <% if @request != "topic" %>
">Recently Active /
">Featured /
">Newest First
<% if authenticated? %>
/ ">Yours
<% end %>
+ <% end %>
@@ -35,7 +41,23 @@
diff --git a/app/views/maps/savelayout.js.erb b/app/views/maps/savelayout.js.erb
index d331de3a..3372a417 100644
--- a/app/views/maps/savelayout.js.erb
+++ b/app/views/maps/savelayout.js.erb
@@ -2,5 +2,5 @@
* @file
* Javascript executed when you save the layout of a map.
*/
-$('.wandSaveLayout').html('Saved!');
-setTimeout(function(){$('.wandSaveLayout').html('Save Layout')},1500);
+$('.sidebarSave .tip').html('Saved!');
+setTimeout(function(){ $('.sidebarSave .tip').html('Save Layout') },1500);
diff --git a/app/views/maps/show.html.erb b/app/views/maps/show.html.erb
index f41d7d37..2ef0d431 100644
--- a/app/views/maps/show.html.erb
+++ b/app/views/maps/show.html.erb
@@ -9,16 +9,22 @@
<% if authenticated? %>
<% if @map.permission == "commons" || @map.user == user %>
<% end %>