Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
aoz-003
Commits
c1bec6e9
Commit
c1bec6e9
authored
Nov 06, 2018
by
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
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/controllers/semester_processes_controller.rb
View file @
c1bec6e9
...
...
@@ -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
...
...
app/models/semester_process.rb
View file @
c1bec6e9
...
...
@@ -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:
tru
e
)
spv
=
SemesterProcessVolunteer
.
new
(
volunteer:
volunteer
,
selected:
fals
e
)
spv
.
build_missions
(
semester
)
spv
end
...
...
app/views/semester_processes/_form.html.slim
View file @
c1bec6e9
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment