Add 'Delete' button to Valuators index/search views

This commit is contained in:
Angel Perez
2017-10-26 16:03:39 -04:00
committed by Angel Perez
parent bb1e5e4608
commit 4e086de493
4 changed files with 18 additions and 8 deletions

View File

@@ -1,6 +1,6 @@
<h2><%= t("admin.valuators.index.title") %></h2> <h2><%= t("admin.valuators.index.title") %></h2>
<%= render 'admin/shared/user_search', url: search_admin_valuators_path %> <%= render "admin/shared/user_search", url: search_admin_valuators_path %>
<div id="valuators"> <div id="valuators">
<% if @valuators.any? %> <% if @valuators.any? %>
@@ -11,16 +11,13 @@
<th scope="col"><%= t("admin.valuators.index.name") %></th> <th scope="col"><%= t("admin.valuators.index.name") %></th>
<th scope="col"><%= t("admin.valuators.index.email") %></th> <th scope="col"><%= t("admin.valuators.index.email") %></th>
<th scope="col"><%= t("admin.valuators.index.description") %></th> <th scope="col"><%= t("admin.valuators.index.description") %></th>
<th scope="col"><%= t("admin.actions.actions") %></th>
</thead> </thead>
<tbody> <tbody>
<% @valuators.each do |valuator| %> <% @valuators.each do |valuator| %>
<tr> <tr>
<td> <td><%= valuator.name %></td>
<%= valuator.name %> <td><%= valuator.email %></td>
</td>
<td>
<%= valuator.email %>
</td>
<td> <td>
<% if valuator.description.present? %> <% if valuator.description.present? %>
<%= valuator.description %> <%= valuator.description %>
@@ -28,6 +25,12 @@
<%= t("admin.valuators.index.no_description") %> <%= t("admin.valuators.index.no_description") %>
<% end %> <% end %>
</td> </td>
<td>
<%= link_to t("admin.valuators.valuator.delete"),
admin_valuator_path(valuator),
method: :delete,
class: "button hollow alert expanded" %>
</td>
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>

View File

@@ -29,7 +29,12 @@
<%= t("admin.valuators.index.no_description") %> <%= t("admin.valuators.index.no_description") %>
<% end %> <% end %>
<td> <td>
<% unless user.valuator? %> <% if user.valuator? %>
<%= link_to t("admin.valuators.valuator.delete"),
admin_valuator_path(user),
method: :delete,
class: "button hollow alert expanded" %>
<% else %>
<%= form_for Valuator.new(user: user), url: admin_valuators_path do |f| %> <%= form_for Valuator.new(user: user), url: admin_valuators_path do |f| %>
<%= f.text_field :description, <%= f.text_field :description,
label: false, label: false,

View File

@@ -481,6 +481,7 @@ en:
valuator: valuator:
description_placeholder: 'Description (optional)' description_placeholder: 'Description (optional)'
add: Add to valuators add: Add to valuators
delete: Delete
search: search:
title: 'Valuators: User search' title: 'Valuators: User search'
summary: summary:

View File

@@ -481,6 +481,7 @@ es:
valuator: valuator:
description_placeholder: 'Descripción (opcional)' description_placeholder: 'Descripción (opcional)'
add: Añadir como evaluador add: Añadir como evaluador
delete: Borrar
search: search:
title: 'Evaluadores: Búsqueda de usuarios' title: 'Evaluadores: Búsqueda de usuarios'
summary: summary: