diff --git a/app/views/bubbles/_pop_toggle.html.erb b/app/views/bubbles/_pop_toggle.html.erb index 8f28a172a..46ab09cfd 100644 --- a/app/views/bubbles/_pop_toggle.html.erb +++ b/app/views/bubbles/_pop_toggle.html.erb @@ -1,8 +1,11 @@ -
<% if bubble.popped? %> <% event = bubble.events.where(action: "popped").last %> - Popped by <%= event.creator.name %> on <%= event.created_at.to_date.strftime('%B %-d') %>. + <% if event %> + Popped by <%= event.creator.name %> on <%= event.created_at.to_date.strftime('%B %-d') %>. + <% else %> + Popped + <% end %> <%= button_to bucket_bubble_pop_path(bubble.bucket, bubble), method: :delete, class: "btn btn--plain borderless fill-transparent" do %> Un-pop <% end %> @@ -12,8 +15,10 @@ <%= image_tag "pop.svg", aria: { hidden: true }, size: 24, class: "colorize--white" %> Pop <% end %> - - (Pops automatically in <%= distance_of_time_in_words(Date.today, event.created_at + 30.days) %>.) - + <% if event %> + + (Pops automatically in <%= distance_of_time_in_words(Time.current, event.created_at + 30.days) %>.) + + <% end %> <% end %>