mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-25 01:13:03 -04:00
Compare commits
82 Commits
release66
...
feature/pr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4b9763e1da | ||
|
|
8709ac6e8f | ||
|
|
d75f503b16 | ||
|
|
1dfc5abca9 | ||
|
|
cc97916bac | ||
|
|
2134b934f8 | ||
|
|
c8cfb5d42a | ||
|
|
508ee5260d | ||
|
|
ee2fffd25b | ||
|
|
c92b912b28 | ||
|
|
f665fba91a | ||
|
|
3578fbdf64 | ||
|
|
0289786891 | ||
|
|
7dc66cb199 | ||
|
|
417602cb85 | ||
|
|
7a2760b086 | ||
|
|
9e0e21b565 | ||
|
|
a481cb7c06 | ||
|
|
a177a53d57 | ||
|
|
abbe9ee7ca | ||
|
|
48d2f0a224 | ||
|
|
074644d5c8 | ||
|
|
2e2e47d405 | ||
|
|
0544abcd8f | ||
|
|
73fb43fc4f | ||
|
|
532afafa0e | ||
|
|
378bd0d8f1 | ||
|
|
bb943fe0c6 | ||
|
|
28742d4936 | ||
|
|
d7e28e79fe | ||
|
|
322bca9281 | ||
|
|
7c081541eb | ||
|
|
475514a8f0 | ||
|
|
bb3fd3bcb7 | ||
|
|
5c86622823 | ||
|
|
fefd387481 | ||
|
|
93de9b35bc | ||
|
|
3d62cfcf81 | ||
|
|
f5a03b8991 | ||
|
|
8044640023 | ||
|
|
d1d718df9e | ||
|
|
da4bb17df8 | ||
|
|
0320cbe5ad | ||
|
|
4d3c4ca10d | ||
|
|
ab29de3d04 | ||
|
|
749134a7de | ||
|
|
1657a527e9 | ||
|
|
9ae90c1b7e | ||
|
|
ba6ec689c5 | ||
|
|
e7090631ab | ||
|
|
fadf5154e4 | ||
|
|
13ed098172 | ||
|
|
df2853edd3 | ||
|
|
948bb78656 | ||
|
|
9c8ae50188 | ||
|
|
0ee6260272 | ||
|
|
bf528220ab | ||
|
|
fd89cc6bce | ||
|
|
08a3890ba2 | ||
|
|
956c73cd1e | ||
|
|
8e74d1796a | ||
|
|
a98990ccd2 | ||
|
|
ac1463e2cf | ||
|
|
8564ec7a7c | ||
|
|
79a54351e3 | ||
|
|
48aa2aafd3 | ||
|
|
3b648925dd | ||
|
|
d04ffbeddd | ||
|
|
e1367613e6 | ||
|
|
70f78f1175 | ||
|
|
6131fdf141 | ||
|
|
44101e07fb | ||
|
|
b4c1104af0 | ||
|
|
3d4ba954e7 | ||
|
|
0b639d5940 | ||
|
|
26de3e7c5e | ||
|
|
6d44a2a780 | ||
|
|
5da8f815d3 | ||
|
|
d71370c0bc | ||
|
|
c58ca74b53 | ||
|
|
0d22706d42 | ||
|
|
1462279b60 |
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)
|
||||
|
||||
131
Gemfile.lock
131
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
|
||||
@@ -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)
|
||||
@@ -351,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)
|
||||
@@ -423,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)
|
||||
@@ -499,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)
|
||||
@@ -532,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)
|
||||
@@ -553,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)
|
||||
@@ -582,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)
|
||||
@@ -628,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)
|
||||
@@ -648,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)
|
||||
@@ -668,11 +668,11 @@ GEM
|
||||
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
|
||||
@@ -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)
|
||||
|
||||
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 |
@@ -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%);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -75,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])
|
||||
|
||||
@@ -107,7 +107,7 @@ class PlantingsController < DataController
|
||||
:crop_id, :description, :garden_id, :planted_at,
|
||||
:parent_seed_id,
|
||||
:quantity, :sunniness, :planted_from, :finished,
|
||||
:finished_at
|
||||
: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
|
||||
@@ -32,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
|
||||
|
||||
#
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
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
|
||||
@@ -13,11 +13,14 @@ class Post < ApplicationRecord
|
||||
has_many :comments, dependent: :destroy
|
||||
has_many :crop_posts, dependent: :delete_all
|
||||
has_many :crops, through: :crop_posts
|
||||
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
|
||||
|
||||
@@ -75,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
|
||||
|
||||
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)
|
||||
|
||||
@@ -3,4 +3,3 @@
|
||||
There are
|
||||
= link_to "https://openfarm.cc/en/crops/#{CGI.escape @crop.name.gsub(' ', '-').downcase}" do
|
||||
#{crop.guides_count} growing guides on Open Farm
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -5,5 +5,3 @@
|
||||
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))
|
||||
|
||||
|
||||
|
||||
@@ -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,42 +1,17 @@
|
||||
- if member.website_url.present? || member.instagram_handle.present? || member.facebook_handle.present? || member.bluesky_handle.present? || member.other_url.present? || twitter_auth || flickr_auth || member.show_email
|
||||
- if twitter_auth || flickr_auth || member.show_email
|
||||
%h4 Contact
|
||||
|
||||
- if member.website_url.present?
|
||||
%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'
|
||||
|
||||
- if twitter_auth
|
||||
%p
|
||||
= image_tag "twitter_32.png", size: "32x32", alt: 'Twitter logo'
|
||||
= link_to twitter_auth.name, "https://twitter.com/#{twitter_auth.name}", target: '_blank', rel: 'noopener noreferrer'
|
||||
= 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
|
||||
|
||||
@@ -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 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) }
|
||||
|
||||
- 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
|
||||
|
||||
@@ -47,6 +47,11 @@
|
||||
= 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: 'Mark as finished'
|
||||
|
||||
@@ -51,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
|
||||
|
||||
@@ -9,4 +9,3 @@
|
||||
|
||||
- else
|
||||
%h2 There are no comments yet
|
||||
|
||||
|
||||
54
app/views/problems/_form.html.haml
Normal file
54
app/views/problems/_form.html.haml
Normal file
@@ -0,0 +1,54 @@
|
||||
= bootstrap_form_for(@problem) do |f|
|
||||
- if @problem.errors.any?
|
||||
#error_explanation.alert.alert-warning{role: "alert"}
|
||||
%h3
|
||||
= pluralize(@problem.errors.size, "error")
|
||||
prohibited this problem from being saved:
|
||||
%ul
|
||||
- @problem.errors.full_messages.each do |msg|
|
||||
%li= msg
|
||||
|
||||
.card.col-12.col-md-8.mx-auto.float-none.white
|
||||
.card-header
|
||||
- if content_for? :title
|
||||
%h1.h2-responsive.text-center
|
||||
%strong=yield :title
|
||||
.card-body
|
||||
- if can? :wrangle, @problem
|
||||
%p
|
||||
%span.help-block
|
||||
As a problem wrangler, you can approve or reject problem suggestions.
|
||||
|
||||
%h2 Basic information
|
||||
|
||||
.form-group#new_problem
|
||||
= f.text_field :name, required: true
|
||||
%span.help-block
|
||||
The common name for the problem, in English (required).
|
||||
- if can? :wrangle, @problem
|
||||
Wranglers: please ensure this is singular, and capitalize
|
||||
proper nouns only.
|
||||
|
||||
- if (can?(:wrangle, @problem) && @problem.requester) || (cannot?(:wrangle, @problem) && @problem.new_record?)
|
||||
%h2 Problem request notes
|
||||
= f.text_area :request_notes, rows: 3, id: 'request_notes', label: 'Comments'
|
||||
|
||||
- unless can? :wrangle, @problem
|
||||
%p
|
||||
When you submit this form, your suggestion will be sent to our team of
|
||||
volunteer problem wranglers for review. We'll let you know the outcome as soon as we can.
|
||||
|
||||
- if can?(:wrangle, @problem) && @problem.requester
|
||||
= f.select(:reason_for_rejection, @problem.reasons_for_rejection, include_blank: true)
|
||||
|
||||
= f.text_area :rejection_notes, rows: 3
|
||||
%span.help-block
|
||||
Please provide additional notes why this problem request was rejected if the above reasons do not apply.
|
||||
|
||||
.card-footer
|
||||
.text-right
|
||||
- if @problem.approved?
|
||||
= f.submit 'Save'
|
||||
- else
|
||||
= f.submit 'Reject', class: 'btn btn-danger', name: 'reject'
|
||||
= f.submit 'Approve and save', class: 'btn btn-success', name: 'approve'
|
||||
10
app/views/problems/_thumbnail.html.haml
Normal file
10
app/views/problems/_thumbnail.html.haml
Normal file
@@ -0,0 +1,10 @@
|
||||
- cache problem do
|
||||
.card.problem-thumbnail
|
||||
= link_to problem_path(id: problem.slug) do
|
||||
= image_tag(problem.thumbnail_url.presence || placeholder_image,
|
||||
alt: "Image of #{problem.name}",
|
||||
class: 'img img-card')
|
||||
|
||||
|
||||
.text
|
||||
%h3.problem-name= link_to problem.name, problem_path(id: problem.slug)
|
||||
30
app/views/problems/edit.html.haml
Normal file
30
app/views/problems/edit.html.haml
Normal file
@@ -0,0 +1,30 @@
|
||||
- content_for :title, "Edit problem: #{@problem.name}"
|
||||
|
||||
- if @problem.approval_status == "approved"
|
||||
- if @problem.requester
|
||||
%p
|
||||
Requested by #{link_to @problem.requester, @problem.requester}
|
||||
#{distance_of_time_in_words(@problem.created_at, Time.zone.now)} ago.
|
||||
%p
|
||||
Approved by #{link_to @problem.creator, @problem.creator}.
|
||||
- else
|
||||
%p
|
||||
Added by
|
||||
= link_to @problem.creator, @problem.creator
|
||||
#{distance_of_time_in_words(@problem.created_at, Time.zone.now)} ago.
|
||||
- elsif @problem.approval_status == "pending"
|
||||
.alert.alert-danger
|
||||
%p
|
||||
Requested by #{link_to @problem.requester, @problem.requester}
|
||||
#{distance_of_time_in_words(@problem.created_at, Time.zone.now)} ago.
|
||||
%p
|
||||
Status: #{@problem.approval_status}.
|
||||
- elsif @problem.approval_status == "rejected"
|
||||
.alert.alert-danger
|
||||
%p
|
||||
Requested by #{link_to @problem.requester, @problem.requester}
|
||||
#{distance_of_time_in_words(@problem.created_at, Time.zone.now)} ago.
|
||||
%p
|
||||
Status: #{@problem.approval_status} by #{link_to @problem.creator, @problem.creator}.
|
||||
|
||||
= render 'form'
|
||||
13
app/views/problems/index.html.haml
Normal file
13
app/views/problems/index.html.haml
Normal file
@@ -0,0 +1,13 @@
|
||||
- content_for :title, t('.title')
|
||||
|
||||
- content_for :breadcrumbs do
|
||||
%li.breadcrumb-item.active= link_to 'Problems', problems_path
|
||||
|
||||
%section.problems
|
||||
%h2= t('.title')
|
||||
= will_paginate @problems
|
||||
.index-cards
|
||||
- @problems.each do |p|
|
||||
= render 'problems/thumbnail', problem: p
|
||||
|
||||
= will_paginate @problems
|
||||
15
app/views/problems/new.html.haml
Normal file
15
app/views/problems/new.html.haml
Normal file
@@ -0,0 +1,15 @@
|
||||
- content_for :title, (can?(:wrangle, @problem) ? "New problem" : "Suggest a problem")
|
||||
|
||||
- unless can? :wrangle, @problem
|
||||
%p
|
||||
Thanks for taking the time to suggest a problem! Our problem database is
|
||||
managed by volunteers, and we appreciate your help. Here are some
|
||||
things to consider when suggesting a new problem:
|
||||
%ul
|
||||
%li
|
||||
First, you might want to search our problems
|
||||
to make sure we don't have it already, perhaps under an alternate name.
|
||||
%li
|
||||
The Growstuff database only contains problems related to growing edible plants.
|
||||
|
||||
= render 'form'
|
||||
26
app/views/problems/show.html.haml
Normal file
26
app/views/problems/show.html.haml
Normal file
@@ -0,0 +1,26 @@
|
||||
- content_for :title, @problem.name
|
||||
|
||||
- content_for :breadcrumbs do
|
||||
%li.breadcrumb-item= link_to 'Problems', problems_path
|
||||
%li.breadcrumb-item.active= link_to @problem.name.capitalize, @problem
|
||||
|
||||
.jumbotron
|
||||
%h1= @problem.name
|
||||
|
||||
.row
|
||||
.col-md-9
|
||||
%section.plantings
|
||||
%h2 Plantings with this problem
|
||||
= will_paginate @plantings
|
||||
.index-cards
|
||||
- @plantings.each do |p|
|
||||
= render 'plantings/thumbnail', planting: p
|
||||
= will_paginate @plantings
|
||||
.col-md-3
|
||||
.card
|
||||
.card-body
|
||||
%h4.card-title= @problem.name
|
||||
%p.card-text
|
||||
This problem has been reported on
|
||||
= pluralize(@problem.plantings.count, 'planting')
|
||||
so far.
|
||||
51
app/views/problems/wrangle.html.haml
Normal file
51
app/views/problems/wrangle.html.haml
Normal file
@@ -0,0 +1,51 @@
|
||||
- content_for :title, "Problem Wrangling"
|
||||
|
||||
%h1 Problem Wrangling
|
||||
|
||||
%nav.nav
|
||||
= link_to "Add Problem", new_problem_path, class: 'btn'
|
||||
|
||||
%section.problem_wranglers
|
||||
%h2 Problem Wranglers
|
||||
- @problem_wranglers.each do |problem_wrangler|
|
||||
= render 'members/tiny', member: problem_wrangler
|
||||
|
||||
%hr/
|
||||
|
||||
%section
|
||||
%h2 Problems
|
||||
|
||||
%ul#myTab.nav.nav-tabs{role: "tablist"}
|
||||
%li.nav-item
|
||||
%a#home-tab.nav-link{ href: wrangle_problems_path, role: "tab", class: @approval_status.blank? ? 'active' : ''}
|
||||
Recently added
|
||||
%li.nav-item
|
||||
%a#profile-tab.nav-link{ href: wrangle_problems_path(approval_status: "pending"), role: "tab", class: @approval_status == "pending" ? 'active' : ''}
|
||||
Pending approval
|
||||
%li.nav-item
|
||||
%a#contact-tab.nav-link{ href: wrangle_problems_path(approval_status: "rejected"), role: "tab", class: @approval_status == "rejected" ? 'active' : ''} Rejected
|
||||
|
||||
%table.table.table-striped.table-bordered.table-sm{id: @approval_status.blank? ? 'recently-added-problems' : "#{@approval_status}-problems" }
|
||||
%tr
|
||||
%th Name
|
||||
%th Requested by
|
||||
- if @approval_status == "rejected"
|
||||
%th Rejected by
|
||||
- if @approval_status != "rejected" && @approval_status != "pending"
|
||||
%th Added by
|
||||
%th When
|
||||
- @problems.each do |p|
|
||||
%tr
|
||||
%td
|
||||
= link_to edit_problem_path(p) do
|
||||
= icon 'fas', 'bug'
|
||||
= p.name
|
||||
%td= p.requester.present? ? (link_to p.requester, p.requester) : "N/A"
|
||||
- unless @approval_status == "pending"
|
||||
%td= p.creator.present? ? (link_to p.creator, p.creator) : "N/A"
|
||||
%td
|
||||
= distance_of_time_in_words(p.created_at, Time.zone.now)
|
||||
ago.
|
||||
|
||||
= page_entries_info @problems
|
||||
= will_paginate @problems
|
||||
@@ -89,6 +89,13 @@ Rails.application.routes.draw do
|
||||
end
|
||||
end
|
||||
|
||||
resources :problems, param: :slug do
|
||||
collection do
|
||||
get 'requested'
|
||||
get 'wrangle'
|
||||
end
|
||||
end
|
||||
|
||||
resources :comments
|
||||
resources :forums
|
||||
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
class AddSocialMediaToMembers < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_column :members, :website_url, :string
|
||||
add_column :members, :instagram_handle, :string
|
||||
add_column :members, :facebook_handle, :string
|
||||
add_column :members, :bluesky_handle, :string
|
||||
add_column :members, :other_handle, :string
|
||||
end
|
||||
end
|
||||
@@ -1,5 +0,0 @@
|
||||
class RenameOtherHandleToOtherUrlInMembers < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
rename_column :members, :other_handle, :other_url
|
||||
end
|
||||
end
|
||||
@@ -446,11 +446,6 @@ ActiveRecord::Schema[7.2].define(version: 2024_09_29_041435) do
|
||||
t.integer "photos_count"
|
||||
t.integer "forums_count"
|
||||
t.integer "activities_count"
|
||||
t.string "website_url"
|
||||
t.string "instagram_handle"
|
||||
t.string "facebook_handle"
|
||||
t.string "bluesky_handle"
|
||||
t.string "other_url"
|
||||
t.index ["confirmation_token"], name: "index_members_on_confirmation_token", unique: true
|
||||
t.index ["discarded_at"], name: "index_members_on_discarded_at"
|
||||
t.index ["email"], name: "index_members_on_email", unique: true
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
class Haml::Filters
|
||||
class GrowstuffMarkdown
|
||||
CROP_REGEX = /(?<!\\)\[([^\[\]]+?)\]\(crop\)/
|
||||
PROBLEM_REGEX = /(?<!\\)\[([^\[\]]+?)\]\(problem\)/
|
||||
MEMBER_REGEX = /(?<!\\)\[([^\[\]]+?)\]\(member\)/
|
||||
MEMBER_AT_REGEX = /(?<!\\)(@\w+)/
|
||||
MEMBER_ESCAPE_AT_REGEX = /(?<!\\)\\(?=@\w+)/
|
||||
@@ -42,6 +43,25 @@ class Haml::Filters
|
||||
end
|
||||
end
|
||||
|
||||
def expand_problems!(text)
|
||||
# turn [aphids](problem) into [aphids](http://growstuff.org/problems/aphids)
|
||||
text.gsub(PROBLEM_REGEX) do
|
||||
problem_str = Regexp.last_match(1)
|
||||
# find problem case-insensitively
|
||||
problem = Problem.where('lower(name) = ?', problem_str.downcase).first
|
||||
problem_link problem, problem_str
|
||||
end
|
||||
end
|
||||
|
||||
def problem_link(problem, link_text)
|
||||
if problem
|
||||
url = Rails.application.routes.url_helpers.problem_url(problem, only_path: true)
|
||||
"[#{link_text}](#{url})"
|
||||
else
|
||||
link_text
|
||||
end
|
||||
end
|
||||
|
||||
def crop_link(crop, link_text)
|
||||
if crop
|
||||
url = Rails.application.routes.url_helpers.crop_url(crop, only_path: true)
|
||||
|
||||
@@ -9,12 +9,10 @@ namespace :openfarm do
|
||||
OpenfarmService.new.import!
|
||||
end
|
||||
|
||||
desc "Delete all pictures with source OpenFarm or from legacy S3 URL"
|
||||
desc "Delete all pictures with source OpenFarm"
|
||||
task delete_pictures: :environment do
|
||||
puts "Deleting pictures with source OpenFarm or from legacy S3 URL..."
|
||||
s3_legacy_url = 'https://s3.amazonaws.com/openfarm-project/%'
|
||||
puts "Deleting pictures with source OpenFarm..."
|
||||
photos_to_delete = Photo.where(source: 'openfarm')
|
||||
.or(Photo.where('fullsize_url LIKE ?', s3_legacy_url))
|
||||
count = photos_to_delete.count
|
||||
photos_to_delete.each do |photo|
|
||||
photo.associations.each do |photo_association|
|
||||
|
||||
Reference in New Issue
Block a user