diff --git a/app/controllers/maps_controller.rb b/app/controllers/maps_controller.rb index bf7e0cc5d..c279dac36 100644 --- a/app/controllers/maps_controller.rb +++ b/app/controllers/maps_controller.rb @@ -58,6 +58,7 @@ def show .where.not(id: @map.id) .sample(4) @unpaginated = true + @users = @map.authors render layout: 'application' end diff --git a/app/models/map.rb b/app/models/map.rb index 1f0c2a57b..1a924d498 100755 --- a/app/models/map.rb +++ b/app/models/map.rb @@ -279,4 +279,12 @@ def fetch_map_data data = warpables data.to_json end + + def authors + user_ids = [] + warpables.each do |warp| + user_ids.push(warp.versions.map(&:whodunnit)) + end + User.where(id: user_ids.flatten.uniq).where.not(id: user_id) + end end diff --git a/app/views/maps/show.html.erb b/app/views/maps/show.html.erb index 7aeeb4b3e..926901b88 100644 --- a/app/views/maps/show.html.erb +++ b/app/views/maps/show.html.erb @@ -29,10 +29,21 @@

A Community Atlas of

-

<%= @map.name %>

-

<%= @map.location %> | by <%= @map.anonymous? ? @map.author : link_to("@#{@map.author}", "/profile/#{@map.author}") %>

+

<%= @map.name %>,

+

<%= @map.location %>

+

by <%= @map.anonymous? ? @map.author : link_to("@#{@map.author}", "/profile/#{@map.author}") %> + <%= 'with' unless @users.empty? %> + <% @users.each_with_index do |author,i| %> + + <%= "@#{author.login}"%> + <% if i < @users.length-2 %> + <%= ',' %> + <% elsif i < @users.length-1 %> + <%= '&' %> + <% end %> + <% end %> +

-