Merge branch 'develop' of github.com:Connoropolous/metamaps_gen002 into develop

This commit is contained in:
Connor Turland 2014-11-26 14:49:16 -05:00
commit ab53e996d4
5 changed files with 99 additions and 6 deletions

View file

@ -1089,6 +1089,31 @@ Metamaps.TopicCard = {
$('.showcard .yourTopic .mapPerm').click(openPermissionSelect); $('.showcard .yourTopic .mapPerm').click(openPermissionSelect);
$('.showcard').click(hidePermissionSelect); $('.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() { handleInvalidLink: function() {
var self = Metamaps.TopicCard; var self = Metamaps.TopicCard;
@ -1162,6 +1187,24 @@ Metamaps.TopicCard = {
nodeValues.attachments = ''; 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 += '<li>' + inmapsAr[i] + '</li>';
}
}
else {
for (i = 0; i < 5; i++){
nodeValues.inmaps += '<li>' + inmapsAr[i] + '</li>';
}
extra = inmapsAr.length - 5;
nodeValues.inmaps += '<li><span class="showMore">See ' + extra + ' more...</span></li>'
for (i = 5; i < inmapsAr.length; i++){
nodeValues.inmaps += '<li class="hideExtra extraText">' + inmapsAr[i] + '</li>';
}
}
nodeValues.permission = topic.get("permission"); nodeValues.permission = topic.get("permission");
nodeValues.mk_permission = topic.get("permission").substring(0, 2); nodeValues.mk_permission = topic.get("permission").substring(0, 2);
nodeValues.map_count = topic.get("map_count").toString(); nodeValues.map_count = topic.get("map_count").toString();

View file

@ -251,6 +251,49 @@
.linkItem.mapCount:hover .mapCountIcon { .linkItem.mapCount:hover .mapCountIcon {
background-position: 0 -32px; 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 { .linkItem.synapseCount {
margin-left: 2px; margin-left: 2px;
width: 24px; width: 24px;

View file

@ -17,7 +17,8 @@ module TopicsHelper
topic['originator'] = t.user.name topic['originator'] = t.user.name
topic['originatorImage'] = t.user.image.url(:thirtytwo) topic['originatorImage'] = t.user.image.url(:thirtytwo)
topic['rtype'] = "topic" topic['rtype'] = "topic"
topic['inmaps'] = t.inmaps
temp.push topic temp.push topic
end end
return temp return temp

View file

@ -54,8 +54,12 @@ class Topic < ActiveRecord::Base
self.synapses.count self.synapses.count
end end
def inmaps
self.maps.map(&:name)
end
def as_json(options={}) 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 end
def topic_autocomplete_method def topic_autocomplete_method

View file

@ -237,10 +237,12 @@
<img src="/assets/user.png" class="contributorIcon" width="32" height="32" /> <img src="/assets/user.png" class="contributorIcon" width="32" height="32" />
<div class="contributorName">{{username}}</div> <div class="contributorName">{{username}}</div>
</div> </div>
<a href="/explore/topics/{{id}}" class="linkItem mapCount" title="Click to see which maps topic appears on"> <div class="linkItem mapCount" title="Click to see which maps topic appears on">
<div class="mapCountIcon"></div> <div class="mapCountIcon"></div>
{{map_count}} {{map_count}}
</a> <div class="tip"><ul>{{{inmaps}}}</ul></div>
</div>
<a href="/topics/{{id}}" class="linkItem synapseCount" title="Click to see this topics synapses"> <a href="/topics/{{id}}" class="linkItem synapseCount" title="Click to see this topics synapses">
<div class="synapseCountIcon"></div> <div class="synapseCountIcon"></div>
{{synapse_count}} {{synapse_count}}