Commit 8f7a4753 authored by Chrysanthi Lagodimou's avatar Chrysanthi Lagodimou

More prominent warning for unsubmitted feedback.

parent df4493b0
Pipeline #31779 passed with stage
in 38 minutes and 2 seconds
module NotificationHelper
def notification_warning_bubble(text)
tag.div(class: 'alert alert-warning alert-dismissible', role: 'alert') do
def notification_bubble(text, type)
tag.div(class: "alert #{type} alert-dismissible", role: 'alert') do
concat notification_close_button
concat raw(text)
end
......
- if alert.present?
= notification_warning_bubble(alert)
= notification_bubble(alert, 'alert-warning')
- elsif notice.present?
- if notice.is_a? String
= notification_warning_bubble(notice)
= notification_bubble(notice, 'alert-warning')
- elsif notice.is_a? Hash
= render 'notification_alert_with_action', notice: notice
- elsif @custom_notice.present?
......
- if current_user.volunteer? && current_user.volunteer.unsubmitted_semester_feedbacks?
- current_user.volunteer.unsubmitted_semester_feedbacks.each do |spv|
- message = 'Sie haben einen ausstehenden Halbjahres-Rapport für dieses Semester.'
- message = 'Sie haben einen ausstehenden Halbjahres-Rapport für dieses Semester. '
- message << "<a href='#{review_semester_semester_process_volunteer_path(spv)}'>Bitte klicken Sie hier um diesen zu bestätigen.</a>".html_safe
= notification_warning_bubble(message)
= notification_bubble(message, 'alert-danger')
......@@ -3,14 +3,11 @@ require 'application_system_test_case'
class SemesterFeedbackTest < ApplicationSystemTestCase
setup do
@volunteer = create :volunteer_with_user
@assignment = create :assignment, volunteer: @volunteer
@group_assignment = create :group_assignment, volunteer: @volunteer
@subject = create :semester_process
@subject_volunteer = create(:semester_process_volunteer, :with_mission, volunteer: @volunteer,
@spv = create(:semester_process_volunteer, :with_mission, volunteer: @volunteer,
semester_process: @subject)
@mission = @subject_volunteer.semester_process_volunteer_missions.first.assignment
login_as @volunteer.user
visit review_semester_semester_process_volunteer_path(@subject_volunteer)
visit review_semester_semester_process_volunteer_path(@spv)
end
def submit_feedback(semester_process_volunteer)
......@@ -28,21 +25,16 @@ class SemesterFeedbackTest < ApplicationSystemTestCase
end
test 'volunteer with unsubmitted feedback should see a warning' do
second_spv = create(:semester_process_volunteer, :with_mission, volunteer: @volunteer,
semester_process: @subject)
visit volunteer_path(@volunteer)
assert page.has_text? 'Sie haben einen ausstehenden Halbjahres-Rapport für dieses Semester.'
assert page.has_link? 'Bitte klicken Sie hier um diesen zu bestätigen', count: 2
visit root_path
assert page.has_text? 'Sie haben einen ausstehenden Halbjahres-Rapport für dieses Semester.'
assert page.has_link? 'Bitte klicken Sie hier um diesen zu bestätigen', count: 2
click_link 'Bitte klicken Sie hier um diesen zu bestätigen', match: :first
submit_feedback(@subject_volunteer)
assert page.has_link? 'Bitte klicken Sie hier um diesen zu bestätigen'
visit root_path
assert page.has_text? 'Sie haben einen ausstehenden Halbjahres-Rapport für dieses Semester.'
assert page.has_link? 'Bitte klicken Sie hier um diesen zu bestätigen', count: 1
assert page.has_link? 'Bitte klicken Sie hier um diesen zu bestätigen'
click_link 'Bitte klicken Sie hier um diesen zu bestätigen'
submit_feedback(second_spv)
submit_feedback(@spv)
visit volunteer_path(@volunteer)
assert_not page.has_text? 'Sie haben einen ausstehenden Halbjahres-Rapport für dieses Semester.'
visit root_path
assert_not page.has_text? 'Sie haben einen ausstehenden Halbjahres-Rapport für dieses Semester.'
end
......@@ -52,18 +44,18 @@ class SemesterFeedbackTest < ApplicationSystemTestCase
end
test 'accepting should remove submit button' do
submit_feedback(@subject_volunteer)
assert_text "Bestätigt am #{I18n.l(@subject_volunteer.commited_at.to_date)} durch #{(@subject_volunteer.commited_by.full_name)}"
submit_feedback(@spv)
assert_text "Bestätigt am #{I18n.l(@spv.commited_at.to_date)} durch #{@spv.commited_by.full_name}"
end
test 'you should be able to add hours on run' do
fill_in_required_feedback_fields
assert_equal @subject_volunteer.hours.count, 0
assert_equal @spv.hours.count, 0
fill_in 'Stunden', with: 10
check 'Ich verzichte auf die Auszahlung von Spesen.'
click_on 'Bestätigen', match: :first
@subject_volunteer.reload
assert_equal @subject_volunteer.hours.first.hours, 10
@spv.reload
assert_equal @spv.hours.first.hours, 10
within '.table.table-striped.hours-table' do
assert_text "#{I18n.l(Time.zone.now.to_date)} 10.0"
end
......@@ -91,12 +83,12 @@ class SemesterFeedbackTest < ApplicationSystemTestCase
fill_in 'IBAN', with: 'CH59 2012 0767 0052 0024 0'
fill_in 'Name der Bank', with: 'Bank'
click_on 'Bestätigen'
@subject_volunteer.reload
assert_equal @subject_volunteer.volunteer.slice(:iban, :bank, :waive),
@spv.reload
assert_equal @spv.volunteer.slice(:iban, :bank, :waive),
{ iban: 'CH59 2012 0767 0052 0024 0', bank: 'Bank', waive: false }.stringify_keys
assert_equal @subject_volunteer.semester_feedbacks.last.slice(:goals, :achievements, :future, :comments, :conversation),
assert_equal @spv.semester_feedbacks.last.slice(:goals, :achievements, :future, :comments, :conversation),
{ goals: 'being on time', achievements: 'everything', future: 'continue', comments: 'nothing', conversation: true }.stringify_keys
assert_equal @subject_volunteer.hours.last.hours, 33
assert_equal @spv.hours.last.hours, 33
end
test 'truncate_modal_shows_all_text' do
......@@ -107,7 +99,7 @@ class SemesterFeedbackTest < ApplicationSystemTestCase
@superadmin = create :user
login_as @superadmin
visit review_semester_semester_process_volunteer_path(@subject_volunteer)
visit review_semester_semester_process_volunteer_path(@spv)
fill_in 'Was waren die wichtigsten Inhalte (oder Ziele) Ihres Einsatzes in den letzten Monaten?', with: goals
fill_in 'Was konnte in den letzten Monaten erreicht werden?', with: achievements
......@@ -117,7 +109,7 @@ class SemesterFeedbackTest < ApplicationSystemTestCase
# submit feedback without revisiting review form
check 'Ich verzichte auf die Auszahlung von Spesen.'
click_on 'Bestätigen', match: :first
@subject_volunteer.reload
@spv.reload
visit semester_process_volunteers_path
page.find('td', text: goals.truncate(300)).click
......
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