diff --git a/app/controllers/bubbles_controller.rb b/app/controllers/bubbles_controller.rb index 286a8818a..13da9696a 100644 --- a/app/controllers/bubbles_controller.rb +++ b/app/controllers/bubbles_controller.rb @@ -23,7 +23,8 @@ class BubblesController < ApplicationController def destroy @bubble.destroy! - redirect_to bubbles_path(bucket_ids: [ @bubble.bucket ]), notice: "Bubble deleted" + + redirect_to bubbles_path(bucket_ids: [ @bubble.bucket ]), notice: deleted_notice end def update @@ -41,6 +42,10 @@ class BubblesController < ApplicationController end def bubble_params - params.expect(bubble: [ :title, :color, :due_on, :image, tag_ids: [] ]) + params.expect(bubble: [ :status, :title, :color, :due_on, :image, tag_ids: [] ]) + end + + def deleted_notice + "Bubble deleted" unless @bubble.creating? end end diff --git a/app/views/bubbles/show.html.erb b/app/views/bubbles/show.html.erb index 292e8346b..3d3c964bc 100644 --- a/app/views/bubbles/show.html.erb +++ b/app/views/bubbles/show.html.erb @@ -95,4 +95,22 @@ <%= turbo_frame_tag dom_id(@bubble, :stage_picker), src: new_bucket_bubble_stage_picker_path(@bubble.bucket, @bubble) %> +<% if @bubble.creating? %> + <%# + If we could put the textare for the bubble title, and the initial + comment, into this form, it should prevent people from losing edits when + they make changes to other properties. In that case, we can remove the + save buttons from inside the bubble, and from the comment box, so that + the middle section all feels like one block that you're then either + publishing, drafting, or cancelling. + %> + + <%= form_with model: @bubble, url: bucket_bubble_path(@bubble.bucket, @bubble) do |form| %> + <%= button_tag "Publish", type: "submit", name: "bubble[status]", value: "published" %> + <%= button_tag "Save a draft", type: "submit", name: "bubble[status]", value: "drafted" %> + <% end %> + + <%= button_to "Cancel", bucket_bubble_path(@bubble.bucket, @bubble), method: :delete %> +<% end %> + <%= render "notifications/tray" %>