-
-
Notifications
You must be signed in to change notification settings - Fork 201
perf: targeted row replacement for verify-attendance clicks #2685
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e47055b
perf: eager-load attendance_warnings and overrider in workshop scopes
mroderick c09f093
perf: targeted row replacement for verify-attendance clicks
mroderick 56dbbc6
feat: unverify attendance with targeted row replacement
mroderick c76e2ea
refactor: remove unused flash messages from attended update helpers
mroderick 6264d41
refactor: declare strict locals on attendance_row partial
mroderick cfc5a72
Merge branch 'master' into feature/fast-workshop-attendance
mroderick File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| -# locals: (invitation:, workshop:) | ||
| .row.attendee.mt-3{ id: "attendee-row-#{invitation.id}" } | ||
| .col-1 | ||
| - if (workshop.date_and_time - 30.minutes).past? | ||
| - if invitation.attended.nil? | ||
| = link_to admin_workshop_invitation_path(workshop, invitation, attended: true), | ||
| class: 'verify_attendance', title: 'Verify attendance', method: :put, remote: true, | ||
| data: { disable_with: "<i class='fa fa-spinner spin'></i>" } do | ||
| %i.far.fa-square | ||
| - else | ||
| = link_to admin_workshop_invitation_path(workshop, invitation, attended: false), | ||
| class: 'verify_attendance', title: 'Unverify attendance', method: :put, remote: true, | ||
| data: { disable_with: "<i class='fa fa-spinner spin'></i>" } do | ||
| %i.far.fa-check-square | ||
| - else | ||
| = link_to admin_workshop_invitation_path(workshop, invitation, attending: false), class: 'cancel_attendance float-right', title: 'Cancel RSVP', data: { confirm: "Are you sure you want to remove #{invitation.member.full_name} from the list of attendees?" }, method: :put, remote: true do | ||
| %i.far.fa-minus-square | ||
| .col-5 | ||
| - if invitation.member.newbie? | ||
| %span{'data-bs-toggle': 'tooltip', 'data-bs-placement': 'bottom', title: 'New attendee.' } | ||
| %i.fas.fa-paw | ||
| - elsif invitation.member.flag_to_organisers? | ||
| %span{'data-bs-toggle': 'tooltip', 'data-bs-placement': 'bottom', title: 'Multiple no shows and attendance warnings in the last six months' } | ||
| %i.fas.fa-exclamation-circle | ||
|
|
||
| - if invitation.member.recent_notes.any? | ||
| %span{'data-bs-toggle': 'tooltip', 'data-bs-placement': 'bottom', title: 'Note recently added'} | ||
| %i.fas.fa-comment | ||
|
|
||
| = link_to admin_member_path(invitation.member) do | ||
| - if invitation.member.full_name.blank? | ||
| = invitation.member.email | ||
| - else | ||
| = invitation.member.full_name | ||
| - if invitation.member.dietary_restrictions.present? | ||
| %p | ||
| - invitation.member.displayed_dietary_restrictions.each do |dr| | ||
| %span.badge.bg-secondary.text-wrap.text-break.mb-1.text-start= dr | ||
| .col-6 | ||
| - if invitation.tutorial? | ||
| %p.mb-1 Tutorial: #{invitation.tutorial} | ||
| - if invitation.note? | ||
| %p.mb-1 Note: #{invitation.note} | ||
| - if invitation.rsvp_time.present? | ||
| %span{'data-bs-toggle': 'tooltip', 'data-bs-placement': 'bottom', title: 'Time of RSVP'} | ||
| %p.mb-1.small | ||
| %i.fas.fa-history | ||
| = l(invitation.rsvp_time) | ||
| - if invitation.automated_rsvp? | ||
| - tooltip_args = { 'data-bs-toggle': 'tooltip', 'data-bs-placement': 'bottom' } | ||
| - if invitation.last_overridden_by_id? | ||
| %span{ tooltip_args, title: "Addition by #{invitation.overrider.full_name}" } | ||
| %p.mb-1.small | ||
| %i.fas.fa-hat-wizard | ||
| - else | ||
| %span{ tooltip_args, title: 'Waiting list or admin addition' } | ||
| %p.mb-1.small | ||
| %i.fas.fa-magic | ||
| - if invitation.reminded_at.present? | ||
| %span{'data-bs-toggle': 'tooltip', 'data-bs-placement': 'bottom', title: 'Reminder emailed at'} | ||
| %p.mb-1.small | ||
| %i.far.fa-clock | ||
| = l(invitation.reminded_at) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,62 +1,4 @@ | ||
| .row | ||
| .col.attendances | ||
| - invitations.each do |invitation| | ||
| .row.attendee.mt-3 | ||
| .col-1 | ||
| - if (invitation.parent.date_and_time - 30.minutes).past? | ||
| - if invitation.attended.nil? | ||
| = link_to admin_workshop_invitation_path(@workshop, invitation, attended: true), | ||
| class: 'verify_attendance', title: 'Verify attendance', method: :put, remote: true, | ||
| data: { disable_with: "<i class='fa fa-spinner spin'></i>" } do | ||
| %i.far.fa-square | ||
| - else | ||
| %i.far.fa-check-square | ||
| - else | ||
| = link_to admin_workshop_invitation_path(@workshop, invitation, attending: false), class: 'cancel_attendance float-right', title: 'Cancel RSVP', data: { confirm: "Are you sure you want to remove #{invitation.member.full_name} from the list of attendees?" }, method: :put, remote: true do | ||
| %i.far.fa-minus-square | ||
| .col-5 | ||
| - if invitation.member.newbie? | ||
| %span{'data-bs-toggle': 'tooltip', 'data-bs-placement': 'bottom', title: 'New attendee.' } | ||
| %i.fas.fa-paw | ||
| - elsif invitation.member.flag_to_organisers? | ||
| %span{'data-bs-toggle': 'tooltip', 'data-bs-placement': 'bottom', title: 'Multiple no shows and attendance warnings in the last six months' } | ||
| %i.fas.fa-exclamation-circle | ||
|
|
||
| - if invitation.member.recent_notes.any? | ||
| %span{'data-bs-toggle': 'tooltip', 'data-bs-placement': 'bottom', title: 'Note recently added'} | ||
| %i.fas.fa-comment | ||
|
|
||
| = link_to admin_member_path(invitation.member) do | ||
| - if invitation.member.full_name.blank? | ||
| = invitation.member.email | ||
| - else | ||
| = invitation.member.full_name | ||
| - if invitation.member.dietary_restrictions.present? | ||
| %p | ||
| - invitation.member.displayed_dietary_restrictions.each do |dr| | ||
| %span.badge.bg-secondary.text-wrap.text-break.mb-1.text-start= dr | ||
| .col-6 | ||
| - if invitation.tutorial? | ||
| %p.mb-1 Tutorial: #{invitation.tutorial} | ||
| - if invitation.note? | ||
| %p.mb-1 Note: #{invitation.note} | ||
| - if invitation.rsvp_time.present? | ||
| %span{'data-bs-toggle': 'tooltip', 'data-bs-placement': 'bottom', title: 'Time of RSVP'} | ||
| %p.mb-1.small | ||
| %i.fas.fa-history | ||
| = l(invitation.rsvp_time) | ||
| - if invitation.automated_rsvp? | ||
| - tooltip_args = { 'data-bs-toggle': 'tooltip', 'data-bs-placement': 'bottom' } | ||
| - if invitation.last_overridden_by_id? | ||
| %span{ tooltip_args, title: "Addition by #{invitation.overrider.full_name}" } | ||
| %p.mb-1.small | ||
| %i.fas.fa-hat-wizard | ||
| - else | ||
| %span{ tooltip_args, title: 'Waiting list or admin addition' } | ||
| %p.mb-1.small | ||
| %i.fas.fa-magic | ||
| - if invitation.reminded_at.present? | ||
| %span{'data-bs-toggle': 'tooltip', 'data-bs-placement': 'bottom', title: 'Reminder emailed at'} | ||
| %p.mb-1.small | ||
| %i.far.fa-clock | ||
| = l(invitation.reminded_at) | ||
| = render partial: 'admin/workshop/attendance_row', locals: { invitation: invitation, workshop: @workshop } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: Opportunity to use the Rails Strict Locals declaration here, which is sort of a function arg declaration list. Example blog post mentioning the feature - https://masilotti.com/safer-rails-partials-with-strict-locals/#strict-locals