topic card description overflow improvement, handle invalid links in topic card

This commit is contained in:
Connor Turland 2014-11-03 17:48:02 -05:00
parent ee1ca7853f
commit 6ecdd1076e
2 changed files with 46 additions and 6 deletions

View file

@ -832,7 +832,14 @@ Metamaps.TopicCard = {
var self = Metamaps.TopicCard; var self = Metamaps.TopicCard;
$('#embedlyLinkLoader').hide(); $('#embedlyLinkLoader').hide();
$('#embedlyLink').fadeIn('fast');
// means that the embedly call returned 404 not found
if ($('#embedlyLink')[0]) {
$('#embedlyLink').css('display', 'block').fadeIn('fast');
$('.embeds').addClass('nonEmbedlyLink');
}
$('.CardOnGraph').addClass('hasAttachment');
if (self.authorizedToEdit) { if (self.authorizedToEdit) {
$('.embeds').append('<div id="linkremove"></div>'); $('.embeds').append('<div id="linkremove"></div>');
$('#linkremove').click(self.removeLink); $('#linkremove').click(self.removeLink);
@ -843,7 +850,7 @@ Metamaps.TopicCard = {
self.openTopicCard.save({ self.openTopicCard.save({
link: null link: null
}); });
$('.embeds').empty(); $('.embeds').empty().removeClass('nonEmbedlyLink');
$('#addLinkInput input').val(""); $('#addLinkInput input').val("");
$('.attachments').removeClass('hidden'); $('.attachments').removeClass('hidden');
$('.CardOnGraph').removeClass('hasAttachment'); $('.CardOnGraph').removeClass('hasAttachment');
@ -892,8 +899,10 @@ Metamaps.TopicCard = {
loader.setDensity(41); // default is 40 loader.setDensity(41); // default is 40
loader.setRange(0.9); // default is 1.3 loader.setRange(0.9); // default is 1.3
loader.show(); // Hidden by default loader.show(); // Hidden by default
embedly('card', document.getElementById('embedlyLink')); var e = embedly('card', document.getElementById('embedlyLink'));
$('.CardOnGraph').addClass('hasAttachment'); if (!e) {
self.handleInvalidLink();
}
} }
}, 100); }, 100);
}; };
@ -908,7 +917,10 @@ Metamaps.TopicCard = {
loader.setDensity(41); // default is 40 loader.setDensity(41); // default is 40
loader.setRange(0.9); // default is 1.3 loader.setRange(0.9); // default is 1.3
loader.show(); // Hidden by default loader.show(); // Hidden by default
embedly('card', document.getElementById('embedlyLink')); var e = embedly('card', document.getElementById('embedlyLink'));
if (!e) {
self.handleInvalidLink();
}
} }
@ -1075,6 +1087,12 @@ Metamaps.TopicCard = {
$('.showcard').click(hidePermissionSelect); $('.showcard').click(hidePermissionSelect);
} }
}, },
handleInvalidLink: function() {
var self = Metamaps.TopicCard;
self.removeLink();
Metamaps.GlobalUI.notifyUser("Invalid link");
},
populateShowCard: function (topic) { populateShowCard: function (topic) {
var self = Metamaps.TopicCard; var self = Metamaps.TopicCard;

View file

@ -113,7 +113,7 @@
font-size: 12px; font-size: 12px;
line-height:15px; line-height:15px;
font-family: helvetica, sans-serif; font-family: helvetica, sans-serif;
overflow-y: scroll; overflow-y: auto;
} }
.CardOnGraph.hasAttachment .scroll { .CardOnGraph.hasAttachment .scroll {
height: auto; height: auto;
@ -548,6 +548,28 @@ font-family: 'din-regular', helvetica, sans-serif;
background-position: center center; background-position: center center;
} }
.embeds.nonEmbedlyLink {
padding-top: 24px;
}
#embedlyLink {
border-left: 8px solid #CCC;
overflow: hidden;
padding: 8px;
padding-left: 12px;
-moz-box-shadow: 1px 1px 5px 0 #ccc;
-webkit-box-shadow: 1px 1px 5px 0 #ccc;
box-shadow: 1px 1px 5px 0 #ccc;
-moz-border-radius-topright: 5px;
-webkit-border-top-right-radius: 5px;
border-top-right-radius: 5px;
-moz-border-radius-bottomright: 8px;
-webkit-border-bottom-right-radius: 8px;
border-bottom-right-radius: 8px;
display: none;
margin: 8px;
}
.linkActions { .linkActions {
position: relative; position: relative;
} }