Browse Source

Subgroup deletion: nullify, confirm

Maarten van den Berg 6 years ago
parent
commit
0b87e522c3
2 changed files with 2 additions and 2 deletions
  1. 1 1
      app/models/subgroup.rb
  2. 1 1
      app/views/activities/edit.html.haml

+ 1 - 1
app/models/subgroup.rb

@@ -1,6 +1,6 @@
1 1
 class Subgroup < ApplicationRecord
2 2
   belongs_to :activity
3
-  has_many :participants
3
+  has_many :participants, dependent: :nullify
4 4
 
5 5
   validates :name, presence: true, uniqueness: { scope: :activity, case_sensitive: false }
6 6
   validates :activity, presence: true

+ 1 - 1
app/views/activities/edit.html.haml

@@ -95,7 +95,7 @@
95 95
                   %i.fa.fa-times
96 96
 
97 97
             %td
98
-              = link_to group_activity_destroy_subgroup_path(@group, @activity, sg.id), method: :delete, class: 'btn btn-danger btn-xs' do
98
+              = link_to group_activity_destroy_subgroup_path(@group, @activity, sg.id), method: :delete, class: 'btn btn-danger btn-xs', data: {confirm: I18n.t(:areyousure)} do
99 99
                 %i.fa.fa-trash
100 100
 
101 101
       = link_to(group_activity_edit_subgroups_path(@group, @activity), class: 'btn btn-default') do