_add_remove_template.html.erb 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <div class="form">
  2. <fieldset>
  3. <h3 class="fieldset-heading">Targets</h3>
  4. <%= form_for(record, url: add_targets_event_path, remote: true) do |f| %>
  5. <%= select_tag add_field_name, grouped_options_for_select(unassociated_targets_by_target_type(Target::ACCEPTABLE_TYPE_STRINGS, current_account)), { multiple: true, id: 'add-targets-select', class: 'chosen-select' } %>
  6. <%= f.submit 'Add', class: 'btn btn-success btn-sm', data: { 'disable-with' => 'Add' } %>
  7. <% end %>
  8. <% unless in_group.empty? %>
  9. <table class="table table-striped">
  10. <thead>
  11. <tr>
  12. <% column_names.each do |column_name| %>
  13. <th><%= column_name %></th>
  14. <% end %>
  15. <th></th>
  16. </tr>
  17. </thead>
  18. <tbody class="in-group" >
  19. <% in_group.each do |group_item| %>
  20. <tr id="<%= "in-group-#{ group_item.class.name.parameterize }-#{ group_item.id }" %>">
  21. <td>
  22. <%= group_item.public_name %>
  23. </td>
  24. <td>
  25. <%= group_item.type %>
  26. </td>
  27. <td>
  28. <%= group_item.tag %>
  29. </td>
  30. <td>
  31. <%= group_item.vens_count %>
  32. </td>
  33. <td>
  34. <%= form_for(record, url: remove_targets_event_path, remote: true) do |f| %>
  35. <%= hidden_field :id, group_item.id, {name: remove_field_name, value: group_item.id} %>
  36. <%= f.submit 'Remove', class: 'btn btn-danger btn-sm', data: { 'disable-with' => 'Remove' } %>
  37. <% end %>
  38. </td>
  39. </tr>
  40. <% end %>
  41. </tbody>
  42. </table>
  43. <% else %>
  44. <div class="blank_slate_container">
  45. <h4>This event has no targets.</h4>
  46. </div>
  47. <% end %>
  48. </fieldset>
  49. </div>