From 6262f9ab40a5bc9086038bdda962118d0c220d9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Ko=C5=82to=C5=84ski?= Date: Fri, 24 Jul 2020 01:48:18 +0200 Subject: [PATCH 1/2] Display suitable information for attendance email confirm --- app/views/admin/members/show.html.haml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/views/admin/members/show.html.haml b/app/views/admin/members/show.html.haml index 99feb099f..2ab97c0ea 100644 --- a/app/views/admin/members/show.html.haml +++ b/app/views/admin/members/show.html.haml @@ -9,9 +9,14 @@ = link_to admin_member_send_eligibility_email_path(@member), data: {confirm: "Clicking OK will send an automated email to this user now to verify their eligibility for codebar. This cannot be undone. Are you sure?"}, class: 'item' do %i.fa.fa-envelope %label Eligibility - = link_to admin_member_send_attendance_email_path(@member), data: {confirm: "Clicking OK will send an automated email to this user now to warn them about missing too many workshops. This cannot be undone. Are you sure?"}, class: 'item' do - %i.fa.fa-clock-o - %label Attendance + - if @member.attendance_warnings.empty? + = link_to admin_member_send_attendance_email_path(@member), data: {confirm: "Clicking OK will send an automated email to this user now to warn them about missing too many workshops. This cannot be undone. Are you sure?"}, class: 'item' do + %i.fa.fa-clock-o + %label Attendance + - else + = link_to admin_member_send_attendance_email_path(@member), data: {confirm: "#{@member.name} has already received a warning about missing too many workshops on #{@member.attendance_warnings.last.created_at.strftime("%Y-%m-%d at %H:%M")}. Are you sure you want to proceed with sending another one?"}, class: 'item' do + %i.fa.fa-clock-o + %label Attendance %section .stripe.reverse From c0d36ca3a1cea084aed09f4de9e18457ff8bc6b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Ko=C5=82to=C5=84ski?= Date: Sat, 25 Jul 2020 16:20:44 +0200 Subject: [PATCH 2/2] Update warn user test --- spec/features/admin/members_spec.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/features/admin/members_spec.rb b/spec/features/admin/members_spec.rb index 5aabf7a59..966aa1888 100644 --- a/spec/features/admin/members_spec.rb +++ b/spec/features/admin/members_spec.rb @@ -62,8 +62,10 @@ scenario 'Warn a user' do visit admin_member_path member + expect(page).to have_selector("a[data-confirm='Clicking OK will send an automated email to this user now to warn them about missing too many workshops. This cannot be undone. Are you sure?']") click_on 'Attendance' - + expect(page).to have_selector("a[data-confirm='#{member.name} has already received a warning about missing too many workshops on #{member.attendance_warnings.last.created_at.strftime("%Y-%m-%d at %H:%M")}. Are you sure you want to proceed with sending another one?']") expect(page).to have_content 'You have sent an attendance warning.' end + end