Commit 27851eab authored by Kaspar Vollenweider's avatar Kaspar Vollenweider

Merge branch 'feat/reenable_terminated_clients' into 'develop'

Feat/reenable terminated clients

See merge request !936
parents 5e0cd5b5 35530146
Pipeline #40073 passed with stage
in 45 minutes and 24 seconds
image: git.panter.ch:5001/panter/gitlab-ci-docker-images/ruby-and-rails:ruby-2.4.5-node8-chrome-imagemagick image: git.panter.ch:5001/panter/gitlab-ci-docker-images/ruby-and-rails:ruby-2.4.5-node8-chrome-imagemagick-chromedriver
stages: stages:
- test - test
......
...@@ -66,7 +66,7 @@ GEM ...@@ -66,7 +66,7 @@ GEM
afm (0.2.2) afm (0.2.2)
airbrussh (1.3.0) airbrussh (1.3.0)
sshkit (>= 1.6.1, != 1.7.0) sshkit (>= 1.6.1, != 1.7.0)
archive-zip (0.11.0) archive-zip (0.12.0)
io-like (~> 0.3.0) io-like (~> 0.3.0)
arel (8.0.0) arel (8.0.0)
ast (2.4.0) ast (2.4.0)
...@@ -134,7 +134,7 @@ GEM ...@@ -134,7 +134,7 @@ GEM
selenium-webdriver selenium-webdriver
childprocess (0.9.0) childprocess (0.9.0)
ffi (~> 1.0, >= 1.0.11) ffi (~> 1.0, >= 1.0.11)
chromedriver-helper (1.2.0) chromedriver-helper (2.1.0)
archive-zip (~> 0.10) archive-zip (~> 0.10)
nokogiri (~> 1.8) nokogiri (~> 1.8)
climate_control (0.2.0) climate_control (0.2.0)
......
...@@ -53,9 +53,17 @@ ...@@ -53,9 +53,17 @@
.index-action-cell { .index-action-cell {
white-space: nowrap; white-space: nowrap;
a, span { a,
span {
display: block; display: block;
margin-right: 2px; margin-right: 2px;
&.single-line {
& > span,
& > a {
display: inline-block;
}
}
} }
a.btn { a.btn {
...@@ -74,9 +82,6 @@ ...@@ -74,9 +82,6 @@
} }
} }
.modal-header-sm { .modal-header-sm {
padding: 7px 15px; padding: 7px 15px;
} }
...@@ -216,3 +221,22 @@ li.button-acceptance a { ...@@ -216,3 +221,22 @@ li.button-acceptance a {
margin: 16px; margin: 16px;
font-size: 16px; font-size: 16px;
} }
.link-icon-span-text {
.glyphicon {
display: inline-block;
}
.icon-span-text {
display: inline-block;
margin-left: 5px;
}
&:hover,
&:focus,
&:active {
.icon-span-text {
text-decoration: underline;
}
}
}
...@@ -144,7 +144,7 @@ class AssignmentsController < ApplicationController ...@@ -144,7 +144,7 @@ class AssignmentsController < ApplicationController
end end
def reactivate def reactivate
state = @assignment.reactivate! ? 'success' : 'failure' state = @assignment.reactivate!(current_user) ? 'success' : 'failure'
redirect_back fallback_location: edit_assignment_path(@assignment), redirect_back fallback_location: edit_assignment_path(@assignment),
notice: t("assignments.notices.reactivation.#{state}") notice: t("assignments.notices.reactivation.#{state}")
end end
......
...@@ -4,7 +4,7 @@ class ClientsController < ApplicationController ...@@ -4,7 +4,7 @@ class ClientsController < ApplicationController
include ContactAttributes include ContactAttributes
rescue_from Client::NotDestroyableError, with: :user_not_authorized rescue_from Client::NotDestroyableError, with: :user_not_authorized
before_action :set_client, only: [:show, :edit, :update, :destroy, :set_terminated] before_action :set_client, only: [:show, :edit, :update, :destroy, :set_terminated, :reactivate]
before_action :set_social_worker_collection, only: [:new, :create, :edit, :update] before_action :set_social_worker_collection, only: [:new, :create, :edit, :update]
before_action :set_assignments, only: [:show, :edit] before_action :set_assignments, only: [:show, :edit]
...@@ -79,6 +79,11 @@ class ClientsController < ApplicationController ...@@ -79,6 +79,11 @@ class ClientsController < ApplicationController
end end
end end
def reactivate
state = @client.reactivate!(current_user) ? 'success' : 'failure'
redirect_to edit_client_path(@client), notice: t("clients.notices.reactivation.#{state}")
end
private private
def create_success_notice def create_success_notice
......
...@@ -103,7 +103,7 @@ class GroupAssignmentsController < ApplicationController ...@@ -103,7 +103,7 @@ class GroupAssignmentsController < ApplicationController
end end
def reactivate def reactivate
state = @group_assignment.reactivate! ? 'success' : 'failure' state = @group_assignment.reactivate!(current_user) ? 'success' : 'failure'
redirect_back fallback_location: edit_group_assignment_path(@group_assignment), redirect_back fallback_location: edit_group_assignment_path(@group_assignment),
notice: t("group_assignments.notices.reactivation.#{state}") notice: t("group_assignments.notices.reactivation.#{state}")
end end
......
class VolunteersController < ApplicationController class VolunteersController < ApplicationController
before_action :set_volunteer, only: [:show, :edit, :update, :terminate, :account, :update_bank_details, :reactivate] before_action :set_volunteer, only: [:show, :edit, :update, :terminate, :account, :update_bank_details, :reactivate]
before_action :set_active_and_archived_missions, only: [:show, :edit]
def index def index
authorize Volunteer authorize Volunteer
...@@ -27,12 +28,6 @@ class VolunteersController < ApplicationController ...@@ -27,12 +28,6 @@ class VolunteersController < ApplicationController
@group_offer_categories = @volunteer.group_offer_categories.active.without_house_moving @group_offer_categories = @volunteer.group_offer_categories.active.without_house_moving
@group_offer_categories_house_moving = @volunteer.group_offer_categories.active.house_moving @group_offer_categories_house_moving = @volunteer.group_offer_categories.active.house_moving
@current_assignments = @volunteer.assignments.unterminated
@archived_assignments = @volunteer.assignment_logs
@current_group_assignments = @volunteer.group_assignments.unterminated
@archived_group_assignments = @volunteer.group_assignment_logs
end end
def new def new
...@@ -119,7 +114,7 @@ class VolunteersController < ApplicationController ...@@ -119,7 +114,7 @@ class VolunteersController < ApplicationController
end end
def reactivate def reactivate
state = @volunteer.reactivate! ? 'success' : 'failure' state = @volunteer.reactivate!(current_user) ? 'success' : 'failure'
redirect_to edit_volunteer_path(@volunteer), notice: t("volunteers.notices.reactivation.#{state}") redirect_to edit_volunteer_path(@volunteer), notice: t("volunteers.notices.reactivation.#{state}")
end end
...@@ -151,6 +146,14 @@ class VolunteersController < ApplicationController ...@@ -151,6 +146,14 @@ class VolunteersController < ApplicationController
authorize @volunteer authorize @volunteer
end end
def set_active_and_archived_missions
@current_assignments = @volunteer.assignments.unterminated
@archived_assignments = @volunteer.assignment_logs
@current_group_assignments = @volunteer.group_assignments.unterminated
@archived_group_assignments = @volunteer.group_assignment_logs
end
def volunteer_params def volunteer_params
params.require(:volunteer).permit policy(Volunteer).permitted_attributes params.require(:volunteer).permit policy(Volunteer).permitted_attributes
end end
......
module ActionAndControllerNameHelper module ActionAndControllerNameHelper
def action_new? def action_name?(action)
action_name == 'new' || action_name == 'create' action_name == action.to_s
end end
def action_index? def action_index?
action_name == 'index' action_name?(:index)
end end
def action_show? def action_show?
action_name == 'show' action_name?(:show)
end
def action_new?
action_name?(:new) || action_name?(:create)
end end
def action_edit? def action_edit?
action_name == 'edit' || action_name == 'update' action_name?(:edit) || action_name?(:update)
end end
def action_in?(*names) def action_in?(*names)
names.map(&:to_s).include? action_name names.map(&:to_s).include? action_name
end end
def controller_name?(name)
controller_name == name.to_s
end
def controller_in?(*names) def controller_in?(*names)
names.map(&:to_s).include? controller_name names.map(&:to_s).include? controller_name
end end
def controller_action?(controller, action)
controller_name?(controller) && action_name?(action)
end
end end
...@@ -2,7 +2,10 @@ class Assignment < ApplicationRecord ...@@ -2,7 +2,10 @@ class Assignment < ApplicationRecord
include AssignmentCommon include AssignmentCommon
include VolunteersGroupAndTandemStateUpdate include VolunteersGroupAndTandemStateUpdate
has_one :assignment_log belongs_to :reactivated_by, class_name: 'User', inverse_of: 'reactivated_assignments',
optional: true
has_one :assignment_log, dependent: :nullify
has_many :hours, as: :hourable has_many :hours, as: :hourable
has_many :feedbacks, as: :feedbackable has_many :feedbacks, as: :feedbackable
......
...@@ -18,6 +18,8 @@ class Client < ApplicationRecord ...@@ -18,6 +18,8 @@ class Client < ApplicationRecord
belongs_to :user, -> { with_deleted }, inverse_of: 'clients' belongs_to :user, -> { with_deleted }, inverse_of: 'clients'
belongs_to :resigned_by, class_name: 'User', inverse_of: 'resigned_clients', belongs_to :resigned_by, class_name: 'User', inverse_of: 'resigned_clients',
optional: true optional: true
belongs_to :reactivated_by, class_name: 'User', inverse_of: 'reactivated_clients',
optional: true
belongs_to :involved_authority, -> { with_deleted }, class_name: 'User', belongs_to :involved_authority, -> { with_deleted }, class_name: 'User',
inverse_of: 'involved_authorities', optional: true inverse_of: 'involved_authorities', optional: true
has_many :manager_departments, through: :user, source: :departments has_many :manager_departments, through: :user, source: :departments
...@@ -125,6 +127,10 @@ class Client < ApplicationRecord ...@@ -125,6 +127,10 @@ class Client < ApplicationRecord
assignments.with_deleted.blank? assignments.with_deleted.blank?
end end
def reactivate!(user)
update!(acceptance: 'accepted', resigned_at: nil, reactivated_by: user, reactivated_at: Time.zone.now)
end
private private
def check_if_destroyable! def check_if_destroyable!
......
...@@ -74,12 +74,12 @@ module GroupAssignmentAndAssignmentCommon ...@@ -74,12 +74,12 @@ module GroupAssignmentAndAssignmentCommon
end end
def reactivatable? def reactivatable?
terminated? && volunteer.accepted? terminated? && dependency_allows_reactivation? && volunteer.accepted?
end end
def reactivate! def reactivate!(user)
update!(period_end: nil, termination_verified_at: nil, termination_submitted_at: nil, termination_verified_by: nil, update!(period_end: nil, termination_verified_at: nil, termination_submitted_at: nil, termination_verified_by: nil,
termination_submitted_by: nil, period_end_set_by: nil) termination_submitted_by: nil, period_end_set_by: nil, reactivated_by: user, reactivated_at: Time.zone.now)
if assignment? if assignment?
assignment_log.delete assignment_log.delete
elsif group_assignment? elsif group_assignment?
...@@ -89,6 +89,14 @@ module GroupAssignmentAndAssignmentCommon ...@@ -89,6 +89,14 @@ module GroupAssignmentAndAssignmentCommon
private private
def dependency_allows_reactivation?
if assignment?
client.accepted?
else
!group_offer.terminated?
end
end
def add_remaining_hours def add_remaining_hours
return unless remaining_hours? return unless remaining_hours?
......
...@@ -2,10 +2,10 @@ class GroupAssignment < ApplicationRecord ...@@ -2,10 +2,10 @@ class GroupAssignment < ApplicationRecord
include VolunteersGroupAndTandemStateUpdate include VolunteersGroupAndTandemStateUpdate
include GroupAssignmentCommon include GroupAssignmentCommon
after_save :update_group_offer_search_field belongs_to :reactivated_by, class_name: 'User', inverse_of: 'reactivated_group_assignments',
optional: true
has_many :group_assignment_logs
has_many :group_assignment_logs, dependent: :nullify
has_many :hours, ->(object) { where(volunteer: object.volunteer) }, through: :group_offer has_many :hours, ->(object) { where(volunteer: object.volunteer) }, through: :group_offer
delegate :title, to: :group_offer delegate :title, to: :group_offer
...@@ -15,6 +15,8 @@ class GroupAssignment < ApplicationRecord ...@@ -15,6 +15,8 @@ class GroupAssignment < ApplicationRecord
message: 'Diese/r Freiwillige ist schon im Gruppenangebot' message: 'Diese/r Freiwillige ist schon im Gruppenangebot'
} }
after_save :update_group_offer_search_field
scope :running, (-> { no_end.have_start }) scope :running, (-> { no_end.have_start })
def termination_verifiable? def termination_verifiable?
......
...@@ -21,9 +21,9 @@ class GroupOffer < ApplicationRecord ...@@ -21,9 +21,9 @@ class GroupOffer < ApplicationRecord
has_many :group_assignment_logs has_many :group_assignment_logs
has_many :hours, as: :hourable, dependent: :destroy, inverse_of: :hourable has_many :hours, as: :hourable, dependent: :destroy
has_many :trial_feedbacks, as: :trial_feedbackable, inverse_of: :trial_feedbackable, has_many :feedbacks, as: :feedbackable, dependent: :destroy
dependent: :destroy has_many :trial_feedbacks, as: :trial_feedbackable, dependent: :destroy
has_many :volunteers, through: :group_assignments has_many :volunteers, through: :group_assignments
has_many :volunteer_contacts, through: :volunteers, source: :contact has_many :volunteer_contacts, through: :volunteers, source: :contact
......
...@@ -72,6 +72,16 @@ class User < ApplicationRecord ...@@ -72,6 +72,16 @@ class User < ApplicationRecord
has_many :resigned_clients, class_name: 'Client', foreign_key: 'resigned_by_id', has_many :resigned_clients, class_name: 'Client', foreign_key: 'resigned_by_id',
inverse_of: 'resigned_by' inverse_of: 'resigned_by'
# reactivated relations
has_many :reactivated_clients, class_name: 'Client', foreign_key: 'reactivated_by_id',
inverse_of: 'reactivated_by'
has_many :reactivated_volunteers, class_name: 'Volunteer', foreign_key: 'reactivated_by_id',
inverse_of: 'reactivated_by'
has_many :reactivated_assignments, class_name: 'Assignment', foreign_key: 'reactivated_by_id',
inverse_of: 'reactivated_by'
has_many :reactivated_group_assignments, class_name: 'GroupAssignment', foreign_key: 'reactivated_by_id',
inverse_of: 'reactivated_by'
# Mailing process done relation # Mailing process done relation
has_many :mailing_volunteer_processes_submitted, class_name: 'ReminderMailingVolunteer', has_many :mailing_volunteer_processes_submitted, class_name: 'ReminderMailingVolunteer',
inverse_of: 'process_submitted_by', foreign_key: 'process_submitted_by_id' inverse_of: 'process_submitted_by', foreign_key: 'process_submitted_by_id'
......
...@@ -28,6 +28,8 @@ class Volunteer < ApplicationRecord ...@@ -28,6 +28,8 @@ class Volunteer < ApplicationRecord
belongs_to :user, -> { with_deleted }, inverse_of: 'volunteer', optional: true belongs_to :user, -> { with_deleted }, inverse_of: 'volunteer', optional: true
belongs_to :registrar, -> { with_deleted }, class_name: 'User', foreign_key: 'registrar_id', optional: true, belongs_to :registrar, -> { with_deleted }, class_name: 'User', foreign_key: 'registrar_id', optional: true,
inverse_of: :volunteers inverse_of: :volunteers
belongs_to :reactivated_by, class_name: 'User', inverse_of: 'reactivated_volunteers',
optional: true
belongs_to :department, optional: true belongs_to :department, optional: true
has_one :registrar_department, through: :registrar has_one :registrar_department, through: :registrar
...@@ -508,7 +510,7 @@ class Volunteer < ApplicationRecord ...@@ -508,7 +510,7 @@ class Volunteer < ApplicationRecord
end end
def user_needed_for_invitation? def user_needed_for_invitation?
!user.present? && accepted? user.blank? && accepted?
end end
def invite_email_valid? def invite_email_valid?
...@@ -526,8 +528,8 @@ class Volunteer < ApplicationRecord ...@@ -526,8 +528,8 @@ class Volunteer < ApplicationRecord
end end
end end
def reactivate! def reactivate!(user)
update!(acceptance: 'accepted') update!(acceptance: 'accepted', reactivated_by: user, reactivated_at: Time.zone.now, resigned_at: nil)
return true if external? return true if external?
if user.present? && (user.sign_in_count.zero? || !user.invitation_accepted?) if user.present? && (user.sign_in_count.zero? || !user.invitation_accepted?)
......
...@@ -16,15 +16,20 @@ class ClientPolicy < ApplicationPolicy ...@@ -16,15 +16,20 @@ class ClientPolicy < ApplicationPolicy
social_worker? && (user_owns_record? || user_involved_authority?) social_worker? && (user_owns_record? || user_involved_authority?)
end end
def reactivate?
record.class.name == 'Client' && record.resigned? &&
superadmin_or_client_responsible?
end
# controller action policies # controller action policies
alias_method :index?, :superadmin_or_department_manager_or_social_worker? alias_method :index?, :superadmin_or_department_manager_or_social_worker?
alias_method :search?, :superadmin_or_department_manager_or_social_worker? alias_method :search?, :superadmin_or_department_manager_or_social_worker?
alias_method :new?, :superadmin_or_department_manager_or_social_worker? alias_method :new?, :superadmin_or_department_manager_or_social_worker?
alias_method :create?, :superadmin_or_department_manager_or_social_worker? alias_method :create?, :superadmin_or_department_manager_or_social_worker?
alias_method :show?, :superadmin_or_department_manager_or_social_worker? alias_method :show?, :superadmin_or_department_manager_or_social_worker?
alias_method :destroy?, :superadmin_or_client_responsible? alias_method :destroy?, :superadmin_or_client_responsible?
alias_method :edit?, :superadmin_or_client_responsible? alias_method :edit?, :superadmin_or_client_responsible?
alias_method :update?, :superadmin_or_client_responsible? alias_method :update?, :superadmin_or_client_responsible?
alias_method :set_terminated?, :superadmin_or_department_managers_record? alias_method :set_terminated?, :superadmin_or_department_managers_record?
# suplementary policies # suplementary policies
......
...@@ -52,7 +52,6 @@ class VolunteerPolicy < ApplicationPolicy ...@@ -52,7 +52,6 @@ class VolunteerPolicy < ApplicationPolicy
alias_method :update?, :volunteer_managing_or_volunteers_profile? alias_method :update?, :volunteer_managing_or_volunteers_profile?
alias_method :update_bank_details?, :volunteer_managing_or_volunteers_profile? alias_method :update_bank_details?, :volunteer_managing_or_volunteers_profile?
alias_method :account?, :superadmin? alias_method :account?, :superadmin?
alias_method :reactivate?, :reactivate?
# supplementary policies # supplementary policies
alias_method :superadmin_privileges?, :superadmin? alias_method :superadmin_privileges?, :superadmin?
......
table.table.table-striped.assignments-table table.table.table-striped.assignments-table
thead thead
tr tr
th
th= t_model(Volunteer) th= t_model(Volunteer)
th= t_model(Client)
th= t_attr(:period_start, Assignment) th= t_attr(:period_start, Assignment)
th= t_attr(:period_end, Assignment) th= t_attr(:period_end, Assignment)
th= t_attr(:created_by) th= t_attr(:created_by)
...@@ -10,10 +10,29 @@ table.table.table-striped.assignments-table ...@@ -10,10 +10,29 @@ table.table.table-striped.assignments-table
th Bemerkungen th Bemerkungen
tbody tbody
- assignments.each do |assignment| - assignments.each do |assignment_log|
- assignment = assignment_log.assignment
- volunteer = assignment.volunteer
tr tr
td = link_to_if policy(assignment.volunteer).show?, assignment.volunteer, assignment.volunteer td.index-action-cell.hidden-print
td= link_to_if policy(assignment.client).show?, assignment.client, assignment.client - if policy(assignment).reactivate?
span.single-line
= button_link icon_span(:edit), edit_assignment_path(assignment)
span.m-l-10
em= t('.edit_for_reactivate')
td.index-action-cell
- if policy(volunteer).reactivate?
= link_to edit_volunteer_path(volunteer), target: '_blank', rel: 'noopener',
class: 'link-icon-span-text',
title: t('.ractivate_link_title') do
= icon_span(:edit)
span.icon-span-text= volunteer.full_name
- elsif policy(volunteer).show?
= link_to volunteer_path(volunteer), class: 'link-icon-span-text' do
= icon_span(:show)
span.icon-span-text= volunteer.full_name
- else
= volunteer.full_name
td= l(assignment.period_start) if assignment.period_start td= l(assignment.period_start) if assignment.period_start
td= l(assignment.period_end) if assignment.period_end td= l(assignment.period_end) if assignment.period_end
td= link_to_if policy(User).show?, td= link_to_if policy(User).show?,
...@@ -21,4 +40,3 @@ table.table.table-striped.assignments-table ...@@ -21,4 +40,3 @@ table.table.table-striped.assignments-table
profile_url_path(assignment.client.involved_authority || assignment.creator) profile_url_path(assignment.client.involved_authority || assignment.creator)
- if policy(Assignment).show_comments? - if policy(Assignment).show_comments?
= td_truncate_content_modal(assignment.comments, 'Bemerkungen') = td_truncate_content_modal(assignment.comments, 'Bemerkungen')
...@@ -10,39 +10,56 @@ table.table.table-striped.assignment-logs-table ...@@ -10,39 +10,56 @@ table.table.table-striped.assignment-logs-table
th= t_attr(:comments) th= t_attr(:comments)
th colspan=2 th colspan=2
tbody tbody
- assignment_logs.each do |assignment| - assignment_logs.each do |assignment_log|
- assignment = assignment_log.assignment
- client = assignment.client
tr tr
td.index-action-cell.hidden-print td.index-action-cell.hidden-print
- if policy(assignment.assignment).show? && assignment.assignment.pdf.exists? - if policy(assignment).show? && assignment.pdf.exists?
= button_link icon_span(:download), assignment_path(assignment.assignment, format: :pdf), = button_link icon_span(:download), assignment_path(assignment, format: :pdf),
title: 'Herunterladen' title: 'Herunterladen'
- if policy(assignment.assignment).reactivate? - if policy(assignment).reactivate?
= button_link icon_span(:edit), edit_assignment_path(assignment.assignment) span.single-line
td= link_to_if(policy(Client).show?, assignment.client.contact.full_name, assignment.client) = button_link icon_span(:edit), edit_assignment_path(assignment)
span.m-l-10
em= t('.edit_for_reactivate')
td.index-action-cell
- if policy(client).reactivate?
= link_to edit_client_path(client), target: '_blank', rel: 'noopener',
class: 'link-icon-span-text',
title: t('.ractivate_link_title') do
= icon_span(:edit)
span.icon-span-text= client.contact.full_name
- elsif policy(client).show?
= link_to client_path(client), class: 'link-icon-span-text' do
= icon_span(:show)
span.icon-span-text= client.contact.full_name
- else
= client.contact.full_name
td= l(assignment.period_start) if assignment.period_start td= l(assignment.period_start) if assignment.period_start
td= l(assignment.period_end) if assignment.period_end td= l(assignment.period_end) if assignment.period_end
td td
- if assignment.client.involved_authority - if client.involved_authority
= link_to_if policy(User).show?, = link_to_if policy(User).show?,
assignment.client.involved_authority.full_name, client.involved_authority.full_name,
profile_url_path(assignment.client.involved_authority) profile_url_path(client.involved_authority)
- else - else
= link_to_if policy(User).show?, = link_to_if policy(User).show?,
assignment.creator.full_name, assignment.creator.full_name,
profile_url_path(assignment.creator) profile_url_path(assignment.creator)
td= link_to_if(assignment.assignment && policy(assignment.assignment).show?, td= link_to_if(assignment && policy(assignment).show?,
t_action(:show), assignment.assignment) { '' } t_action(:show), assignment) { '' }
- if policy(Assignment).show_comments? - if policy(Assignment).show_comments?
= td_truncate_content_modal(assignment.comments, 'Bemerkungen') = td_truncate_content_modal(assignment.comments, 'Bemerkungen')
td.index-action-cell.hidden-print td.index-action-cell.hidden-print
span span
- unless assignment.assignment.volunteer.external? - unless assignment.volunteer.external?
= link_to_if(policy(TrialFeedback).index?, t_title(:index, TrialFeedback), = link_to_if(policy(TrialFeedback).index?, t_title(:index, TrialFeedback),
polymorphic_path([assignment.assignment.volunteer, assignment.assignment, TrialFeedback])) { '' } polymorphic_path([assignment.volunteer, assignment, TrialFeedback])) { '' }
= link_to_if(policy(Feedback).index?, t_title(:index, Feedback), = link_to_if(policy(Feedback).index?, t_title(:index, Feedback),
polymorphic_path([assignment.assignment.volunteer, assignment.assignment, Feedback])) { '' } polymorphic_path([assignment.volunteer, assignment, Feedback])) { '' }
= link_to_if(policy(Assignment).verify_termination?, 'Beendigungsformular', = link_to_if(policy(Assignment).verify_termination?, 'Beendigungsformular',
polymorphic_path(assignment.assignment, action: :terminate)) { '' } polymorphic_path(assignment, action: :terminate)) { '' }
td.index-action-cell.hidden-print td.index-action-cell.hidden-print
span span
= "Quittiert von " = "Quittiert von "
......
...@@ -7,9 +7,9 @@ tr ...@@ -7,9 +7,9 @@ tr
- if policy(assignment).show? && assignment.pdf.exists? - if policy(assignment).show? && assignment.pdf.exists?
= button_link icon_span(:download), assignment_path(assignment, format: :pdf), title: 'Herunterladen' = button_link icon_span(:download), assignment_path(assignment, format: :pdf), title: 'Herunterladen'
td.button-acceptance= assignment_status_badge(assignment) td.button-acceptance= assignment_status_badge(assignment)
- if controller_name != 'volunteers' - unless controller_in?(:volunteers)
td = link_to_if policy(assignment.volunteer).show?, assignment.volunteer, edit_volunteer_path(assignment.volunteer) td = link_to_if policy(assignment.volunteer).show?, assignment.volunteer, edit_volunteer_path(assignment.volunteer)
- if controller_name != 'clients' - unless controller_in?(:clients)
td= link_to_if policy(assignment.client).show?, assignment.client.contact.full_name, edit_client_path(assignment.client) td= link_to_if policy(assignment.client).show?, assignment.client.contact.full_name, edit_client_path(assignment.client)
td= l(assignment.period_start) if assignment.period_start td= l(assignment.period_start) if assignment.period_start
td= l(assignment.period_end) if assignment.period_end td= l(assignment.period_end) if assignment.period_end
......
...@@ -3,9 +3,9 @@ table.table.table-striped.assignments-table ...@@ -3,9 +3,9 @@ table.table.table-striped.assignments-table