Browse Source

Commit-continue

Maarten van den Berg 6 years ago
parent
commit
dacd186e7a

+ 6 - 1
app/controllers/activities_controller.rb

@@ -201,8 +201,13 @@ class ActivitiesController < ApplicationController
201 201
   def update
202 202
     respond_to do |format|
203 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 209
         format.html do
205
-          redirect_to group_activity_url(@group, @activity)
210
+          redirect_to redirect
206 211
           flash_message(:info, I18n.t('activities.updated'))
207 212
         end
208 213
         format.json { render :show, status: :ok, location: @activity }

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

@@ -62,7 +62,10 @@
62 62
       </div>
63 63
     </div>
64 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 69
       <% unless activity.new_record? %>
67 70
         <%= link_to I18n.t('activities.subgroups.distribute_remaining'),
68 71
           { action: 'immediate_subgroups', group_id: activity.group_id, activity_id: activity.id },

+ 3 - 0
config/locales/aardbei_en.yml

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

+ 3 - 0
config/locales/aardbei_nl.yml

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