app/controllers/wiki/pages_controller.rb in tawork-0.0.24 vs app/controllers/wiki/pages_controller.rb in tawork-0.0.25
- old
+ new
@@ -115,9 +115,19 @@
@page.tag_list.remove(params[:tag])
@page.save
render json: {}
end
+ def destroy
+ parent = @page.parent
+ @page.save_and_destroy(current_user)
+
+ link = root_url
+ link = wiki_page_path(parent) if parent
+
+ redirect_to link, notice: "Page was deleted.", status: :see_other
+ end
+
protected
def load_page
@page = Page.find(params[:id]) if params[:id]
end