mirror of
https://github.com/manyfold3d/manyfold.git
synced 2026-10-23 12:12:21 -05:00
Add delete option to UI
- Add delete button to list and item view for collections
This commit is contained in:
1 parent
ac8a12c78c
commit
ea9e596e4d
3 files changed
+9
No files matched your search
@@ -1,3 +1,5 @@
|
||||
require 'fileutils'
|
||||
|
||||
class ModelsController < ApplicationController
|
||||
before_action :get_library, except: [:index, :bulk_edit, :bulk_update]
|
||||
before_action :get_model, except: [:bulk_edit, :bulk_update, :index]
|
||||
@@ -84,6 +86,11 @@ class ModelsController < ApplicationController
|
||||
|
||||
def destroy
|
||||
@model.destroy
|
||||
|
||||
# Delete directory corresponding to model
|
||||
pathname = File.join(@library.path, @model.path)
|
||||
FileUtils.remove_dir(pathname) if File.exist?(pathname)
|
||||
|
||||
redirect_to library_path(@library)
|
||||
end
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
<div class='mt-2'>
|
||||
<%= link_to "Open", [model.library, model], {class: "btn btn-primary btn-sm"} %>
|
||||
<%= link_to "Edit", edit_library_model_path(model.library, model), {class: "btn btn-outline-secondary btn-sm"} %>
|
||||
<%= link_to "Delete", library_model_path(model.library, model), {method: :delete, class: "btn btn-outline-danger btn-sm", data: {confirm: "This will delete files. Are you sure you want to continue?"}} %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
|
||||
@@ -73,6 +73,7 @@
|
||||
<%= button_tag "Organize Files", class: "btn btn-warning", "data-bs-toggle": "modal", "data-bs-target": "#confirm-move" %>
|
||||
<%= link_to "Search Yeggi", "https://yeggi.com/q/#{ERB::Util.url_encode(@model.name)}/", class: 'btn btn-secondary' %>
|
||||
<% end %>
|
||||
<%= link_to "Delete", library_model_path(@library, @model), {method: :delete, class: "btn btn-danger", data: {confirm: "This will delete files. Are you sure you want to continue?"}} %>
|
||||
<% end %>
|
||||
|
||||
<%= card(:secondary, 'Notes') do %>
|
||||
|
||||
Reference in new issue
Block a user