Compare commits

...

7 Commits

Author SHA1 Message Date
Daniel O'Connor
d57ca1b4bb Merge branch 'dev' into fix-3278 2024-07-23 19:44:09 +09:30
Daniel O'Connor
dc4133abd2 Merge branch 'dev' into fix-3278 2024-07-17 20:06:48 +09:30
Daniel O'Connor
0b4bdc6946 Re-add expectation 2024-07-13 09:55:06 +00:00
Daniel O'Connor
3d308db0d9 'Only required for wrangers, and only when approving 2024-07-13 09:54:31 +00:00
Daniel O'Connor
bfa1ae3ae2 Require a name 2024-07-13 09:42:20 +00:00
Daniel O'Connor
71ef2c058b Require a URL 2024-07-13 09:41:35 +00:00
Daniel O'Connor
b42385be14 Fix #3278 by ensuring we rebuild names on error 2024-07-13 09:39:58 +00:00
2 changed files with 8 additions and 3 deletions

View File

@@ -113,7 +113,12 @@ class CropsController < ApplicationController
@crop.approval_status = "pending"
end
notify_wranglers if Crop.transaction { @crop.save && save_crop_names }
if Crop.transaction { @crop.save && save_crop_names }
notify_wranglers
else
@crop.alternate_names.build
@crop.scientific_names.build
end
respond_with @crop
end

View File

@@ -26,7 +26,7 @@
%h2 Basic information
.form-group#new_crop
= f.text_field :name
= f.text_field :name, required: true
%span.help-block
The common name for the crop, in English (required).
- if can? :wrangle, @crop
@@ -43,7 +43,7 @@
- unless @crop.approved?
= link_to 'Search wikipedia', "https://en.wikipedia.org/w/index.php?search=#{@crop.name}", target: '_blank'
= f.text_field :en_wikipedia_url, id: "en_wikipedia_url", label: 'Wikipedia URL'
= f.url_field :en_wikipedia_url, id: "en_wikipedia_url", label: 'Wikipedia URL'
%span.help-block
Link to the crop's page on the English language Wikipedia (required).