Skip to content

Commit

Permalink
add nearby activity
Browse files Browse the repository at this point in the history
  • Loading branch information
RuthNjeri committed Feb 15, 2021
1 parent 6ec8308 commit ee399de
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 deletions.
4 changes: 4 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ def lon
get_value_of_power_tag('lon')
end

def zoom
get_value_of_power_tag('zoom')
end

# we can revise/improve this for m2m later...
def has_role(some_role)
role == some_role
Expand Down
19 changes: 19 additions & 0 deletions app/views/dashboard_v2/_location.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<% if current_user.has_power_tag("lat") && current_user.has_power_tag("lon") %>
<% lon = current_user.lon %>
<% lat = current_user.lat%>
<% zoom = current_user.zoom ? current_user.zoom: '' %>
<%# Display Map %>
<%= render_map(lat, lon, zoom) %>
<%# Link to view Nearby Activity %>
<% url = "/map#" + zoom.to_s + "/" + lat.to_s + lon.to_s %>
<a href="<%= url %>" class="btn btn-outline-secondary btn-location mt-2 mb-5"><i class="fa fa-map-marker" aria-hidden="true"></i> <%= translation('dashboard_v2.sidebar.nearby_activity') %> </a>
<% else %>
<div style="margin: 2.2rem 0;">
<a class="btn btn-lg btn-outline-secondary blurred-location-input" submit_to="/profile/tags/create/<%= current_user.uid %>"><i class="fa fa-map-marker" style="color:#c40;"></i> <%= translation('dashboard_v2.sidebar.add_location') %></a>
<p><small class="form-grey">
<%= translation('dashboard_v2.sidebar.location_work') %> |
<a class="form-grey" style="text-decoration: underline;" href="https://publiclab.org/location-privacy" target="_blank"><%= translation('dashboard_v2.sidebar.location_privacy') %></a>
</p></small>
</div>
<%= render partial: 'tag/location' %>
<% end %>
14 changes: 2 additions & 12 deletions app/views/dashboard_v2/_sidebar.html.erb
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
<%= javascript_include_tag('asyncTagSubscriptions.js') %>
<%# TODO Location not working, will be fixed after working on https://github.com/publiclab/plots2/issues/8566 %>
<% if current_user %>
<div style="margin: 2.2rem 0;">
<a class="btn btn-lg btn-outline-secondary blurred-location-input" submit_to="/profile/tags/create/<%= current_user.uid %>"><i class="fa fa-map-marker" style="color:#c40;"></i> <%= translation('dashboard_v2.sidebar.add_location') %></a>
<p><small class="form-grey">
<%= translation('dashboard_v2.sidebar.location_work') %> |
<a class="form-grey" style="text-decoration: underline;" href="https://publiclab.org/location-privacy" target="_blank"><%= translation('dashboard_v2.sidebar.location_privacy') %></a>
</p></small>
</div>
<% end %>
<%= render partial: 'tag/location' %>
<%= render partial: 'dashboard_v2/location'%>
<%# More Topics %>
<div id="accordion">
<div class="card">
Expand Down Expand Up @@ -72,7 +62,7 @@
position: absolute;
right: 0;
padding-right: 9px;
padding-top: 1px;
padding-top: 9px;
}

a[aria-expanded=true] .fa-angle-up {
Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ en:
new_user: "Welcome! To improve your feed, follow the trending and featured topics linked below."
more_topics: "To improve your feed, follow the trending and featured topics linked below."
sidebar:
nearby_activity: "Nearby Activity"
add_location: "Add your location"
location_work: "Add your location to see work near you"
location_privacy: "About location privacy"
Expand Down

0 comments on commit ee399de

Please sign in to comment.