diff --git a/app/assets/javascripts/src/Metamaps.js b/app/assets/javascripts/src/Metamaps.js index 98a42c4d..09e3e27a 100644 --- a/app/assets/javascripts/src/Metamaps.js +++ b/app/assets/javascripts/src/Metamaps.js @@ -1089,6 +1089,31 @@ Metamaps.TopicCard = { $('.showcard .yourTopic .mapPerm').click(openPermissionSelect); $('.showcard').click(hidePermissionSelect); } + + $('.links .mapCount').unbind().click(function(event){ + $('.mapCount .tip').toggle(); + event.stopPropagation(); + }); + $('.mapCount .tip').unbind().click(function(event){ + event.stopPropagation(); + }); + $('.showCard').unbind('.hideTip').bind('click.hideTip', function(){ + $('.mapCount .tip').hide(); + }); + var originalText = $('.showMore').html(); + $('.mapCount .tip .showMore').unbind().toggle( + function(event){ + $('.extraText').toggleClass("hideExtra"); + $('.showMore').html('Show less...'); + }, + function(event){ + $('.extraText').toggleClass("hideExtra"); + $('.showMore').html(originalText); + }); + + $('.mapCount .tip showMore').unbind().click(function(event){ + event.stopPropagation(); + }); }, handleInvalidLink: function() { var self = Metamaps.TopicCard; @@ -1162,6 +1187,24 @@ Metamaps.TopicCard = { nodeValues.attachments = ''; } + console.log(topic.get("inmaps")); + var inmapsAr = topic.get("inmaps"); + nodeValues.inmaps =''; + if (inmapsAr.length < 6) { + for (i = 0; i < inmapsAr.length; i++) { + nodeValues.inmaps += '
  • ' + inmapsAr[i] + '
  • '; + } + } + else { + for (i = 0; i < 5; i++){ + nodeValues.inmaps += '
  • ' + inmapsAr[i] + '
  • '; + } + extra = inmapsAr.length - 5; + nodeValues.inmaps += '
  • See ' + extra + ' more...
  • ' + for (i = 5; i < inmapsAr.length; i++){ + nodeValues.inmaps += '
  • ' + inmapsAr[i] + '
  • '; + } + } nodeValues.permission = topic.get("permission"); nodeValues.mk_permission = topic.get("permission").substring(0, 2); nodeValues.map_count = topic.get("map_count").toString(); diff --git a/app/assets/stylesheets/base.css b/app/assets/stylesheets/base.css index 5837e16d..92809fbf 100644 --- a/app/assets/stylesheets/base.css +++ b/app/assets/stylesheets/base.css @@ -251,6 +251,49 @@ .linkItem.mapCount:hover .mapCountIcon { background-position: 0 -32px; } + +.CardOnGraph .mapCount .tip { + top: 44px; + left: 0px; + font-size: 12px !important; +} + +.CardOnGraph .mapCount .tip:before { + content: ''; + position: absolute; + top: 26px; + left: 10px; + margin-top: -30px; + width: 0; + height: 0; + border-bottom: 4px solid #000000; + border-left: 5px solid transparent; + border-right: 5px solid transparent; +} + +.CardOnGraph .mapCount .tip li { + list-style-type: none; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + padding: 6px 10px; + display: block; + height: 14px; + font-family: 'din-regular', helvetica, sans-serif; + font-size: 14px; + line-height: 14px; + position: relative; +} + +.CardOnGraph .mapCount li.hideExtra { + display: none; +} + +.showMore { + cursor: pointer; +} + + .linkItem.synapseCount { margin-left: 2px; width: 24px; diff --git a/app/helpers/topics_helper.rb b/app/helpers/topics_helper.rb index 6732f17e..864493b7 100644 --- a/app/helpers/topics_helper.rb +++ b/app/helpers/topics_helper.rb @@ -17,7 +17,8 @@ module TopicsHelper topic['originator'] = t.user.name topic['originatorImage'] = t.user.image.url(:square) topic['rtype'] = "topic" - + topic['inmaps'] = t.inmaps + temp.push topic end return temp diff --git a/app/models/topic.rb b/app/models/topic.rb index b19d2d57..a9111f51 100644 --- a/app/models/topic.rb +++ b/app/models/topic.rb @@ -54,8 +54,12 @@ class Topic < ActiveRecord::Base self.synapses.count end + def inmaps + self.maps.map(&:name) + end + def as_json(options={}) - super(:methods =>[:user_name, :user_image, :map_count, :synapse_count]) + super(:methods =>[:user_name, :user_image, :map_count, :synapse_count, :inmaps]) end def topic_autocomplete_method diff --git a/app/views/layouts/_templates.html.erb b/app/views/layouts/_templates.html.erb index 176556cc..9f9f5c0a 100644 --- a/app/views/layouts/_templates.html.erb +++ b/app/views/layouts/_templates.html.erb @@ -215,10 +215,12 @@
    {{username}}
    - -
    - {{map_count}} -
    +
    +
    + {{map_count}} +
    +
    +
    {{synapse_count}}