Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
Rocket.Chat
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RocketChat
Rocket.Chat
Commits
453cc192
Commit
453cc192
authored
8 years ago
by
Domenic Horner
Browse files
Options
Downloads
Patches
Plain Diff
handle locations when disabled
parent
f89099a2
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
packages/rocketchat-mapview/client/mapview.coffee
+4
-2
4 additions, 2 deletions
packages/rocketchat-mapview/client/mapview.coffee
with
4 additions
and
2 deletions
packages/rocketchat-mapview/client/mapview.coffee
+
4
−
2
View file @
453cc192
...
@@ -10,15 +10,17 @@ class MapView
...
@@ -10,15 +10,17 @@ class MapView
mv_enabled
=
RocketChat
.
settings
.
get
'MapView_Enabled'
mv_enabled
=
RocketChat
.
settings
.
get
'MapView_Enabled'
mv_googlekey
=
RocketChat
.
settings
.
get
'MapView_GMapsAPIKey'
mv_googlekey
=
RocketChat
.
settings
.
get
'MapView_GMapsAPIKey'
if
message
.
location
and
mv_enabled
if
message
.
location
# GeoJSON is reversed - ie. [lng, lat]
# GeoJSON is reversed - ie. [lng, lat]
longitude
=
message
.
location
.
coordinates
[
0
]
longitude
=
message
.
location
.
coordinates
[
0
]
latitude
=
message
.
location
.
coordinates
[
1
]
latitude
=
message
.
location
.
coordinates
[
1
]
# confirm we have an api key set, and generate the html required for the mapview
# confirm we have an api key set, and generate the html required for the mapview
if
mv_googlekey
?
.
length
if
mv_enabled
and
mv_googlekey
?
.
length
message
.
html
=
'<a href="https://maps.google.com/maps?daddr='
+
latitude
+
','
+
longitude
+
'" target="_blank"><img src="https://maps.googleapis.com/maps/api/staticmap?zoom=14&size=250x250&markers=color:gray%7Clabel:%7C'
+
latitude
+
','
+
longitude
+
'&key='
+
mv_googlekey
+
'" /></a>'
message
.
html
=
'<a href="https://maps.google.com/maps?daddr='
+
latitude
+
','
+
longitude
+
'" target="_blank"><img src="https://maps.googleapis.com/maps/api/staticmap?zoom=14&size=250x250&markers=color:gray%7Clabel:%7C'
+
latitude
+
','
+
longitude
+
'&key='
+
mv_googlekey
+
'" /></a>'
else
message
.
html
=
'<a href="https://maps.google.com/maps?daddr='
+
latitude
+
','
+
longitude
+
'" target="_blank">Shared Location</a>'
return
message
return
message
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment