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

save and load templates, with tabula-java-1.0.0 #711

Merged
merged 24 commits into from
Aug 10, 2017

Conversation

jeremybmerrill
Copy link
Member

this set of commits adds UI and serverside ability to

save a template from the extraction view
load an already-saved template from the extraction view
upload/download/rename a template from disk in the Library (front page) view
this incorporates @cheapsteak's #669 PR. this will close the feature requested in #608, #483, #93, #505.

The "template" is the same as the JSON output you can already download from the export view. Template metadata is recorded in workspace.json, which now has a new format (with stuff to automatically convert existing workspace.json files).

@jazzido @mtigas, anyone else, wanna take a look? (I already showed Mike IRL)

this is kind of just a first-stab at the problem, there's a bunch of enhancements that could be done now:

refactor tabula_web.rb's template persistence stuff, which is a little repetitive and gross right now
reimplement Autodetected Selections as a template, since it's really the same thing
how should we handle repeated selections? (i.e. if the template is saved with one selection repeated on pages 2 thru 100 of 100 page PDF, and that selection is loaded on a 102 page PDF, should we apply the selection to the following pages?)
you should be able to name templates from PDFView
you should be able to "overwrite" old templates from PDFView (i.e. loading a template, modifying it, and saving it as teh same one, not a new one)
maybe you should be able to upload templates in PDFView (rather than just on the front page)
"batch" mode from front page, applying one template to multiple PDFs all at once.
how to handle selections that don't "match" the PDF they're applied to -- maybe a selection's coordinates are outside the page on the new PDF, or there are selections on pages that don't exist in the new PDF.

This PR is an updated version of #705, except it's proposed to merge into tabula-java-1.0.0 per @jazzido's request, so we can do it all at once.

@jeremybmerrill
Copy link
Member Author

@jazzido I'll also note: this converts from the old workspace.json format to the new one. The new singleton Tabula::Workspace thingy works great, thanks for adding that!


def create_template(template_info)
puts template_info.inspect
template_name = template_info["name"] || "Unnamed Template #{Time.now.to_s}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jeremybmerrill can we move this to Tabula::Workspace? Thanks!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I inlined it in the route where it's called. I think it's not really about manipulating the workspace, but instead about manipulating templates. e9fd394

@jazzido
Copy link
Contributor

jazzido commented Aug 10, 2017

Awesome, @jeremybmerrill ! Thanks a lot. Just submitted a minor change request.

@@ -3,6 +3,7 @@ language: ruby
before_install:
- gem update --system
- gem install bundler
- gem install jbundler
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Man, Travis is driving me nuts. jbundler is in the Gemfile, so that wouldn't be necessary right? So frustrating.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Soooo frustrating, yes.

@jazzido
Copy link
Contributor

jazzido commented Aug 10, 2017

BTW, it'd be nice to give some feedback when the user clicks the "Save as template" button.

@jazzido
Copy link
Contributor

jazzido commented Aug 10, 2017

OMG it worked. Thanks!

@jazzido jazzido merged commit 68c83fe into tabula-java-1.0.0 Aug 10, 2017
jeremybmerrill pushed a commit that referenced this pull request Jun 26, 2018
save and load templates, with tabula-java-1.0.0
@Al-aminI
Copy link

please how can i c reate a template.json

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.

4 participants