Verified Commit 6d9fd93c authored by Kaspar Vollenweider's avatar Kaspar Vollenweider 👻
Browse files

rename action: update_submitted_at -> submit_feedback

parent 424a7882
Pipeline #22355 passed with stage
in 37 minutes and 20 seconds
...@@ -98,7 +98,7 @@ class AssignmentsController < ApplicationController ...@@ -98,7 +98,7 @@ class AssignmentsController < ApplicationController
@volunteer = @assignment.volunteer @volunteer = @assignment.volunteer
end end
def update_submitted_at def submit_feedback
@assignment.update(assignment_params.slice(:volunteer_attributes) @assignment.update(assignment_params.slice(:volunteer_attributes)
.merge(submit_feedback: current_user)) .merge(submit_feedback: current_user))
redirect_to default_redirect || hours_and_feedbacks_submitted_assignments_path redirect_to default_redirect || hours_and_feedbacks_submitted_assignments_path
......
...@@ -61,7 +61,7 @@ class GroupAssignmentsController < ApplicationController ...@@ -61,7 +61,7 @@ class GroupAssignmentsController < ApplicationController
rmv.update(link_visits: rmv.link_visits + 1) rmv.update(link_visits: rmv.link_visits + 1)
end end
def update_submitted_at def submit_feedback
@group_assignment.update(group_assignment_params.slice(:volunteer_attributes) @group_assignment.update(group_assignment_params.slice(:volunteer_attributes)
.merge(submit_feedback: current_user)) .merge(submit_feedback: current_user))
redirect_to default_redirect || hours_and_feedbacks_submitted_assignments_path redirect_to default_redirect || hours_and_feedbacks_submitted_assignments_path
......
...@@ -41,7 +41,7 @@ class AssignmentPolicy < ApplicationPolicy ...@@ -41,7 +41,7 @@ class AssignmentPolicy < ApplicationPolicy
alias_method :verify_termination?, alias_method :verify_termination?,
:superadmin? :superadmin?
alias_method :update_submitted_at?, alias_method :submit_feedback?,
:superadmin_or_department_manager_creation_or_volunteer_related? :superadmin_or_department_manager_creation_or_volunteer_related?
alias_method :last_submitted_hours_and_feedbacks?, alias_method :last_submitted_hours_and_feedbacks?,
:superadmin_or_department_manager_creation_or_volunteer_related? :superadmin_or_department_manager_creation_or_volunteer_related?
......
...@@ -16,7 +16,7 @@ class GroupAssignmentPolicy < ApplicationPolicy ...@@ -16,7 +16,7 @@ class GroupAssignmentPolicy < ApplicationPolicy
# Actions related to editing a member # Actions related to editing a member
alias_method :edit?, :superadmin_or_department_manager_offer? alias_method :edit?, :superadmin_or_department_manager_offer?
alias_method :update?, :superadmin_or_department_manager_offer? alias_method :update?, :superadmin_or_department_manager_offer?
alias_method :update_submitted_at?, :superadmin_or_departments_offer_or_volunteer_related? alias_method :submit_feedback?, :superadmin_or_departments_offer_or_volunteer_related?
alias_method :update_terminated_at?, :superadmin_or_departments_offer_or_volunteer_related? alias_method :update_terminated_at?, :superadmin_or_departments_offer_or_volunteer_related?
alias_method :set_end_today?, :superadmin_or_department_manager_offer? alias_method :set_end_today?, :superadmin_or_department_manager_offer?
alias_method :terminate?, :superadmin_or_departments_offer_or_volunteer_related? alias_method :terminate?, :superadmin_or_departments_offer_or_volunteer_related?
......
= simple_form_for(confirmable, html: { class: 'col-xs-12 form-auto-save'}, = simple_form_for(confirmable, html: { class: 'col-xs-12 form-auto-save'},
url: polymorphic_path(confirmable, action: :update_submitted_at, redirect_to: default_redirect, ), method: :put) do |f| url: polymorphic_path(confirmable, action: :submit_feedback, redirect_to: default_redirect, ), method: :put) do |f|
h1 Zuletzt übermittelte Stunden und Halbjahres-Rapporte h1 Zuletzt übermittelte Stunden und Halbjahres-Rapporte
......
...@@ -2,9 +2,9 @@ Rails.application.routes.draw do ...@@ -2,9 +2,9 @@ Rails.application.routes.draw do
# Route Concerns # Route Concerns
# #
concern :update_submitted_at do concern :submit_feedback do
get :last_submitted_hours_and_feedbacks, on: :member get :last_submitted_hours_and_feedbacks, on: :member
put :update_submitted_at, on: :member put :submit_feedback, on: :member
get :hours_and_feedbacks_submitted, on: :collection get :hours_and_feedbacks_submitted, on: :collection
end end
...@@ -52,7 +52,7 @@ Rails.application.routes.draw do ...@@ -52,7 +52,7 @@ Rails.application.routes.draw do
end end
end end
resources :assignments, except: [:destroy], concerns: [:update_submitted_at, :termination_actions] do resources :assignments, except: [:destroy], concerns: [:submit_feedback, :termination_actions] do
get :volunteer_search, on: :collection get :volunteer_search, on: :collection
get :client_search, on: :collection get :client_search, on: :collection
end end
...@@ -69,7 +69,7 @@ Rails.application.routes.draw do ...@@ -69,7 +69,7 @@ Rails.application.routes.draw do
resources :feedbacks, only: [:new, :create] resources :feedbacks, only: [:new, :create]
resources :group_assignments, only: [:show, :create, :edit, :update], resources :group_assignments, only: [:show, :create, :edit, :update],
concerns: [:update_submitted_at, :termination_actions] do concerns: [:submit_feedback, :termination_actions] do
put :set_end_today, on: :member put :set_end_today, on: :member
end end
......
...@@ -17,11 +17,11 @@ class AssignmentPolicyTest < PolicyAssertions::Test ...@@ -17,11 +17,11 @@ class AssignmentPolicyTest < PolicyAssertions::Test
'show_comments?', *actions_list( 'show_comments?', *actions_list(
:find_client, :show, :edit, :update, :find_client, :show, :edit, :update,
:terminate, :update_terminated_at, :terminate, :update_terminated_at,
:update_submitted_at, :last_submitted_hours_and_feedbacks :submit_feedback, :last_submitted_hours_and_feedbacks
)) ))
refute_permit(department_manager, create(:assignment), refute_permit(department_manager, create(:assignment),
*actions_list( *actions_list(
:show, :edit, :update, :update_submitted_at, :terminate, :show, :edit, :update, :submit_feedback, :terminate,
:update_terminated_at, :last_submitted_hours_and_feedbacks :update_terminated_at, :last_submitted_hours_and_feedbacks
)) ))
refute_permit(department_manager, Assignment, *actions_list(:verify_termination)) refute_permit(department_manager, Assignment, *actions_list(:verify_termination))
...@@ -46,7 +46,7 @@ class AssignmentPolicyTest < PolicyAssertions::Test ...@@ -46,7 +46,7 @@ class AssignmentPolicyTest < PolicyAssertions::Test
other_assignment = create :assignment, volunteer: (create :volunteer) other_assignment = create :assignment, volunteer: (create :volunteer)
assert_permit(volunteer.user, assignment, assert_permit(volunteer.user, assignment,
*actions_list( *actions_list(
:show, :last_submitted_hours_and_feedbacks, :update_submitted_at, :show, :last_submitted_hours_and_feedbacks, :submit_feedback,
:hours_and_feedbacks_submitted, :terminate :hours_and_feedbacks_submitted, :terminate
)) ))
refute_permit(volunteer.user, Assignment, refute_permit(volunteer.user, Assignment,
......
...@@ -48,12 +48,12 @@ class GroupAssignmentPolicyTest < PolicyAssertions::Test ...@@ -48,12 +48,12 @@ class GroupAssignmentPolicyTest < PolicyAssertions::Test
)) ))
assert_permit(volunteer.user, volunteer_group_assignment, assert_permit(volunteer.user, volunteer_group_assignment,
*actions_list( *actions_list(
:terminate, :update_submitted_at, :show, :update_terminated_at, :terminate, :submit_feedback, :show, :update_terminated_at,
:last_submitted_hours_and_feedbacks, :hours_and_feedbacks_submitted :last_submitted_hours_and_feedbacks, :hours_and_feedbacks_submitted
)) ))
refute_permit(volunteer.user, create(:group_assignment), refute_permit(volunteer.user, create(:group_assignment),
'show_comments?', *actions_list( 'show_comments?', *actions_list(
:terminate, :update_submitted_at, :show, :update_terminated_at, :terminate, :submit_feedback, :show, :update_terminated_at,
:last_submitted_hours_and_feedbacks :last_submitted_hours_and_feedbacks
)) ))
end end
...@@ -75,7 +75,7 @@ class GroupAssignmentPolicyTest < PolicyAssertions::Test ...@@ -75,7 +75,7 @@ class GroupAssignmentPolicyTest < PolicyAssertions::Test
actions_list( actions_list(
:edit, :edit,
:update, :update,
:update_submitted_at, :submit_feedback,
:update_terminated_at, :update_terminated_at,
:set_end_today, :set_end_today,
:terminate, :terminate,
......
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