Skip to content
Snippets Groups Projects
Commit 2e07e18b authored by Alexandre Peres Arias's avatar Alexandre Peres Arias
Browse files

add remove delete button

parent 63995898
No related branches found
No related tags found
No related merge requests found
......@@ -14,4 +14,16 @@ class Management::ComplaintsController < ManagementController
end
end
def destroy
object_rid = params["object_rid"]
user_rid = params["user_rid"]
complaint_repository.destroy(user_rid, object_rid)
respond_to do |format|
format.html { redirect_to :back, notice: 'Complaint was successfully destroyed.' }
end
end
end
......@@ -11,12 +11,12 @@ module OrientDb
end
end
def destroy(object)
if !edge_exists?(odb_class, complaint.user.rid, complaint.object)
def destroy(user_rid,object_rid)
if !edge_exists?(odb_class, user_rid, object_rid)
raise "The object has not been reported by you yet."
end
connection.command "DELETE EDGE Complaint FROM #{complaint.user.rid} TO #{complaint.object}"
connection.command "DELETE EDGE Complaint FROM #{user_rid} TO #{object_rid}"
end
def build_object(args={})
......
......@@ -17,8 +17,12 @@
<BR>
<b>Descrição:</b> <%= c.description == "" ? "--" : c.description %><BR>
<div id="suspend", class="ls-btn ls-float-right">
<div id="suspend", class="ls-btn ls-float-right">
<%= link_to 'Excluir Denúncia', management_complaints_path(:object_rid => c.object["@rid"], :user_rid => c.user.rid), {method: :delete, data: { confirm: 'Tem certeza que deseja excluir?'}, title: 'Apagar usuário', class: 'ls-color-danger', role: 'option'} %>
</div>
<div id="suspend", class="ls-btn ls-float-right">
Suspender conteúdo
</div>
</div>
</div>
<%end%>
<%end%>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment