Merge lp:~costales/unav/0.65-parse-pois-url into lp:unav

Proposed by costales
Status: Merged
Merged at revision: 152
Proposed branch: lp:~costales/unav/0.65-parse-pois-url
Merge into: lp:unav
Diff against target: 56 lines (+14/-3)
3 files modified
qml/PoiDetailsPage.qml (+2/-2)
qml/PoiListPage.qml (+1/-1)
qml/js/utils.js (+11/-0)
To merge this branch: bzr merge lp:~costales/unav/0.65-parse-pois-url
Reviewer Review Type Date Requested Status
uNav developers Pending
Review via email: mp+314264@code.launchpad.net

Description of the change

Add http:// in the beggining if the POI hasn't that in the URL, for launch externally in the browser.

To post a comment you must log in.
153. By costales

http or https

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/PoiDetailsPage.qml'
2--- qml/PoiDetailsPage.qml 2016-07-15 13:11:01 +0000
3+++ qml/PoiDetailsPage.qml 2017-01-09 13:31:35 +0000
4@@ -68,7 +68,7 @@
5 cuisine.title = poiDetailsModel.get(0).cuisine
6 phone.title = poiDetailsModel.get(0).phone
7 openingHours.title = poiDetailsModel.get(0).opening_hours
8- website.title = poiDetailsModel.get(0).website
9+ website.title = QmlJs.parse_poi_url(poiDetailsModel.get(0).website)
10 internet.title = poiDetailsModel.get(0).internet_access
11 wheelchair.title = poiDetailsModel.get(0).wheelchair
12 lat = parseFloat(mainPageStack.clickedLat)
13@@ -125,7 +125,7 @@
14 poiActionButtonModel.append({mode: "CALL", iconName: "call-start"})
15 }
16
17- if (website.title && website.title.substring(0, 4) === "http") {
18+ if (website.title) {
19 poiActionButtonModel.append({mode: "WEB", iconName: "stock_website"})
20 }
21 }
22
23=== modified file 'qml/PoiListPage.qml'
24--- qml/PoiListPage.qml 2016-07-15 14:30:09 +0000
25+++ qml/PoiListPage.qml 2017-01-09 13:31:35 +0000
26@@ -222,7 +222,7 @@
27 "name": poiXmlModel.get(i).name.split(',')[0],
28 "description": poiXmlModel.get(i).description,
29 "phone": poiXmlModel.get(i).phone,
30- "website": poiXmlModel.get(i).website,
31+ "website": QmlJs.parse_poi_url(poiXmlModel.get(i).website),
32 // "cuisine": poiXmlModel.get(i).cuisine,
33 "wheelchair": poiXmlModel.get(i).wheelchair,
34 "openinghours": poiXmlModel.get(i).openinghours,
35
36=== modified file 'qml/js/utils.js'
37--- qml/js/utils.js 2016-08-28 07:13:49 +0000
38+++ qml/js/utils.js 2017-01-09 13:31:35 +0000
39@@ -91,6 +91,17 @@
40 }
41
42 /**
43+* Function parse_poi_url(poi_website): Return string
44+* url: POI's URL
45+**/
46+function parse_poi_url(poi_website) {
47+ if (poi_website.substring(0, 8) === "https://" || poi_website.substring(0, 7) === "http://")
48+ return poi_website;
49+ else
50+ return "http://" + poi_website;
51+}
52+
53+/**
54 * Function is_url_dispatcher(url): Return boolean
55 * url: URL calling uNav
56 **/

Subscribers

People subscribed via source and target branches