mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-25 09:19:15 -04:00
Compare commits
7 Commits
feature-us
...
feature/pr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4b9763e1da | ||
|
|
8709ac6e8f | ||
|
|
d75f503b16 | ||
|
|
1dfc5abca9 | ||
|
|
cc97916bac | ||
|
|
2134b934f8 | ||
|
|
c8cfb5d42a |
2
.github/workflows/ci-features-admin.yml
vendored
2
.github/workflows/ci-features-admin.yml
vendored
@@ -38,7 +38,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout this repo
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Configure sysctl limits
|
||||
run: |
|
||||
|
||||
2
.github/workflows/ci-features-comments.yml
vendored
2
.github/workflows/ci-features-comments.yml
vendored
@@ -38,7 +38,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout this repo
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Configure sysctl limits
|
||||
run: |
|
||||
|
||||
@@ -38,7 +38,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout this repo
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Configure sysctl limits
|
||||
run: |
|
||||
|
||||
2
.github/workflows/ci-features-crops.yml
vendored
2
.github/workflows/ci-features-crops.yml
vendored
@@ -38,7 +38,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout this repo
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Configure sysctl limits
|
||||
run: |
|
||||
|
||||
2
.github/workflows/ci-features-gardens.yml
vendored
2
.github/workflows/ci-features-gardens.yml
vendored
@@ -38,7 +38,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout this repo
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Configure sysctl limits
|
||||
run: |
|
||||
|
||||
2
.github/workflows/ci-features-harvests.yml
vendored
2
.github/workflows/ci-features-harvests.yml
vendored
@@ -38,7 +38,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout this repo
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Configure sysctl limits
|
||||
run: |
|
||||
|
||||
2
.github/workflows/ci-features-home.yml
vendored
2
.github/workflows/ci-features-home.yml
vendored
@@ -38,7 +38,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout this repo
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Configure sysctl limits
|
||||
run: |
|
||||
|
||||
2
.github/workflows/ci-features-members.yml
vendored
2
.github/workflows/ci-features-members.yml
vendored
@@ -38,7 +38,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout this repo
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Configure sysctl limits
|
||||
run: |
|
||||
|
||||
2
.github/workflows/ci-features-places.yml
vendored
2
.github/workflows/ci-features-places.yml
vendored
@@ -38,7 +38,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout this repo
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Configure sysctl limits
|
||||
run: |
|
||||
|
||||
2
.github/workflows/ci-features-plantings.yml
vendored
2
.github/workflows/ci-features-plantings.yml
vendored
@@ -38,7 +38,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout this repo
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Configure sysctl limits
|
||||
run: |
|
||||
|
||||
2
.github/workflows/ci-features-posts.yml
vendored
2
.github/workflows/ci-features-posts.yml
vendored
@@ -38,7 +38,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout this repo
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Configure sysctl limits
|
||||
run: |
|
||||
|
||||
2
.github/workflows/ci-features-seeds.yml
vendored
2
.github/workflows/ci-features-seeds.yml
vendored
@@ -38,7 +38,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout this repo
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Configure sysctl limits
|
||||
run: |
|
||||
|
||||
2
.github/workflows/ci-features-timeline.yml
vendored
2
.github/workflows/ci-features-timeline.yml
vendored
@@ -38,7 +38,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout this repo
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Configure sysctl limits
|
||||
run: |
|
||||
|
||||
2
.github/workflows/ci-features.yml
vendored
2
.github/workflows/ci-features.yml
vendored
@@ -38,7 +38,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout this repo
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Configure sysctl limits
|
||||
run: |
|
||||
|
||||
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@@ -6,7 +6,7 @@ jobs:
|
||||
contributors:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install ruby version specified in .ruby-version
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
@@ -53,7 +53,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout this repo
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Configure sysctl limits
|
||||
run: |
|
||||
|
||||
@@ -12,7 +12,6 @@ submit the change with your pull request.
|
||||
- Miles Gould / [pozorvlak](https://github.com/pozorvlak)
|
||||
- Mackenzie Morgan / [maco](https://github.com/maco)
|
||||
- Brenda Wallace / [br3nda](https://github.com/br3nda)
|
||||
- Daniel O'Connor / [CloCkWeRX](https://github.com/CloCkWeRX)
|
||||
|
||||
## Contributors
|
||||
|
||||
@@ -69,6 +68,7 @@ submit the change with your pull request.
|
||||
- Jym Paul Carandang / [jacarandang](https://github.com/jacarandang)
|
||||
- Anthony Atkinson / [sha1sum](https://github.com/sha1sum)
|
||||
- Terence Conquest / [twconquest](https://github.com/twconquest)
|
||||
- Daniel O'Connor / [CloCkWeRX](https://github.com/CloCkWeRX)
|
||||
- DV Dasari / [dv2](https://github.com/dv2)
|
||||
- Eric Tillberg / [Thrillberg](https://github.com/Thrillberg)
|
||||
- Lucas Nogueira / [lucasnogueira](https://github.com/lucasnogueira)
|
||||
@@ -95,11 +95,10 @@ submit the change with your pull request.
|
||||
- Ítalo Pires / [italopires](https://github.com/italopires)
|
||||
- Bennett Zink / [bennett-zink](https://github.com/bennett-zink)
|
||||
- Dominick Thornton / [domthor](https://github.com/domthor)
|
||||
|
||||
|
||||
## Bots
|
||||
|
||||
### Security and Dependency Updates
|
||||
- `codefactor-io[bot]`
|
||||
- DeppBot / [deppbot](https://github.com/deppbot)
|
||||
- `dependabot[bot]` [dependabot](https://github.com/dependabot-bot) / [dependabot-preview](https://github.com/apps/dependabot-preview)
|
||||
- [google-labs-jules[bot]](https://github.com/apps/google-labs-jules)
|
||||
|
||||
5
Gemfile
5
Gemfile
@@ -91,9 +91,10 @@ gem 'bootstrap-datepicker-rails'
|
||||
# DRY-er easier bootstrap 4 forms
|
||||
gem "bootstrap_form", ">= 4.5.0"
|
||||
|
||||
# For connecting to other services (eg Flickr)
|
||||
# For connecting to other services (eg Twitter)
|
||||
gem 'omniauth', '~> 1.3'
|
||||
gem 'omniauth-flickr', '>= 0.0.15'
|
||||
gem 'omniauth-twitter'
|
||||
|
||||
# Pretty charts
|
||||
gem "chartkick"
|
||||
@@ -201,5 +202,3 @@ group :travis do
|
||||
end
|
||||
|
||||
|
||||
|
||||
gem "i18n_data", "~> 1.1"
|
||||
|
||||
153
Gemfile.lock
153
Gemfile.lock
@@ -33,29 +33,29 @@ GEM
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actioncable (7.2.2.2)
|
||||
actionpack (= 7.2.2.2)
|
||||
activesupport (= 7.2.2.2)
|
||||
actioncable (7.2.2.1)
|
||||
actionpack (= 7.2.2.1)
|
||||
activesupport (= 7.2.2.1)
|
||||
nio4r (~> 2.0)
|
||||
websocket-driver (>= 0.6.1)
|
||||
zeitwerk (~> 2.6)
|
||||
actionmailbox (7.2.2.2)
|
||||
actionpack (= 7.2.2.2)
|
||||
activejob (= 7.2.2.2)
|
||||
activerecord (= 7.2.2.2)
|
||||
activestorage (= 7.2.2.2)
|
||||
activesupport (= 7.2.2.2)
|
||||
actionmailbox (7.2.2.1)
|
||||
actionpack (= 7.2.2.1)
|
||||
activejob (= 7.2.2.1)
|
||||
activerecord (= 7.2.2.1)
|
||||
activestorage (= 7.2.2.1)
|
||||
activesupport (= 7.2.2.1)
|
||||
mail (>= 2.8.0)
|
||||
actionmailer (7.2.2.2)
|
||||
actionpack (= 7.2.2.2)
|
||||
actionview (= 7.2.2.2)
|
||||
activejob (= 7.2.2.2)
|
||||
activesupport (= 7.2.2.2)
|
||||
actionmailer (7.2.2.1)
|
||||
actionpack (= 7.2.2.1)
|
||||
actionview (= 7.2.2.1)
|
||||
activejob (= 7.2.2.1)
|
||||
activesupport (= 7.2.2.1)
|
||||
mail (>= 2.8.0)
|
||||
rails-dom-testing (~> 2.2)
|
||||
actionpack (7.2.2.2)
|
||||
actionview (= 7.2.2.2)
|
||||
activesupport (= 7.2.2.2)
|
||||
actionpack (7.2.2.1)
|
||||
actionview (= 7.2.2.1)
|
||||
activesupport (= 7.2.2.1)
|
||||
nokogiri (>= 1.8.5)
|
||||
racc
|
||||
rack (>= 2.2.4, < 3.2)
|
||||
@@ -64,15 +64,15 @@ GEM
|
||||
rails-dom-testing (~> 2.2)
|
||||
rails-html-sanitizer (~> 1.6)
|
||||
useragent (~> 0.16)
|
||||
actiontext (7.2.2.2)
|
||||
actionpack (= 7.2.2.2)
|
||||
activerecord (= 7.2.2.2)
|
||||
activestorage (= 7.2.2.2)
|
||||
activesupport (= 7.2.2.2)
|
||||
actiontext (7.2.2.1)
|
||||
actionpack (= 7.2.2.1)
|
||||
activerecord (= 7.2.2.1)
|
||||
activestorage (= 7.2.2.1)
|
||||
activesupport (= 7.2.2.1)
|
||||
globalid (>= 0.6.0)
|
||||
nokogiri (>= 1.8.5)
|
||||
actionview (7.2.2.2)
|
||||
activesupport (= 7.2.2.2)
|
||||
actionview (7.2.2.1)
|
||||
activesupport (= 7.2.2.1)
|
||||
builder (~> 3.1)
|
||||
erubi (~> 1.11)
|
||||
rails-dom-testing (~> 2.2)
|
||||
@@ -87,22 +87,22 @@ GEM
|
||||
active_utils (3.5.0)
|
||||
activesupport (>= 4.2)
|
||||
i18n
|
||||
activejob (7.2.2.2)
|
||||
activesupport (= 7.2.2.2)
|
||||
activejob (7.2.2.1)
|
||||
activesupport (= 7.2.2.1)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (7.2.2.2)
|
||||
activesupport (= 7.2.2.2)
|
||||
activerecord (7.2.2.2)
|
||||
activemodel (= 7.2.2.2)
|
||||
activesupport (= 7.2.2.2)
|
||||
activemodel (7.2.2.1)
|
||||
activesupport (= 7.2.2.1)
|
||||
activerecord (7.2.2.1)
|
||||
activemodel (= 7.2.2.1)
|
||||
activesupport (= 7.2.2.1)
|
||||
timeout (>= 0.4.0)
|
||||
activestorage (7.2.2.2)
|
||||
actionpack (= 7.2.2.2)
|
||||
activejob (= 7.2.2.2)
|
||||
activerecord (= 7.2.2.2)
|
||||
activesupport (= 7.2.2.2)
|
||||
activestorage (7.2.2.1)
|
||||
actionpack (= 7.2.2.1)
|
||||
activejob (= 7.2.2.1)
|
||||
activerecord (= 7.2.2.1)
|
||||
activesupport (= 7.2.2.1)
|
||||
marcel (~> 1.0)
|
||||
activesupport (7.2.2.2)
|
||||
activesupport (7.2.2.1)
|
||||
base64
|
||||
benchmark (>= 0.3)
|
||||
bigdecimal
|
||||
@@ -183,7 +183,7 @@ GEM
|
||||
image_processing (~> 1.1)
|
||||
marcel (~> 1.0.0)
|
||||
ssrf_filter (~> 1.0)
|
||||
chartkick (5.2.0)
|
||||
chartkick (5.1.5)
|
||||
childprocess (5.0.0)
|
||||
coderay (1.1.3)
|
||||
coercible (1.0.0)
|
||||
@@ -251,7 +251,7 @@ GEM
|
||||
elasticsearch-transport (7.0.0)
|
||||
faraday
|
||||
multi_json
|
||||
erb (5.0.2)
|
||||
erb (5.0.1)
|
||||
erubi (1.13.1)
|
||||
erubis (2.7.0)
|
||||
excon (1.2.5)
|
||||
@@ -341,8 +341,6 @@ GEM
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
ruby-progressbar (~> 1.8, >= 1.8.1)
|
||||
terminal-table (>= 1.5.1)
|
||||
i18n_data (1.1.0)
|
||||
simple_po_parser (~> 1.1)
|
||||
icalendar (2.11.2)
|
||||
base64
|
||||
ice_cube (~> 0.16)
|
||||
@@ -353,7 +351,7 @@ GEM
|
||||
image_processing (1.12.2)
|
||||
mini_magick (>= 4.9.5, < 5)
|
||||
ruby-vips (>= 2.0.17, < 3)
|
||||
io-console (0.8.1)
|
||||
io-console (0.8.0)
|
||||
irb (1.15.2)
|
||||
pp (>= 0.6.0)
|
||||
rdoc (>= 4.0.0)
|
||||
@@ -425,14 +423,14 @@ GEM
|
||||
bigdecimal (~> 3.1)
|
||||
net-http (0.6.0)
|
||||
uri
|
||||
net-imap (0.5.9)
|
||||
net-imap (0.4.20)
|
||||
date
|
||||
net-protocol
|
||||
net-pop (0.1.2)
|
||||
net-protocol
|
||||
net-protocol (0.2.2)
|
||||
timeout
|
||||
net-smtp (0.5.1)
|
||||
net-smtp (0.5.0)
|
||||
net-protocol
|
||||
netrc (0.11.0)
|
||||
nio4r (2.7.4)
|
||||
@@ -442,7 +440,7 @@ GEM
|
||||
nokogiri (1.18.9-x86_64-linux-gnu)
|
||||
racc (~> 1.4)
|
||||
oauth (0.5.6)
|
||||
oj (3.16.11)
|
||||
oj (3.16.10)
|
||||
bigdecimal (>= 3.0)
|
||||
ostruct (>= 0.2)
|
||||
omniauth (1.9.2)
|
||||
@@ -454,9 +452,12 @@ GEM
|
||||
omniauth-oauth (1.1.0)
|
||||
oauth
|
||||
omniauth (~> 1.0)
|
||||
omniauth-twitter (1.4.0)
|
||||
omniauth-oauth (~> 1.1)
|
||||
rack
|
||||
open-uri (0.1.0)
|
||||
orm_adapter (0.5.0)
|
||||
ostruct (0.6.3)
|
||||
ostruct (0.6.2)
|
||||
parallel (1.27.0)
|
||||
parser (3.3.9.0)
|
||||
ast (~> 2.4.1)
|
||||
@@ -498,20 +499,20 @@ GEM
|
||||
rackup (1.0.1)
|
||||
rack (< 3)
|
||||
webrick
|
||||
rails (7.2.2.2)
|
||||
actioncable (= 7.2.2.2)
|
||||
actionmailbox (= 7.2.2.2)
|
||||
actionmailer (= 7.2.2.2)
|
||||
actionpack (= 7.2.2.2)
|
||||
actiontext (= 7.2.2.2)
|
||||
actionview (= 7.2.2.2)
|
||||
activejob (= 7.2.2.2)
|
||||
activemodel (= 7.2.2.2)
|
||||
activerecord (= 7.2.2.2)
|
||||
activestorage (= 7.2.2.2)
|
||||
activesupport (= 7.2.2.2)
|
||||
rails (7.2.2.1)
|
||||
actioncable (= 7.2.2.1)
|
||||
actionmailbox (= 7.2.2.1)
|
||||
actionmailer (= 7.2.2.1)
|
||||
actionpack (= 7.2.2.1)
|
||||
actiontext (= 7.2.2.1)
|
||||
actionview (= 7.2.2.1)
|
||||
activejob (= 7.2.2.1)
|
||||
activemodel (= 7.2.2.1)
|
||||
activerecord (= 7.2.2.1)
|
||||
activestorage (= 7.2.2.1)
|
||||
activesupport (= 7.2.2.1)
|
||||
bundler (>= 1.15.0)
|
||||
railties (= 7.2.2.2)
|
||||
railties (= 7.2.2.1)
|
||||
rails-controller-testing (1.0.5)
|
||||
actionpack (>= 5.0.1.rc1)
|
||||
actionview (>= 5.0.1.rc1)
|
||||
@@ -531,9 +532,9 @@ GEM
|
||||
rails_stdout_logging
|
||||
rails_serve_static_assets (0.0.5)
|
||||
rails_stdout_logging (0.0.5)
|
||||
railties (7.2.2.2)
|
||||
actionpack (= 7.2.2.2)
|
||||
activesupport (= 7.2.2.2)
|
||||
railties (7.2.2.1)
|
||||
actionpack (= 7.2.2.1)
|
||||
activesupport (= 7.2.2.1)
|
||||
irb (~> 1.13)
|
||||
rackup (>= 1.0.0)
|
||||
rake (>= 12.2)
|
||||
@@ -552,8 +553,8 @@ GEM
|
||||
recaptcha (5.20.1)
|
||||
redis-client (0.23.2)
|
||||
connection_pool
|
||||
regexp_parser (2.11.2)
|
||||
reline (0.6.2)
|
||||
regexp_parser (2.11.1)
|
||||
reline (0.6.1)
|
||||
io-console (~> 0.5)
|
||||
responders (3.1.1)
|
||||
actionpack (>= 5.2)
|
||||
@@ -581,7 +582,7 @@ GEM
|
||||
rspec-mocks (3.13.5)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.13.0)
|
||||
rspec-rails (8.0.2)
|
||||
rspec-rails (8.0.1)
|
||||
actionpack (>= 7.2)
|
||||
activesupport (>= 7.2)
|
||||
railties (>= 7.2)
|
||||
@@ -607,7 +608,7 @@ GEM
|
||||
rswag-ui (2.16.0)
|
||||
actionpack (>= 5.2, < 8.1)
|
||||
railties (>= 5.2, < 8.1)
|
||||
rubocop (1.80.1)
|
||||
rubocop (1.79.2)
|
||||
json (~> 2.3)
|
||||
language_server-protocol (~> 3.17.0.2)
|
||||
lint_roller (~> 1.1.0)
|
||||
@@ -627,7 +628,7 @@ GEM
|
||||
rubocop-factory_bot (2.27.1)
|
||||
lint_roller (~> 1.1)
|
||||
rubocop (~> 1.72, >= 1.72.1)
|
||||
rubocop-rails (2.33.3)
|
||||
rubocop-rails (2.32.0)
|
||||
activesupport (>= 4.2.0)
|
||||
lint_roller (~> 1.1)
|
||||
rack (>= 1.1)
|
||||
@@ -647,7 +648,7 @@ GEM
|
||||
ruby-units (4.1.0)
|
||||
ruby-vips (2.2.1)
|
||||
ffi (~> 1.12)
|
||||
rubyzip (3.0.1)
|
||||
rubyzip (2.4.1)
|
||||
sass (3.7.4)
|
||||
sass-listen (~> 4.0.0)
|
||||
sass-listen (4.0.0)
|
||||
@@ -661,17 +662,17 @@ GEM
|
||||
sprockets (> 3.0)
|
||||
sprockets-rails
|
||||
tilt
|
||||
scout_apm (5.7.1)
|
||||
scout_apm (5.7.0)
|
||||
parser
|
||||
searchkick (5.3.1)
|
||||
activemodel (>= 6.1)
|
||||
hashie
|
||||
securerandom (0.4.1)
|
||||
selenium-webdriver (4.35.0)
|
||||
selenium-webdriver (4.34.0)
|
||||
base64 (~> 0.2)
|
||||
logger (~> 1.4)
|
||||
rexml (~> 3.2, >= 3.2.5)
|
||||
rubyzip (>= 1.2.2, < 4.0)
|
||||
rubyzip (>= 1.2.2, < 3.0)
|
||||
websocket (~> 1.0)
|
||||
sidekiq (7.3.9)
|
||||
base64
|
||||
@@ -679,7 +680,6 @@ GEM
|
||||
logger
|
||||
rack (>= 2.2.4)
|
||||
redis-client (>= 0.22.2)
|
||||
simple_po_parser (1.1.6)
|
||||
sprockets (3.7.5)
|
||||
base64
|
||||
concurrent-ruby (~> 1.0)
|
||||
@@ -694,7 +694,7 @@ GEM
|
||||
temple (0.10.4)
|
||||
terminal-table (4.0.0)
|
||||
unicode-display_width (>= 1.1.1, < 4)
|
||||
terser (1.2.6)
|
||||
terser (1.2.5)
|
||||
execjs (>= 0.3.0, < 3)
|
||||
thor (1.4.0)
|
||||
thread_safe (0.3.6)
|
||||
@@ -704,7 +704,7 @@ GEM
|
||||
trollop (1.16.2)
|
||||
tzinfo (2.0.6)
|
||||
concurrent-ruby (~> 1.0)
|
||||
unicode-display_width (3.1.5)
|
||||
unicode-display_width (3.1.4)
|
||||
unicode-emoji (~> 4.0, >= 4.0.4)
|
||||
unicode-emoji (4.0.4)
|
||||
unicorn (6.1.0)
|
||||
@@ -730,8 +730,7 @@ GEM
|
||||
rack-test (>= 0.5.3)
|
||||
webrick (1.9.1)
|
||||
websocket (1.2.11)
|
||||
websocket-driver (0.8.0)
|
||||
base64
|
||||
websocket-driver (0.7.6)
|
||||
websocket-extensions (>= 0.1.0)
|
||||
websocket-extensions (0.1.5)
|
||||
will_paginate (4.0.1)
|
||||
@@ -793,7 +792,6 @@ DEPENDENCIES
|
||||
haml_lint (>= 0.25.1)
|
||||
hashie (>= 3.5.3)
|
||||
i18n-tasks
|
||||
i18n_data (~> 1.1)
|
||||
icalendar
|
||||
jquery-rails
|
||||
jquery-ui-rails!
|
||||
@@ -811,6 +809,7 @@ DEPENDENCIES
|
||||
oj
|
||||
omniauth (~> 1.3)
|
||||
omniauth-flickr (>= 0.0.15)
|
||||
omniauth-twitter
|
||||
percy-capybara (~> 5.0.0)
|
||||
pg
|
||||
platform-api
|
||||
|
||||
@@ -62,3 +62,5 @@ For more information about this project, contact [info@growstuff.org](mailto:inf
|
||||
|
||||
Security Issues: If you find an authorization bypass or data breach, please contact our maintainers directly at [maintainers@growstuff.org](mailto:maintainers@growstuff.org).
|
||||
|
||||
You can also contact us on [Twitter](http://twitter.com/growstufforg/) or
|
||||
[Facebook](https://www.facebook.com/pages/Growstuff/1531133417099494) or [Github](https://github.com/Growstuff/growstuff/issues)..
|
||||
|
||||
BIN
app/assets/images/location-not-set.en.png
Normal file
BIN
app/assets/images/location-not-set.en.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
BIN
app/assets/images/twitter_32.png
Normal file
BIN
app/assets/images/twitter_32.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
@@ -1,13 +1,7 @@
|
||||
.crop-icon {
|
||||
height: 1em;
|
||||
}
|
||||
.card-footer {
|
||||
.btn-group-vertical {
|
||||
.btn {
|
||||
text-wrap: initial
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.crop-thumbnail {
|
||||
.text {
|
||||
bottom: 0;
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
// stats shown on homepage. eg. "999 members..."
|
||||
.stats {
|
||||
a {
|
||||
font-weight: bold;
|
||||
}
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.crops,
|
||||
|
||||
@@ -33,6 +33,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
.location-not-set {
|
||||
background-image: image-url("location-not-set.en.png");
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
height: 250px;
|
||||
width: 100%;
|
||||
}
|
||||
.card {
|
||||
.badge-location {
|
||||
background-color: darken($blue, 10%);
|
||||
|
||||
@@ -10,33 +10,9 @@
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#navbarSupportedContent {
|
||||
ul {
|
||||
flex-direction: column-reverse;
|
||||
flex-wrap: nowrap;
|
||||
|
||||
li.nav-item {
|
||||
display: block;
|
||||
a {
|
||||
display: grid;
|
||||
grid-template-columns: 2em 1fr 2em;
|
||||
}
|
||||
a.dropdown-toggle::after {
|
||||
width: 100%;
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.crop-actions {
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
a {
|
||||
margin: auto;
|
||||
.navbar .nav > li {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
.navbar .navbar-form {
|
||||
padding-left: 0;
|
||||
|
||||
@@ -10,7 +10,6 @@ body {
|
||||
|
||||
.navbar {
|
||||
flex-wrap: nowrap;
|
||||
align-items: flex-start
|
||||
}
|
||||
.navbar-brand {
|
||||
.site-name {
|
||||
@@ -368,6 +367,9 @@ ul.thumbnail-buttons {
|
||||
h1 {
|
||||
font-size: 400%;
|
||||
}
|
||||
.stats a {
|
||||
color: $black;
|
||||
}
|
||||
|
||||
// signup widget on homepage
|
||||
.signup {
|
||||
|
||||
@@ -57,6 +57,6 @@ class AlternateNamesController < ApplicationController
|
||||
private
|
||||
|
||||
def alternate_name_params
|
||||
params.require(:alternate_name).permit(:crop_id, :name, :creator_id, :language)
|
||||
params.require(:alternate_name).permit(:crop_id, :name, :creator_id)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -78,7 +78,6 @@ class ApplicationController < ActionController::Base
|
||||
:tos_agreement,
|
||||
# profile stuff
|
||||
:bio, :location, :latitude, :longitude,
|
||||
:website_url, :instagram_handle, :facebook_handle, :bluesky_handle, :other_url,
|
||||
# email settings
|
||||
:show_email, :newsletter, :send_notification_email, :send_planting_reminder,
|
||||
# update password
|
||||
|
||||
@@ -13,55 +13,43 @@ class CommentsController < ApplicationController
|
||||
end
|
||||
|
||||
def new
|
||||
@commentable = find_commentable
|
||||
@comment = Comment.new
|
||||
if @commentable
|
||||
@comments = @commentable.comments
|
||||
@post = Post.find_by(id: params[:post_id])
|
||||
|
||||
if @post
|
||||
@comments = @post.comments
|
||||
respond_with(@comments)
|
||||
else
|
||||
redirect_to(request.referer || root_url,
|
||||
alert: "Can't post a comment on a non-existent commentable")
|
||||
alert: "Can't post a comment on a non-existent post")
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
# TODO: Why does this need a collection of comments?
|
||||
@comments = @comment.commentable.comments
|
||||
@commentable = @comment.commentable
|
||||
@comments = @comment.post.comments
|
||||
end
|
||||
|
||||
def create
|
||||
@comment = Comment.new(comment_params)
|
||||
@commentable = @comment.commentable
|
||||
@comment.author = current_member
|
||||
@comment.save
|
||||
respond_with @comment, location: @commentable
|
||||
respond_with @comment, location: @comment.post
|
||||
end
|
||||
|
||||
def update
|
||||
@comment.update(body: comment_params['body'])
|
||||
respond_with @comment, location: @comment.commentable
|
||||
respond_with @comment, location: @comment.post
|
||||
end
|
||||
|
||||
def destroy
|
||||
@commentable = @comment.commentable
|
||||
@post = @comment.post
|
||||
@comment.destroy
|
||||
respond_with(@commentable)
|
||||
respond_with(@post)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_commentable
|
||||
return unless params[:comment]
|
||||
|
||||
if params[:comment][:commentable_type] == 'Photo'
|
||||
Photo.find(params[:comment][:commentable_id])
|
||||
elsif params[:comment][:commentable_type] == 'Post'
|
||||
Post.find(params[:comment][:commentable_id])
|
||||
end
|
||||
end
|
||||
|
||||
def comment_params
|
||||
params.require(:comment).permit(:body, :commentable_id, :commentable_type)
|
||||
params.require(:comment).permit(:body, :post_id)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -39,6 +39,12 @@ class CropsController < ApplicationController
|
||||
respond_with @crops
|
||||
end
|
||||
|
||||
def openfarm
|
||||
@crop = Crop.find(params[:crop_slug])
|
||||
@crop.update_openfarm_data!
|
||||
respond_with @crop, location: @crop
|
||||
end
|
||||
|
||||
def gbif
|
||||
@crop = Crop.find(params[:crop_slug])
|
||||
@crop.update_gbif_data!
|
||||
@@ -69,6 +75,7 @@ class CropsController < ApplicationController
|
||||
end
|
||||
|
||||
def show
|
||||
@problems = Problem.joins(plantings: :crop).where(crops: { id: @crop.id }).distinct
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
@posts = @crop.posts.order(created_at: :desc).paginate(page: params[:page])
|
||||
@@ -131,6 +138,7 @@ class CropsController < ApplicationController
|
||||
|
||||
if @crop.approval_status_changed?(from: "pending", to: "approved")
|
||||
notifier.deliver_now!
|
||||
@crop.update_openfarm_data!
|
||||
@crop.update_gbif_data!
|
||||
end
|
||||
else
|
||||
@@ -159,7 +167,7 @@ class CropsController < ApplicationController
|
||||
end
|
||||
|
||||
def save_crop_names
|
||||
AlternateName.create!(names_params(:alt_name).map { |n| { name: n, creator_id: current_member.id, crop_id: @crop.id, language: "EN" } })
|
||||
AlternateName.create!(names_params(:alt_name).map { |n| { name: n, creator_id: current_member.id, crop_id: @crop.id } })
|
||||
ScientificName.create!(names_params(:sci_name).map { |n| { name: n, creator_id: current_member.id, crop_id: @crop.id } })
|
||||
end
|
||||
|
||||
@@ -174,18 +182,20 @@ class CropsController < ApplicationController
|
||||
def recreate_names(param_name, name_type)
|
||||
return if params[param_name].blank?
|
||||
|
||||
@crop.send("#{name_type}_names").each(&:destroy)
|
||||
destroy_names(name_type)
|
||||
params[param_name].each_value do |value|
|
||||
next if value.empty?
|
||||
|
||||
if name_type == 'alternate'
|
||||
@crop.send("#{name_type}_names").create!(name: value, creator_id: current_member.id, language: "EN")
|
||||
else
|
||||
@crop.send("#{name_type}_names").create!(name: value, creator_id: current_member.id)
|
||||
end
|
||||
create_name!(name_type, value) unless value.empty?
|
||||
end
|
||||
end
|
||||
|
||||
def destroy_names(name_type)
|
||||
@crop.send("#{name_type}_names").each(&:destroy)
|
||||
end
|
||||
|
||||
def create_name!(name_type, value)
|
||||
@crop.send("#{name_type}_names").create!(name: value, creator_id: current_member.id)
|
||||
end
|
||||
|
||||
def crop_params
|
||||
params.require(:crop).permit(
|
||||
:name, :en_wikipedia_url,
|
||||
@@ -207,12 +217,12 @@ class CropsController < ApplicationController
|
||||
def crop_json_fields
|
||||
{
|
||||
include: {
|
||||
plantings: {
|
||||
plantings: {
|
||||
include: {
|
||||
owner: { only: %i(id login_name location latitude longitude) }
|
||||
}
|
||||
},
|
||||
scientific_names: { only: [:name] }, alternate_names: { only: %i(name language) }
|
||||
scientific_names: { only: [:name] }, alternate_names: { only: [:name] }
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
@@ -4,7 +4,7 @@ class GardensController < DataController
|
||||
def index
|
||||
@owner = Member.find_by(slug: params[:member_slug])
|
||||
@show_all = params[:all] == '1'
|
||||
@show_jump_to = params[:member_slug].present? || false
|
||||
@show_jump_to = params[:member_slug].present? ? true : false
|
||||
|
||||
@gardens = @gardens.includes(:owner)
|
||||
@gardens = @gardens.active unless @show_all
|
||||
@@ -18,7 +18,7 @@ class GardensController < DataController
|
||||
end
|
||||
|
||||
def show
|
||||
@current_plantings = @garden.plantings.current.where.not(failed: true).includes(:crop, :owner).order(planted_at: :desc)
|
||||
@current_plantings = @garden.plantings.current.includes(:crop, :owner).order(planted_at: :desc)
|
||||
@current_activities = @garden.activities.current.includes(:owner).order(created_at: :desc)
|
||||
@finished_plantings = @garden.plantings.finished.includes(:crop)
|
||||
@suggested_companions = Crop.approved.where(
|
||||
|
||||
@@ -16,6 +16,7 @@ class MembersController < ApplicationController
|
||||
|
||||
def show
|
||||
@member = Member.confirmed.kept.find_by!(slug: params[:slug])
|
||||
@twitter_auth = @member.auth('twitter')
|
||||
@flickr_auth = @member.auth('flickr')
|
||||
@posts = @member.posts
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
||||
@authentication = action.establish_authentication(auth, member)
|
||||
|
||||
if action.member_created?
|
||||
raise "Invalid provider" unless %w(flickr).index(auth['provider'].to_s)
|
||||
raise "Invalid provider" unless %w(twitter flickr).index(auth['provider'].to_s)
|
||||
|
||||
session["devise.#{auth['provider']}_data"] = request.env["omniauth.auth"]
|
||||
sign_in member
|
||||
|
||||
@@ -21,7 +21,6 @@ class PhotosController < ApplicationController
|
||||
|
||||
def show
|
||||
@crops = Crop.distinct.joins(:photo_associations).where(photo_associations: { photo: @photo })
|
||||
@comment = Comment.new(commentable: @photo)
|
||||
respond_with(@photo)
|
||||
end
|
||||
|
||||
|
||||
@@ -91,32 +91,6 @@ class PlantingsController < DataController
|
||||
respond_with @planting, location: @planting.garden
|
||||
end
|
||||
|
||||
def transplant
|
||||
# The `load_and_authorize_resource` in DataController will handle finding the
|
||||
# planting and authorizing the action.
|
||||
# We still need to authorize the new garden
|
||||
new_garden = Garden.find(params[:garden_id])
|
||||
authorize! :update, new_garden
|
||||
|
||||
# Mark original planting as finished
|
||||
@planting.update(finished: true, finished_at: Time.zone.now)
|
||||
|
||||
# Create a new planting
|
||||
new_planting = @planting.dup
|
||||
new_planting.garden = new_garden
|
||||
new_planting.slug = nil # let friendly_id generate a new slug
|
||||
new_planting.finished = false
|
||||
new_planting.finished_at = nil
|
||||
|
||||
if new_planting.save
|
||||
redirect_to edit_planting_path(new_planting), notice: 'Planting was successfully transplanted.'
|
||||
else
|
||||
# if the save fails, we should probably roll back the finishing of the original planting
|
||||
@planting.update(finished: false, finished_at: nil)
|
||||
redirect_to @planting, alert: "There was an error transplanting the planting: #{new_planting.errors.full_messages.to_sentence}"
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def update_crop_medians
|
||||
@@ -133,7 +107,7 @@ class PlantingsController < DataController
|
||||
:crop_id, :description, :garden_id, :planted_at,
|
||||
:parent_seed_id,
|
||||
:quantity, :sunniness, :planted_from, :finished,
|
||||
:finished_at, :failed
|
||||
:finished_at, :failed, problem_ids: []
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
76
app/controllers/problems_controller.rb
Normal file
76
app/controllers/problems_controller.rb
Normal file
@@ -0,0 +1,76 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ProblemsController < ApplicationController
|
||||
before_action :authenticate_member!, except: %i(index show)
|
||||
load_and_authorize_resource id_param: :slug, class: Problem
|
||||
respond_to :html, :json
|
||||
|
||||
def index
|
||||
@problems = Problem.approved.popular.paginate(page: params[:page])
|
||||
@num_requested_problems = requested_problems.size if current_member
|
||||
respond_with @problems
|
||||
end
|
||||
|
||||
def requested
|
||||
@requested = requested_problems.paginate(page: params[:page])
|
||||
respond_with @requested
|
||||
end
|
||||
|
||||
def show
|
||||
@problem = Problem.friendly.find(params[:id])
|
||||
@plantings = @problem.plantings.paginate(page: params[:page])
|
||||
respond_with @problem
|
||||
end
|
||||
|
||||
def new
|
||||
@problem = Problem.new
|
||||
respond_with @problem
|
||||
end
|
||||
|
||||
def edit; end
|
||||
|
||||
def create
|
||||
@problem = Problem.new(problem_params)
|
||||
if current_member.role? :problem_wrangler
|
||||
@problem.creator = current_member
|
||||
else
|
||||
@problem.requester = current_member
|
||||
@problem.approval_status = "pending"
|
||||
end
|
||||
@problem.save
|
||||
respond_with @problem
|
||||
end
|
||||
|
||||
def update
|
||||
if can?(:wrangle, @problem)
|
||||
@problem.approval_status = 'rejected' if params.fetch("reject", false)
|
||||
@problem.approval_status = 'approved' if params.fetch("approve", false)
|
||||
end
|
||||
@problem.update(problem_params)
|
||||
respond_with @problem
|
||||
end
|
||||
|
||||
def wrangle
|
||||
@approval_status = params[:approval_status]
|
||||
@problems = case @approval_status
|
||||
when "pending"
|
||||
Problem.pending_approval
|
||||
when "rejected"
|
||||
Problem.rejected
|
||||
else
|
||||
Problem.recent
|
||||
end.paginate(page: params[:page])
|
||||
@problem_wranglers = Role.problem_wranglers
|
||||
respond_with @problems
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def problem_params
|
||||
params.require(:problem).permit(:name, :reason_for_rejection, :rejection_notes)
|
||||
end
|
||||
|
||||
def requested_problems
|
||||
current_member.requested_problems.pending_approval
|
||||
end
|
||||
end
|
||||
@@ -6,6 +6,7 @@ class RegistrationsController < Devise::RegistrationsController
|
||||
prepend_before_action :check_captcha, only: [:create] # Change this to be any actions you want to protect with recaptcha.
|
||||
|
||||
def edit
|
||||
@twitter_auth = current_member.auth('twitter')
|
||||
@flickr_auth = current_member.auth('flickr')
|
||||
render "edit"
|
||||
end
|
||||
|
||||
@@ -19,7 +19,9 @@ class SeedsController < DataController
|
||||
where['parent_planting'] = @planting.id
|
||||
end
|
||||
|
||||
where['tradeable_to'] = params[:tradeable_to] if params[:tradeable_to].present?
|
||||
if params[:tradeable_to].present?
|
||||
where['tradeable_to'] = params[:tradeable_to]
|
||||
end
|
||||
|
||||
@show_all = (params[:all] == '1')
|
||||
where['finished'] = false unless @show_all
|
||||
@@ -56,7 +58,6 @@ class SeedsController < DataController
|
||||
|
||||
def create
|
||||
@seed = Seed.new(seed_params)
|
||||
@seed.finished ||= false
|
||||
@seed.owner = current_member
|
||||
@seed.crop = @seed.parent_planting.crop if @seed.parent_planting
|
||||
flash[:notice] = "Successfully added #{@seed.crop} seed to your stash." if @seed.save
|
||||
|
||||
@@ -21,10 +21,6 @@ module ApplicationHelper
|
||||
classes
|
||||
end
|
||||
|
||||
def count_github_contibutors
|
||||
File.open(Rails.root.join('CONTRIBUTORS.md')).readlines.grep(/^-/).size
|
||||
end
|
||||
|
||||
# Produces a cache key for uniquely identifying cached fragments.
|
||||
def cache_key_for(klass, identifier = "all")
|
||||
count = klass.count
|
||||
@@ -36,7 +32,7 @@ module ApplicationHelper
|
||||
# of HAML, Tilt, and dynamic compilation with interpolated ruby.
|
||||
def markdownify(text)
|
||||
translator = Haml::Filters::GrowstuffMarkdown.new
|
||||
translator.expand_members!(translator.expand_crops!(text.to_s))
|
||||
translator.expand_members!(translator.expand_problems!(translator.expand_crops!(text.to_s)))
|
||||
end
|
||||
|
||||
#
|
||||
@@ -54,6 +50,7 @@ module ApplicationHelper
|
||||
|
||||
uri.query = "&width=#{size}&height=#{size}" if uri.host == 'graph.facebook.com'
|
||||
|
||||
# TODO: Assess twitter - https://dev.twitter.com/overview/general/user-profile-images-and-banners
|
||||
# TODO: Assess flickr - https://www.flickr.com/services/api/misc.buddyicons.html
|
||||
|
||||
return uri.to_s
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
module ButtonsHelper
|
||||
include IconsHelper
|
||||
|
||||
def garden_plant_something_button(garden, classes: "btn btn-default")
|
||||
return unless can? :edit, garden
|
||||
|
||||
@@ -53,7 +52,7 @@ module ButtonsHelper
|
||||
link_to t('buttons.mark_as_inactive'),
|
||||
garden_path(garden, garden: { active: 0 }),
|
||||
method: :put, class: classes,
|
||||
data: { confirm: I18n.t('gardens.confirm_deactivate') }
|
||||
data: { confirm: 'All plantings associated with this garden will be marked as finished. Are you sure?' }
|
||||
end
|
||||
|
||||
def create_button(model_to_create, path, icon, label)
|
||||
@@ -98,7 +97,7 @@ module ButtonsHelper
|
||||
end
|
||||
|
||||
def planting_finish_button(planting, classes: 'btn btn-default btn-secondary')
|
||||
return unless can?(:edit, planting) || planting.finished || planting.failed
|
||||
return unless can?(:edit, planting) || planting.finished
|
||||
|
||||
link_to planting_path(slug: planting.slug, planting: { finished: 1 }),
|
||||
method: :put, class: "#{classes} append-date" do
|
||||
@@ -106,15 +105,6 @@ module ButtonsHelper
|
||||
end
|
||||
end
|
||||
|
||||
def planting_failed_button(planting, classes: 'btn btn-default btn-secondary')
|
||||
return unless can?(:edit, planting) || planting.finished || planting.failed
|
||||
|
||||
link_to planting_path(slug: planting.slug, planting: { failed: 1 }),
|
||||
method: :put, class: "#{classes}" do
|
||||
finished_icon + ' ' + t('buttons.mark_as_failed')
|
||||
end
|
||||
end
|
||||
|
||||
def seed_finish_button(seed, classes: 'btn btn-default')
|
||||
return unless can?(:create, Planting) && seed.active
|
||||
|
||||
@@ -132,7 +122,7 @@ module ButtonsHelper
|
||||
end
|
||||
|
||||
def planting_save_seeds_button(planting, classes: 'btn btn-default')
|
||||
return unless can?(:edit, planting) && !planting.failed?
|
||||
return unless can?(:edit, planting)
|
||||
|
||||
link_to new_planting_seed_path(planting_slug: planting.slug), class: classes do
|
||||
seed_icon + ' ' + t('buttons.save_seeds')
|
||||
|
||||
@@ -43,14 +43,6 @@ module PlantingsHelper
|
||||
(planting.first_harvest_predicted_at - Time.zone.today).to_i
|
||||
end
|
||||
|
||||
# Returns a list of gardens the planting can be transplanted to
|
||||
# based on the planting's owner.
|
||||
def transplantable_gardens_by_owner(planting)
|
||||
garden_ids = planting.owner.gardens.select(:id).to_a + GardenCollaborator.where(member_id: planting.owner.id).select(:garden_id).to_a
|
||||
|
||||
Garden.active.where.not(id: planting.garden_id).where(id: garden_ids)
|
||||
end
|
||||
|
||||
def days_from_now_to_last_harvest(planting)
|
||||
return unless planting.planted_at.present? && planting.last_harvest_predicted_at.present?
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@ class Ability
|
||||
# are wranglers or admins
|
||||
cannot :read, Crop
|
||||
can :read, Crop, approval_status: "approved"
|
||||
cannot :read, Problem
|
||||
can :read, Problem, approval_status: "approved"
|
||||
# scientific names should only be viewable if associated crop is approved
|
||||
cannot :read, ScientificName
|
||||
can :read, ScientificName do |sn|
|
||||
@@ -56,6 +58,8 @@ class Ability
|
||||
# members can see even rejected or pending crops if they requested it
|
||||
can :read, Crop, requester_id: member.id
|
||||
can :requested, Crop # see list of crops they've requested
|
||||
can :read, Problem, requester_id: member.id
|
||||
can :requested, Problem
|
||||
|
||||
# managing your own user settings
|
||||
can :update, Member, id: member.id
|
||||
@@ -82,8 +86,14 @@ class Ability
|
||||
can :gbif, Crop
|
||||
end
|
||||
|
||||
if member.role? :problem_wrangler
|
||||
can :wrangle, Problem
|
||||
can :manage, Problem
|
||||
end
|
||||
|
||||
# any member can create a crop provisionally
|
||||
can :create, Crop
|
||||
can :create, Problem
|
||||
|
||||
# can create & destroy their own authentications against other sites.
|
||||
can :create, Authentication
|
||||
@@ -111,10 +121,6 @@ class Ability
|
||||
can :update, Planting do |planting|
|
||||
planting.garden.garden_collaborators.where(member_id: member.id).any?
|
||||
end
|
||||
can :transplant, Planting, garden: { owner_id: member.id }
|
||||
can :transplant, Planting do |planting|
|
||||
planting.garden.garden_collaborators.where(member_id: member.id).any?
|
||||
end
|
||||
can :destroy, Planting do |planting|
|
||||
planting.garden.garden_collaborators.where(member_id: member.id).any?
|
||||
end
|
||||
|
||||
@@ -5,7 +5,6 @@ class AlternateName < ApplicationRecord
|
||||
belongs_to :creator, class_name: 'Member', inverse_of: :created_alternate_names
|
||||
validates :name, presence: true
|
||||
validates :crop, presence: true
|
||||
validates :language, presence: true
|
||||
|
||||
after_commit :reindex
|
||||
|
||||
|
||||
@@ -2,27 +2,26 @@
|
||||
|
||||
class Comment < ApplicationRecord
|
||||
belongs_to :author, class_name: 'Member', inverse_of: :comments
|
||||
belongs_to :commentable, polymorphic: true, counter_cache: true
|
||||
# validates :body, presence: true
|
||||
belongs_to :post, counter_cache: true
|
||||
|
||||
scope :post_order, -> { order(created_at: :asc) } # for display on post page
|
||||
|
||||
after_create do
|
||||
recipient = commentable.author.id
|
||||
recipient = post.author.id
|
||||
sender = author.id
|
||||
# don't send notifications to yourself
|
||||
if recipient != sender
|
||||
Notification.create(
|
||||
recipient_id: recipient,
|
||||
sender_id: sender,
|
||||
subject: "#{author} commented on #{commentable.subject}",
|
||||
subject: "#{author} commented on #{post.subject}",
|
||||
body:,
|
||||
notifiable: commentable
|
||||
post_id: post.id
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
def to_s
|
||||
"#{author.login_name} commented on #{commentable.subject}"
|
||||
"#{author.login_name} commented on #{post.subject}"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,12 +8,7 @@ module Finishable
|
||||
scope :current, -> { where.not(finished: true) }
|
||||
|
||||
def active
|
||||
# Plantings can fail. At the moment, activities and seeds cannot.
|
||||
if respond_to?(:failed)
|
||||
!finished && !failed
|
||||
else
|
||||
!finished
|
||||
end
|
||||
!finished
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,6 +4,10 @@ module OpenFarmData
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
def update_openfarm_data!
|
||||
OpenfarmService.new.update_crop(self)
|
||||
end
|
||||
|
||||
def of_photo
|
||||
fetch_attr('main_image_path')
|
||||
end
|
||||
@@ -39,6 +43,10 @@ module OpenFarmData
|
||||
fetch_attr('common_names')
|
||||
end
|
||||
|
||||
def guides_count
|
||||
fetch_attr('guides_count')
|
||||
end
|
||||
|
||||
def binomial_name
|
||||
fetch_attr('binomial_name')
|
||||
end
|
||||
|
||||
@@ -38,7 +38,7 @@ module PredictHarvest
|
||||
|
||||
# status
|
||||
def harvest_time?
|
||||
return false if crop.perennial || finished || failed
|
||||
return false if crop.perennial || finished
|
||||
|
||||
# We have harvests but haven't finished
|
||||
harvests.size.positive? ||
|
||||
|
||||
@@ -8,12 +8,12 @@ module PredictPlanting
|
||||
before_save :calculate_lifespan
|
||||
|
||||
def calculate_lifespan
|
||||
self.lifespan = (planted_at.present? && finished_at.present? && !failed? ? finished_at - planted_at : nil)
|
||||
self.lifespan = (planted_at.present? && finished_at.present? ? finished_at - planted_at : nil)
|
||||
end
|
||||
|
||||
# dates
|
||||
def finish_predicted_at
|
||||
if planted_at.blank? || failed?
|
||||
if planted_at.blank?
|
||||
nil
|
||||
elsif crop.median_lifespan.present?
|
||||
planted_at + crop.median_lifespan.days
|
||||
@@ -34,18 +34,15 @@ module PredictPlanting
|
||||
end
|
||||
|
||||
def actual_lifespan
|
||||
return unless planted_at.present? && finished_at.present? && !failed?
|
||||
return unless planted_at.present? && finished_at.present?
|
||||
|
||||
(finished_at - planted_at).to_i
|
||||
end
|
||||
|
||||
def age_in_days
|
||||
return if planted_at.blank?
|
||||
return if failed?
|
||||
|
||||
known_last_day ||= finished_at || Time.zone.today
|
||||
known_last_day = Time.zone.today if known_last_day > Time.zone.today
|
||||
|
||||
(known_last_day - planted_at).to_i
|
||||
end
|
||||
|
||||
@@ -53,9 +50,9 @@ module PredictPlanting
|
||||
Rails.cache.fetch("#{cache_key_with_version}/percentage_grown", expires_in: 8.hours) do
|
||||
if finished?
|
||||
100
|
||||
elsif !planted? || failed?
|
||||
elsif !planted?
|
||||
0
|
||||
elsif crop.perennial || (finish_predicted_at.nil? && finished_at.nil?) # This covers future dated finished_at that hasn't occurrred yet.
|
||||
elsif crop.perennial || finish_predicted_at.nil?
|
||||
nil
|
||||
else
|
||||
calculate_percentage_grown
|
||||
@@ -74,7 +71,7 @@ module PredictPlanting
|
||||
end
|
||||
|
||||
def late?
|
||||
crop.annual? && !finished && !failed &&
|
||||
crop.annual? && !finished &&
|
||||
planted_at.present? &&
|
||||
finish_predicted_at.present? &&
|
||||
finish_predicted_at <= Time.zone.today
|
||||
@@ -94,9 +91,9 @@ module PredictPlanting
|
||||
private
|
||||
|
||||
def calculate_percentage_grown
|
||||
return 0 if age_in_days.to_i < 0
|
||||
return 0 if age_in_days < 0
|
||||
|
||||
percent = (age_in_days.to_f / expected_lifespan.to_f) * 100
|
||||
percent = (age_in_days / expected_lifespan.to_f) * 100
|
||||
(percent > 100 ? 100 : percent)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -59,8 +59,7 @@ module SearchSeeds
|
||||
search('*', limit:,
|
||||
where: {
|
||||
finished: false,
|
||||
tradable: true,
|
||||
_or: [{ plant_before: nil }, { plant_before: { lt: Date.today } }]
|
||||
tradable: true
|
||||
},
|
||||
boost_by: [:created_at],
|
||||
load: false)
|
||||
|
||||
@@ -17,6 +17,7 @@ class Crop < ApplicationRecord
|
||||
has_many :scientific_names, dependent: :delete_all
|
||||
has_many :alternate_names, dependent: :delete_all
|
||||
has_many :plantings, dependent: :destroy
|
||||
has_many :problems, through: :plantings
|
||||
has_many :seeds, dependent: :destroy
|
||||
has_many :harvests, dependent: :destroy
|
||||
has_many :photo_associations, dependent: :delete_all, inverse_of: :crop
|
||||
|
||||
@@ -59,7 +59,7 @@ class CsvImporter
|
||||
|
||||
alternate_names.split(/,\s*/).each do |name|
|
||||
altname = AlternateName.find_by(name:, crop: @crop)
|
||||
altname ||= AlternateName.create! name:, crop: @crop, language: "EN", creator: cropbot
|
||||
altname ||= AlternateName.create! name:, crop: @crop, creator: cropbot
|
||||
@crop.alternate_names << altname
|
||||
end
|
||||
end
|
||||
|
||||
@@ -10,8 +10,7 @@ class Follow < ApplicationRecord
|
||||
recipient_id: followed_id,
|
||||
sender_id: follower_id,
|
||||
subject: "#{follower.login_name} is now following you",
|
||||
body: "#{follower.login_name} just followed you on #{ENV.fetch('GROWSTUFF_SITE_NAME', nil)}. ",
|
||||
notifiable: self
|
||||
body: "#{follower.login_name} just followed you on #{ENV.fetch('GROWSTUFF_SITE_NAME', nil)}. "
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,7 +5,6 @@ class Garden < ApplicationRecord
|
||||
include Geocodable
|
||||
include PhotoCapable
|
||||
include Ownable
|
||||
|
||||
friendly_id :garden_slug, use: %i(slugged finders)
|
||||
|
||||
has_many :plantings, dependent: :destroy
|
||||
@@ -45,7 +44,6 @@ class Garden < ApplicationRecord
|
||||
.where.not(gardens: { latitude: nil })
|
||||
.where.not(gardens: { longitude: nil })
|
||||
}
|
||||
|
||||
AREA_UNITS_VALUES = {
|
||||
"square metres" => "square metre",
|
||||
"square feet" => "square foot",
|
||||
|
||||
@@ -42,6 +42,10 @@ class Member < ApplicationRecord
|
||||
inverse_of: :requester
|
||||
has_many :created_crops, class_name: 'Crop', foreign_key: 'creator_id', dependent: :nullify,
|
||||
inverse_of: :creator
|
||||
has_many :requested_problems, class_name: 'Problem', foreign_key: 'requester_id', dependent: :nullify,
|
||||
inverse_of: :requester
|
||||
has_many :created_problems, class_name: 'Problem', foreign_key: 'creator_id', dependent: :nullify,
|
||||
inverse_of: :creator
|
||||
has_many :created_alternate_names, class_name: 'AlternateName', foreign_key: 'creator_id', inverse_of: :creator
|
||||
has_many :created_scientific_names, class_name: 'ScientificName', foreign_key: 'creator_id', inverse_of: :creator
|
||||
|
||||
@@ -91,9 +95,6 @@ class Member < ApplicationRecord
|
||||
uniqueness: {
|
||||
case_sensitive: false
|
||||
}
|
||||
validates :website_url, format: { with: /\Ahttps?:\/\//, message: "must start with http:// or https://" }, allow_blank: true
|
||||
validates :other_url, format: { with: /\Ahttps?:\/\//, message: "must start with http:// or https://" }, allow_blank: true
|
||||
validates :instagram_handle, :facebook_handle, :bluesky_handle, format: { without: %r{\Ahttps?:\/\/|\/}, message: "should be a handle, not a URL" }, allow_blank: true
|
||||
|
||||
#
|
||||
# Triggers
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
class Notification < ApplicationRecord
|
||||
belongs_to :sender, class_name: 'Member', inverse_of: :sent_notifications
|
||||
belongs_to :recipient, class_name: 'Member', inverse_of: :notifications
|
||||
belongs_to :notifiable, polymorphic: true
|
||||
belongs_to :post, optional: true
|
||||
|
||||
validates :subject, length: { maximum: 255 }
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ class Photo < ApplicationRecord
|
||||
PHOTO_CAPABLE = %w(Garden Planting Harvest Seed Post Crop).freeze
|
||||
|
||||
has_many :photo_associations, dependent: :delete_all, inverse_of: :photo
|
||||
has_many :comments, as: :commentable, dependent: :destroy
|
||||
|
||||
# This doesn't work, ActiveRecord tries to use the polymoriphic photographable
|
||||
# relationship instead.
|
||||
@@ -84,14 +83,6 @@ class Photo < ApplicationRecord
|
||||
"#{title} by #{owner.login_name}"
|
||||
end
|
||||
|
||||
def subject
|
||||
title
|
||||
end
|
||||
|
||||
def author
|
||||
owner
|
||||
end
|
||||
|
||||
def flickr_photo_id
|
||||
source_id if source == 'flickr'
|
||||
end
|
||||
|
||||
@@ -24,6 +24,8 @@ class Planting < ApplicationRecord
|
||||
belongs_to :crop, counter_cache: true
|
||||
has_many :harvests, dependent: :destroy
|
||||
has_many :activities, dependent: :destroy
|
||||
has_many :planting_problems, dependent: :destroy
|
||||
has_many :problems, through: :planting_problems
|
||||
|
||||
#
|
||||
# Ancestry of food
|
||||
@@ -43,8 +45,7 @@ class Planting < ApplicationRecord
|
||||
.where.not(gardens: { latitude: nil })
|
||||
.where.not(gardens: { longitude: nil })
|
||||
}
|
||||
scope :active, -> { where(finished: false, failed: false).where('finished_at IS NULL OR finished_at < ?', Time.zone.now) }
|
||||
scope :failed, -> { where(failed: true) }
|
||||
scope :active, -> { where('finished <> true').where('finished_at IS NULL OR finished_at < ?', Time.zone.now) }
|
||||
scope :annual, -> { joins(:crop).where(crops: { perennial: false }) }
|
||||
scope :perennial, -> { joins(:crop).where(crops: { perennial: true }) }
|
||||
scope :interesting, -> { has_photos.one_per_owner.order(planted_at: :desc) }
|
||||
@@ -73,7 +74,6 @@ class Planting < ApplicationRecord
|
||||
validates :crop, presence: true, approved: { message: "must be present and exist in our database" }
|
||||
validate :finished_must_be_after_planted
|
||||
validate :owner_must_match_garden_owner
|
||||
validate :cannot_be_finished_and_failed
|
||||
validates :quantity, allow_nil: true, numericality: {
|
||||
only_integer: true, greater_than_or_equal_to: 0
|
||||
}
|
||||
@@ -98,11 +98,7 @@ class Planting < ApplicationRecord
|
||||
end
|
||||
|
||||
def finished?
|
||||
(finished || (finished_at.present? && finished_at <= Time.zone.today)) && !failed?
|
||||
end
|
||||
|
||||
def failed?
|
||||
failed
|
||||
finished || (finished_at.present? && finished_at <= Time.zone.today)
|
||||
end
|
||||
|
||||
def planted?
|
||||
@@ -126,10 +122,6 @@ class Planting < ApplicationRecord
|
||||
|
||||
private
|
||||
|
||||
def cannot_be_finished_and_failed
|
||||
errors.add(:failed, "can't be true if planting is also finished") if finished && failed
|
||||
end
|
||||
|
||||
# check that any finished_at date occurs after planted_at
|
||||
def finished_must_be_after_planted
|
||||
return unless planted_at && finished_at # only check if we have both
|
||||
|
||||
8
app/models/planting_problem.rb
Normal file
8
app/models/planting_problem.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class PlantingProblem < ApplicationRecord
|
||||
include PhotoCapable
|
||||
|
||||
belongs_to :planting
|
||||
belongs_to :problem
|
||||
end
|
||||
@@ -3,7 +3,6 @@
|
||||
class Post < ApplicationRecord
|
||||
extend FriendlyId
|
||||
include Likeable
|
||||
|
||||
friendly_id :author_date_subject, use: %i(slugged finders)
|
||||
include PhotoCapable
|
||||
|
||||
@@ -11,15 +10,17 @@ class Post < ApplicationRecord
|
||||
# Relationships
|
||||
belongs_to :author, class_name: 'Member', inverse_of: :posts
|
||||
belongs_to :forum, optional: true
|
||||
has_many :comments, as: :commentable, dependent: :destroy
|
||||
has_many :comments, dependent: :destroy
|
||||
has_many :crop_posts, dependent: :delete_all
|
||||
has_many :crops, through: :crop_posts
|
||||
has_many :notifications, as: :notifiable, dependent: :destroy
|
||||
has_many :problem_posts, dependent: :delete_all
|
||||
has_many :problems, through: :problem_posts
|
||||
|
||||
after_create :send_notification
|
||||
#
|
||||
# Triggers
|
||||
after_save :update_crop_posts_association
|
||||
after_save :update_problem_posts_association
|
||||
|
||||
default_scope { joins(:author).merge(Member.kept) } # Ensures the owner still exists
|
||||
|
||||
@@ -77,6 +78,17 @@ class Post < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
def update_problem_posts_association
|
||||
problems.clear
|
||||
# look for problems mentioned in the post. eg. [aphids](problem)
|
||||
body.scan(Haml::Filters::GrowstuffMarkdown::PROBLEM_REGEX) do |_m|
|
||||
problem_name = Regexp.last_match(1)
|
||||
problem = Problem.case_insensitive_name(problem_name).first
|
||||
# create association
|
||||
problems << problem if problem && problems.exclude?(problem)
|
||||
end
|
||||
end
|
||||
|
||||
def send_notification
|
||||
recipients = []
|
||||
sender = author.id
|
||||
@@ -97,7 +109,6 @@ class Post < ApplicationRecord
|
||||
Notification.create(
|
||||
recipient_id:,
|
||||
sender_id: sender,
|
||||
notifiable: self,
|
||||
subject: "#{author} mentioned you in their post #{subject}",
|
||||
body:
|
||||
)
|
||||
|
||||
88
app/models/problem.rb
Normal file
88
app/models/problem.rb
Normal file
@@ -0,0 +1,88 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Problem < ApplicationRecord
|
||||
extend FriendlyId
|
||||
include PhotoCapable
|
||||
include SearchCrops # Note: This might need to be adapted to SearchProblems
|
||||
|
||||
friendly_id :name, use: %i(slugged finders)
|
||||
|
||||
##
|
||||
## Relationships
|
||||
belongs_to :creator, class_name: 'Member', optional: true, inverse_of: :created_problems
|
||||
belongs_to :requester, class_name: 'Member', optional: true, inverse_of: :requested_problems
|
||||
has_many :planting_problems, dependent: :delete_all
|
||||
has_many :plantings, through: :planting_problems
|
||||
has_many :problem_posts, dependent: :delete_all
|
||||
has_many :posts, through: :problem_posts, dependent: :delete_all
|
||||
|
||||
##
|
||||
## Scopes
|
||||
scope :recent, -> { approved.order(created_at: :desc) }
|
||||
scope :popular, -> { approved.order(Arel.sql("plantings_count desc, lower(name) asc")) }
|
||||
scope :pending_approval, -> { where(approval_status: "pending") }
|
||||
scope :approved, -> { where(approval_status: "approved") }
|
||||
scope :rejected, -> { where(approval_status: "rejected") }
|
||||
scope :interesting, -> { approved.has_photos }
|
||||
scope :has_photos, -> { includes(:photos).where.not(photos: { id: nil }) }
|
||||
|
||||
##
|
||||
## Validations
|
||||
validates :reason_for_rejection, presence: true, if: :rejected?
|
||||
validate :must_be_rejected_if_rejected_reasons_present
|
||||
validate :must_have_meaningful_reason_for_rejection
|
||||
validates :name, uniqueness: { scope: :approval_status }, if: :pending?
|
||||
|
||||
def to_s
|
||||
name
|
||||
end
|
||||
|
||||
def to_param
|
||||
slug
|
||||
end
|
||||
|
||||
def pending?
|
||||
approval_status == "pending"
|
||||
end
|
||||
|
||||
def approved?
|
||||
approval_status == "approved"
|
||||
end
|
||||
|
||||
def rejected?
|
||||
approval_status == "rejected"
|
||||
end
|
||||
|
||||
def approval_statuses
|
||||
%w(rejected pending approved)
|
||||
end
|
||||
|
||||
def reasons_for_rejection
|
||||
["already in database", "not a pest or disease", "not enough information", "other"]
|
||||
end
|
||||
|
||||
def rejection_explanation
|
||||
return rejection_notes if reason_for_rejection == "other"
|
||||
|
||||
reason_for_rejection
|
||||
end
|
||||
|
||||
def self.case_insensitive_name(name)
|
||||
where(["lower(problems.name) = :value", { value: name.downcase }])
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def must_be_rejected_if_rejected_reasons_present
|
||||
return if rejected?
|
||||
return unless reason_for_rejection.present? || rejection_notes.present?
|
||||
|
||||
errors.add(:approval_status, "must be rejected if a reason for rejection is present")
|
||||
end
|
||||
|
||||
def must_have_meaningful_reason_for_rejection
|
||||
return unless reason_for_rejection == "other" && rejection_notes.blank?
|
||||
|
||||
errors.add(:rejection_notes, "must be added if the reason for rejection is \"other\"")
|
||||
end
|
||||
end
|
||||
6
app/models/problem_post.rb
Normal file
6
app/models/problem_post.rb
Normal file
@@ -0,0 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ProblemPost < ApplicationRecord
|
||||
belongs_to :problem
|
||||
belongs_to :post
|
||||
end
|
||||
@@ -8,7 +8,7 @@ class Role < ApplicationRecord
|
||||
has_and_belongs_to_many :members
|
||||
|
||||
class << self
|
||||
%i(crop_wranglers admins).each do |method|
|
||||
%i(crop_wranglers admins problem_wranglers).each do |method|
|
||||
define_method method do
|
||||
slug = method.to_s.singularize.dasherize
|
||||
Role.where(slug:).try(:first).try(:members)
|
||||
|
||||
@@ -59,7 +59,6 @@ class Seed < ApplicationRecord
|
||||
scope :has_location, -> { joins(:owner).where.not('members.location': nil) }
|
||||
scope :recent, -> { order(created_at: :desc) }
|
||||
scope :active, -> { where('finished <> true').where('finished_at IS NULL OR finished_at < ?', Time.zone.now) }
|
||||
scope :expired, -> { active.where('plant_before < ?', Time.zone.today) }
|
||||
|
||||
def tradable
|
||||
tradable_to != 'nowhere'
|
||||
|
||||
@@ -13,7 +13,6 @@ module Api
|
||||
|
||||
attribute :slug
|
||||
attribute :planted_at
|
||||
attribute :failed
|
||||
attribute :finished
|
||||
attribute :finished_at
|
||||
attribute :quantity
|
||||
@@ -38,7 +37,9 @@ module Api
|
||||
filter :finished
|
||||
|
||||
attribute :percentage_grown
|
||||
delegate :percentage_grown, to: :@model
|
||||
def percentage_grown
|
||||
@model.percentage_grown
|
||||
end
|
||||
|
||||
attribute :crop_name
|
||||
attribute :crop_slug
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
|
||||
.row
|
||||
.col-md-6
|
||||
= f.check_box :finished, label: t('buttons.mark_as_finished')
|
||||
= f.check_box :finished, label: 'Mark as finished'
|
||||
%span.help-block= t('.finish_helper')
|
||||
|
||||
.card-footer
|
||||
|
||||
@@ -31,8 +31,7 @@
|
||||
= f.label :name, class: 'control-label col-md-2'
|
||||
.col-md-8
|
||||
= f.text_field :name, class: 'form-control'
|
||||
.col-md-8
|
||||
= f.select :language, I18nData.languages.map {|code, name| [name.split(";").first, code] }, class: 'form-control'
|
||||
|
||||
.form-group
|
||||
.form-actions.col-md-offset-2.col-md-8
|
||||
= f.submit 'Save', class: 'btn btn-primary'
|
||||
|
||||
@@ -1 +1 @@
|
||||
#{link_to 'commented', event_model} on #{link_to event_model.commentable, event_model.commentable}
|
||||
#{link_to 'commented', event_model} on #{link_to event_model.post, event_model.post}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
- @comment ||= Comment.new(commentable: @commentable)
|
||||
.card.col-md-8.col-lg-7.mx-auto.float-none.white.z-depth-1.py-2.px-2
|
||||
.card-body
|
||||
- if content_for? :title
|
||||
@@ -15,13 +14,13 @@
|
||||
%li= msg
|
||||
|
||||
.md-form
|
||||
= f.text_area :body, rows: 6, class: 'form-control md-textarea', autofocus: 'autofocus', required: true, pattern: '\w+'
|
||||
= f.text_area :body, rows: 6, class: 'form-control md-textarea', autofocus: 'autofocus'
|
||||
= f.label :body, "Your comment:"
|
||||
|
||||
%span.help-block
|
||||
= render partial: "shared/markdown_help"
|
||||
.actions.text-right
|
||||
= f.submit 'Post comment', class: 'btn btn-primary'
|
||||
.field
|
||||
= f.hidden_field :commentable_id, value: @commentable.id
|
||||
= f.hidden_field :commentable_type, value: @commentable.class.name
|
||||
- if defined?(@post)
|
||||
.field
|
||||
= f.hidden_field :post_id, value: @post.id
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
|
||||
%p
|
||||
Editing comment on
|
||||
= link_to @comment.commentable.subject, @comment.commentable
|
||||
= link_to @comment.post.subject, @comment.post
|
||||
|
||||
= render 'form', locals: { comment: @comment, commentable: @comment.commentable }
|
||||
= render 'form'
|
||||
|
||||
@@ -5,18 +5,17 @@
|
||||
%link= comments_url
|
||||
- @comments.each do |comment|
|
||||
%item
|
||||
%title Comment by #{comment.author.login_name} on #{comment.commentable.subject}
|
||||
%title Comment by #{comment.author.login_name} on #{comment.post.subject}
|
||||
%description
|
||||
:escaped_markdown
|
||||
<p>
|
||||
Comment on
|
||||
#{ link_to comment.commentable.subject, polymorphic_url(comment.commentable) }
|
||||
#{ link_to comment.post.subject, post_url(comment.post) }
|
||||
</p>
|
||||
|
||||
:escaped_markdown
|
||||
#{ strip_tags markdownify(comment.body) }
|
||||
|
||||
%pubdate= comment.created_at.to_fs(:rfc822)
|
||||
%link= polymorphic_url(comment.commentable)
|
||||
%link= post_url(comment.post)
|
||||
%guid= comment_url(comment)
|
||||
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
= content_for :title, "New comment"
|
||||
- if @commentable.is_a?(Post)
|
||||
%section.blog-post
|
||||
.card.post{ id: "post-#{@commentable.id}" }
|
||||
.card-header
|
||||
%h2.display-3= @commentable.subject
|
||||
.card-body= render "posts/single", post: @commentable || @comment.commentable, subject: true
|
||||
- elsif @commentable.is_a?(Photo)
|
||||
%section.blog-post
|
||||
.card.photo{ id: "photo-#{@commentable.id}" }
|
||||
.card-header
|
||||
%h2.display-3= @commentable.subject
|
||||
.card-body= render "photos/card", photo: @commentable || @comment.commentable, subject: true
|
||||
|
||||
= render partial: "comments/comments", locals: { commentable: @commentable || @comment.commentable }
|
||||
%section.blog-post
|
||||
.card.post{ id: "post-#{@post.id}" }
|
||||
.card-header
|
||||
%h2.display-3= @post.subject
|
||||
.card-body= render "posts/single", post: @post || @comment.post, subject: true
|
||||
|
||||
= render 'form', locals: { comment: @comment, commentable: @commentable || @comment.commentable }
|
||||
= render partial: "posts/comments", locals: { post: @post || @comment.post }
|
||||
|
||||
= render 'form'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
- if crop.approved? && signed_in?
|
||||
|
||||
.btn-group.crop-actions{"aria-label" => "Crop Actions", role: "group"}
|
||||
.btn-group{"aria-label" => "Crop Actions", role: "group"}
|
||||
= render 'plantings/modal', planting: Planting.new(crop: crop, owner: current_member)
|
||||
= render 'harvests/modal', harvest: Harvest.new(crop: @crop, owner: current_member)
|
||||
= render 'seeds/modal', seed: Seed.new(crop: @crop, owner: current_member)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
- if can? :edit, an
|
||||
.dropdown.planting-actions
|
||||
%a#crop-actions-altnames.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", :type => "button", :href => '#'}
|
||||
= "#{an.name} (#{an.language})"
|
||||
= an.name
|
||||
.dropdown-menu.dropdown-menu-xs{"aria-labelledby" => "crop-actions-altnames"}
|
||||
- if can? :edit, an
|
||||
= link_to edit_alternate_name_path(an), class: 'dropdown-item' do
|
||||
@@ -16,7 +16,7 @@
|
||||
= delete_icon
|
||||
= t('.delete')
|
||||
- else
|
||||
.badge= "#{an.name} (#{an.language})"
|
||||
.badge= an.name
|
||||
|
||||
|
||||
%p.text-right
|
||||
|
||||
@@ -25,9 +25,9 @@
|
||||
Last harvest expected
|
||||
%strong= crop.median_days_to_last_harvest
|
||||
days after planting
|
||||
- if member_signed_in?
|
||||
.card-footer
|
||||
.d-flex.btn-group-vertical
|
||||
= render 'plantings/modal', planting: Planting.new(crop: crop, owner: current_member)
|
||||
- #= render 'harvests/modal', harvest: Harvest.new(crop: crop, owner: current_member)
|
||||
= render 'seeds/modal', seed: Seed.new(crop: crop, owner: current_member)
|
||||
- if member_signed_in?
|
||||
.card-footer
|
||||
.d-flex.justify-content-between
|
||||
= render 'plantings/modal', planting: Planting.new(crop: crop, owner: current_member)
|
||||
- #= render 'harvests/modal', harvest: Harvest.new(crop: crop, owner: current_member)
|
||||
= render 'seeds/modal', seed: Seed.new(crop: crop, owner: current_member)
|
||||
|
||||
5
app/views/crops/_planting_advice.html.haml
Normal file
5
app/views/crops/_planting_advice.html.haml
Normal file
@@ -0,0 +1,5 @@
|
||||
- if crop.guides_count.present? && crop.guides_count.positive?
|
||||
%p
|
||||
There are
|
||||
= link_to "https://openfarm.cc/en/crops/#{CGI.escape @crop.name.gsub(' ', '-').downcase}" do
|
||||
#{crop.guides_count} growing guides on Open Farm
|
||||
@@ -10,6 +10,10 @@
|
||||
= edit_icon
|
||||
= t('.edit')
|
||||
|
||||
= link_to crop_openfarm_path(crop), method: :post, class: 'dropdown-item' do
|
||||
= icon 'far', 'update'
|
||||
Fetch data from OpenFarm
|
||||
|
||||
= link_to crop_gbif_path(crop), method: :post, class: 'dropdown-item' do
|
||||
= icon 'far', 'update'
|
||||
Fetch data from GBIF
|
||||
|
||||
@@ -30,6 +30,15 @@
|
||||
- @crop.companions.each do |companion|
|
||||
= render 'crops/tiny', crop: companion
|
||||
|
||||
- if @problems.any?
|
||||
%section.problems
|
||||
%h2 Problems
|
||||
- @problems.group_by(&:name).each do |problem_name, problems|
|
||||
- problem = problems.first
|
||||
= link_to problem_path(problem) do
|
||||
= problem_name
|
||||
%span.badge.badge-secondary= problems.size
|
||||
|
||||
%section.photos
|
||||
= cute_icon
|
||||
= render 'crops/photos', crop: @crop
|
||||
@@ -74,6 +83,7 @@
|
||||
.card-body
|
||||
%h4 How to grow #{@crop.name.pluralize}
|
||||
= render 'grown_for', crop: @crop
|
||||
= render 'planting_advice', crop: @crop
|
||||
- if @crop.parent
|
||||
%hr/
|
||||
%p.parent-crop
|
||||
@@ -123,6 +133,13 @@
|
||||
= icon 'fas', 'external-link-alt'
|
||||
Wikipedia (English)
|
||||
|
||||
%li.list-group-item
|
||||
= link_to "https://openfarm.cc/en/crops/#{CGI.escape @crop.name.gsub(' ', '-')}",
|
||||
class: 'card-link',
|
||||
target: "_blank",
|
||||
rel: "noopener noreferrer" do
|
||||
= icon 'fas', 'external-link-alt'
|
||||
OpenFarm - Growing guide
|
||||
%li.list-group-item
|
||||
= link_to "https://www.gardenate.com/plant/#{CGI.escape @crop.name}",
|
||||
target: "_blank",
|
||||
@@ -139,14 +156,6 @@
|
||||
= icon 'fas', 'external-link-alt'
|
||||
Google
|
||||
|
||||
%li.list-group-item
|
||||
= link_to 'https://chat.openai.com/?model=gpt-4o&prompt=' + CGI.escape(['How do I grow', @crop.name, "and what grows well with it? What should I plant the next season if practicing crop rotation? Explain why and add links to your sources"].join(' ')),
|
||||
target: "_blank",
|
||||
class: 'card-link',
|
||||
rel: "noopener noreferrer" do
|
||||
= icon 'fas', 'external-link-alt'
|
||||
ChatGPT
|
||||
|
||||
%li.list-group-item
|
||||
= link_to "https://wikihow.com/wikiHowTo?search=#{CGI.escape "grow #{@crop.name}" }",
|
||||
target: "_blank",
|
||||
|
||||
@@ -3,6 +3,19 @@
|
||||
html: { method: :put, class: 'form-horizontal' }) do |_f|
|
||||
%br/
|
||||
= render 'devise/shared/error_messages', resource: resource
|
||||
.row
|
||||
.col-md-12
|
||||
%p
|
||||
= image_tag "twitter_32.png", size: "32x32", alt: 'Twitter logo'
|
||||
- if @twitter_auth
|
||||
You are connected to Twitter as
|
||||
= link_to @twitter_auth.name, "https://twitter.com/#{@twitter_auth.name}"
|
||||
= link_to "Disconnect", @twitter_auth,
|
||||
confirm: "Are you sure you want to remove this connection?",
|
||||
method: :delete, class: "remove btn btn-danger"
|
||||
- else
|
||||
= link_to 'Connect to Twitter', '/members/auth/twitter', class: 'btn'
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
%p
|
||||
|
||||
@@ -13,32 +13,7 @@
|
||||
.form-group
|
||||
= f.label :bio, class: 'control-label col-md-2'
|
||||
.col-md-8
|
||||
= f.text_area :bio, rows: 6, class: 'form-control', placeholder: "I'm am XYZ gardener interested in A, B, C"
|
||||
|
||||
.form-group
|
||||
= f.label :website_url, 'Website', class: 'control-label col-md-2'
|
||||
.col-md-8
|
||||
= f.url_field :website_url, class: 'form-control', placeholder: "https://you.example.com/"
|
||||
|
||||
.form-group
|
||||
= f.label :instagram_handle, 'Instagram', class: 'control-label col-md-2'
|
||||
.col-md-8
|
||||
= f.text_field :instagram_handle, class: 'form-control', placeholder: 'your_handle'
|
||||
|
||||
.form-group
|
||||
= f.label :facebook_handle, 'Facebook', class: 'control-label col-md-2'
|
||||
.col-md-8
|
||||
= f.text_field :facebook_handle, class: 'form-control', placeholder: 'your_handle'
|
||||
|
||||
.form-group
|
||||
= f.label :bluesky_handle, 'Bluesky', class: 'control-label col-md-2'
|
||||
.col-md-8
|
||||
= f.text_field :bluesky_handle, class: 'form-control', placeholder: 'your_handle'
|
||||
|
||||
.form-group
|
||||
= f.label :other_url, 'Other URL', class: 'control-label col-md-2'
|
||||
.col-md-8
|
||||
= f.url_field :other_url, class: 'form-control', placeholder: "https://you.example.com/"
|
||||
= f.text_area :bio, rows: 6, class: 'form-control'
|
||||
|
||||
.form-group
|
||||
%label.control-label.col-md-2
|
||||
|
||||
@@ -15,4 +15,5 @@
|
||||
|
||||
- if can?(:destroy, garden)
|
||||
.dropdown-divider
|
||||
= delete_button(garden, classes: 'dropdown-item text-danger', message: 'gardens.confirm_delete')
|
||||
= delete_button(garden, classes: 'dropdown-item text-danger',
|
||||
message: 'All plantings associated with this garden will also be deleted. Are you sure?')
|
||||
|
||||
@@ -66,7 +66,8 @@
|
||||
|
||||
- if can?(:destroy, @garden)
|
||||
.dropdown-divider
|
||||
= delete_button(@garden, classes: 'dropdown-item text-danger', message: 'gardens.confirm_delete')
|
||||
= delete_button(@garden, classes: 'dropdown-item text-danger',
|
||||
message: 'All plantings associated with this garden will also be deleted. Are you sure?')
|
||||
|
||||
%section
|
||||
%h2 Current activities in garden
|
||||
|
||||
@@ -4,6 +4,4 @@
|
||||
member: link_to(t('.member_linktext', count: Member.confirmed.size.to_i), members_path),
|
||||
number_crops: link_to(t('.number_crops_linktext', count: Crop.count.to_i), crops_path),
|
||||
number_plantings: link_to(t('.number_plantings_linktext', count: Planting.count.to_i), plantings_path),
|
||||
number_gardens: link_to(t('.number_gardens_linktext', count: Garden.count.to_i), gardens_path),
|
||||
contributors: link_to(count_github_contibutors, 'https://github.com/Growstuff/growstuff/blob/dev/CONTRIBUTORS.md', target: '_blank', rel: 'noopener'),
|
||||
github: link_to('GitHub', 'http://github.com/Growstuff/growstuff', target: '_blank', rel: 'noopener'))
|
||||
number_gardens: link_to(t('.number_gardens_linktext', count: Garden.count.to_i), gardens_path))
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
%p= render 'stats', cached: true
|
||||
.col
|
||||
%br
|
||||
%p
|
||||
- if current_member.plantings.active.any?
|
||||
= link_to member_path(current_member, anchor: "#content"), class: 'btn btn-dark' do
|
||||
@@ -62,16 +61,3 @@
|
||||
%section.members
|
||||
= cute_icon
|
||||
= render 'members', cached: true
|
||||
.col-12.col-lg-6
|
||||
%section.pwa-install
|
||||
= cute_icon
|
||||
%h2.text-center= t('home.pwa_title')
|
||||
.index-cards
|
||||
.card
|
||||
.card-body
|
||||
%h3= t('home.pwa_ios_title')
|
||||
%p= t('home.pwa_ios_steps_html')
|
||||
.card
|
||||
.card-body
|
||||
%h3= t('home.pwa_android_title')
|
||||
%p= t('home.pwa_android_steps_html')
|
||||
@@ -6,6 +6,6 @@
|
||||
%span.site-name Growstuff
|
||||
.nav= render 'crops/search_bar'
|
||||
.nav
|
||||
%button.navbar-toggler.ml-auto{ "aria-controls" => "navbarSupportedContent", "aria-expanded" => "false", "aria-label" => "Toggle navigation", "data-bs-target" => "#navbarSupportedContent", "data-bs-toggle" => "collapse", type: "button" }
|
||||
%span.navbar-toggler-icon
|
||||
%button.navbar-toggler{ "aria-controls" => "navbarSupportedContent", "aria-expanded" => "false", "aria-label" => "Toggle navigation", "data-bs-target" => "#navbarSupportedContent", "data-bs-toggle" => "collapse", type: "button" }
|
||||
%i.fas.fa-ellipsis-v.navbar-toggler-icon
|
||||
= render 'layouts/menu'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#navbarSupportedContent.collapse.navbar-collapse
|
||||
%ul.navbar-nav.mr-auto.bg-dark
|
||||
%ul.navbar-nav.mr-auto
|
||||
- if signed_in?
|
||||
%li.nav-item
|
||||
= link_to timeline_index_path, method: :get, class: 'nav-link text-white' do
|
||||
@@ -30,9 +30,7 @@
|
||||
|
||||
- cache("everyone-menu", expires_in: 1.week) do
|
||||
%li.nav-item.dropdown
|
||||
%a.nav-link.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", href: "#", role: "button"}
|
||||
%span
|
||||
= t('.crops')
|
||||
%a.nav-link.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", href: "#", role: "button"}= t('.crops')
|
||||
.dropdown-menu
|
||||
= link_to crops_path, class: 'dropdown-item' do
|
||||
= t('.browse_crops')
|
||||
@@ -46,9 +44,7 @@
|
||||
= harvest_icon
|
||||
= t('.harvests')
|
||||
%li.nav-item.dropdown
|
||||
%a.nav-link.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", href: "#", role: "button"}
|
||||
%span
|
||||
= t('.community')
|
||||
%a.nav-link.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", href: "#", role: "button"}= t('.community')
|
||||
.dropdown-menu{"aria-labelledby" => "navbarDropdown"}
|
||||
= link_to t('.community_map'), places_path, class: 'dropdown-item'
|
||||
= link_to t('.browse_members'), members_path, class: 'dropdown-item'
|
||||
@@ -58,9 +54,7 @@
|
||||
- if member_signed_in?
|
||||
- if current_member.role?(:crop_wrangler) || current_member.role?(:admin)
|
||||
%li.nav-item.dropdown
|
||||
%a.nav-link.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", href: "#", role: "button"}
|
||||
%span
|
||||
= t('.admin')
|
||||
%a.nav-link.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", href: "#", role: "button"}= t('.admin')
|
||||
.dropdown-menu{"aria-labelledby" => "navbarDropdown"}
|
||||
- if current_member.role?(:crop_wrangler)
|
||||
= link_to t('.crop_wrangling'), wrangle_crops_path, class: 'dropdown-item'
|
||||
|
||||
@@ -1 +1,13 @@
|
||||
%h2 All about #{member.login_name}
|
||||
%p
|
||||
%small
|
||||
%a{href: "#content"}
|
||||
Skip to main content
|
||||
- if member.bio.blank?
|
||||
- if can? :edit, member
|
||||
= link_to "Add a bio to complete your profile.", edit_member_registration_path
|
||||
- else
|
||||
#{member.login_name} hasn't written a bio yet.
|
||||
- else
|
||||
:markdown
|
||||
#{ strip_tags markdownify(member.bio) }
|
||||
|
||||
@@ -1,37 +1,17 @@
|
||||
- if member.website_url.present? || member.instagram_handle.present? || member.facebook_handle.present? || member.bluesky_handle.present? || member.other_url.present? || flickr_auth || member.show_email
|
||||
- if twitter_auth || flickr_auth || member.show_email
|
||||
%h4 Contact
|
||||
|
||||
- if member.website_url.present?
|
||||
- if twitter_auth
|
||||
%p
|
||||
= icon 'fas', 'globe', class: 'fa-fw'
|
||||
= link_to "Website", member.website_url, target: '_blank', rel: 'noopener noreferrer'
|
||||
|
||||
- if member.instagram_handle.present?
|
||||
%p
|
||||
= icon 'fab', 'instagram', class: 'fa-fw'
|
||||
= link_to member.instagram_handle, "https://instagram.com/#{member.instagram_handle}", target: '_blank', rel: 'noopener noreferrer'
|
||||
|
||||
- if member.facebook_handle.present?
|
||||
%p
|
||||
= icon 'fab', 'facebook', class: 'fa-fw'
|
||||
= link_to member.facebook_handle, "https://facebook.com/#{member.facebook_handle}", target: '_blank', rel: 'noopener noreferrer'
|
||||
|
||||
- if member.bluesky_handle.present?
|
||||
%p
|
||||
= icon 'fas', 'comment-dots', class: 'fa-fw'
|
||||
= link_to member.bluesky_handle, "https://bsky.app/profile/#{member.bluesky_handle}", target: '_blank', rel: 'noopener noreferrer'
|
||||
|
||||
- if member.other_url.present?
|
||||
%p
|
||||
= icon 'fas', 'link', class: 'fa-fw'
|
||||
= link_to "More...", member.other_url, target: '_blank', rel: 'noopener noreferrer'
|
||||
= image_tag "twitter_32.png", size: "32x32", alt: 'Twitter logo'
|
||||
= link_to twitter_auth.name, "https://twitter.com/#{twitter_auth.name}"
|
||||
|
||||
- if flickr_auth
|
||||
%p
|
||||
= image_tag "flickr_32.png", size: "32x32", alt: 'Flickr logo'
|
||||
= link_to flickr_auth.name, "https://flickr.com/photos/#{flickr_auth.uid}", target: '_blank', rel: 'noopener noreferrer'
|
||||
= link_to flickr_auth.name, "https://flickr.com/photos/#{flickr_auth.uid}"
|
||||
|
||||
- if member.show_email
|
||||
%p
|
||||
= icon 'fas', 'envelope', class: 'fa-fw'
|
||||
Email:
|
||||
= mail_to member.email
|
||||
|
||||
@@ -5,5 +5,5 @@
|
||||
= link_to member.location, place_path(member.location, anchor: "members")
|
||||
- else
|
||||
.location-not-set
|
||||
%h1 Location not known or geocodable
|
||||
%p We can't show you what's nearby
|
||||
.sr-only Location not known
|
||||
.sr-only We can't show you what's nearby
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
- cache member do
|
||||
.card
|
||||
.card.card-double
|
||||
.card-body
|
||||
%h4.login-name= link_to member, member
|
||||
%div
|
||||
|
||||
@@ -21,21 +21,6 @@
|
||||
.row
|
||||
.col= render "bio", member: @member
|
||||
.col= render "avatar", member: @member
|
||||
.row
|
||||
.col
|
||||
%p
|
||||
%small
|
||||
%a{href: "#content"}
|
||||
Skip to main content
|
||||
- if @member.bio.blank?
|
||||
- if member_signed_in? && current_member == @member
|
||||
= link_to "Add a bio to complete your profile.", edit_member_registration_path
|
||||
- else
|
||||
#{@member.login_name} hasn't written a bio yet.
|
||||
- else
|
||||
:markdown
|
||||
#{ strip_tags markdownify(@member.bio) }
|
||||
|
||||
- if @member.roles.any?
|
||||
%p
|
||||
- @member.roles.each do |role|
|
||||
@@ -45,16 +30,12 @@
|
||||
= icon 'fas', 'map-marker'
|
||||
= truncate(@member.location, length: 15, separator: ' ', omission: '... ')
|
||||
%p
|
||||
%small
|
||||
%strong Member since
|
||||
%br
|
||||
= @member.created_at.to_fs(:date)
|
||||
%strong Member since
|
||||
= @member.created_at.to_fs(:date)
|
||||
- if @member.last_sign_in_at
|
||||
%p
|
||||
%small
|
||||
%strong Last Login
|
||||
%br
|
||||
= @member.last_sign_in_at&.to_fs(:default)
|
||||
%strong Last Login
|
||||
= @member.last_sign_in_at&.to_fs(:default)
|
||||
|
||||
- if can? :update, @member
|
||||
= link_to edit_member_registration_path, class: 'btn btn-block' do
|
||||
@@ -77,13 +58,14 @@
|
||||
|
||||
= render "stats", member: @member
|
||||
.card-footer
|
||||
= render "contact", member: @member, flickr_auth: @flickr_auth
|
||||
= render "contact", member: @member, twitter_auth: @twitter_auth,
|
||||
flickr_auth: @flickr_auth
|
||||
|
||||
.col-md-10#content
|
||||
.row
|
||||
%section.order-3.order-md-1.col-12= render "map", member: @member
|
||||
- if @harvesting.size.positive?
|
||||
%section.harvests.order-2.order-md-1.col-12
|
||||
- if @harvesting.size.positive?
|
||||
%section.harvests.order-2.order-md-1
|
||||
%h2 Ready to harvest
|
||||
.index-cards
|
||||
- @harvesting.each do |planting|
|
||||
|
||||
@@ -46,12 +46,4 @@
|
||||
- else
|
||||
= @photo.license_name
|
||||
|
||||
= render "associations", photo: @photo
|
||||
.row
|
||||
- if can? :create, Comment
|
||||
= link_to new_comment_path(comment: { commentable_type: 'Photo', commentable_id: @photo.id }), class: 'btn' do
|
||||
= icon 'fas', 'comment'
|
||||
Comment
|
||||
.row
|
||||
.col-md-9
|
||||
= render 'comments/comments', commentable: @photo
|
||||
= render "associations", photo: @photo
|
||||
@@ -7,16 +7,7 @@
|
||||
- if planting.active
|
||||
= planting_plan_something_button(planting, classes: 'dropdown-item')
|
||||
= planting_finish_button(planting, classes: 'dropdown-item')
|
||||
= planting_failed_button(planting, classes: 'dropdown-item')
|
||||
= planting_harvest_button(planting, classes: 'dropdown-item')
|
||||
= planting_save_seeds_button(planting, classes: 'dropdown-item')
|
||||
- if can?(:transplant, planting) && planting.active && transplantable_gardens_by_owner(planting).any?
|
||||
.dropdown-divider
|
||||
.px-2
|
||||
= form_tag transplant_planting_path(planting), method: :post do
|
||||
.form-group
|
||||
= label_tag :garden_id, 'Transplant to:'
|
||||
= select_tag :garden_id, options_from_collection_for_select(transplantable_gardens_by_owner(planting), :id, :name), class: 'form-control form-control-sm'
|
||||
= submit_tag 'Transplant', class: 'btn btn-sm btn-primary mt-2'
|
||||
.dropdown-divider
|
||||
= delete_button(planting, classes: 'dropdown-item text-danger')
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
- if planting.active
|
||||
= planting_finish_button(planting, classes: 'dropdown-item')
|
||||
= planting_failed_button(planting, classes: 'dropdown-item')
|
||||
= planting_harvest_button(planting, classes: 'dropdown-item')
|
||||
= planting_save_seeds_button(planting, classes: 'dropdown-item')
|
||||
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
%h2 Seeds saved
|
||||
|
||||
- if can?(:edit, planting) && !planting.failed?
|
||||
%a.btn.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", role: "button"}
|
||||
= seed_icon
|
||||
= t('buttons.save_seeds')
|
||||
.dropdown-menu.dropdown-secondary
|
||||
- Seed::TRADABLE_TO_VALUES.each do |trade|
|
||||
= link_to seeds_path(return: 'planting', seed: {crop_id: planting.crop.id, parent_planting_id: planting.id, tradable_to: trade}), method: :post, class: 'dropdown-item' do
|
||||
Will trade:
|
||||
= trade
|
||||
%a.btn.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", role: "button"}
|
||||
= seed_icon
|
||||
= t('buttons.save_seeds')
|
||||
.dropdown-menu.dropdown-secondary
|
||||
- Seed::TRADABLE_TO_VALUES.each do |trade|
|
||||
= link_to seeds_path(return: 'planting', seed: {crop_id: planting.crop.id, parent_planting_id: planting.id, tradable_to: trade}), method: :post, class: 'dropdown-item' do
|
||||
Will trade:
|
||||
= trade
|
||||
|
||||
- if planting.child_seeds.size.positive?
|
||||
.index-cards
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
- if planting.finish_is_predicatable?
|
||||
.card.fact-card
|
||||
%h3 Progress
|
||||
- if planting.age_in_days.to_i < 0
|
||||
- if planting.age_in_days < 0
|
||||
%strong Planned
|
||||
- else
|
||||
%strong #{planting.age_in_days}/#{planting.expected_lifespan}
|
||||
@@ -40,12 +40,12 @@
|
||||
- if planting.quantity.to_i.positive? && planting.planted_from.present?
|
||||
= planting.planted_from.pluralize(planting.quantity.to_i)
|
||||
|
||||
- unless planting.finished? || planting.failed?
|
||||
- unless planting.finished?
|
||||
.card.fact-card.grid-sizer
|
||||
%h3 Growing
|
||||
%strong= seedling_icon
|
||||
%span
|
||||
- if planting.age_in_days.to_i < 0
|
||||
- if planting.age_in_days < 0
|
||||
Planting planned
|
||||
- else
|
||||
Planting is still growing today
|
||||
|
||||
@@ -34,7 +34,9 @@
|
||||
.col-md-4
|
||||
= f.text_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"
|
||||
class: 'add-datepicker', label: 'When?'
|
||||
%span.help-inline
|
||||
Tip: Plan our your future plantings by forward dating, and subscribe to your iCalendar feed for reminders to plant
|
||||
|
||||
.row
|
||||
.col-md-4
|
||||
@@ -45,19 +47,21 @@
|
||||
= f.number_field :quantity, label: 'How many?', min: 1
|
||||
= f.text_area :description, rows: 6, label: 'Tell us more about it'
|
||||
|
||||
= f.collection_check_boxes :problem_ids, Problem.approved.order(:name), :id, :name do |b|
|
||||
.form-check
|
||||
= b.check_box
|
||||
= b.label
|
||||
|
||||
.row
|
||||
.col-md-6
|
||||
= f.check_box :finished, label: t('buttons.mark_as_finished'), title: t('.finish_helper')
|
||||
|
||||
= f.check_box :finished, label: 'Mark as finished'
|
||||
%span.help-block= t('.finish_helper')
|
||||
.col-md-6
|
||||
= f.text_field :finished_at,
|
||||
value: @planting.finished_at ? @planting.finished_at.to_fs(:ymd) : '',
|
||||
class: 'add-datepicker',
|
||||
label: 'Finished date',
|
||||
placeholder: 'optional'
|
||||
.row
|
||||
.col-md-6
|
||||
= f.check_box :failed, label: t('buttons.mark_as_failed'), title: t('.failed_helper')
|
||||
|
||||
.card-footer
|
||||
.text-right= f.submit 'Save'
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
%h2 Harvests
|
||||
- if can?(:edit, planting) && !planting.failed
|
||||
|
||||
- if can? :edit, planting
|
||||
= render 'harvests/modal', harvest: Harvest.new(crop: planting.crop, planting: planting)
|
||||
- if planting.harvests.empty?
|
||||
%p No harvests recorded
|
||||
- if planting.finished? && can?(:edit, planting) && can?(:create, Harvest)
|
||||
- if !planting.finished? && can?(:edit, planting) && can?(:create, Harvest)
|
||||
%p Record your harvests here to improve crop predictions, and you'll be able to compare with your garden next season.
|
||||
- else
|
||||
.index-cards
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
%p.small #{harvest_icon} First harvest expected #{I18n.l planting.first_harvest_predicted_at}
|
||||
- if planting.finished_at.present?
|
||||
%p.small #{finished_icon} Finished #{I18n.l planting.finished_at}
|
||||
- elsif planting.failed?
|
||||
%p.small #{finished_icon} Failed
|
||||
- elsif planting.finish_predicted_at.present?
|
||||
%p.small #{finished_icon} Finish expected #{I18n.l planting.finish_predicted_at}
|
||||
- if planting.planted_at.present? && planting.expected_lifespan.present?
|
||||
|
||||
@@ -32,17 +32,15 @@
|
||||
%strong= @planting.crop.name.titleize
|
||||
%small.text-muted= @planting.crop.default_scientific_name
|
||||
%tt
|
||||
- if @planting.failed?
|
||||
%span.badge.badge-danger Failed
|
||||
- elsif @planting.finished?
|
||||
%span.badge.badge-success Finished
|
||||
- if @planting.finished?
|
||||
Finished
|
||||
- elsif @planting.percentage_grown.present?
|
||||
#{@planting.percentage_grown.to_i}%
|
||||
- if @planting.finish_is_predicatable?
|
||||
- if @planting.age_in_days.to_i < 0
|
||||
- if @planting.age_in_days < 0
|
||||
%strong Planned
|
||||
- else
|
||||
%strong #{@planting.age_in_days.to_i}/#{@planting.expected_lifespan} days
|
||||
%strong #{@planting.age_in_days}/#{@planting.expected_lifespan} days
|
||||
|
||||
= render 'timeline', planting: @planting
|
||||
= render 'likes/likes', object: @planting
|
||||
@@ -53,6 +51,23 @@
|
||||
|
||||
.col-md-8.col-xs-12
|
||||
%section= render 'facts', planting: @planting
|
||||
|
||||
- if @planting.problems.any?
|
||||
%section.problems
|
||||
%h2 Problems
|
||||
- @planting.planting_problems.each do |planting_problem|
|
||||
.card
|
||||
.card-header
|
||||
%h3= planting_problem.problem.name
|
||||
.card-body
|
||||
- if planting_problem.photos.any?
|
||||
.row
|
||||
- planting_problem.photos.each do |photo|
|
||||
.col-md-4
|
||||
= image_tag photo.thumbnail_url, class: 'img-fluid'
|
||||
- else
|
||||
%p No photos of this problem for this planting yet.
|
||||
|
||||
- if @planting.description.present?
|
||||
= cute_icon
|
||||
.card
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
%a{ name: "comments" }
|
||||
- if commentable.comments
|
||||
- if post.comments
|
||||
%hr/
|
||||
%h2
|
||||
= comment_icon
|
||||
= localize_plural(commentable.comments, Comment)
|
||||
- commentable.comments.post_order.each do |comment|
|
||||
= localize_plural(post.comments, Comment)
|
||||
- post.comments.post_order.each do |comment|
|
||||
= render "comments/single", comment: comment
|
||||
|
||||
- else
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user