Skip to content
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

Feature/Custom start page property for f-pdf-viewer #875

Open
wants to merge 2 commits into
base: 8.0.x
Choose a base branch
from

Conversation

b0ink
Copy link

@b0ink b0ink commented Sep 28, 2024

Description

Implements an optional [startPage] input property to the f-pdf-viewer component that accepts a page number that the pdf viewer will scroll to when it renders.

This PR adds [startPage]="2" to only the f-pdf-viewer used in the tutor inbox section, so that tutors no longer have to scroll past the initial page in every submission.

Example:

    <f-pdf-viewer [pdfUrl]="pdfUrl" [startPage]="2"></f-pdf-viewer>

Notes:
The startPage property will default to 1 if it's not passed in the component.
However, if startPage is 1, the initial scrollToPage(this.startPage) function will not be called in onPageRendered() since users could already be scrolling down before this is called - and onLoaded() is called too soon to use scrollToPage(). (Overall behaviour remains the same)

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • Testing this requires a multi-page PDF, so you can temporarily copy over doubtfire-api/test_files/submissions/1.2P.pdf into the doubtfire-api/test_files/unit_files/ directory and rename it to sample-student-submission.pdf to override the original single page PDF
  • Alternatively, login as a student and upload a multi-page PDF to a task that atutor has access to, then run rake submission:generate_pdfs in doubtfire-api
  • Login as atutor and select any unit, then select either the Inbox or Task Explorer dropdown
  • Ensure you're not using the native PDF viewer by keeping the toggle icon (next to the download icon) in the off position.
  • When selecting a submission from the list, the pdf-viewer will automatically load the PDF submission from the second page

Testing Checklist:

  • Tested in latest Chrome
  • Tested in latest Safari
  • Tested in latest Firefox

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant