c2df855211
* main: (29 commits) Add assigners to filter summary Use `Current.user`'s name for filter chips Allow assigner ids param Sort filter params before hashing Fix tests Test field accessors Test filter chips controller Test filter terms Wire up assigner filters Spell out button_to params Use Filter class method to digest fixture params Add frame to search terms form Render each kind of filter in its own frame button -> chip No need to apply terms from the controller anymore Add terms to filter buttons -> chips Clean up Filter class methods KNOWN_PARAMS -> PERMITTED_PARAMS Remove most_active as index option ...
52 lines
983 B
Ruby
52 lines
983 B
Ruby
class BubblesController < ApplicationController
|
|
include BucketScoped
|
|
|
|
skip_before_action :set_bucket, only: :index
|
|
|
|
before_action :set_filter, only: :index
|
|
before_action :set_bubble, only: %i[ show edit update ]
|
|
|
|
def index
|
|
@bubbles = @filter.bubbles
|
|
end
|
|
|
|
def create
|
|
@bubble = @bucket.bubbles.create!
|
|
redirect_to @bubble
|
|
end
|
|
|
|
def show
|
|
fresh_when etag: @bubble
|
|
end
|
|
|
|
def edit
|
|
end
|
|
|
|
def update
|
|
@bubble.update! bubble_params
|
|
|
|
if turbo_frame_request?
|
|
if params[:bubble][:due_on].present?
|
|
render "bubbles/date_pickers/show"
|
|
else
|
|
render :show
|
|
end
|
|
else
|
|
redirect_to @bubble
|
|
end
|
|
end
|
|
|
|
private
|
|
def set_filter
|
|
@filter = Current.user.filters.build params.permit(*Filter::PERMITTED_PARAMS)
|
|
end
|
|
|
|
def set_bubble
|
|
@bubble = @bucket.bubbles.find params[:id]
|
|
end
|
|
|
|
def bubble_params
|
|
params.expect(bubble: [ :title, :color, :due_on, :image, tag_ids: [] ])
|
|
end
|
|
end
|