diff --git a/app/controllers/bubbles_controller.rb b/app/controllers/bubbles_controller.rb index 30b6344df..c6e65b1ca 100644 --- a/app/controllers/bubbles_controller.rb +++ b/app/controllers/bubbles_controller.rb @@ -4,7 +4,8 @@ class BubblesController < ApplicationController before_action :set_bubble, only: %i[ show edit update ] def index - @bubbles = @bucket.bubbles.not_popped + @bubbles = @bucket.bubbles + @bubbles = params.include?(:popped) ? @bubbles.popped : @bubbles.not_popped if params[:term].present? @bubbles = @bubbles.mentioning(params[:term]) diff --git a/app/helpers/bubbles_helper.rb b/app/helpers/bubbles_helper.rb index 380916c03..d58a12e26 100644 --- a/app/helpers/bubbles_helper.rb +++ b/app/helpers/bubbles_helper.rb @@ -22,6 +22,6 @@ module BubblesHelper end def bubble_filter_params - params.permit(:term, :tag_id, :assignee_id) + params.permit(:popped, :term, :tag_id, :assignee_id) end end diff --git a/app/views/bubbles/_bubble.html.erb b/app/views/bubbles/_bubble.html.erb index 85f654e2a..20c71b14e 100644 --- a/app/views/bubbles/_bubble.html.erb +++ b/app/views/bubbles/_bubble.html.erb @@ -32,7 +32,7 @@ - + <% else %> diff --git a/app/views/bubbles/_filters.html.erb b/app/views/bubbles/_filters.html.erb index 58cbc3936..8364ea411 100644 --- a/app/views/bubbles/_filters.html.erb +++ b/app/views/bubbles/_filters.html.erb @@ -1,17 +1,21 @@

-
  • Most active
  • +
  • <%= link_to "Most active", bucket_bubbles_path(bucket, bubble_filter_params.without(:popped)), class: "filter__button" %>
  • Most discussed
  • Most boosted
  • Newest
  • Oldest
  • -
  • Popped
  • +
  • <%= link_to "Popped", bucket_bubbles_path(bucket, bubble_filter_params.merge(popped: true)), class: "filter__button" %>