mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-11-03 11:44:17 -05:00
Keep every packet label when a side is photographed again, and use the newest photo of a side. Before, giving a second photo the same label cleared the older photo's, which let it back into the crop's photos and default picture. Carry the label through the HTML photo picker (its search form and the links that add a photo), so a packet photo added without JavaScript is labelled. Have the OCR script treat any network failure on an image (DNS, timeout) as that image failing, so the rest of the batch still runs. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
58 lines
1.9 KiB
Plaintext
58 lines
1.9 KiB
Plaintext
- content_for :title, "New Photo"
|
|
|
|
%h1 New Photo
|
|
%h2 Choose photo for #{link_to @item, @item} from Flickr, or contribute to unique crops to <a href="https://inaturalist.org/" target="_blank">iNaturalist</a> or <a href="https://identify.plantnet.org/" target="_blank">Pl@ntNet</a> via the app.
|
|
|
|
- if @please_reconnect_flickr
|
|
%h2.alert Please reconnect your flickr account
|
|
|
|
%p the token has expired or been revoked.
|
|
|
|
= link_to '/members/auth/flickr', class: "btn btn-lg" do
|
|
= icon 'fab', 'flickr'
|
|
Reconnect Flickr
|
|
|
|
|
|
- elsif @flickr_auth
|
|
%p
|
|
Connected to Flickr as
|
|
= succeed "." do
|
|
= link_to @flickr_auth.name, "http://flickr.com/photos/#{@flickr_auth.uid}"
|
|
Please select a photo from your recent uploads.
|
|
|
|
|
|
%p
|
|
= bootstrap_form_tag(url: new_photo_path, method: :get, layout: :inline) do |f|
|
|
- if @sets && !@sets.empty?
|
|
= f.select :set, options_for_select(@sets, @current_set), label: "Choose a photo album", include_blank: true
|
|
= f.text_field :tag, value: @current_tag, label: "or search by tag"
|
|
= hidden_field_tag :type, @type
|
|
= hidden_field_tag :id, @id
|
|
= hidden_field_tag :label, @label if @label.present?
|
|
= f.submit "Search", class: "btn btn-success"
|
|
|
|
- if @sets && @current_set
|
|
%h2= @sets.key(@current_set)
|
|
|
|
.row.pagination
|
|
.col-md-12= page_entries_info @photos
|
|
.col-md-12= will_paginate @photos
|
|
|
|
.row
|
|
- @photos.each do |photo|
|
|
.col-md-2.col-6
|
|
.card
|
|
= link_to photos_path(photo: { source_id: photo.id, source: 'flickr' }, id: @id, type: @type, label: @label.presence), method: :post do
|
|
= image_tag(FlickRaw.url_z(photo), alt: photo.title, class: 'img img-card')
|
|
.card-body= photo.title
|
|
|
|
.row.pagination
|
|
.col-md-12= will_paginate @photos
|
|
- else
|
|
%h2.alert You must connect your account to Flickr to add photos.
|
|
|
|
%p
|
|
= link_to '/members/auth/flickr', class: :btn do
|
|
= icon 'fab', 'flickr'
|
|
connect to Flickr
|