added delete builing button
This commit is contained in:
parent
7c0295d9d8
commit
70589b9d51
|
@ -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
|
||||
|
|
|
@ -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>
|
Loading…
Reference in New Issue