Commit 0fa5ed58 authored by Chrysanthi Lagodimou's avatar Chrysanthi Lagodimou

Merge branch 'Changes/SemesterSelection-Hours-Footer-VolunteerIndex' into 'develop'

Changes/semester selection hours footer volunteer index

See merge request !877
parents 53b3931f c9e0780f
Pipeline #32416 passed with stage
in 36 minutes and 25 seconds
......@@ -16,6 +16,7 @@ $custom-red: #a51a0f;
$white: #fff;
$black: #000;
$dark: #333;
$red: #f00;
$silver: #ccc;
// Grays
......
......@@ -13,9 +13,17 @@ body,
}
.footer {
align-self: center;
background-color: $white;
flex: 0 0 auto;
text-align: center;
font-family: Arial,Helvetica Neue, Helvetica, sans-serif;
width: 100%;
hr {
border-color: $red;
}
p .red {
background: none;
color: $red;
}
}
module SemesterProcessVolunteerHelper
def set_reviewed
@semester_process_volunteer.commited_by = current_user
@semester_process_volunteer.commited_at = Time.zone.now
......@@ -17,14 +16,14 @@ module SemesterProcessVolunteerHelper
review_params[:semester_feedbacks_attributes].each do |_key, hash|
spv_mission = SemesterProcessVolunteerMission.find(hash[:semester_feedback][:spv_mission_id])
@nested_objects[spv_mission.id.to_s][:feedback] = SemesterFeedback.new(hash[:semester_feedback].merge({
author: current_user, semester_process_volunteer: @semester_process_volunteer
author: current_user, semester_process_volunteer: @semester_process_volunteer
}))
if hash[:hour][:hours].to_i.positive?
@nested_objects[spv_mission.id.to_s][:hours] = Hour.new(hash[:hour].merge({
volunteer: spv_mission.volunteer,
meeting_date: Time.zone.now,
hourable: spv_mission.mission.group_assignment? ? spv_mission.mission.group_offer : spv_mission.mission
@nested_objects[spv_mission.id.to_s][:hours] = Hour.new(hash[:hour].merge({
volunteer: spv_mission.volunteer,
meeting_date: spv_mission.semester_process_volunteer.semester.last.to_date,
hourable: spv_mission.mission.group_assignment? ? spv_mission.mission.group_offer : spv_mission.mission
}))
end
end
......
......@@ -27,7 +27,7 @@ class SemesterProcessVolunteer < ApplicationRecord
has_many :reminders, -> { where(kind: 'reminder') }, class_name: 'SemesterProcessMail',
foreign_key: 'semester_process_volunteer_id', inverse_of: 'semester_process_volunteer'
accepts_nested_attributes_for :group_assignments, :assignments , :semester_process_volunteer_missions , :volunteer, :semester_feedbacks
accepts_nested_attributes_for :group_assignments, :assignments, :semester_process_volunteer_missions, :volunteer, :semester_feedbacks
validates_associated :hours, :semester_feedbacks, :volunteer
......@@ -44,7 +44,7 @@ class SemesterProcessVolunteer < ApplicationRecord
}
attr_accessor :hours
def hours
missions.map do |m|
m.hours.within_semester(semester)
......@@ -52,7 +52,7 @@ class SemesterProcessVolunteer < ApplicationRecord
end
def semester_feedback_with_mission(mission)
self.semester_feedbacks.order(:created_at).select{|sf| sf.mission == mission}.last
semester_feedbacks.order(:created_at).select { |sf| sf.mission == mission }.last
end
# will only return an array, not a AD-result
......@@ -84,6 +84,10 @@ class SemesterProcessVolunteer < ApplicationRecord
semester_feedbacks.map(&field).compact.join('<hr>').html_safe if field_size != 0
end
def render_feedback_conversation
semester_feedbacks.map(&:conversation).any?
end
def responsible=(responsible_user)
self.responsibility_taken_at = Time.zone.now
super(responsible_user)
......
footer.footer.navbar.hidden-print
.container-fluid
p
mark.red AOZ
' Fachstelle Freiwilligenarbeit
hr
p.text-muted
= 'AOZ Fachstelle Freiwilligenarbeit - Flüelastrasse 32 - 8047 Zürich - '
= mail_to 'info@aoz-freiwillige.ch', 'info@aoz-freiwillige.ch'
p
= 'Flüelastrasse 32 - 8047 Zürich - Telefon 044 415 67 35 - Telefax n.v. - '
= mail_to 'freiwillige@aoz.ch', 'freiwillige@aoz.ch'
= ' – '
= link_to 'www.aoz.ch/freiwilligenarbeit', 'http://www.aoz.ch/freiwilligenarbeit'
p
= link_to ' www.aoz-freiwillige.ch', 'www.aoz-freiwillige.ch'
......@@ -2,7 +2,7 @@ nav.navbar.section-navigation
hr
ul.list-inline
li= clear_filter_button
li= button_link 'Neuen Semester Prozess erstellen', new_semester_process_path, dimension: 'sm'
li= button_link 'Neuen Semester Prozess erstellen', new_semester_process_path(semester: params[:semester]), dimension: 'sm'
li= render 'semester_filter'
- if @semester_process
li= button_link 'Semester Prozess bearbeiten', edit_semester_process_path(@semester_process), dimension: 'sm'
......
......@@ -16,6 +16,7 @@ h1 Semester Prozess
th Erfolge
th Zukunft
th Bemerkungen
th Gespräch
th Übernommen
th.limit-width-15 Notizen
th Quittiert
......@@ -40,6 +41,9 @@ h1 Semester Prozess
= td_truncate_content_modal(spv.render_feedback(:achievements), 'Erfolge', shorten_size: 300)
= td_truncate_content_modal(spv.render_feedback(:future), 'Zukunft', shorten_size: 300)
= td_truncate_content_modal(spv.render_feedback(:comments), 'Bemerkungen', shorten_size: 300)
td
- if spv.render_feedback_conversation
= icon_span(:yes)
td.index-action-cell.hidden-print
- if spv.responsible.present?
= 'Übernommen durch '
......
......@@ -26,6 +26,7 @@
th= t_attr(:comments)
th= sort_link @q, :external
th= t_attr(:created_by, Volunteer)
th= t_attr(:accepted_at, Volunteer)
tbody
= render volunteers
......
......@@ -58,3 +58,4 @@ tr id=(dom_id(volunteer))
= link_to volunteer.registrar.full_name, profile_url_path(volunteer.registrar)
br
= l(volunteer.created_at.to_date) if volunteer.created_at
td = volunteer.accepted_at if volunteer.accepted_at
......@@ -34,6 +34,15 @@ FactoryBot.define do
subject '%{Anrede} %{Name}'
end
trait :half_year_process_email do
kind { EmailTemplate.kinds[:half_year_process_email] }
body do
"%{Anrede} %{Name}\r\n\r\n#{FFaker::Lorem.paragraph}\r\n\r\n%{Einsatz} %{EinsatzStart} "\
'%{FeedbackLink}'
end
subject '%{Anrede} %{Name}'
end
trait :termination do
kind { EmailTemplate.kinds[:termination] }
body do
......@@ -45,6 +54,7 @@ FactoryBot.define do
factory :email_template_signup, traits: [:signup]
factory :email_template_trial, traits: [:trial]
factory :email_template_half_year, traits: [:half_year]
factory :email_template_half_year_process_email, traits: [:half_year_process_email]
factory :email_template_termination, traits: [:termination]
end
end
......@@ -3,7 +3,7 @@ FactoryBot.define do
association :creator, factory: :user
mail_subject_template 'mail subject template'
mail_body_template 'mail body template'
sequence(:semester) {|n| Time.zone.local(2017 + n, 12, 1).beginning_of_day..Time.zone.local(2018 + n, 5, 30).end_of_month }
sequence(:semester) { |n| Time.zone.local(2017 + n, 12, 1).beginning_of_day..Time.zone.local(2018 + n, 5, 30).end_of_month }
transient do
build_volunteers { false }
......
......@@ -63,6 +63,7 @@ class SemesterFeedbackTest < ApplicationSystemTestCase
@spv.reload
assert_equal Hour.last.hours, 10
assert_equal Hour.last.hourable, @spv.missions.last
assert_equal Hour.last.meeting_date, @spv.semester.last.to_date
end
test 'iban and bank has to be filled' do
......
......@@ -16,10 +16,18 @@ class SemesterProcessVolunteersTest < ApplicationSystemTestCase
end
test 'filter semester process volunteer on semester' do
click_button "Semester: #{@current_semester.previous_s[0..3]},#{@current_semester.previous_s[5]}", match: :first
click_link "#{@current_semester.previous_s(2)[5]}. Semester #{@current_semester.previous_s(2)[0..3]}"
click_button "Semester: #{@current_semester.collection.second[1]}", match: :first
click_link @two_semesters_back.semester_t
assert_not page.has_text? @one_semester_back.semester_process_volunteers.first.semester_feedbacks.first.goals
assert page.has_text? @two_semesters_back.semester_process_volunteers.first.semester_feedbacks.first.goals
assert_not page.has_text? @three_semesters_back.semester_process_volunteers.first.semester_feedbacks.first.goals
end
test 'New semester process after filtering on index preserves semester selection' do
create :email_template, :half_year_process_email
click_button "Semester: #{@current_semester.collection.second[1]}", match: :first
click_link @three_semesters_back.semester_t
click_on 'Neuen Semester Prozess erstellen', match: :first
assert page.has_select? 'Semester', selected: @current_semester.collection.last[0]
end
end
Markdown is supported
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