Commit f27c4145e13a12476ae3b7cee4ee575437aadaa9
In annotations, when a link is added, it should linkified
When links are added in annotations, they should be placed inside <a> tag so
they can become hyperlinks in the UI.
| | | | 492 | // create the text to displayed for each annotation from the other | 492 | // create the text to displayed for each annotation from the other |
---|
493 | // attributes of the sweet/annotation | 493 | // attributes of the sweet/annotation |
---|
494 | createPopupText: function(annotation) { | 494 | createPopupText: function(annotation) { |
---|
| | 495 | // title |
---|
495 | var text = (annotation.title) ? '<h4>' + annotation.title + '</h4>' : ''; | 496 | var text = (annotation.title) ? '<h4>' + annotation.title + '</h4>' : ''; |
---|
| | 497 | |
---|
| | 498 | // comment |
---|
496 | text += (annotation.comment) ? '<p>' + annotation.comment + '</p>' : ''; | 499 | text += (annotation.comment) ? '<p>' + annotation.comment + '</p>' : ''; |
---|
497 | text += (annotation.link) ? '<p>' + annotation.link + '</p>' : ''; | | text += (annotation.link) ? '<p>' + annotation.link + '</p>' : ''; |
---|
| | 500 | | | | 501 | // link |
---|
| | 502 | text += (annotation.link) ? '<a target="blank" href="' + |
---|
| | 503 | swtr.utils.linkify(annotation.link) + '">' + annotation.link + |
---|
| | 504 | '</a>' : ''; |
---|
| | 505 | |
---|
| | 506 | // tags |
---|
498 | text += (annotation.tags) ? '<p>' + annotation.tags + '</p>' : ''; | 507 | text += (annotation.tags) ? '<p>' + annotation.tags + '</p>' : ''; |
---|
499 | | 508 | |
---|
500 | // if older annotation i.e w/o comment,title etc fields | 509 | // if older annotation i.e w/o comment,title etc fields |
---|
… | | … | |
---|
572 | }); | 572 | }); |
---|
573 | | 573 | |
---|
574 | // utilities and helper functions to go here | 574 | // utilities and helper functions to go here |
---|
575 | swtr.utils = {}; | | swtr.utils = {}; |
---|
| | 575 | swtr.utils = { | | | 576 | linkify: function(link) { |
---|
| | 577 | if(link.match('http')) { |
---|
| | 578 | return link; |
---|
| | 579 | } |
---|
| | 580 | else { |
---|
| | 581 | return 'http://' + link; |
---|
| | 582 | } |
---|
| | 583 | } |
---|
| | 584 | }; |
---|
576 | | 585 | |
---|
577 | //swtr.AppView = AppView; | 586 | //swtr.AppView = AppView; |
---|
578 | | 587 | |
---|