Verified Commit 319d5cef authored by Kaspar Vollenweider's avatar Kaspar Vollenweider 👻
Browse files

add edit button, handle redirect back to LSHAF form, a system test for this

parent 143c239b
Pipeline #22212 passed with stage
in 47 minutes and 27 seconds
......@@ -39,7 +39,7 @@ class FeedbacksController < ApplicationController
def update
if @feedback.update(feedback_params)
redirect_to @feedback.volunteer, make_notice
redirect_to params[:redirect_to] || @feedback.volunteer, make_notice
else
render :edit
end
......@@ -79,7 +79,8 @@ class FeedbacksController < ApplicationController
[@volunteer, @feedbackable, @feedback], {
url: polymorphic_path(
[@volunteer, @feedbackable, @feedback],
redirect_to: default_redirect, group_assignment: params[:group_assignment]
redirect_to: params[:redirect_back] || default_redirect,
group_assignment: params[:group_assignment]
)
}
]
......
......@@ -14,7 +14,8 @@ table.table.table-striped.feedbacks-table
tbody
- feedbacks.each do |record|
tr
td= button_link navigation_glyph(:edit), edit_polymorphic_path([@volunteer, record.feedbackable, record])
td= glyph_action_button_link :edit, edit_polymorphic_path([@volunteer, record.feedbackable, record],
redirect_back: "#{request.path}?#{request.query_string}")
td= record.goals
td= record.achievements
td= record.future
......
......@@ -150,4 +150,19 @@ class VolunteerSubmitsAfterRemindTest < ApplicationSystemTestCase
refute_text 'hour_volunteer2'
refute_text 'feedback_volunteer2'
end
test 'volunteer_can_edit_feedback_on_last_submitted_hours_and_feedbacks_path' do
login_as @assignment_feedback.volunteer.user
visit last_submitted_hours_and_feedbacks_assignment_path(@assignment_feedback.feedbackable)
click_link 'Bearbeiten', match_polymorph_path(
[@assignment_feedback.volunteer, @assignment_feedback.feedbackable, @assignment_feedback]
)
# assert the redirect back to the previous page works
fill_in 'Was konnte in den letzten Monaten erreicht werden?', with: 'some_different_goal_text'
click_button 'Halbjahres-Rapport aktualisieren'
assert page.has_text? 'Halbjahres-Rapport wurde erfolgreich geändert.'
assert page.has_text? 'Zuletzt übermittelte Stunden und Halbjahres-Rapporte'
end
end
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment