Skip to content

Commit

Permalink
add by_location_id hyperlinks to activities
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanTG committed Jan 11, 2025
1 parent 4e2c982 commit d3a03d4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 25 deletions.
16 changes: 6 additions & 10 deletions app/views/maps/_nearby_activity.html.haml
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
%div#nearby_activity.mt_20.mb_20
%div.bold.flex_center.red{:style => 'margin: 12px 0;'}
%span.sorted_submissions
#{sorted_submissions.size} recent map edits in the nearby area
#{sorted_submissions.size} recent map edit(s) in the nearby area
%span.close_activity.pointer{:onclick => "closeActivity();"}
X
- sorted_submissions.take(200).each do |recent_activity|
- if (!recent_activity.user_name.blank?)
- recent_activity_user = " by #{recent_activity.user_name}"
- else
- recent_activity_user = ""
%div.recent_activity_container
%div.recent_activity_icon
=image_tag("icons/#{recent_activity.submission_type}.svg", :alt => "#{recent_activity.submission_type}", :class => '')
Expand All @@ -18,7 +14,7 @@
%span.bold.red #{recent_activity.machine_name}
added to
%span.bold
#{recent_activity.location_name}
=link_to "#{recent_activity.location_name}", "/map?by_location_id=#{recent_activity.location_id}"
in #{recent_activity.city_name}
- if (!recent_activity.user_name.blank?)
by
Expand All @@ -32,7 +28,7 @@
%span.bold.red #{recent_activity.machine_name}
%div.mt_5
%span.bold
#{recent_activity.location_name}
=link_to "#{recent_activity.location_name}", "/map?by_location_id=#{recent_activity.location_id}"
in #{recent_activity.city_name}
- if (!recent_activity.user_name.blank?)
by
Expand All @@ -41,7 +37,7 @@
%span.bold.red #{recent_activity.machine_name}
removed from
%span.bold
#{recent_activity.location_name}
=link_to "#{recent_activity.location_name}", "/map?by_location_id=#{recent_activity.location_id}"
in #{recent_activity.city_name}
- if (!recent_activity.user_name.blank?)
by
Expand All @@ -56,15 +52,15 @@
%span.bold.red.mt_8.inline_block #{recent_activity.machine_name}
%div.mt_5
%span.bold
#{recent_activity.location_name}
=link_to "#{recent_activity.location_name}", "/map?by_location_id=#{recent_activity.location_id}"
in #{recent_activity.city_name}
- if (!recent_activity.user_name.blank?)
by
%span.red.bold #{recent_activity.user_name}
- elsif (recent_activity.submission_type == 'confirm_location')
Line-up confirmed at
%span.bold
#{recent_activity.location_name}
=link_to "#{recent_activity.location_name}", "/map?by_location_id=#{recent_activity.location_id}"
in #{recent_activity.city_name}
- if (!recent_activity.user_name.blank?)
by
Expand Down
27 changes: 12 additions & 15 deletions app/views/pages/activity.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,18 @@
.clear

.column.w_640
- region_name = @region.name
- @region.recent_activity.take(200).each do |recent_activity|
- if (!recent_activity.user_name.blank?)
- recent_activity_user = " by #{recent_activity.user_name}"
- else
- recent_activity_user = ""
%div.recent_activity_container
%div.recent_activity_icon
=image_tag("icons/#{recent_activity.submission_type}.svg", :alt => "#{recent_activity.submission_type}", :class => '')
%div.recent_activity_date.font14.bold #{recent_activity.created_at.strftime("%b %d, %Y")}
%div.recent_activity_submission.font14
%div.recent_activity_submission.font14
- if (recent_activity.submission_type == 'new_lmx')
%span.bold.red #{recent_activity.machine_name}
%span.bold.red #{recent_activity.machine_name}
added to
%span.bold
#{recent_activity.location_name}
=link_to "#{recent_activity.location_name}", "/#{region_name}?by_location_id=#{recent_activity.location_id}"
in #{recent_activity.city_name}
- if (!recent_activity.user_name.blank?)
by
Expand All @@ -35,41 +32,41 @@
%span.bold.red #{recent_activity.machine_name}
%div.mt_5
%span.bold
#{recent_activity.location_name}
=link_to "#{recent_activity.location_name}", "/#{region_name}?by_location_id=#{recent_activity.location_id}"
in #{recent_activity.city_name}
- if (!recent_activity.user_name.blank?)
by
%span.red.bold #{recent_activity.user_name}
- elsif (recent_activity.submission_type == 'remove_machine')
%span.bold.red #{recent_activity.machine_name}
%span.bold.red #{recent_activity.machine_name}
removed from
%span.bold
#{recent_activity.location_name}
=link_to "#{recent_activity.location_name}", "/#{region_name}?by_location_id=#{recent_activity.location_id}"
in #{recent_activity.city_name}
- if (!recent_activity.user_name.blank?)
by
by
%span.red.bold #{recent_activity.user_name}
- elsif (recent_activity.submission_type == 'new_msx')
- if (recent_activity.high_score.blank?)
#{recent_activity.submission}
- else
High score:
High score:
%span.bold #{number_with_precision(recent_activity.high_score, precision: 0, delimiter: ',')}
%br/
%span.bold.red.mt_8.inline_block #{recent_activity.machine_name}
%div.mt_5
%span.bold
#{recent_activity.location_name}
=link_to "#{recent_activity.location_name}", "/#{region_name}?by_location_id=#{recent_activity.location_id}"
in #{recent_activity.city_name}
- if (!recent_activity.user_name.blank?)
by
%span.red.bold #{recent_activity.user_name}
- elsif (recent_activity.submission_type == 'confirm_location')
Line-up confirmed at
%span.bold
#{recent_activity.location_name}
=link_to "#{recent_activity.location_name}", "/#{region_name}?by_location_id=#{recent_activity.location_id}"
in #{recent_activity.city_name}
- if (!recent_activity.user_name.blank?)
by
by
%span.red.bold #{recent_activity.user_name}

0 comments on commit d3a03d4

Please sign in to comment.