From: Anton Khorev Date: Wed, 19 Feb 2025 00:53:29 +0000 (+0300) Subject: Initialize dashboard followings and nearby users in controller X-Git-Tag: live~88^2~1 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/02d94679394a627574f2a21dd2733455a78b7c43?hp=--cc Initialize dashboard followings and nearby users in controller --- 02d94679394a627574f2a21dd2733455a78b7c43 diff --git a/app/controllers/dashboards_controller.rb b/app/controllers/dashboards_controller.rb index 540683d25..54dba26d3 100644 --- a/app/controllers/dashboards_controller.rb +++ b/app/controllers/dashboards_controller.rb @@ -10,5 +10,7 @@ class DashboardsController < ApplicationController def show @user = current_user + @followings = current_user.followings + @nearby_users = current_user.nearby - @followings end end diff --git a/app/views/dashboards/show.html.erb b/app/views/dashboards/show.html.erb index 70dae774e..a198f534d 100644 --- a/app/views/dashboards/show.html.erb +++ b/app/views/dashboards/show.html.erb @@ -21,15 +21,12 @@ } %> <%= tag.div "", :id => "map", :class => "content_map border border-secondary-subtle rounded z-0", :data => { :user => user_data } %> <% end %> - - <% followings = @user.followings %> - <% nearby = @user.nearby - followings %>

<%= t ".followings" %>

- <% if followings.empty? %> + <% if @followings.empty? %> <%= t ".no followings" %> <% else %>
- <%= render :partial => "contact", :collection => followings, :locals => { :type => "following" } %> + <%= render :partial => "contact", :collection => @followings, :locals => { :type => "following" } %>
<% end %> @@ -47,7 +44,7 @@

<%= t ".nearby users" %>

- <% if nearby.empty? %> + <% if @nearby_users.empty? %> <%= t ".no nearby users" %> <% else %>
- <%= render :partial => "contact", :collection => nearby, :locals => { :type => "nearby mapper" } %> + <%= render :partial => "contact", :collection => @nearby_users, :locals => { :type => "nearby mapper" } %>
<% end %>