diff --git a/app/controllers/admin/spaces_controller.rb b/app/controllers/admin/spaces_controller.rb index e0c3a39..791a7c7 100644 --- a/app/controllers/admin/spaces_controller.rb +++ b/app/controllers/admin/spaces_controller.rb @@ -19,6 +19,13 @@ class Admin::SpacesController < OrbitAdminController redirect_to admin_spaces_path end + def destroy + uid = params[:id].split("-").last + building = Building.find_by(:uid => uid) rescue nil + building.destroy if !building.nil? + redirect_to admin_spaces_path + end + def update uid = params[:id].split("-").last building = Building.find_by(:uid => uid) rescue nil diff --git a/app/views/admin/spaces/_building.html.erb b/app/views/admin/spaces/_building.html.erb index 1738c7b..3cc3915 100644 --- a/app/views/admin/spaces/_building.html.erb +++ b/app/views/admin/spaces/_building.html.erb @@ -5,6 +5,6 @@
<%= building.title %>
\ No newline at end of file