osu-cascades / ecotone-web

Monitoring native plants & biodiversity at OSU Cascades.
http://ecotone.osucascades.edu
MIT License
6 stars 9 forks source link

Add qrcode property to plots, upon creation #45

Closed ybakos closed 7 years ago

ybakos commented 7 years ago

https://github.com/whomwah/rqrcode

nathanstruhs commented 7 years ago

plants.each create qr code in migration

nathanstruhs commented 7 years ago

Hi @ybakos,

Before I pull the trigger on this migration, I was hoping you could take a look at it: https://github.com/osu-cascades/ecotone-web/blob/qr-code/db/migrate/20170526185353_add_attachment_qr_code_to_plots.rb

Couple questions

ybakos commented 7 years ago

Will try to get to this today, 6/26.

ybakos commented 7 years ago

@nathanstruhs I think we should avoid storing the generated qrcode image entirely - but correct me if I'm forgetting something. Now that I've had time to take a look at the library, it seems we can just QRCode.new(plot_path(@plot)) in the view for plots#show, embedding the resulting svg/html in the page with the respectful methods.

Bio users can then just print the page and make a little physical qrcode label (we'll have to experiment with this, for sizing, etc) and ultimately we can have a simple "print qr code" button that makes it a little better.

I think using plot_path is a smarter approach than plot_url, since, although the former requires a little string concatenation with a literal hostname, the latter decouples the qrcode from the hostname (in case it changes later).