Commit 590fbef2 authored by Jiri Strojil's avatar Jiri Strojil
Browse files

Everything except sorting done

parent d95ffd5c
Pipeline #29494 passed with stage
in 41 minutes and 20 seconds
......@@ -13,6 +13,10 @@ class SemesterProcessesController < ApplicationController
@semester_process = SemesterProcess.new(semester: @selected_semester)
@semester_process.build_semester_volunteers(@volunteers)
authorize @semester_process
if params[:sort_by]
@semester_process.semester_process_volunteers.sort_by {|spv| spv.volunteer.full_name}
end
@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 +39,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
......@@ -85,6 +89,7 @@ class SemesterProcessesController < ApplicationController
:kind,
:subject,
:body,
:sort,
semester_process_volunteers_attributes: [
:volunteer_id, :selected
]
......
......@@ -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= link_to "Freiwilliger/r", new_semester_process_url(semester: params[:semester],sort: "desc")
th Einsatz
tbody
= f.simple_fields_for :semester_process_volunteers do |fv|
tr
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