Skip to content
Snippets Groups Projects
Commit df27b4e1 authored by Benoit Lavenier's avatar Benoit Lavenier
Browse files

[fix] fix link on description, when missing protocol (http://)

parent 72d02238
Branches
Tags
No related merge requests found
......@@ -389,6 +389,7 @@ angular.module('cesium.filters', ['cesium.config', 'cesium.platform', 'pascalpre
return function(input, size) {
size = size || 25;
var startIndex = input.startsWith('http://') ? 7 : (input.startsWith('https://') ? 8 : 0);
startIndex = input.startsWith('www.', startIndex) ? startIndex + 4 : startIndex; // Remove sequence 'www.'
return !input || (input.length-startIndex) <= size ? input.substr(startIndex) : (input.substr(startIndex, size) + '...');
};
})
......
......@@ -343,10 +343,9 @@ angular.module('cesium.es.http.services', ['ngResource', 'ngApi', 'cesium.servic
prefix = prefix || '#';
var reg = prefix === '@' ? regexp.USER_TAG : regexp.HASH_TAG;
var matches = value && reg.exec(value);
var tags;
var tags = matches && [];
while(matches) {
var tag = matches[1];
tags = tags || [];
if (!_.contains(tags, tag)) {
tags.push(tag);
}
......@@ -358,10 +357,9 @@ angular.module('cesium.es.http.services', ['ngResource', 'ngApi', 'cesium.servic
function parseUrlsFromText(value) {
var matches = value && regexp.URL.exec(value);
var urls;
var urls = matches && [];
while(matches) {
var url = matches[0];
urls = urls || [];
if (!_.contains(urls, url)) {
urls.push(url);
}
......@@ -390,8 +388,9 @@ angular.module('cesium.es.http.services', ['ngResource', 'ngApi', 'cesium.servic
// Replace URL in description
var urls = parseUrlsFromText(content);
_.forEach(urls, function(url){
var href = (url.startsWith('http://') || url.startsWith('https://')) ? url : ('http://' + url);
// Redirect URL to the function 'openLink', to open a new window if need (e.g. desktop app)
var link = '<a on-tap=\"openLink($event, \'{0}\')\" href=\"{1}\" target="_blank">{2}</a>'.format(url, url, truncUrlFilter(url));
var link = '<a on-tap=\"openLink($event, \'{0}\')\" href=\"{1}\" target="_blank">{2}</a>'.format(href, href, truncUrlFilter(url));
content = content.replace(url, link);
});
......
......@@ -86,11 +86,9 @@
<div class="pull-left" ng-if="!search.loading">
<ng-if ng-if="search.type=='last'">
<h4>{{ ('MESSAGE.LIST.LAST_' + type) | upper | translate}}</h4>
<!--<small class="gray no-padding" ng-if="search.total">{{'WOT.LOOKUP.NEWCOMERS_COUNT'|translate:{count: search.total} }}</small>-->
</ng-if>
<ng-if ng-if="search.type=='text'">
<h4 translate>COMMON.RESULTS_LIST</h4>
<!--<small class="gray no-padding" ng-if="search.total">{{'WOT.LOOKUP.PENDING_COUNT'|translate:{count: search.total} }}</small>-->
</ng-if>
</div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment