Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
aoz-003
Commits
42f316e8
Verified
Commit
42f316e8
authored
Jul 30, 2018
by
Kaspar Vollenweider
👻
Browse files
redirect back to form in case of save failure
parent
87102e1c
Pipeline
#23747
passed with stage
in 48 minutes and 39 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/controllers/assignments_controller.rb
View file @
42f316e8
...
...
@@ -99,9 +99,17 @@ class AssignmentsController < ApplicationController
end
def
submit_feedback
@assignment
.
update
(
assignment_params
.
slice
(
:volunteer_attributes
)
.
merge
(
submit_feedback:
current_user
))
redirect_to
default_redirect
||
hours_and_feedbacks_submitted_assignments_path
@assignment
.
volunteer
.
assign_attributes
(
assignment_feedback_params
[
:volunteer_attributes
]
.
slice
(
:waive
,
:bank
,
:iban
))
@assignment
.
submit_feedback
=
current_user
if
@assignment
.
save
redirect_to
default_redirect
||
hours_and_feedbacks_submitted_assignments_path
else
redirect_to
(
last_submitted_hours_and_feedbacks_assignment_path
(
@assignment
),
notice:
'Das bestätigen des Feedbacks ist fehlgeschlagen.'
)
end
end
def
terminate
...
...
@@ -172,6 +180,10 @@ class AssignmentsController < ApplicationController
authorize
@assignment
end
def
assignment_feedback_params
params
.
require
(
:assignment
).
permit
(
volunteer_attributes:
[
:waive
,
:iban
,
:bank
])
end
def
assignment_params
params
.
require
(
:assignment
).
permit
(
:client_id
,
:volunteer_id
,
:period_start
,
:period_end
,
...
...
app/controllers/group_assignments_controller.rb
View file @
42f316e8
...
...
@@ -62,9 +62,17 @@ class GroupAssignmentsController < ApplicationController
end
def
submit_feedback
@group_assignment
.
update
(
group_assignment_params
.
slice
(
:volunteer_attributes
)
.
merge
(
submit_feedback:
current_user
))
redirect_to
default_redirect
||
hours_and_feedbacks_submitted_assignments_path
@group_assignment
.
volunteer
.
assign_attributes
(
group_assignment_params
[
:volunteer_attributes
]
.
slice
(
:waive
,
:bank
,
:iban
))
@group_assignment
.
submit_feedback
=
current_user
if
@group_assignment
.
save
redirect_to
default_redirect
||
hours_and_feedbacks_submitted_assignments_path
else
redirect_to
(
last_submitted_hours_and_feedbacks_group_assignment_path
(
@assignment
),
notice:
'Das bestätigen des Feedbacks ist fehlgeschlagen.'
)
end
end
def
terminate
;
end
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment