added delete builing button

This commit is contained in:
Harry Bomrah 2015-10-13 19:11:21 +08:00
parent 7c0295d9d8
commit 70589b9d51
2 changed files with 8 additions and 1 deletions

View File

@ -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

View File

@ -5,6 +5,6 @@
<p><%= building.title %></p>
</a>
<div class="actions">
<a href="<%= edit_admin_space_path(building) %>">Edit</a> | <a href="#">Delete</a>
<a href="<%= edit_admin_space_path(building) %>">Edit</a> | <a href="<%= admin_space_path(building) %>" data-method="delete" data-confirm="Are you sure?">Delete</a>
</div>
</li>