Skip to content

Commit

Permalink
Not to show marker on profile page map if tag blurred:true exists . p…
Browse files Browse the repository at this point in the history
…ubliclab#2230 (publiclab#2245)

* Indentation + blurred:true tag

Removes marker if the blurred:true tag exists .

* remove marker feature
  • Loading branch information
sagarpreet-chadha authored and Souravirus committed Mar 12, 2018
1 parent 5941d56 commit cde8487
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def profile
if @profile_user.has_power_tag("lat") && @profile_user.has_power_tag("lon")
@map_lat = @profile_user.get_value_of_power_tag("lat").to_f
@map_lon = @profile_user.get_value_of_power_tag("lon").to_f
@map_blurred = @profile_user.has_tag("location:blurred")
@map_blurred = @profile_user.has_tag("blurred:true")
end

if @user.status == 0
Expand Down
28 changes: 14 additions & 14 deletions app/views/map/_userLeaflet.html.erb
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<% if haslocation == true %>
<% unique_id = rand(100) %>
<style>
#map<%= unique_id %> { height:300px; margin: 0; position: relative;}
</style>
<div class="leaflet-map" id="map<%= unique_id %>"></div>
<script>
var map = L.map('map<%= unique_id %>').setView([<%= @map_lat %>,<%= @map_lon %>], 7);
L.tileLayer("//a.tiles.mapbox.com/v3/jywarren.map-lmrwb2em/{z}/{x}/{y}.png").addTo(map);
<% if !(@map_blurred == "true") %>
L.marker([<%= @map_lat %>, <%= @map_lon %>]).addTo(map).bindPopup("<a href='https://publiclab.org/profile/<%= @profile_user.username %>'><%= @profile_user.username %> </a>");
<% if haslocation == true %>
<% unique_id = rand(100) %>
<style>
#map<%= unique_id %> { height:300px; margin: 0; position: relative;}
</style>
<div class="leaflet-map" id="map<%= unique_id %>"></div>
<script>
var map = L.map('map<%= unique_id %>').setView([<%= @map_lat %>,<%= @map_lon %>], 7);
L.tileLayer("//a.tiles.mapbox.com/v3/jywarren.map-lmrwb2em/{z}/{x}/{y}.png").addTo(map);
<% if !(@map_blurred == true) %>
L.marker([<%= @map_lat %>, <%= @map_lon %>]).addTo(map).bindPopup("<a href='https://publiclab.org/profile/<%= @profile_user.username %>'><%= @profile_user.username %> </a>");
<% end %>
</script>
<% else %>
</script>
<% else %>
<div id="map_template" style="position: relative; display: inline-block;">
<img src="https://a.tiles.mapbox.com/v3/jywarren.map-lmrwb2em/0/0/0.png" style="height:300px; margin: 0; position: relative; margin-right: -10px;">
<button type='button' class='btn btn-default btn-lg' onclick='addLocation()' style="position: absolute; position: absolute;top: 41% ; left: 15% ;"> <strong> Share your Location </strong> </button>
Expand All @@ -21,4 +21,4 @@
$('.blurred-location-input').click() ;
}
</script>
<% end %>
<% end %>

0 comments on commit cde8487

Please sign in to comment.