From f27c4145e13a12476ae3b7cee4ee575437aadaa9 Mon Sep 17 00:00:00 2001 From: Anon Ray Date: Thu, 3 Jul 2014 14:36:08 +0530 Subject: [PATCH] In annotations, when a link is added, it should linkified When links are added in annotations, they should be placed inside tag so they can become hyperlinks in the UI. --- swtr/static/js/swtmaker.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/swtr/static/js/swtmaker.js b/swtr/static/js/swtmaker.js index ef002f5..741686d 100644 --- a/swtr/static/js/swtmaker.js +++ b/swtr/static/js/swtmaker.js @@ -492,9 +492,18 @@ // create the text to displayed for each annotation from the other // attributes of the sweet/annotation createPopupText: function(annotation) { + // title var text = (annotation.title) ? '

' + annotation.title + '

' : ''; + + // comment text += (annotation.comment) ? '

' + annotation.comment + '

' : ''; - text += (annotation.link) ? '

' + annotation.link + '

' : ''; + + // link + text += (annotation.link) ? '
' + annotation.link + + '' : ''; + + // tags text += (annotation.tags) ? '

' + annotation.tags + '

' : ''; // if older annotation i.e w/o comment,title etc fields @@ -563,7 +572,16 @@ }); // utilities and helper functions to go here - swtr.utils = {}; + swtr.utils = { + linkify: function(link) { + if(link.match('http')) { + return link; + } + else { + return 'http://' + link; + } + } + }; //swtr.AppView = AppView; -- 1.7.10.4