diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb index 382436855..8d122e42c 100644 --- a/app/controllers/profiles_controller.rb +++ b/app/controllers/profiles_controller.rb @@ -130,7 +130,7 @@ def profile_params end def search_with_search_params - @profiles = matching_profiles.map(&:profile_card_details) + @profiles = matching_profiles @pagy, @records = pagy_array(@profiles) # search results aggregated according to certain attributes to display as filters aggs = ProfileGrouper.new(params[:locale], @profiles.map { |profile| profile[:id] }).agg_hash diff --git a/app/models/category.rb b/app/models/category.rb index 7f5e3e3e2..70a54eacf 100644 --- a/app/models/category.rb +++ b/app/models/category.rb @@ -10,7 +10,6 @@ class Category < ApplicationRecord def self.sorted_categories Category.all.includes(:translations).order(:position) - end def short_name diff --git a/app/models/profile.rb b/app/models/profile.rb index 2ed75baef..02a14b222 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -116,7 +116,7 @@ def self.typeahead(term, region: nil) :city, :willing_to_travel, :nonprofit, - :main_topic_or_first_topic, + :main_topic, keyword_init: true ) @@ -128,7 +128,7 @@ def profile_card_details city: city, willing_to_travel: willing_to_travel, nonprofit: nonprofit, - main_topic_or_first_topic: main_topic_or_first_topic, + main_topic: main_topic, ) end @@ -150,12 +150,6 @@ def name_or_email fullname.present? ? fullname : email end - def main_topic_or_first_topic - return nil unless main_topic - - main_topic - end - # Try building a slug based on the following fields in # increasing order of specificity. def slug_candidate diff --git a/app/views/profiles/_profile.html.erb b/app/views/profiles/_profile.html.erb index 86203f9c3..e4553fbbf 100644 --- a/app/views/profiles/_profile.html.erb +++ b/app/views/profiles/_profile.html.erb @@ -2,14 +2,14 @@ <% tooltip_empty = !profile.iso_languages.present? && profile.city.nil? && profile.willing_to_travel.nil? && profile.nonprofit.nil? %> <% title = render partial: "profiles/profile_tooltip", locals: { profile: profile } %>
- <%= profile_image_link(Profile.find(profile.id)) %> + <%= profile_image_link(profile) %>
<%= link_to profile.fullname, profile_path(profile.id) %>

- <%= profile.main_topic_or_first_topic.truncate(60) if profile.main_topic_or_first_topic %> + <%= profile.main_topic.truncate(60) if profile.main_topic %>

<% end %> - <% if @profile.main_topic_or_first_topic %> + <% if @profile.main_topic %>

<%= t(:main_topic, scope: 'profiles.show') %> - <%= @profile.main_topic_or_first_topic %> + <%= @profile.main_topic %>

<% end %>