allow deleting non-required categories

This commit is contained in:
Andrew Brown 2019-01-15 14:28:46 -06:00
parent b79e0aed07
commit 5e84558d68

View File

@ -225,6 +225,29 @@
<% end %>
</div>
</li>
<% unless attribute_category.attribute_fields.any? { |attribute_field| ['name', 'universe'].include?(attribute_field.field_type) } %>
<li>
<div class="collapsible-header">
<i class="material-icons <%= @content_type_class.color %>-text"><%= attribute_category.icon %></i>
Delete this category
</div>
<div class="collapsible-body">
<p class="grey-text text-darken-2">
<span class="red-text">This is a VERY dangerous action!</span>
This will delete this category, every field in this category, and every answer you've written to any of those fields! This CANNOT be undone,
so please make sure you have backed up any answers you will lose by deleting the field they're answering.
</p>
<% if attribute_category.persisted? && current_user.can_delete?(attribute_category) %>
<%= link_to attribute_category,
class: 'btn red black-text',
method: :delete,
data: { confirm: "Are you sure? This will delete this entire category, all of its fields, and any answer you've written to any of those fields!" } do %>
Delete this category
<% end %>
<% end %>
</div>
</li>
<% end %>
</ul>
</div>
</div>