Browse Source

Commit-continue

Maarten van den Berg 6 years ago
parent
commit
dacd186e7a

+ 6 - 1
app/controllers/activities_controller.rb

201
   def update
201
   def update
202
     respond_to do |format|
202
     respond_to do |format|
203
       if @activity.update(activity_params)
203
       if @activity.update(activity_params)
204
+        redirect = group_activity_path(@group, @activity)
205
+        if params.has_key?('commit-continue')
206
+          redirect = edit_group_activity_path(@group, @activity)
207
+        end
208
+
204
         format.html do
209
         format.html do
205
-          redirect_to group_activity_url(@group, @activity)
210
+          redirect_to redirect
206
           flash_message(:info, I18n.t('activities.updated'))
211
           flash_message(:info, I18n.t('activities.updated'))
207
         end
212
         end
208
         format.json { render :show, status: :ok, location: @activity }
213
         format.json { render :show, status: :ok, location: @activity }

+ 4 - 1
app/views/activities/_form.html.erb

62
       </div>
62
       </div>
63
     </div>
63
     </div>
64
     <div class="form-group btn-group">
64
     <div class="form-group btn-group">
65
-      <%= f.submit class: 'btn btn-primary' %>
65
+      <%= submit_tag(t(:save_and_return), class: "btn btn-success") %>
66
+      <%= f.submit class: 'btn btn-primary', name: "commit-continue" %>
67
+    </div>
68
+    <div class="form-group btn-group">
66
       <% unless activity.new_record? %>
69
       <% unless activity.new_record? %>
67
         <%= link_to I18n.t('activities.subgroups.distribute_remaining'),
70
         <%= link_to I18n.t('activities.subgroups.distribute_remaining'),
68
           { action: 'immediate_subgroups', group_id: activity.group_id, activity_id: activity.id },
71
           { action: 'immediate_subgroups', group_id: activity.group_id, activity_id: activity.id },

+ 3 - 0
config/locales/aardbei_en.yml

41
   next: "Next"
41
   next: "Next"
42
   previous: "Previous"
42
   previous: "Previous"
43
 
43
 
44
+  save_and_return: "Save and return"
45
+  save: "Save"
46
+
44
   somethingbroke: "Something broke!"
47
   somethingbroke: "Something broke!"
45
 
48
 
46
   areyousure: "Are you sure?"
49
   areyousure: "Are you sure?"

+ 3 - 0
config/locales/aardbei_nl.yml

20
   next: "Volgende"
20
   next: "Volgende"
21
   previous: "Vorige"
21
   previous: "Vorige"
22
 
22
 
23
+  save_and_return: "Opslaan en terug"
24
+  save: "Opslaan"
25
+
23
   areyousure: "Weet je het zeker?"
26
   areyousure: "Weet je het zeker?"
24
 
27
 
25
   somethingbroke: "Er is iets misgegaan! Neem contact op als dit blijft gebeuren."
28
   somethingbroke: "Er is iets misgegaan! Neem contact op als dit blijft gebeuren."