Skip to content

Commit

Permalink
PL.editor shows map if lat,lon passed in URL. (publiclab#6788)
Browse files Browse the repository at this point in the history
* pl-editor shows map

* indentation

* yarn.lock added for PL.editor

* safe traverse syntax used
  • Loading branch information
sagarpreet-chadha authored and Vinit Shahdeo committed Feb 1, 2020
1 parent e184b8a commit 1e5317d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 19 deletions.
8 changes: 8 additions & 0 deletions app/controllers/editor_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ def rich
if params[:main_image] && Image.find_by(id: params[:main_image])
@main_image = Image.find_by(id: params[:main_image]).path
end

if params[:tags]&.include? "lat:" and params[:tags]&.include? "lon:"
tags = params[:tags].split(',')
tags.each do |x|
x.include? "lat:" and (@lat = x.split(':')[1])
x.include? "lon:" and (@lon = x.split(':')[1])
end
end
template if params[:n] && !params[:body] # use another node body as a template
image if params[:i]
end
Expand Down
8 changes: 1 addition & 7 deletions app/views/editor/rich.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -304,14 +304,8 @@

</div>
<script>
$( document ).ready(function() {
$("#map_content").hide() ;
$("#location_button").click(function(){
$("#map_content").toggle() ;
}) ;
});
var editor;

(function() {
editor = new PL.Editor({
data: {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"noty": "3.1.4",
"phantomjs-prebuilt": "^2.1.16",
"popper.js": "^1.16.0",
"publiclab-editor": "~2.0.0",
"publiclab-editor": "^2.0.3",
"short-code-forms": "jywarren/short-code-forms#~0.0.1",
"simple-data-grapher": "^2.0.0",
"typeahead.js": "^0.11.1",
Expand Down
15 changes: 4 additions & 11 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3190,14 +3190,6 @@ leaflet-blurred-location@^1.2.5, leaflet-blurred-location@^1.3.0:
jquery "^3.2.1"
leaflet "^1.3.3"

"leaflet-blurred-location@git://github.com/publiclab/leaflet-blurred-location.git#main":
version "1.3.0"
resolved "git://github.com/publiclab/leaflet-blurred-location.git#1bff37cb96518bd87192277b14c290cba3c138ba"
dependencies:
haversine-distance "^1.1.4"
jquery "^3.2.1"
leaflet "^1.3.3"

leaflet-environmental-layers@^2.0.5:
version "2.0.5"
resolved "https://registry.yarnpkg.com/leaflet-environmental-layers/-/leaflet-environmental-layers-2.0.5.tgz#c35cd704102a049803db58df7ba73dcea02dafc0"
Expand Down Expand Up @@ -4264,9 +4256,10 @@ publiclab-editor@^2.0.0:
woofmark "git://github.com/jywarren/woofmark.git#xhrOptionsAltBureaucracy"
xhr "~2.5.0"

publiclab-editor@~2.0.0:
version "2.0.2"
resolved "https://registry.yarnpkg.com/publiclab-editor/-/publiclab-editor-2.0.2.tgz#d0017f1337232d776e64e6acda1156a470cf9ce2"
publiclab-editor@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/publiclab-editor/-/publiclab-editor-2.0.3.tgz#0f14c9c0c7718f42c3085a8f38842baca596ce27"
integrity sha512-na7Am5jYDYp2t9sGKuuMxx0UwmkNWR7TNZ3/F34WY/EMMZwkF0fvyOWtuS93IhVjtGxGYJ8Jzna1lQ3ajcZOgg==
dependencies:
at.js "^1.5.4"
backbone "~1.3.3"
Expand Down

0 comments on commit 1e5317d

Please sign in to comment.