Commit c1bec6e9 authored by Beat Seeliger's avatar Beat Seeliger
Browse files

Merge branch 'features/add-checkbox-for-mass-selection' into 'develop'

Features/add checkbox for mass selection

See merge request !831
parents 96af367c bd1df11a
Pipeline #30179 passed with stage
in 35 minutes and 24 seconds
......@@ -13,6 +13,8 @@ class SemesterProcessesController < ApplicationController
@semester_process = SemesterProcess.new(semester: @selected_semester)
@semester_process.build_semester_volunteers(@volunteers)
authorize @semester_process
@spvs_sorted = @semester_process.semester_process_volunteers.sort { |spv1, spv2| spv1.volunteer.contact.full_name <=> spv2.volunteer.contact.full_name}
@seme
if EmailTemplate.half_year_process_email.active.any?
template = EmailTemplate.half_year_process_email.active.first.slice(:subject, :body)
@semester_process.assign_attributes(mail_body_template: template[:body], mail_subject_template: template[:subject])
......@@ -35,7 +37,7 @@ class SemesterProcessesController < ApplicationController
mail_subject_template: semester_process_params[:subject]
)
@semester_process.build_semester_volunteers(@volunteers, selected_volunteers)
@semester_process.build_semester_volunteers(@volunteers, selected_volunteers: selected_volunteers)
@semester_process.build_volunteers_hours_feedbacks_and_mails
if @semester_process.save
......
......@@ -67,7 +67,7 @@ class SemesterProcess < ApplicationRecord
def build_semester_volunteers(volunteers, selected = nil)
volunteers = volunteers.where(id: selected) if selected
semester_process_volunteers << volunteers.to_a.map do |volunteer|
spv = SemesterProcessVolunteer.new(volunteer: volunteer, selected: true)
spv = SemesterProcessVolunteer.new(volunteer: volunteer, selected: false)
spv.build_missions(semester)
spv
end
......
......@@ -16,12 +16,12 @@
.table-responsive.table-scrollable
table.table.table-striped
thead:tr
th
th Name
th.limit-width= select_all_rows
th Freiwilliger/r
th Einsatz
tbody
= f.simple_fields_for :semester_process_volunteers do |fv|
tr
= f.simple_fields_for :semester_process_volunteers, @spvs_sorted do |fv|
tr.table-row-selectable
td= fv.input :selected, as: :boolean, label: false
td= link_to fv.object.volunteer.contact.full_name, fv.object.volunteer
td.index-action-cell
......
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