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

fix orientdb connection to highlights management

parent 7b52dc30
No related branches found
No related tags found
No related merge requests found
......@@ -24,14 +24,21 @@ class Management::HighlightsController < ManagementController
def create
render :action => 'new'
@name = params[:name]
@url = params[:url]
db = OrientDb::HighlightRepository.new
db.insert_data(@name,@url)
db.insert_data(params[:name],params[:url])
end
def destroy
params[:name].each do |name|
db = OrientDb::HighlightRepository.new
db.destroy_data(name)
end
redirect_to management_highlights_index_path
end
end
......@@ -17,9 +17,10 @@ module OrientDb
return nil
end
def remove_data
#return @connection.command "DELETE FROM Highlight (name)"
def destroy_data(name)
return @connection.command "DELETE VERTEX Highlight where name = '#{name}'"
rescue
return nil
end
end
......
......@@ -6,24 +6,28 @@
<class="ls-title-2"><h3>Remover destaque</h3><br>
<fieldset>
<%= form_tag(:action => "destroy", :method => "get") do %>
<fieldset>
<!-- Exemplo com Radio button -->
<div class="ls-label col-md-5">
<p>Escolha os destaques a remover:</p>
<% @highlights.each do |highlight| %>
<label class="ls-label-text">
<input type="radio" name="plataforms">
<%= highlight['name'] %>
</label>
<%end%>
</div>
</fieldset>
<div class="ls-label col-md-5">
<p>Escolha os destaques a remover:</p>
<% @highlights.each do |highlight| %>
<label class="ls-label-text">
<input type="checkbox" name="name[]" value= <%= highlight['name'] %>>
<%= highlight['name'] %>
</label>
<%end%>
</div>
</fieldset>
<div class="ls-actions-btn">
<%= submit_tag "Salvar", class: "ls-btn" %>
<%= link_to "Cancelar", management_highlights_index_path, class: "ls-btn-danger" %>
</div>
<%end%>
</div>
<div class="ls-actions-btn">
<button class="ls-btn">Remover</button>
<%= link_to "Cancelar", management_highlights_index_path, class: "ls-btn-danger" %>
</div>
</body>
......@@ -9,7 +9,7 @@ Rails.application.routes.draw do
namespace :management do
root 'welcome#index'
post 'highlights/create'
post 'highlights/destroy'
end
root 'welcome#index'
......
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