Delete columns
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
class Collections::ColumnsController < ApplicationController
|
||||
include ActionView::RecordIdentifier, CollectionScoped
|
||||
|
||||
before_action :set_column, only: [:show, :update]
|
||||
before_action :set_column, only: [:show, :update, :destroy]
|
||||
|
||||
def show
|
||||
set_page_and_extract_portion_from @column.cards.active.reverse_chronologically
|
||||
end
|
||||
|
||||
def create
|
||||
@column = @collection.columns.create!(column_params)
|
||||
@@ -13,8 +17,9 @@ class Collections::ColumnsController < ApplicationController
|
||||
render turbo_stream: turbo_stream.replace(dom_id(@column), partial: "collections/show/column", method: :morph, locals: { column: @column })
|
||||
end
|
||||
|
||||
def show
|
||||
set_page_and_extract_portion_from @column.cards.active.reverse_chronologically
|
||||
def destroy
|
||||
@column.destroy
|
||||
render turbo_stream: turbo_stream.remove(dom_id(@column))
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -15,8 +15,11 @@
|
||||
</dialog>
|
||||
</li>
|
||||
<li class="popup__item">
|
||||
<button class="popup__btn btn">Delete column</button>
|
||||
<%= button_to "Delete column", collection_column_path(column.collection, column),
|
||||
method: :delete,
|
||||
class: "popup__btn btn",
|
||||
form: { data: { turbo_confirm: "Are you sure you want to delete this column? This will move the cards back to the stream." } } %>
|
||||
</li>
|
||||
</ul>
|
||||
</dialog>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user