mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-25 09:19:15 -04:00
Compare commits
17 Commits
release85
...
planted_at
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
44e2149fe1 | ||
|
|
4f548a8f8e | ||
|
|
6c1f1a8542 | ||
|
|
37441120c2 | ||
|
|
6ec5226f0b | ||
|
|
6ecac1526d | ||
|
|
d5ad194ded | ||
|
|
30ac140eb7 | ||
|
|
d1e6ce6c42 | ||
|
|
0eacdf8fb8 | ||
|
|
724d55147b | ||
|
|
e4efa0bfab | ||
|
|
64d51ec4bd | ||
|
|
a689b04bfc | ||
|
|
bce1407859 | ||
|
|
a04cbf3b2a | ||
|
|
5cf14ad536 |
@@ -124,7 +124,7 @@ class Planting < ApplicationRecord
|
||||
def finished_must_be_after_planted
|
||||
return unless planted_at && finished_at # only check if we have both
|
||||
|
||||
errors.add(:finished_at, "must be after the planting date") unless planted_at < finished_at
|
||||
errors.add(:finished_at, "must be after the planting date (#{finished_at}) < #{planted_at}") unless planted_at < finished_at
|
||||
end
|
||||
|
||||
def owner_must_match_garden_owner
|
||||
|
||||
@@ -32,9 +32,9 @@
|
||||
label: 'Where did you plant it?')
|
||||
= link_to "Add a garden.", new_garden_path
|
||||
.col-md-4
|
||||
= f.text_field :planted_at,
|
||||
= f.date_field :planted_at,
|
||||
value: @planting.planted_at ? @planting.planted_at.to_fs(:ymd) : '',
|
||||
class: 'add-datepicker', label: 'When?'
|
||||
label: 'When?'
|
||||
%span.help-inline
|
||||
Tip: Plan our your future plantings by forward dating, and subscribe to your iCalendar feed for reminders to plant
|
||||
|
||||
@@ -52,11 +52,9 @@
|
||||
= f.check_box :finished, label: 'Mark as finished'
|
||||
%span.help-block= t('.finish_helper')
|
||||
.col-md-6
|
||||
= f.text_field :finished_at,
|
||||
= f.date_field :finished_at,
|
||||
value: @planting.finished_at ? @planting.finished_at.to_fs(:ymd) : '',
|
||||
class: 'add-datepicker',
|
||||
label: 'Finished date',
|
||||
placeholder: 'optional'
|
||||
label: 'Finished date'
|
||||
|
||||
.card-footer
|
||||
.text-right= f.submit 'Save'
|
||||
|
||||
@@ -39,7 +39,7 @@ describe "Planting a crop", :js, :search do
|
||||
select "semi-shade", from: "Sun or shade?"
|
||||
fill_in "Tell us more about it", with: "It's rad."
|
||||
choose 'Garden'
|
||||
fill_in "When", with: "2014-06-15"
|
||||
fill_in "When", with: Date.parse("2014-06-15")
|
||||
click_button "Save"
|
||||
end
|
||||
end
|
||||
@@ -185,7 +185,7 @@ describe "Planting a crop", :js, :search do
|
||||
click_link 'Actions'
|
||||
click_link "Edit"
|
||||
check "finished"
|
||||
fill_in "Finished date", with: "2015-06-25"
|
||||
fill_in "Finished date", with: Date.parse("2015-06-25")
|
||||
click_button "Save"
|
||||
expect(page).to have_content "planting was successfully updated"
|
||||
expect(page).to have_content "Finished"
|
||||
@@ -196,9 +196,9 @@ describe "Planting a crop", :js, :search do
|
||||
select_from_autocomplete "maize"
|
||||
choose(member.gardens.first.name)
|
||||
within "form#new_planting" do
|
||||
fill_in "When?", with: "2014-07-01"
|
||||
fill_in "When?", with: Date.parse("2014-07-01")
|
||||
check "Mark as finished"
|
||||
fill_in "Finished date", with: "2014-08-30"
|
||||
fill_in "Finished date", with: Date.parse("2014-08-30")
|
||||
uncheck 'Mark as finished'
|
||||
end
|
||||
|
||||
@@ -253,7 +253,7 @@ describe "Planting a crop", :js, :search do
|
||||
fill_autocomplete "crop", with: "mai"
|
||||
select_from_autocomplete "maize"
|
||||
within "form#new_planting" do
|
||||
fill_in "When", with: "2015-10-15"
|
||||
fill_in "When", with: Date.parse("2015-10-15")
|
||||
fill_in "How many?", with: 42
|
||||
select "cutting", from: "Planted from"
|
||||
select "sun", from: "Sun or shade?"
|
||||
|
||||
@@ -22,6 +22,6 @@ describe "plantings/_form" do
|
||||
end
|
||||
|
||||
it "has a free-form text field containing the planting date in ISO format" do
|
||||
assert_select "input#planting_planted_at[type='text'][value='2013-03-01']"
|
||||
assert_select "input#planting_planted_at[type='date'][value='2013-03-01']"
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user