mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-25 01:13:03 -04:00
Compare commits
44 Commits
rubocop-mr
...
datepicker
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
75807ba2af | ||
|
|
62406a6573 | ||
|
|
53e90f57dd | ||
|
|
54acc2c108 | ||
|
|
0639cd5ab8 | ||
|
|
41c4ae1448 | ||
|
|
99221d7cf3 | ||
|
|
eeb8c84c31 | ||
|
|
e65dd4ef85 | ||
|
|
40ed3c8007 | ||
|
|
035decb132 | ||
|
|
7102552bfe | ||
|
|
e1270512dc | ||
|
|
8d40355355 | ||
|
|
919c3dbf37 | ||
|
|
3e7a58fcfc | ||
|
|
fc301558e1 | ||
|
|
2523bea154 | ||
|
|
f89d64ac3a | ||
|
|
65a0540e3d | ||
|
|
654aa318c4 | ||
|
|
5128c8be0e | ||
|
|
0e1578aeef | ||
|
|
c6b5cc61da | ||
|
|
dddc85c338 | ||
|
|
69e764dd63 | ||
|
|
8aa0f98196 | ||
|
|
4c8c54eadd | ||
|
|
9c6797e850 | ||
|
|
a5f774f043 | ||
|
|
fe0d4295be | ||
|
|
c5bdac4a5c | ||
|
|
195602288c | ||
|
|
c78a347002 | ||
|
|
5178e1257e | ||
|
|
03f8acdd1d | ||
|
|
426cb3ed37 | ||
|
|
4716b33d82 | ||
|
|
329c3ddddd | ||
|
|
3405d224b4 | ||
|
|
bd858a0b23 | ||
|
|
defc3def4f | ||
|
|
4b0e228525 | ||
|
|
0f9e151c15 |
@@ -39,9 +39,7 @@
|
||||
= link_to "Add a planting.", new_planting_path
|
||||
|
||||
.col-md-4
|
||||
= f.date_field :due_date,
|
||||
value: @activity.due_date ? @activity.due_date.to_fs(:ymd) : '',
|
||||
label: 'When?'
|
||||
= f.date_field :due_date, value: @activity.due_date ? @activity.due_date.to_fs(:ymd) : '', label: 'When?'
|
||||
|
||||
%hr
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
= link_to "Request new crops.", new_crop_path
|
||||
|
||||
.col-md-4
|
||||
= f.date_field :harvested_at, value: @harvest.harvested_at ? @harvest.harvested_at.to_fs(:ymd) : '', label: 'When?'
|
||||
= f.date_field :harvested_at, value: @harvest.harvested_at ? @harvest.harvested_at.to_fs(:ymd) : '', label: 'When?', required: true
|
||||
.col-12
|
||||
= f.form_group :plant_part_id, label: { text: "Harvested Plant Part" } do
|
||||
.row
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
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?', title: "Plan out your future plantings by forward dating, and subscribe to your iCalendar feed for reminders to plant"
|
||||
|
||||
@@ -50,9 +50,8 @@
|
||||
= f.check_box :finished, label: t('buttons.mark_as_finished'), title: 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'
|
||||
.row
|
||||
|
||||
@@ -28,23 +28,23 @@
|
||||
= link_to "Request new crops.", new_crop_path
|
||||
.row
|
||||
.col-12.col-md-4
|
||||
= f.text_field :saved_at,
|
||||
= f.date_field :saved_at,
|
||||
value: @seed.saved_at ? @seed.saved_at.to_fs(:ymd) : '',
|
||||
class: 'add-datepicker', label: 'When were the seeds harvested/saved?'
|
||||
label: 'When were the seeds harvested/saved?'
|
||||
.col-12.col-md-4= f.number_field :quantity, label: 'Quantity', min: 1
|
||||
.col-12.col-md-4
|
||||
= f.text_field :plant_before, class: 'add-datepicker',
|
||||
value: @seed.plant_before ? @seed.plant_before.to_fs(:ymd) : ''
|
||||
= f.date_field :plant_before, value: @seed.plant_before ? @seed.plant_before.to_fs(:ymd) : ''
|
||||
|
||||
.row
|
||||
.col-12.col-md-4
|
||||
= f.check_box :finished, label: t('buttons.mark_as_finished')
|
||||
.col-12.col-md-4
|
||||
= f.text_field :finished_at, class: 'add-datepicker', value: @seed.finished_at ? @seed.finished_at.to_fs(:ymd) : ''
|
||||
= f.date_field :finished_at, value: @seed.finished_at ? @seed.finished_at.to_fs(:ymd) : ''
|
||||
.col-12.col-md-4
|
||||
%span.help-inline= t('.finish_helper')
|
||||
|
||||
.row
|
||||
-# TODO: Range control?
|
||||
.col-md-6= f.number_field :days_until_maturity_min, label_as_placeholder: true, label: 'min', prepend: 'Days until maturity', min: 1
|
||||
.col-md-6= f.number_field :days_until_maturity_max, label_as_placeholder: true, label: 'max', prepend: 'to', append: "days", min: 1
|
||||
|
||||
|
||||
@@ -5,6 +5,5 @@
|
||||
= edit_icon
|
||||
.hide{id: "date--#{model.id}-#{field.to_s}"}
|
||||
= bootstrap_form_for(model) do |f|
|
||||
= f.date_field field,
|
||||
value: model.send(field) ? model.send(field).to_fs(:ymd) : '', label: 'When?'
|
||||
= f.date_field field, value: model.send(field) ? model.send(field).to_fs(:ymd) : '', label: 'When?'
|
||||
= f.submit :save
|
||||
|
||||
@@ -12,6 +12,5 @@
|
||||
- elsif field_type == :select
|
||||
= f.select field, collection
|
||||
- elsif field_type == :date
|
||||
= f.date_field field,
|
||||
value: model.send(field) ? model.send(field).to_fs(:ymd) : '', label: 'When?'
|
||||
= f.date_field field, value: model.send(field) ? model.send(field).to_fs(:ymd) : '', label: 'When?'
|
||||
= f.submit :save
|
||||
|
||||
@@ -62,9 +62,9 @@ describe "Planting a crop", :js, :search do
|
||||
before do
|
||||
visit new_planting_path
|
||||
|
||||
@a_past_date = 15.days.ago.strftime("%Y-%m-%d")
|
||||
@right_now = Time.zone.today.strftime("%Y-%m-%d")
|
||||
@a_future_date = 1.year.from_now.strftime("%Y-%m-%d")
|
||||
@a_past_date = 15.days.ago
|
||||
@right_now = Time.zone.today
|
||||
@a_future_date = 1.year.from_now
|
||||
end
|
||||
|
||||
it "shows that it is not planted yet" do
|
||||
@@ -111,7 +111,7 @@ describe "Planting a crop", :js, :search do
|
||||
fill_in "How many?", with: 42
|
||||
select "cutting", from: "Planted from"
|
||||
select "semi-shade", from: "Sun or shade?"
|
||||
fill_in "When?", with: '2013-03-10'
|
||||
fill_in "When?", with: Time.new(2013, 3, 10)
|
||||
fill_in "Tell us more about it", with: "It's rad."
|
||||
fill_in "Finished date", with: @a_future_date
|
||||
click_button "Save"
|
||||
@@ -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: Time.new(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: Time.new(2014, 7, 1)
|
||||
check "Mark as finished"
|
||||
fill_in "Finished date", with: "2014-08-30"
|
||||
fill_in "Finished date", with: Time.new(2014, 8, 30)
|
||||
uncheck 'Mark as finished'
|
||||
end
|
||||
|
||||
@@ -276,7 +276,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: Time.new(2015, 10, 15)
|
||||
fill_in "How many?", with: 42
|
||||
select "cutting", from: "Planted from"
|
||||
select "sun", from: "Sun or shade?"
|
||||
|
||||
@@ -33,7 +33,7 @@ describe "Seeds", :js, :search do
|
||||
select_from_autocomplete "maize"
|
||||
within "form#new_seed" do
|
||||
fill_in "Quantity", with: 42
|
||||
fill_in "Plant before", with: "2014-06-15"
|
||||
fill_in "Plant before", with: TIme.new(2014, 6, 15)
|
||||
fill_in "min", with: 999
|
||||
fill_in "max", with: 1999
|
||||
select "certified organic", from: "Organic?"
|
||||
|
||||
@@ -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