Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions app/views/admin/members/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion spec/features/admin/members_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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