diff --git a/app/models/communication/block/heading.rb b/app/models/communication/block/heading.rb index f8537a44cf004a572d7a074bbd3918b7a9bd2484..b15589e15cf0b0e61106acf611fcb08e43d149a7 100644 --- a/app/models/communication/block/heading.rb +++ b/app/models/communication/block/heading.rb @@ -35,7 +35,8 @@ class Communication::Block::Heading < ApplicationRecord has_many :children, class_name: 'Communication::Block::Heading', foreign_key: :parent_id - has_many :blocks + has_many :blocks, + dependent: :nullify DEFAULT_LEVEL = 2 diff --git a/app/views/admin/communication/blocks/edit.html.erb b/app/views/admin/communication/blocks/edit.html.erb index 6af97a74bc0779b11093dbfa23f2bcd1feefda4a..b498bd9a6534814eee3ff46b79b468d997b17dc6 100644 --- a/app/views/admin/communication/blocks/edit.html.erb +++ b/app/views/admin/communication/blocks/edit.html.erb @@ -34,9 +34,6 @@ </textarea> <% content_for :action_bar_left do %> <%= destroy_link @block %> - <%= link_to 'Dependencies', - [:admin, @block], - class: button_classes('btn-light') if current_user.server_admin? %> <% end %> <% content_for :action_bar_right do %> <%= submit f %> diff --git a/app/views/admin/communication/blocks/headings/_form.html.erb b/app/views/admin/communication/blocks/headings/_form.html.erb index 34108a9817d51711da3651f514b8fdc27d74d762..1af6668bea2e52e4baa33a5ea29609a2e7cf25b4 100644 --- a/app/views/admin/communication/blocks/headings/_form.html.erb +++ b/app/views/admin/communication/blocks/headings/_form.html.erb @@ -8,6 +8,13 @@ url = heading.persisted? ? admin_communication_heading_path(heading) <%= f.input :title %> <%= f.input :about_type, as: :hidden %> <%= f.input :about_id, as: :hidden %> + <% content_for :action_bar_left do %> + <%= link_to t('delete'), + admin_communication_heading_path(heading), + method: :delete, + data: { confirm: t('please_confirm') }, + class: button_classes_danger if can? :destroy, heading %> + <% end %> <% content_for :action_bar_right do %> <%= submit f %> <% end %>