From 5e84558d68bb3cdeb311682d0d0e50770944dcce Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Tue, 15 Jan 2019 14:28:46 -0600 Subject: [PATCH] allow deleting non-required categories --- app/views/content/attributes.html.erb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/app/views/content/attributes.html.erb b/app/views/content/attributes.html.erb index 4e08c685..9d463f63 100644 --- a/app/views/content/attributes.html.erb +++ b/app/views/content/attributes.html.erb @@ -225,6 +225,29 @@ <% end %> + <% unless attribute_category.attribute_fields.any? { |attribute_field| ['name', 'universe'].include?(attribute_field.field_type) } %> +
  • +
    + <%= attribute_category.icon %> + Delete this category +
    +
    +

    + This is a VERY dangerous action! + 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. +

    + <% 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 %> +
    +
  • + <% end %>