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

🎁 IiifPrint Re Split PDF on command #294

Open
5 of 6 tasks
ShanaLMoore opened this issue Nov 20, 2023 · 1 comment
Open
5 of 6 tasks

🎁 IiifPrint Re Split PDF on command #294

ShanaLMoore opened this issue Nov 20, 2023 · 1 comment

Comments

@ShanaLMoore
Copy link
Contributor

ShanaLMoore commented Nov 20, 2023

Summary

LaRita has a WIP PR that covers the backend work required for this feature 🎉 (this has not been tested yet).

We need to create a frontend button or interface, on a PDF fileset, that would trigger the backend behavior.

consider user permissions - the user should be able to edit.

Before starting, ask Jeremy for notes

Tasks

  • Leverage https://github.com/samvera/hyrax/blob/b334e186e77691d7da8ed59ff27f091be1c2a700/app/views/hyrax/file_sets/_show_actions.html.erb file to add the link/button to POST a request a split (within the if @presenter.editor? ... block)
    • only render this new button when the file set is a PDF
  • Create a decorator for the Hyrax::FileSetsController with the split_pdf action
    • When the FileSet is not a PDF raise an exception (e.g. FileSet is expected to be a PDF) (Note: We'll want this in cases where the above conditional failed and yet here we are. The exception will report to Sentry)
    • When the FileSet is a PDF we want to spawn a job to perform the splitting
  • Create a job that wraps the above PR
  • Add a route that POSTs to the newly created action; you'll likely need that route to have a :id parameter so that the decorator will properly behave.
  • Add to Adventist (updating routes)

Considerations

(Jeremy here): I had thought about creating a separate controller, to avoid the decorator pattern. That separate controller would be IiifPrint::PdfSplitsController. The action would be create and follow the above guidance. Advantages would be keeping the controller space clear.

I have several projects located on my machine; and it looks as though we have not overriden the file_sets behavior. See details:

`cd ~/git; fd _show_actions.html | rg file_sets`
hyrax/app/views/hyrax/file_sets/_show_actions.html.erb
hyrax/spec/views/hyrax/file_sets/_show_actions.html.erb_spec.rb
dlp-curate/app/views/hyrax/file_sets/_show_actions.html.erb

Acceptance Criteria

  • When a user clicks a button, the PDF should split (or re-split).
@jeremyf jeremyf assigned jeremyf and unassigned jeremyf Nov 22, 2023
jeremyf added a commit that referenced this issue Nov 27, 2023
For applications that have already installed IiifPrint, you'll need to
manually add the following to your `config/routes.rb` file:

```ruby
mount IiifPrint::Engine, at: '/'
```

Related to:

- #292
- #294

Co-authored-by: LaRita Robinson <larita@scientist.com>
jeremyf added a commit that referenced this issue Nov 27, 2023
For applications that have already installed IiifPrint, you'll need to
manually add the following to your `config/routes.rb` file:

```ruby
mount IiifPrint::Engine, at: '/'
```

Related to:

- #292
- #294

Co-authored-by: LaRita Robinson <larita@scientist.com>
jeremyf added a commit that referenced this issue Nov 28, 2023
For applications that have already installed IiifPrint, you'll need to
manually add the following to your `config/routes.rb` file:

```ruby
mount IiifPrint::Engine, at: '/'
```

Related to:

- #292
- #294

Co-authored-by: LaRita Robinson <larita@scientist.com>
jeremyf added a commit that referenced this issue Nov 28, 2023
This commit replaces raising exceptions when we can't derive the URL.
Instead it opts to return nil and let the caller determine what to do.

The primary result is that it's easier to have a rodeo configuration
"miss" finding files in the pre-process location due to configuration
issues.

But alas, that's the nature of a rodeo.

Related to:

- #294
@laritakr
Copy link
Contributor

@jeremyf jeremyf removed their assignment May 30, 2024
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

No branches or pull requests

3 participants