mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-25 01:13:03 -04:00
Compare commits
202 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f5a03b8991 | ||
|
|
d1d718df9e | ||
|
|
da4bb17df8 | ||
|
|
0320cbe5ad | ||
|
|
4d3c4ca10d | ||
|
|
749134a7de | ||
|
|
1657a527e9 | ||
|
|
ba6ec689c5 | ||
|
|
df2853edd3 | ||
|
|
948bb78656 | ||
|
|
9c8ae50188 | ||
|
|
0ee6260272 | ||
|
|
bf528220ab | ||
|
|
fd89cc6bce | ||
|
|
08a3890ba2 | ||
|
|
956c73cd1e | ||
|
|
8e74d1796a | ||
|
|
a98990ccd2 | ||
|
|
ac1463e2cf | ||
|
|
8564ec7a7c | ||
|
|
79a54351e3 | ||
|
|
48aa2aafd3 | ||
|
|
3b648925dd | ||
|
|
d04ffbeddd | ||
|
|
e1367613e6 | ||
|
|
70f78f1175 | ||
|
|
6131fdf141 | ||
|
|
44101e07fb | ||
|
|
b4c1104af0 | ||
|
|
3d4ba954e7 | ||
|
|
b8f7f95f32 | ||
|
|
0b639d5940 | ||
|
|
f216ddc368 | ||
|
|
967c0f4638 | ||
|
|
cac0e3cb12 | ||
|
|
65406b9e56 | ||
|
|
224109aaf8 | ||
|
|
bec1ec1879 | ||
|
|
e88e54b0c1 | ||
|
|
76a6c1d849 | ||
|
|
b7f4de782d | ||
|
|
112a626941 | ||
|
|
b72aeab136 | ||
|
|
a7d100fe7e | ||
|
|
810a9e39e3 | ||
|
|
b320435ddf | ||
|
|
2f7ce2721f | ||
|
|
c9e19203a9 | ||
|
|
005efab3be | ||
|
|
46599937d9 | ||
|
|
496a6ac2b6 | ||
|
|
9efb1f8486 | ||
|
|
59bd6f3450 | ||
|
|
3e9bf73297 | ||
|
|
dcff643637 | ||
|
|
a83966aa92 | ||
|
|
1c47e421b9 | ||
|
|
6289ab0951 | ||
|
|
d127647eeb | ||
|
|
9eda4bb2f2 | ||
|
|
f1d524130b | ||
|
|
e4de08f47f | ||
|
|
0b4820e5df | ||
|
|
d264905aa9 | ||
|
|
25d2c5f854 | ||
|
|
d383c8e2e4 | ||
|
|
ed89163311 | ||
|
|
26de3e7c5e | ||
|
|
6ae2de7e47 | ||
|
|
da74c19c2a | ||
|
|
d767a011a4 | ||
|
|
bbe6a3fd36 | ||
|
|
3eb2fe7637 | ||
|
|
7f0af10637 | ||
|
|
75d93bb3c3 | ||
|
|
c49f2bab19 | ||
|
|
ed71023306 | ||
|
|
59d95dfd77 | ||
|
|
e999c5870f | ||
|
|
072ec1dd82 | ||
|
|
8ecae23d61 | ||
|
|
d20ceb54b5 | ||
|
|
7e3be99aac | ||
|
|
d99d4a1bbe | ||
|
|
ea530754aa | ||
|
|
4bd322d8ca | ||
|
|
5fc41ca50f | ||
|
|
5da8f815d3 | ||
|
|
d71370c0bc | ||
|
|
d0d31edd5e | ||
|
|
67a2005f1e | ||
|
|
c58ca74b53 | ||
|
|
b528b40052 | ||
|
|
3b17265a92 | ||
|
|
0d22706d42 | ||
|
|
f8c93f16db | ||
|
|
8006d26c6e | ||
|
|
2766082696 | ||
|
|
d887d5c788 | ||
|
|
0634719afc | ||
|
|
a13cf93aeb | ||
|
|
04376f15a2 | ||
|
|
82d3f84e0c | ||
|
|
af6cee2f16 | ||
|
|
4f705ff37b | ||
|
|
4829d5513c | ||
|
|
d1419aaca4 | ||
|
|
2458afc451 | ||
|
|
278be7067f | ||
|
|
bc71c4a706 | ||
|
|
b1a42a2ed6 | ||
|
|
fe22c92a63 | ||
|
|
f00b31cf46 | ||
|
|
7cfee1d89c | ||
|
|
6c89cef5bc | ||
|
|
5d79aa3e60 | ||
|
|
29c8d87703 | ||
|
|
83ef779c11 | ||
|
|
4ada3e1585 | ||
|
|
88f5622d0c | ||
|
|
fa6752c668 | ||
|
|
f9186c1a8a | ||
|
|
82dcd1d86c | ||
|
|
b2146e791f | ||
|
|
a9c33a30d2 | ||
|
|
497cb6627d | ||
|
|
a8a96ae125 | ||
|
|
4dcafdb117 | ||
|
|
bd132c32fa | ||
|
|
2b5ed05628 | ||
|
|
df9f8445ad | ||
|
|
534d493693 | ||
|
|
3bfa1af67b | ||
|
|
e5e0aacfeb | ||
|
|
962cf0bca7 | ||
|
|
419ee298ff | ||
|
|
bdad7bd222 | ||
|
|
b07fff72d0 | ||
|
|
bff516d413 | ||
|
|
add339a09f | ||
|
|
c59226c1f0 | ||
|
|
7f8170d230 | ||
|
|
4d12b9afd7 | ||
|
|
0f8be52bdd | ||
|
|
88098db188 | ||
|
|
97fc9eb150 | ||
|
|
d0bdc1178e | ||
|
|
02b0c1617f | ||
|
|
93ea4af8d5 | ||
|
|
7ccdb7ed66 | ||
|
|
6660181142 | ||
|
|
b6cc950575 | ||
|
|
e699108d2a | ||
|
|
67c44fb17e | ||
|
|
11f2fbd399 | ||
|
|
540941f3b7 | ||
|
|
c8797cd0db | ||
|
|
871535e902 | ||
|
|
be0ce48be2 | ||
|
|
24f8f99691 | ||
|
|
0988e598f4 | ||
|
|
2e94ee9c6d | ||
|
|
8d42aed06f | ||
|
|
fbbef7747a | ||
|
|
9297484c48 | ||
|
|
8a507cb0bc | ||
|
|
12dc2cbff4 | ||
|
|
60cc7e6867 | ||
|
|
29cb393c62 | ||
|
|
88b0c9748c | ||
|
|
d60ae89e5a | ||
|
|
37b0831bdb | ||
|
|
6b99d20e50 | ||
|
|
cb0ee4e3b7 | ||
|
|
4074078560 | ||
|
|
2745948c46 | ||
|
|
0fb10cfd24 | ||
|
|
172dff42c6 | ||
|
|
6d5238c1ce | ||
|
|
3f78c15fc9 | ||
|
|
bc1476b4fe | ||
|
|
98e7226d67 | ||
|
|
70c28b3468 | ||
|
|
49e3180d17 | ||
|
|
2b2dc853df | ||
|
|
fbf25bfd61 | ||
|
|
7bdc171917 | ||
|
|
b1eae352cb | ||
|
|
56e8edb17e | ||
|
|
db98ebb50f | ||
|
|
98ae840ada | ||
|
|
70b9071a79 | ||
|
|
e484304eca | ||
|
|
400510a5e4 | ||
|
|
ed8aced07e | ||
|
|
89b8e7b98c | ||
|
|
bb8a333a21 | ||
|
|
8d2f8ffe34 | ||
|
|
56fcce0cce | ||
|
|
03fed2139f | ||
|
|
1462279b60 | ||
|
|
600da7f178 |
@@ -1,47 +0,0 @@
|
||||
plugins:
|
||||
brakeman:
|
||||
enabled: false # codeclimate's brakeman is stuck in rails 5 rules
|
||||
bundler-audit:
|
||||
enabled: true
|
||||
coffeelint:
|
||||
enabled: true
|
||||
duplication:
|
||||
enabled: true
|
||||
config:
|
||||
languages:
|
||||
- ruby
|
||||
- javascript
|
||||
editorconfig:
|
||||
enabled: true
|
||||
eslint:
|
||||
enabled: true
|
||||
fixme:
|
||||
enabled: true
|
||||
haml-lint:
|
||||
enabled: true
|
||||
nodesecurity:
|
||||
enabled: true
|
||||
rubocop:
|
||||
enabled: true
|
||||
channel: "rubocop-1-11"
|
||||
scss-lint:
|
||||
enabled: true
|
||||
shellcheck:
|
||||
enabled: true
|
||||
ratings:
|
||||
paths:
|
||||
- "**.rb"
|
||||
- "**.ru"
|
||||
- "**.js"
|
||||
- "**.coffee"
|
||||
- "**.scss"
|
||||
- "**.haml"
|
||||
- Gemfile.lock
|
||||
exclude_paths:
|
||||
- config/
|
||||
- db/
|
||||
- spec/
|
||||
- public/
|
||||
- app/assets/stylesheets/bootstrap-accessibility.css
|
||||
- app/assets/javascripts/bootstrap*
|
||||
- app/assets/stylesheets/leaflet_overrides.scss
|
||||
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@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- 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@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Configure sysctl limits
|
||||
run: |
|
||||
|
||||
@@ -38,7 +38,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout this repo
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- 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@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- 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@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- 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@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- 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@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- 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@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Configure sysctl limits
|
||||
run: |
|
||||
|
||||
102
.github/workflows/ci-features-places.yml
vendored
Normal file
102
.github/workflows/ci-features-places.yml
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
name: CI Features - Admin
|
||||
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
rspec:
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
db:
|
||||
image: postgres
|
||||
env:
|
||||
##
|
||||
# The Postgres service fails its docker health check unless you
|
||||
# specify these environment variables
|
||||
#
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
POSTGRES_DB: growstuff_test
|
||||
ports: ['5432:5432']
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
env:
|
||||
APP_DOMAIN_NAME: localhost:3000
|
||||
APP_PROTOCOL: http
|
||||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
||||
DATABASE_URL: postgres://postgres:postgres@localhost:5432/growstuff_test
|
||||
DEVISE_SECRET_KEY: secret
|
||||
ELASTIC_SEARCH_VERSION: "7.5.1-amd64"
|
||||
GROWSTUFF_EMAIL: "noreply@test.growstuff.org"
|
||||
GROWSTUFF_FLICKR_KEY: secretkey"
|
||||
GROWSTUFF_FLICKR_SECRET: secretsecret
|
||||
GROWSTUFF_SITE_NAME: "Growstuff (travis)"
|
||||
RAILS_ENV: test
|
||||
RAILS_SECRET_TOKEN: supersecret
|
||||
|
||||
steps:
|
||||
- name: Checkout this repo
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Configure sysctl limits
|
||||
run: |
|
||||
sudo swapoff -a
|
||||
sudo sysctl -w vm.swappiness=1
|
||||
sudo sysctl -w fs.file-max=262144
|
||||
sudo sysctl -w vm.max_map_count=262144
|
||||
|
||||
- name: Start Elasticsearch
|
||||
uses: elastic/elastic-github-actions/elasticsearch@master
|
||||
with:
|
||||
stack-version: 7.5.1
|
||||
|
||||
##
|
||||
# Cache Yarn modules
|
||||
#
|
||||
# See https://github.com/actions/cache/blob/master/examples.md#node---yarn for details
|
||||
#
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- name: Setup yarn cache
|
||||
uses: actions/cache@v4
|
||||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
|
||||
- name: Install required OS packages
|
||||
run: |
|
||||
sudo apt-get -y install libpq-dev google-chrome-stable
|
||||
|
||||
- name: Install NodeJS
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '12'
|
||||
|
||||
- name: Install Ruby (version given by .ruby-version) and Bundler
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
bundler-cache: true
|
||||
|
||||
- name: Install required JS packages
|
||||
run: yarn install
|
||||
|
||||
- name: install chrome
|
||||
run: sudo apt-get install google-chrome-stable
|
||||
|
||||
- name: Prepare database for testing
|
||||
run: bundle exec rails db:prepare
|
||||
|
||||
- name: precompile assets
|
||||
run: bundle exec rails assets:precompile
|
||||
|
||||
- name: index into elastic search
|
||||
run: bundle exec rails search:reindex
|
||||
|
||||
- name: Run rspec (places/)
|
||||
run: bundle exec rspec spec/features/places/ -fd
|
||||
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@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Configure sysctl limits
|
||||
run: |
|
||||
|
||||
102
.github/workflows/ci-features-posts.yml
vendored
Normal file
102
.github/workflows/ci-features-posts.yml
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
name: CI Features - Admin
|
||||
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
rspec:
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
db:
|
||||
image: postgres
|
||||
env:
|
||||
##
|
||||
# The Postgres service fails its docker health check unless you
|
||||
# specify these environment variables
|
||||
#
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
POSTGRES_DB: growstuff_test
|
||||
ports: ['5432:5432']
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
env:
|
||||
APP_DOMAIN_NAME: localhost:3000
|
||||
APP_PROTOCOL: http
|
||||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
||||
DATABASE_URL: postgres://postgres:postgres@localhost:5432/growstuff_test
|
||||
DEVISE_SECRET_KEY: secret
|
||||
ELASTIC_SEARCH_VERSION: "7.5.1-amd64"
|
||||
GROWSTUFF_EMAIL: "noreply@test.growstuff.org"
|
||||
GROWSTUFF_FLICKR_KEY: secretkey"
|
||||
GROWSTUFF_FLICKR_SECRET: secretsecret
|
||||
GROWSTUFF_SITE_NAME: "Growstuff (travis)"
|
||||
RAILS_ENV: test
|
||||
RAILS_SECRET_TOKEN: supersecret
|
||||
|
||||
steps:
|
||||
- name: Checkout this repo
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Configure sysctl limits
|
||||
run: |
|
||||
sudo swapoff -a
|
||||
sudo sysctl -w vm.swappiness=1
|
||||
sudo sysctl -w fs.file-max=262144
|
||||
sudo sysctl -w vm.max_map_count=262144
|
||||
|
||||
- name: Start Elasticsearch
|
||||
uses: elastic/elastic-github-actions/elasticsearch@master
|
||||
with:
|
||||
stack-version: 7.5.1
|
||||
|
||||
##
|
||||
# Cache Yarn modules
|
||||
#
|
||||
# See https://github.com/actions/cache/blob/master/examples.md#node---yarn for details
|
||||
#
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- name: Setup yarn cache
|
||||
uses: actions/cache@v4
|
||||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
|
||||
- name: Install required OS packages
|
||||
run: |
|
||||
sudo apt-get -y install libpq-dev google-chrome-stable
|
||||
|
||||
- name: Install NodeJS
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '12'
|
||||
|
||||
- name: Install Ruby (version given by .ruby-version) and Bundler
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
bundler-cache: true
|
||||
|
||||
- name: Install required JS packages
|
||||
run: yarn install
|
||||
|
||||
- name: install chrome
|
||||
run: sudo apt-get install google-chrome-stable
|
||||
|
||||
- name: Prepare database for testing
|
||||
run: bundle exec rails db:prepare
|
||||
|
||||
- name: precompile assets
|
||||
run: bundle exec rails assets:precompile
|
||||
|
||||
- name: index into elastic search
|
||||
run: bundle exec rails search:reindex
|
||||
|
||||
- name: Run rspec (posts/)
|
||||
run: bundle exec rspec spec/features/posts/ -fd
|
||||
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@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- 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@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Configure sysctl limits
|
||||
run: |
|
||||
|
||||
18
.github/workflows/ci-features.yml
vendored
18
.github/workflows/ci-features.yml
vendored
@@ -38,7 +38,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout this repo
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Configure sysctl limits
|
||||
run: |
|
||||
@@ -107,19 +107,5 @@ jobs:
|
||||
- name: Run rspec (photos/)
|
||||
run: bundle exec rspec spec/features/photos/ -fd
|
||||
|
||||
- name: Run rspec (places/)
|
||||
run: bundle exec rspec spec/features/places/ -fd
|
||||
|
||||
- name: Run rspec (plantings/)
|
||||
run: bundle exec rspec spec/features/plantings/ -fd
|
||||
|
||||
- name: Run rspec (posts/)
|
||||
run: bundle exec rspec spec/features/posts/ -fd
|
||||
|
||||
- name: Run rspec (rss/)
|
||||
run: bundle exec rspec spec/features/rss/ -fd
|
||||
|
||||
- name: Report to code climate
|
||||
run: |
|
||||
gem install codeclimate-test-reporter
|
||||
codeclimate-test-reporter
|
||||
run: bundle exec rspec spec/features/rss/ -fd
|
||||
11
.github/workflows/ci.yml
vendored
11
.github/workflows/ci.yml
vendored
@@ -6,7 +6,7 @@ jobs:
|
||||
contributors:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
- 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@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Configure sysctl limits
|
||||
run: |
|
||||
@@ -127,9 +127,4 @@ jobs:
|
||||
run: bundle exec rspec spec/routing/ -fd --fail-fast
|
||||
|
||||
- name: Run rspec (request)
|
||||
run: bundle exec rspec spec/requests/ -fd --fail-fast
|
||||
|
||||
- name: Report to code climate
|
||||
run: |
|
||||
gem install codeclimate-test-reporter
|
||||
codeclimate-test-reporter
|
||||
run: bundle exec rspec spec/requests/ -fd --fail-fast
|
||||
@@ -1 +1 @@
|
||||
3.3.7
|
||||
3.3.8
|
||||
|
||||
@@ -12,6 +12,7 @@ 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
|
||||
|
||||
@@ -68,7 +69,6 @@ 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,10 +95,11 @@ 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)
|
||||
|
||||
11
Gemfile
11
Gemfile
@@ -91,10 +91,9 @@ gem 'bootstrap-datepicker-rails'
|
||||
# DRY-er easier bootstrap 4 forms
|
||||
gem "bootstrap_form", ">= 4.5.0"
|
||||
|
||||
# For connecting to other services (eg Twitter)
|
||||
# For connecting to other services (eg Flickr)
|
||||
gem 'omniauth', '~> 1.3'
|
||||
gem 'omniauth-flickr', '>= 0.0.15'
|
||||
gem 'omniauth-twitter'
|
||||
|
||||
# Pretty charts
|
||||
gem "chartkick"
|
||||
@@ -175,6 +174,7 @@ group :development, :test do
|
||||
gem 'rubocop-rspec_rails'
|
||||
gem 'webrat' # provides HTML matchers for view tests
|
||||
|
||||
gem 'crowdin-cli' # for translations
|
||||
gem 'dotenv-rails'
|
||||
|
||||
# cli utils
|
||||
@@ -188,15 +188,18 @@ end
|
||||
group :test do
|
||||
gem 'axe-core-capybara'
|
||||
gem 'axe-core-rspec'
|
||||
gem 'codeclimate-test-reporter', require: false
|
||||
gem 'rails-controller-testing'
|
||||
gem 'selenium-webdriver'
|
||||
gem 'timecop'
|
||||
gem 'vcr'
|
||||
gem "rspec-rebound"
|
||||
gem "percy-capybara", "~> 5.0.0"
|
||||
end
|
||||
|
||||
group :travis do
|
||||
gem 'platform-api'
|
||||
end
|
||||
|
||||
gem "percy-capybara", "~> 5.0.0"
|
||||
|
||||
|
||||
gem "i18n_data", "~> 1.1"
|
||||
|
||||
327
Gemfile.lock
327
Gemfile.lock
@@ -33,29 +33,29 @@ GEM
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actioncable (7.2.2.1)
|
||||
actionpack (= 7.2.2.1)
|
||||
activesupport (= 7.2.2.1)
|
||||
actioncable (7.2.2.2)
|
||||
actionpack (= 7.2.2.2)
|
||||
activesupport (= 7.2.2.2)
|
||||
nio4r (~> 2.0)
|
||||
websocket-driver (>= 0.6.1)
|
||||
zeitwerk (~> 2.6)
|
||||
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)
|
||||
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)
|
||||
mail (>= 2.8.0)
|
||||
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)
|
||||
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)
|
||||
mail (>= 2.8.0)
|
||||
rails-dom-testing (~> 2.2)
|
||||
actionpack (7.2.2.1)
|
||||
actionview (= 7.2.2.1)
|
||||
activesupport (= 7.2.2.1)
|
||||
actionpack (7.2.2.2)
|
||||
actionview (= 7.2.2.2)
|
||||
activesupport (= 7.2.2.2)
|
||||
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.1)
|
||||
actionpack (= 7.2.2.1)
|
||||
activerecord (= 7.2.2.1)
|
||||
activestorage (= 7.2.2.1)
|
||||
activesupport (= 7.2.2.1)
|
||||
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)
|
||||
globalid (>= 0.6.0)
|
||||
nokogiri (>= 1.8.5)
|
||||
actionview (7.2.2.1)
|
||||
activesupport (= 7.2.2.1)
|
||||
actionview (7.2.2.2)
|
||||
activesupport (= 7.2.2.2)
|
||||
builder (~> 3.1)
|
||||
erubi (~> 1.11)
|
||||
rails-dom-testing (~> 2.2)
|
||||
@@ -80,29 +80,29 @@ GEM
|
||||
active_link_to (1.0.5)
|
||||
actionpack
|
||||
addressable
|
||||
active_median (0.5.0)
|
||||
activesupport (>= 7)
|
||||
active_median (0.6.0)
|
||||
activesupport (>= 7.1)
|
||||
active_record_union (1.3.0)
|
||||
activerecord (>= 4.0)
|
||||
active_utils (3.5.0)
|
||||
activesupport (>= 4.2)
|
||||
i18n
|
||||
activejob (7.2.2.1)
|
||||
activesupport (= 7.2.2.1)
|
||||
activejob (7.2.2.2)
|
||||
activesupport (= 7.2.2.2)
|
||||
globalid (>= 0.3.6)
|
||||
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)
|
||||
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)
|
||||
timeout (>= 0.4.0)
|
||||
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)
|
||||
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)
|
||||
marcel (~> 1.0)
|
||||
activesupport (7.2.2.1)
|
||||
activesupport (7.2.2.2)
|
||||
base64
|
||||
benchmark (>= 0.3)
|
||||
bigdecimal
|
||||
@@ -119,15 +119,15 @@ GEM
|
||||
ast (2.4.3)
|
||||
autoprefixer-rails (10.4.16.0)
|
||||
execjs (~> 2)
|
||||
axe-core-api (4.10.2)
|
||||
axe-core-api (4.10.3)
|
||||
dumb_delegator
|
||||
ostruct
|
||||
virtus
|
||||
axe-core-capybara (4.10.2)
|
||||
axe-core-api (= 4.10.2)
|
||||
axe-core-capybara (4.10.3)
|
||||
axe-core-api (= 4.10.3)
|
||||
dumb_delegator
|
||||
axe-core-rspec (4.10.2)
|
||||
axe-core-api (= 4.10.2)
|
||||
axe-core-rspec (4.10.3)
|
||||
axe-core-api (= 4.10.3)
|
||||
dumb_delegator
|
||||
ostruct
|
||||
virtus
|
||||
@@ -135,14 +135,14 @@ GEM
|
||||
descendants_tracker (~> 0.0.4)
|
||||
ice_nine (~> 0.11.0)
|
||||
thread_safe (~> 0.3, >= 0.3.1)
|
||||
base64 (0.2.0)
|
||||
base64 (0.3.0)
|
||||
bcrypt (3.1.20)
|
||||
benchmark (0.4.0)
|
||||
benchmark (0.4.1)
|
||||
better_errors (2.10.1)
|
||||
erubi (>= 1.0.0)
|
||||
rack (>= 0.9.0)
|
||||
rouge (>= 1.0.0)
|
||||
bigdecimal (3.1.9)
|
||||
bigdecimal (3.2.2)
|
||||
bluecloth (2.2.0)
|
||||
bonsai-elasticsearch-rails (7.0.1)
|
||||
elasticsearch-model (< 8)
|
||||
@@ -156,7 +156,7 @@ GEM
|
||||
actionpack (>= 6.1)
|
||||
activemodel (>= 6.1)
|
||||
builder (3.3.0)
|
||||
bullet (8.0.1)
|
||||
bullet (8.0.8)
|
||||
activesupport (>= 3.0.0)
|
||||
uniform_notifier (~> 1.11)
|
||||
byebug (12.0.0)
|
||||
@@ -183,10 +183,8 @@ GEM
|
||||
image_processing (~> 1.1)
|
||||
marcel (~> 1.0.0)
|
||||
ssrf_filter (~> 1.0)
|
||||
chartkick (5.1.4)
|
||||
chartkick (5.2.0)
|
||||
childprocess (5.0.0)
|
||||
codeclimate-test-reporter (1.0.9)
|
||||
simplecov (<= 0.13)
|
||||
coderay (1.1.3)
|
||||
coercible (1.0.0)
|
||||
descendants_tracker (~> 0.0.1)
|
||||
@@ -200,8 +198,16 @@ GEM
|
||||
comfy_bootstrap_form (4.0.9)
|
||||
rails (>= 5.0.0)
|
||||
concurrent-ruby (1.3.5)
|
||||
connection_pool (2.5.0)
|
||||
connection_pool (2.5.3)
|
||||
crass (1.0.6)
|
||||
crowdin-api (1.12.0)
|
||||
open-uri (>= 0.1.0, < 0.2.0)
|
||||
rest-client (>= 2.0.0, < 2.2.0)
|
||||
crowdin-cli (0.2.2)
|
||||
crowdin-api (>= 0.2.0)
|
||||
gli (>= 2.7.0)
|
||||
i18n (>= 0.6.4)
|
||||
rubyzip (>= 1.0.0)
|
||||
csv (3.3.1)
|
||||
csv_shaper (1.4.0)
|
||||
activesupport (>= 3.0.0)
|
||||
@@ -222,16 +228,16 @@ GEM
|
||||
railties (>= 4.1.0)
|
||||
responders
|
||||
warden (~> 1.2.3)
|
||||
diff-lcs (1.6.0)
|
||||
diff-lcs (1.6.2)
|
||||
discard (1.4.0)
|
||||
activerecord (>= 4.2, < 9.0)
|
||||
docile (1.1.5)
|
||||
dotenv (3.1.7)
|
||||
dotenv-rails (3.1.7)
|
||||
dotenv (= 3.1.7)
|
||||
domain_name (0.6.20240107)
|
||||
dotenv (3.1.8)
|
||||
dotenv-rails (3.1.8)
|
||||
dotenv (= 3.1.8)
|
||||
railties (>= 6.1)
|
||||
drb (2.2.1)
|
||||
dumb_delegator (1.0.0)
|
||||
drb (2.2.3)
|
||||
dumb_delegator (1.1.0)
|
||||
elasticsearch (7.0.0)
|
||||
elasticsearch-api (= 7.0.0)
|
||||
elasticsearch-transport (= 7.0.0)
|
||||
@@ -245,23 +251,24 @@ GEM
|
||||
elasticsearch-transport (7.0.0)
|
||||
faraday
|
||||
multi_json
|
||||
erb (5.0.2)
|
||||
erubi (1.13.1)
|
||||
erubis (2.7.0)
|
||||
excon (1.2.5)
|
||||
logger
|
||||
execjs (2.10.0)
|
||||
factory_bot (6.5.0)
|
||||
activesupport (>= 5.0.0)
|
||||
factory_bot_rails (6.4.4)
|
||||
factory_bot (6.5.4)
|
||||
activesupport (>= 6.1.0)
|
||||
factory_bot_rails (6.5.0)
|
||||
factory_bot (~> 6.5)
|
||||
railties (>= 5.0.0)
|
||||
faker (3.5.1)
|
||||
railties (>= 6.1.0)
|
||||
faker (3.5.2)
|
||||
i18n (>= 1.8.11, < 2)
|
||||
faraday (2.12.2)
|
||||
faraday (2.13.4)
|
||||
faraday-net_http (>= 2.0, < 3.5)
|
||||
json
|
||||
logger
|
||||
faraday-net_http (3.4.0)
|
||||
faraday-net_http (3.4.1)
|
||||
net-http (>= 0.5.0)
|
||||
ffi (1.16.3)
|
||||
flickraw (0.9.10)
|
||||
@@ -276,6 +283,8 @@ GEM
|
||||
gibbon (1.2.1)
|
||||
httparty
|
||||
multi_json (>= 1.9.0)
|
||||
gli (2.22.2)
|
||||
ostruct
|
||||
globalid (1.2.1)
|
||||
activesupport (>= 6.1)
|
||||
gravatar-ultimate (2.0.0)
|
||||
@@ -296,7 +305,7 @@ GEM
|
||||
activesupport (>= 5.1)
|
||||
haml (>= 4.0.6)
|
||||
railties (>= 5.1)
|
||||
haml_lint (0.61.1)
|
||||
haml_lint (0.66.0)
|
||||
haml (>= 5.0)
|
||||
parallel (~> 1.10)
|
||||
rainbow
|
||||
@@ -312,6 +321,9 @@ GEM
|
||||
webrick
|
||||
highline (3.1.2)
|
||||
reline
|
||||
http-accept (1.7.0)
|
||||
http-cookie (1.0.8)
|
||||
domain_name (~> 0.5)
|
||||
httparty (0.22.0)
|
||||
csv
|
||||
mini_mime (>= 1.0.0)
|
||||
@@ -329,16 +341,20 @@ GEM
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
ruby-progressbar (~> 1.8, >= 1.8.1)
|
||||
terminal-table (>= 1.5.1)
|
||||
icalendar (2.10.3)
|
||||
i18n_data (1.1.0)
|
||||
simple_po_parser (~> 1.1)
|
||||
icalendar (2.11.2)
|
||||
base64
|
||||
ice_cube (~> 0.16)
|
||||
logger
|
||||
ostruct
|
||||
ice_cube (0.17.0)
|
||||
ice_nine (0.11.2)
|
||||
image_processing (1.12.2)
|
||||
mini_magick (>= 4.9.5, < 5)
|
||||
ruby-vips (>= 2.0.17, < 3)
|
||||
io-console (0.8.0)
|
||||
irb (1.15.1)
|
||||
io-console (0.8.1)
|
||||
irb (1.15.2)
|
||||
pp (>= 0.6.0)
|
||||
rdoc (>= 4.0.0)
|
||||
reline (>= 0.4.2)
|
||||
@@ -346,7 +362,7 @@ GEM
|
||||
rails-dom-testing (>= 1, < 3)
|
||||
railties (>= 4.2.0)
|
||||
thor (>= 0.14, < 2.0)
|
||||
json (2.10.2)
|
||||
json (2.13.2)
|
||||
json-schema (5.1.0)
|
||||
addressable (~> 2.8)
|
||||
jsonapi-resources (0.10.7)
|
||||
@@ -357,7 +373,7 @@ GEM
|
||||
kgio (2.11.4)
|
||||
kramdown (2.4.0)
|
||||
rexml
|
||||
language_server-protocol (3.17.0.4)
|
||||
language_server-protocol (3.17.0.5)
|
||||
launchy (3.0.1)
|
||||
addressable (~> 2.8)
|
||||
childprocess (~> 5.0)
|
||||
@@ -371,7 +387,7 @@ GEM
|
||||
rb-fsevent (~> 0.10, >= 0.10.3)
|
||||
rb-inotify (~> 0.9, >= 0.9.10)
|
||||
logger (1.7.0)
|
||||
loofah (2.24.0)
|
||||
loofah (2.24.1)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.12.0)
|
||||
mail (2.8.1)
|
||||
@@ -391,12 +407,16 @@ GEM
|
||||
matrix (0.4.2)
|
||||
memcachier (0.0.2)
|
||||
method_source (1.1.0)
|
||||
mime-types (3.7.0)
|
||||
logger
|
||||
mime-types-data (~> 3.2025, >= 3.2025.0507)
|
||||
mime-types-data (3.2025.0805)
|
||||
mimemagic (0.4.3)
|
||||
nokogiri (~> 1)
|
||||
rake
|
||||
mini_magick (4.12.0)
|
||||
mini_mime (1.1.5)
|
||||
mini_portile2 (2.8.8)
|
||||
mini_portile2 (2.8.9)
|
||||
minitest (5.25.5)
|
||||
moneta (1.0.0)
|
||||
msgpack (1.8.0)
|
||||
@@ -405,23 +425,24 @@ GEM
|
||||
bigdecimal (~> 3.1)
|
||||
net-http (0.6.0)
|
||||
uri
|
||||
net-imap (0.4.19)
|
||||
net-imap (0.5.9)
|
||||
date
|
||||
net-protocol
|
||||
net-pop (0.1.2)
|
||||
net-protocol
|
||||
net-protocol (0.2.2)
|
||||
timeout
|
||||
net-smtp (0.5.0)
|
||||
net-smtp (0.5.1)
|
||||
net-protocol
|
||||
netrc (0.11.0)
|
||||
nio4r (2.7.4)
|
||||
nokogiri (1.18.4)
|
||||
nokogiri (1.18.9)
|
||||
mini_portile2 (~> 2.8.2)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.18.4-x86_64-linux-gnu)
|
||||
nokogiri (1.18.9-x86_64-linux-gnu)
|
||||
racc (~> 1.4)
|
||||
oauth (0.5.6)
|
||||
oj (3.16.10)
|
||||
oj (3.16.11)
|
||||
bigdecimal (>= 3.0)
|
||||
ostruct (>= 0.2)
|
||||
omniauth (1.9.2)
|
||||
@@ -433,18 +454,17 @@ 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.1)
|
||||
parallel (1.26.3)
|
||||
parser (3.3.7.3)
|
||||
ostruct (0.6.3)
|
||||
parallel (1.27.0)
|
||||
parser (3.3.9.0)
|
||||
ast (~> 2.4.1)
|
||||
racc
|
||||
percy-capybara (5.0.0)
|
||||
capybara (>= 3)
|
||||
pg (1.5.9)
|
||||
pg (1.6.1)
|
||||
pg (1.6.1-x86_64-linux)
|
||||
platform-api (3.8.0)
|
||||
heroics (~> 0.1.1)
|
||||
moneta (~> 1.0.0)
|
||||
@@ -457,15 +477,15 @@ GEM
|
||||
pry (0.15.2)
|
||||
coderay (~> 1.1)
|
||||
method_source (~> 1.0)
|
||||
psych (5.2.3)
|
||||
psych (5.2.6)
|
||||
date
|
||||
stringio
|
||||
public_suffix (6.0.1)
|
||||
puma (6.6.0)
|
||||
puma (6.6.1)
|
||||
nio4r (~> 2.0)
|
||||
query_diet (0.7.2)
|
||||
racc (1.8.1)
|
||||
rack (2.2.13)
|
||||
rack (2.2.17)
|
||||
rack-cors (2.0.2)
|
||||
rack (>= 2.0.0)
|
||||
rack-protection (3.2.0)
|
||||
@@ -478,25 +498,25 @@ GEM
|
||||
rackup (1.0.1)
|
||||
rack (< 3)
|
||||
webrick
|
||||
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)
|
||||
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)
|
||||
bundler (>= 1.15.0)
|
||||
railties (= 7.2.2.1)
|
||||
railties (= 7.2.2.2)
|
||||
rails-controller-testing (1.0.5)
|
||||
actionpack (>= 5.0.1.rc1)
|
||||
actionview (>= 5.0.1.rc1)
|
||||
activesupport (>= 5.0.1.rc1)
|
||||
rails-dom-testing (2.2.0)
|
||||
rails-dom-testing (2.3.0)
|
||||
activesupport (>= 5.0.0)
|
||||
minitest
|
||||
nokogiri (>= 1.6)
|
||||
@@ -511,9 +531,9 @@ GEM
|
||||
rails_stdout_logging
|
||||
rails_serve_static_assets (0.0.5)
|
||||
rails_stdout_logging (0.0.5)
|
||||
railties (7.2.2.1)
|
||||
actionpack (= 7.2.2.1)
|
||||
activesupport (= 7.2.2.1)
|
||||
railties (7.2.2.2)
|
||||
actionpack (= 7.2.2.2)
|
||||
activesupport (= 7.2.2.2)
|
||||
irb (~> 1.13)
|
||||
rackup (>= 1.0.0)
|
||||
rake (>= 12.2)
|
||||
@@ -521,52 +541,61 @@ GEM
|
||||
zeitwerk (~> 2.6)
|
||||
rainbow (3.1.1)
|
||||
raindrops (0.20.1)
|
||||
rake (13.2.1)
|
||||
rake (13.3.0)
|
||||
rate_throttle_client (0.1.2)
|
||||
rb-fsevent (0.11.2)
|
||||
rb-inotify (0.10.1)
|
||||
ffi (~> 1.0)
|
||||
rdoc (6.12.0)
|
||||
rdoc (6.14.2)
|
||||
erb
|
||||
psych (>= 4.0.0)
|
||||
recaptcha (5.19.0)
|
||||
recaptcha (5.20.1)
|
||||
redis-client (0.23.2)
|
||||
connection_pool
|
||||
regexp_parser (2.10.0)
|
||||
reline (0.6.0)
|
||||
regexp_parser (2.11.2)
|
||||
reline (0.6.2)
|
||||
io-console (~> 0.5)
|
||||
responders (3.1.1)
|
||||
actionpack (>= 5.2)
|
||||
railties (>= 5.2)
|
||||
rest-client (2.1.0)
|
||||
http-accept (>= 1.7.0, < 2.0)
|
||||
http-cookie (>= 1.0.2, < 2.0)
|
||||
mime-types (>= 1.16, < 4.0)
|
||||
netrc (~> 0.8)
|
||||
rexml (3.4.1)
|
||||
rouge (4.1.2)
|
||||
rspec (3.13.0)
|
||||
rspec-core (~> 3.13.0)
|
||||
rspec-expectations (~> 3.13.0)
|
||||
rspec-mocks (~> 3.13.0)
|
||||
rspec-activemodel-mocks (1.2.1)
|
||||
rspec-activemodel-mocks (1.3.0)
|
||||
activemodel (>= 3.0)
|
||||
activesupport (>= 3.0)
|
||||
rspec-mocks (>= 2.99, < 4.0)
|
||||
rspec-core (3.13.3)
|
||||
rspec-core (3.13.5)
|
||||
rspec-support (~> 3.13.0)
|
||||
rspec-expectations (3.13.3)
|
||||
rspec-expectations (3.13.5)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.13.0)
|
||||
rspec-mocks (3.13.2)
|
||||
rspec-mocks (3.13.5)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.13.0)
|
||||
rspec-rails (7.1.1)
|
||||
actionpack (>= 7.0)
|
||||
activesupport (>= 7.0)
|
||||
railties (>= 7.0)
|
||||
rspec-rails (8.0.2)
|
||||
actionpack (>= 7.2)
|
||||
activesupport (>= 7.2)
|
||||
railties (>= 7.2)
|
||||
rspec-core (~> 3.13)
|
||||
rspec-expectations (~> 3.13)
|
||||
rspec-mocks (~> 3.13)
|
||||
rspec-support (~> 3.13)
|
||||
rspec-support (3.13.2)
|
||||
rspectre (0.1.0)
|
||||
parser (>= 3.2.2.1)
|
||||
rspec (~> 3.9)
|
||||
rspec-rebound (0.2.1)
|
||||
rspec-core (~> 3.3)
|
||||
rspec-support (3.13.4)
|
||||
rspectre (0.2.0)
|
||||
parser (>= 3.3.7.1)
|
||||
prism (~> 1.3)
|
||||
rspec (~> 3.10)
|
||||
rswag-api (2.16.0)
|
||||
activesupport (>= 5.2, < 8.1)
|
||||
railties (>= 5.2, < 8.1)
|
||||
@@ -578,7 +607,7 @@ GEM
|
||||
rswag-ui (2.16.0)
|
||||
actionpack (>= 5.2, < 8.1)
|
||||
railties (>= 5.2, < 8.1)
|
||||
rubocop (1.75.1)
|
||||
rubocop (1.80.1)
|
||||
json (~> 2.3)
|
||||
language_server-protocol (~> 3.17.0.2)
|
||||
lint_roller (~> 1.1.0)
|
||||
@@ -586,10 +615,10 @@ GEM
|
||||
parser (>= 3.3.0.2)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
regexp_parser (>= 2.9.3, < 3.0)
|
||||
rubocop-ast (>= 1.43.0, < 2.0)
|
||||
rubocop-ast (>= 1.46.0, < 2.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 2.4.0, < 4.0)
|
||||
rubocop-ast (1.43.0)
|
||||
rubocop-ast (1.46.0)
|
||||
parser (>= 3.3.7.2)
|
||||
prism (~> 1.4)
|
||||
rubocop-capybara (2.22.1)
|
||||
@@ -598,16 +627,16 @@ GEM
|
||||
rubocop-factory_bot (2.27.1)
|
||||
lint_roller (~> 1.1)
|
||||
rubocop (~> 1.72, >= 1.72.1)
|
||||
rubocop-rails (2.30.3)
|
||||
rubocop-rails (2.33.3)
|
||||
activesupport (>= 4.2.0)
|
||||
lint_roller (~> 1.1)
|
||||
rack (>= 1.1)
|
||||
rubocop (>= 1.72.1, < 2.0)
|
||||
rubocop-ast (>= 1.38.0, < 2.0)
|
||||
rubocop (>= 1.75.0, < 2.0)
|
||||
rubocop-ast (>= 1.44.0, < 2.0)
|
||||
rubocop-rake (0.7.1)
|
||||
lint_roller (~> 1.1)
|
||||
rubocop (>= 1.72.1)
|
||||
rubocop-rspec (3.5.0)
|
||||
rubocop-rspec (3.6.0)
|
||||
lint_roller (~> 1.1)
|
||||
rubocop (~> 1.72, >= 1.72.1)
|
||||
rubocop-rspec_rails (2.31.0)
|
||||
@@ -618,7 +647,7 @@ GEM
|
||||
ruby-units (4.1.0)
|
||||
ruby-vips (2.2.1)
|
||||
ffi (~> 1.12)
|
||||
rubyzip (2.4.1)
|
||||
rubyzip (3.0.1)
|
||||
sass (3.7.4)
|
||||
sass-listen (~> 4.0.0)
|
||||
sass-listen (4.0.0)
|
||||
@@ -632,17 +661,17 @@ GEM
|
||||
sprockets (> 3.0)
|
||||
sprockets-rails
|
||||
tilt
|
||||
scout_apm (5.6.2)
|
||||
scout_apm (5.7.1)
|
||||
parser
|
||||
searchkick (5.3.1)
|
||||
activemodel (>= 6.1)
|
||||
hashie
|
||||
securerandom (0.4.1)
|
||||
selenium-webdriver (4.30.1)
|
||||
selenium-webdriver (4.35.0)
|
||||
base64 (~> 0.2)
|
||||
logger (~> 1.4)
|
||||
rexml (~> 3.2, >= 3.2.5)
|
||||
rubyzip (>= 1.2.2, < 3.0)
|
||||
rubyzip (>= 1.2.2, < 4.0)
|
||||
websocket (~> 1.0)
|
||||
sidekiq (7.3.9)
|
||||
base64
|
||||
@@ -650,11 +679,7 @@ GEM
|
||||
logger
|
||||
rack (>= 2.2.4)
|
||||
redis-client (>= 0.22.2)
|
||||
simplecov (0.13.0)
|
||||
docile (~> 1.1.0)
|
||||
json (>= 1.8, < 3)
|
||||
simplecov-html (~> 0.10.0)
|
||||
simplecov-html (0.10.2)
|
||||
simple_po_parser (1.1.6)
|
||||
sprockets (3.7.5)
|
||||
base64
|
||||
concurrent-ruby (~> 1.0)
|
||||
@@ -664,28 +689,28 @@ GEM
|
||||
activesupport (>= 5.2)
|
||||
sprockets (>= 3.0.0)
|
||||
ssrf_filter (1.1.2)
|
||||
stringio (3.1.5)
|
||||
stringio (3.1.7)
|
||||
sysexits (1.2.0)
|
||||
temple (0.10.3)
|
||||
temple (0.10.4)
|
||||
terminal-table (4.0.0)
|
||||
unicode-display_width (>= 1.1.1, < 4)
|
||||
terser (1.2.5)
|
||||
execjs (>= 0.3.0, < 3)
|
||||
thor (1.3.2)
|
||||
thor (1.4.0)
|
||||
thread_safe (0.3.6)
|
||||
tilt (2.6.0)
|
||||
tilt (2.6.1)
|
||||
timecop (0.9.10)
|
||||
timeout (0.4.3)
|
||||
trollop (1.16.2)
|
||||
tzinfo (2.0.6)
|
||||
concurrent-ruby (~> 1.0)
|
||||
unicode-display_width (3.1.4)
|
||||
unicode-display_width (3.1.5)
|
||||
unicode-emoji (~> 4.0, >= 4.0.4)
|
||||
unicode-emoji (4.0.4)
|
||||
unicorn (6.1.0)
|
||||
kgio (~> 2.6)
|
||||
raindrops (~> 0.7)
|
||||
uniform_notifier (1.16.0)
|
||||
uniform_notifier (1.17.0)
|
||||
uri (1.0.3)
|
||||
useragent (0.16.11)
|
||||
validate_url (1.0.15)
|
||||
@@ -705,7 +730,8 @@ GEM
|
||||
rack-test (>= 0.5.3)
|
||||
webrick (1.9.1)
|
||||
websocket (1.2.11)
|
||||
websocket-driver (0.7.6)
|
||||
websocket-driver (0.8.0)
|
||||
base64
|
||||
websocket-extensions (>= 0.1.0)
|
||||
websocket-extensions (0.1.5)
|
||||
will_paginate (4.0.1)
|
||||
@@ -715,7 +741,7 @@ GEM
|
||||
webrick
|
||||
xpath (3.2.0)
|
||||
nokogiri (~> 1.8)
|
||||
zeitwerk (2.7.2)
|
||||
zeitwerk (2.7.3)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
@@ -741,9 +767,9 @@ DEPENDENCIES
|
||||
capybara-email
|
||||
capybara-screenshot
|
||||
chartkick
|
||||
codeclimate-test-reporter
|
||||
coffee-rails
|
||||
comfortable_mexican_sofa!
|
||||
crowdin-cli
|
||||
csv_shaper
|
||||
dalli
|
||||
database_cleaner
|
||||
@@ -767,6 +793,7 @@ DEPENDENCIES
|
||||
haml_lint (>= 0.25.1)
|
||||
hashie (>= 3.5.3)
|
||||
i18n-tasks
|
||||
i18n_data (~> 1.1)
|
||||
icalendar
|
||||
jquery-rails
|
||||
jquery-ui-rails!
|
||||
@@ -784,7 +811,6 @@ DEPENDENCIES
|
||||
oj
|
||||
omniauth (~> 1.3)
|
||||
omniauth-flickr (>= 0.0.15)
|
||||
omniauth-twitter
|
||||
percy-capybara (~> 5.0.0)
|
||||
pg
|
||||
platform-api
|
||||
@@ -802,6 +828,7 @@ DEPENDENCIES
|
||||
responders
|
||||
rspec-activemodel-mocks
|
||||
rspec-rails
|
||||
rspec-rebound
|
||||
rspectre
|
||||
rswag-api
|
||||
rswag-specs
|
||||
@@ -831,7 +858,7 @@ DEPENDENCIES
|
||||
xmlrpc
|
||||
|
||||
RUBY VERSION
|
||||
ruby 3.3.7p123
|
||||
ruby 3.3.8p144
|
||||
|
||||
BUNDLED WITH
|
||||
2.4.22
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# 🌱 Growstuff
|
||||
|
||||

|
||||
[](https://codeclimate.com/github/Growstuff/growstuff)
|
||||
|
||||
Welcome to the Growstuff project.
|
||||
|
||||
@@ -63,5 +62,3 @@ 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)..
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 20 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.5 KiB |
@@ -33,13 +33,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
.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%);
|
||||
|
||||
@@ -30,3 +30,7 @@
|
||||
@import "predictions";
|
||||
@import "homepage";
|
||||
@import "maps";
|
||||
|
||||
@view-transition {
|
||||
navigation: auto;
|
||||
}
|
||||
@@ -57,6 +57,6 @@ class AlternateNamesController < ApplicationController
|
||||
private
|
||||
|
||||
def alternate_name_params
|
||||
params.require(:alternate_name).permit(:crop_id, :name, :creator_id)
|
||||
params.require(:alternate_name).permit(:crop_id, :name, :creator_id, :language)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -78,6 +78,7 @@ 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,43 +13,55 @@ class CommentsController < ApplicationController
|
||||
end
|
||||
|
||||
def new
|
||||
@commentable = find_commentable
|
||||
@comment = Comment.new
|
||||
@post = Post.find_by(id: params[:post_id])
|
||||
|
||||
if @post
|
||||
@comments = @post.comments
|
||||
if @commentable
|
||||
@comments = @commentable.comments
|
||||
respond_with(@comments)
|
||||
else
|
||||
redirect_to(request.referer || root_url,
|
||||
alert: "Can't post a comment on a non-existent post")
|
||||
alert: "Can't post a comment on a non-existent commentable")
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@comments = @comment.post.comments
|
||||
# TODO: Why does this need a collection of comments?
|
||||
@comments = @comment.commentable.comments
|
||||
@commentable = @comment.commentable
|
||||
end
|
||||
|
||||
def create
|
||||
@comment = Comment.new(comment_params)
|
||||
@commentable = @comment.commentable
|
||||
@comment.author = current_member
|
||||
@comment.save
|
||||
respond_with @comment, location: @comment.post
|
||||
respond_with @comment, location: @commentable
|
||||
end
|
||||
|
||||
def update
|
||||
@comment.update(body: comment_params['body'])
|
||||
respond_with @comment, location: @comment.post
|
||||
respond_with @comment, location: @comment.commentable
|
||||
end
|
||||
|
||||
def destroy
|
||||
@post = @comment.post
|
||||
@commentable = @comment.commentable
|
||||
@comment.destroy
|
||||
respond_with(@post)
|
||||
respond_with(@commentable)
|
||||
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, :post_id)
|
||||
params.require(:comment).permit(:body, :commentable_id, :commentable_type)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -39,12 +39,6 @@ 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!
|
||||
@@ -137,7 +131,6 @@ 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
|
||||
@@ -166,7 +159,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 } })
|
||||
AlternateName.create!(names_params(:alt_name).map { |n| { name: n, creator_id: current_member.id, crop_id: @crop.id, language: "EN" } })
|
||||
ScientificName.create!(names_params(:sci_name).map { |n| { name: n, creator_id: current_member.id, crop_id: @crop.id } })
|
||||
end
|
||||
|
||||
@@ -181,18 +174,16 @@ class CropsController < ApplicationController
|
||||
def recreate_names(param_name, name_type)
|
||||
return if params[param_name].blank?
|
||||
|
||||
destroy_names(name_type)
|
||||
params[param_name].each_value do |value|
|
||||
create_name!(name_type, value) unless value.empty?
|
||||
end
|
||||
end
|
||||
|
||||
def destroy_names(name_type)
|
||||
@crop.send("#{name_type}_names").each(&:destroy)
|
||||
end
|
||||
params[param_name].each_value do |value|
|
||||
next if value.empty?
|
||||
|
||||
def create_name!(name_type, value)
|
||||
@crop.send("#{name_type}_names").create!(name: value, creator_id: current_member.id)
|
||||
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
|
||||
end
|
||||
end
|
||||
|
||||
def crop_params
|
||||
@@ -216,12 +207,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: [:name] }
|
||||
scientific_names: { only: [:name] }, alternate_names: { only: %i(name language) }
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
@@ -16,7 +16,6 @@ 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(twitter flickr).index(auth['provider'].to_s)
|
||||
raise "Invalid provider" unless %w(flickr).index(auth['provider'].to_s)
|
||||
|
||||
session["devise.#{auth['provider']}_data"] = request.env["omniauth.auth"]
|
||||
sign_in member
|
||||
|
||||
@@ -21,6 +21,7 @@ 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,6 +91,32 @@ 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
|
||||
@@ -107,7 +133,7 @@ class PlantingsController < DataController
|
||||
:crop_id, :description, :garden_id, :planted_at,
|
||||
:parent_seed_id,
|
||||
:quantity, :sunniness, :planted_from, :finished,
|
||||
:finished_at
|
||||
:finished_at, :failed
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ 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,6 +19,10 @@ class SeedsController < DataController
|
||||
where['parent_planting'] = @planting.id
|
||||
end
|
||||
|
||||
if params[:tradeable_to].present?
|
||||
where['tradeable_to'] = params[:tradeable_to]
|
||||
end
|
||||
|
||||
@show_all = (params[:all] == '1')
|
||||
where['finished'] = false unless @show_all
|
||||
|
||||
|
||||
@@ -50,7 +50,6 @@ 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,6 +2,7 @@
|
||||
|
||||
module ButtonsHelper
|
||||
include IconsHelper
|
||||
|
||||
def garden_plant_something_button(garden, classes: "btn btn-default")
|
||||
return unless can? :edit, garden
|
||||
|
||||
@@ -97,7 +98,7 @@ module ButtonsHelper
|
||||
end
|
||||
|
||||
def planting_finish_button(planting, classes: 'btn btn-default btn-secondary')
|
||||
return unless can?(:edit, planting) || planting.finished
|
||||
return unless can?(:edit, planting) || planting.finished || planting.failed
|
||||
|
||||
link_to planting_path(slug: planting.slug, planting: { finished: 1 }),
|
||||
method: :put, class: "#{classes} append-date" do
|
||||
@@ -105,6 +106,15 @@ 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
|
||||
|
||||
@@ -122,7 +132,7 @@ module ButtonsHelper
|
||||
end
|
||||
|
||||
def planting_save_seeds_button(planting, classes: 'btn btn-default')
|
||||
return unless can?(:edit, planting)
|
||||
return unless can?(:edit, planting) && !planting.failed?
|
||||
|
||||
link_to new_planting_seed_path(planting_slug: planting.slug), class: classes do
|
||||
seed_icon + ' ' + t('buttons.save_seeds')
|
||||
|
||||
@@ -43,6 +43,14 @@ 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?
|
||||
|
||||
|
||||
@@ -111,6 +111,10 @@ 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,6 +5,7 @@ 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,26 +2,27 @@
|
||||
|
||||
class Comment < ApplicationRecord
|
||||
belongs_to :author, class_name: 'Member', inverse_of: :comments
|
||||
belongs_to :post, counter_cache: true
|
||||
belongs_to :commentable, polymorphic: true, counter_cache: true
|
||||
# validates :body, presence: true
|
||||
|
||||
scope :post_order, -> { order(created_at: :asc) } # for display on post page
|
||||
|
||||
after_create do
|
||||
recipient = post.author.id
|
||||
recipient = commentable.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 #{post.subject}",
|
||||
subject: "#{author} commented on #{commentable.subject}",
|
||||
body:,
|
||||
post_id: post.id
|
||||
notifiable: commentable
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
def to_s
|
||||
"#{author.login_name} commented on #{post.subject}"
|
||||
"#{author.login_name} commented on #{commentable.subject}"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,7 +8,12 @@ module Finishable
|
||||
scope :current, -> { where.not(finished: true) }
|
||||
|
||||
def active
|
||||
!finished
|
||||
# Plantings can fail. At the moment, activities and seeds cannot.
|
||||
if respond_to?(:failed)
|
||||
!finished && !failed
|
||||
else
|
||||
!finished
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,10 +4,6 @@ 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
|
||||
|
||||
@@ -38,7 +38,7 @@ module PredictHarvest
|
||||
|
||||
# status
|
||||
def harvest_time?
|
||||
return false if crop.perennial || finished
|
||||
return false if crop.perennial || finished || failed
|
||||
|
||||
# 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? ? finished_at - planted_at : nil)
|
||||
self.lifespan = (planted_at.present? && finished_at.present? && !failed? ? finished_at - planted_at : nil)
|
||||
end
|
||||
|
||||
# dates
|
||||
def finish_predicted_at
|
||||
if planted_at.blank?
|
||||
if planted_at.blank? || failed?
|
||||
nil
|
||||
elsif crop.median_lifespan.present?
|
||||
planted_at + crop.median_lifespan.days
|
||||
@@ -34,15 +34,18 @@ module PredictPlanting
|
||||
end
|
||||
|
||||
def actual_lifespan
|
||||
return unless planted_at.present? && finished_at.present?
|
||||
return unless planted_at.present? && finished_at.present? && !failed?
|
||||
|
||||
(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
|
||||
|
||||
@@ -50,9 +53,9 @@ module PredictPlanting
|
||||
Rails.cache.fetch("#{cache_key_with_version}/percentage_grown", expires_in: 8.hours) do
|
||||
if finished?
|
||||
100
|
||||
elsif !planted?
|
||||
elsif !planted? || failed?
|
||||
0
|
||||
elsif crop.perennial || finish_predicted_at.nil?
|
||||
elsif crop.perennial || (finish_predicted_at.nil? && finished_at.nil?) # This covers future dated finished_at that hasn't occurrred yet.
|
||||
nil
|
||||
else
|
||||
calculate_percentage_grown
|
||||
@@ -71,7 +74,7 @@ module PredictPlanting
|
||||
end
|
||||
|
||||
def late?
|
||||
crop.annual? && !finished &&
|
||||
crop.annual? && !finished && !failed &&
|
||||
planted_at.present? &&
|
||||
finish_predicted_at.present? &&
|
||||
finish_predicted_at <= Time.zone.today
|
||||
|
||||
@@ -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, creator: cropbot
|
||||
altname ||= AlternateName.create! name:, crop: @crop, language: "EN", creator: cropbot
|
||||
@crop.alternate_names << altname
|
||||
end
|
||||
end
|
||||
|
||||
@@ -10,7 +10,8 @@ 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)}. "
|
||||
body: "#{follower.login_name} just followed you on #{ENV.fetch('GROWSTUFF_SITE_NAME', nil)}. ",
|
||||
notifiable: self
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,6 +5,7 @@ class Garden < ApplicationRecord
|
||||
include Geocodable
|
||||
include PhotoCapable
|
||||
include Ownable
|
||||
|
||||
friendly_id :garden_slug, use: %i(slugged finders)
|
||||
|
||||
has_many :plantings, dependent: :destroy
|
||||
@@ -44,6 +45,7 @@ class Garden < ApplicationRecord
|
||||
.where.not(gardens: { latitude: nil })
|
||||
.where.not(gardens: { longitude: nil })
|
||||
}
|
||||
|
||||
AREA_UNITS_VALUES = {
|
||||
"square metres" => "square metre",
|
||||
"square feet" => "square foot",
|
||||
|
||||
@@ -91,6 +91,9 @@ 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 :post, optional: true
|
||||
belongs_to :notifiable, polymorphic: true
|
||||
|
||||
validates :subject, length: { maximum: 255 }
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ 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.
|
||||
@@ -83,6 +84,14 @@ 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
|
||||
|
||||
@@ -43,7 +43,8 @@ class Planting < ApplicationRecord
|
||||
.where.not(gardens: { latitude: nil })
|
||||
.where.not(gardens: { longitude: nil })
|
||||
}
|
||||
scope :active, -> { where('finished <> true').where('finished_at IS NULL OR finished_at < ?', Time.zone.now) }
|
||||
scope :active, -> { where(finished: false, failed: false).where('finished_at IS NULL OR finished_at < ?', Time.zone.now) }
|
||||
scope :failed, -> { where(failed: true) }
|
||||
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) }
|
||||
@@ -72,6 +73,7 @@ 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
|
||||
}
|
||||
@@ -96,7 +98,11 @@ class Planting < ApplicationRecord
|
||||
end
|
||||
|
||||
def finished?
|
||||
finished || (finished_at.present? && finished_at <= Time.zone.today)
|
||||
(finished || (finished_at.present? && finished_at <= Time.zone.today)) && !failed?
|
||||
end
|
||||
|
||||
def failed?
|
||||
failed
|
||||
end
|
||||
|
||||
def planted?
|
||||
@@ -120,6 +126,10 @@ 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
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
class Post < ApplicationRecord
|
||||
extend FriendlyId
|
||||
include Likeable
|
||||
|
||||
friendly_id :author_date_subject, use: %i(slugged finders)
|
||||
include PhotoCapable
|
||||
|
||||
@@ -10,9 +11,10 @@ class Post < ApplicationRecord
|
||||
# Relationships
|
||||
belongs_to :author, class_name: 'Member', inverse_of: :posts
|
||||
belongs_to :forum, optional: true
|
||||
has_many :comments, dependent: :destroy
|
||||
has_many :comments, as: :commentable, dependent: :destroy
|
||||
has_many :crop_posts, dependent: :delete_all
|
||||
has_many :crops, through: :crop_posts
|
||||
has_many :notifications, as: :notifiable, dependent: :destroy
|
||||
|
||||
after_create :send_notification
|
||||
#
|
||||
@@ -95,6 +97,7 @@ class Post < ApplicationRecord
|
||||
Notification.create(
|
||||
recipient_id:,
|
||||
sender_id: sender,
|
||||
notifiable: self,
|
||||
subject: "#{author} mentioned you in their post #{subject}",
|
||||
body:
|
||||
)
|
||||
|
||||
@@ -59,6 +59,7 @@ 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,6 +13,7 @@ module Api
|
||||
|
||||
attribute :slug
|
||||
attribute :planted_at
|
||||
attribute :failed
|
||||
attribute :finished
|
||||
attribute :finished_at
|
||||
attribute :quantity
|
||||
@@ -37,9 +38,7 @@ module Api
|
||||
filter :finished
|
||||
|
||||
attribute :percentage_grown
|
||||
def percentage_grown
|
||||
@model.percentage_grown
|
||||
end
|
||||
delegate :percentage_grown, to: :@model
|
||||
|
||||
attribute :crop_name
|
||||
attribute :crop_slug
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
|
||||
.row
|
||||
.col-md-6
|
||||
= f.check_box :finished, label: 'Mark as finished'
|
||||
= f.check_box :finished, label: t('buttons.mark_as_finished')
|
||||
%span.help-block= t('.finish_helper')
|
||||
|
||||
.card-footer
|
||||
|
||||
@@ -31,7 +31,8 @@
|
||||
= 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,12 +1,11 @@
|
||||
%a{ name: "comments" }
|
||||
- if post.comments
|
||||
- if commentable.comments
|
||||
%hr/
|
||||
%h2
|
||||
= comment_icon
|
||||
= localize_plural(post.comments, Comment)
|
||||
- post.comments.post_order.each do |comment|
|
||||
= localize_plural(commentable.comments, Comment)
|
||||
- commentable.comments.post_order.each do |comment|
|
||||
= render "comments/single", comment: comment
|
||||
|
||||
- else
|
||||
%h2 There are no comments yet
|
||||
|
||||
@@ -1 +1 @@
|
||||
#{link_to 'commented', event_model} on #{link_to event_model.post, event_model.post}
|
||||
#{link_to 'commented', event_model} on #{link_to event_model.commentable, event_model.commentable}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
- @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
|
||||
@@ -14,13 +15,13 @@
|
||||
%li= msg
|
||||
|
||||
.md-form
|
||||
= f.text_area :body, rows: 6, class: 'form-control md-textarea', autofocus: 'autofocus'
|
||||
= f.text_area :body, rows: 6, class: 'form-control md-textarea', autofocus: 'autofocus', required: true, pattern: '\w+'
|
||||
= f.label :body, "Your comment:"
|
||||
|
||||
%span.help-block
|
||||
= render partial: "shared/markdown_help"
|
||||
.actions.text-right
|
||||
= f.submit 'Post comment', class: 'btn btn-primary'
|
||||
- if defined?(@post)
|
||||
.field
|
||||
= f.hidden_field :post_id, value: @post.id
|
||||
.field
|
||||
= f.hidden_field :commentable_id, value: @commentable.id
|
||||
= f.hidden_field :commentable_type, value: @commentable.class.name
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
|
||||
%p
|
||||
Editing comment on
|
||||
= link_to @comment.post.subject, @comment.post
|
||||
= link_to @comment.commentable.subject, @comment.commentable
|
||||
|
||||
= render 'form'
|
||||
= render 'form', locals: { comment: @comment, commentable: @comment.commentable }
|
||||
|
||||
@@ -5,17 +5,18 @@
|
||||
%link= comments_url
|
||||
- @comments.each do |comment|
|
||||
%item
|
||||
%title Comment by #{comment.author.login_name} on #{comment.post.subject}
|
||||
%title Comment by #{comment.author.login_name} on #{comment.commentable.subject}
|
||||
%description
|
||||
:escaped_markdown
|
||||
<p>
|
||||
Comment on
|
||||
#{ link_to comment.post.subject, post_url(comment.post) }
|
||||
#{ link_to comment.commentable.subject, polymorphic_url(comment.commentable) }
|
||||
</p>
|
||||
|
||||
:escaped_markdown
|
||||
#{ strip_tags markdownify(comment.body) }
|
||||
|
||||
%pubdate= comment.created_at.to_fs(:rfc822)
|
||||
%link= post_url(comment.post)
|
||||
%link= polymorphic_url(comment.commentable)
|
||||
%guid= comment_url(comment)
|
||||
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
= 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
|
||||
|
||||
%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 partial: "comments/comments", locals: { commentable: @commentable || @comment.commentable }
|
||||
|
||||
= render partial: "posts/comments", locals: { post: @post || @comment.post }
|
||||
|
||||
= render 'form'
|
||||
= render 'form', locals: { comment: @comment, commentable: @commentable || @comment.commentable }
|
||||
|
||||
@@ -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.name} (#{an.language})"
|
||||
.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
|
||||
.badge= "#{an.name} (#{an.language})"
|
||||
|
||||
|
||||
%p.text-right
|
||||
|
||||
@@ -10,10 +10,6 @@
|
||||
= 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
|
||||
|
||||
@@ -147,6 +147,14 @@
|
||||
= 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,19 +3,6 @@
|
||||
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,7 +13,32 @@
|
||||
.form-group
|
||||
= f.label :bio, class: 'control-label col-md-2'
|
||||
.col-md-8
|
||||
= f.text_area :bio, rows: 6, class: 'form-control'
|
||||
= 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/"
|
||||
|
||||
.form-group
|
||||
%label.control-label.col-md-2
|
||||
|
||||
@@ -51,7 +51,8 @@
|
||||
%section.seeds
|
||||
= cute_icon
|
||||
= render 'seeds'
|
||||
%p.text-right= link_to "#{t('home.seeds.view_all')} »", seeds_path, class: 'btn btn-block'
|
||||
%p.text-right
|
||||
= link_to "#{t('home.seeds.view_all')} »", seeds_path(tradeable_to: ['locally', 'nationally', 'internationally']), class: 'btn btn-block'
|
||||
.col-12.col-lg-6
|
||||
%section.discussion.text-center
|
||||
= cute_icon
|
||||
|
||||
@@ -1,13 +1 @@
|
||||
%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,17 +1,37 @@
|
||||
- if twitter_auth || flickr_auth || member.show_email
|
||||
- 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
|
||||
%h4 Contact
|
||||
|
||||
- if twitter_auth
|
||||
- if member.website_url.present?
|
||||
%p
|
||||
= image_tag "twitter_32.png", size: "32x32", alt: 'Twitter logo'
|
||||
= link_to twitter_auth.name, "https://twitter.com/#{twitter_auth.name}"
|
||||
= 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 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}"
|
||||
= link_to flickr_auth.name, "https://flickr.com/photos/#{flickr_auth.uid}", target: '_blank', rel: 'noopener noreferrer'
|
||||
|
||||
- if member.show_email
|
||||
%p
|
||||
Email:
|
||||
= icon 'fas', 'envelope', class: 'fa-fw'
|
||||
= mail_to member.email
|
||||
|
||||
@@ -5,5 +5,5 @@
|
||||
= link_to member.location, place_path(member.location, anchor: "members")
|
||||
- else
|
||||
.location-not-set
|
||||
.sr-only Location not known
|
||||
.sr-only We can't show you what's nearby
|
||||
%h1 Location not known or geocodable
|
||||
%p We can't show you what's nearby
|
||||
|
||||
@@ -21,6 +21,21 @@
|
||||
.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|
|
||||
@@ -30,12 +45,16 @@
|
||||
= icon 'fas', 'map-marker'
|
||||
= truncate(@member.location, length: 15, separator: ' ', omission: '... ')
|
||||
%p
|
||||
%strong Member since
|
||||
= @member.created_at.to_fs(:date)
|
||||
%small
|
||||
%strong Member since
|
||||
%br
|
||||
= @member.created_at.to_fs(:date)
|
||||
- if @member.last_sign_in_at
|
||||
%p
|
||||
%strong Last Login
|
||||
= @member.last_sign_in_at&.to_fs(:default)
|
||||
%small
|
||||
%strong Last Login
|
||||
%br
|
||||
= @member.last_sign_in_at&.to_fs(:default)
|
||||
|
||||
- if can? :update, @member
|
||||
= link_to edit_member_registration_path, class: 'btn btn-block' do
|
||||
@@ -58,8 +77,7 @@
|
||||
|
||||
= render "stats", member: @member
|
||||
.card-footer
|
||||
= render "contact", member: @member, twitter_auth: @twitter_auth,
|
||||
flickr_auth: @flickr_auth
|
||||
= render "contact", member: @member, flickr_auth: @flickr_auth
|
||||
|
||||
.col-md-10#content
|
||||
.row
|
||||
|
||||
@@ -46,4 +46,12 @@
|
||||
- else
|
||||
= @photo.license_name
|
||||
|
||||
= render "associations", photo: @photo
|
||||
= 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
|
||||
@@ -7,7 +7,16 @@
|
||||
- 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,6 +19,7 @@
|
||||
|
||||
- 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,13 +1,14 @@
|
||||
%h2 Seeds saved
|
||||
|
||||
%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 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
|
||||
|
||||
- if planting.child_seeds.size.positive?
|
||||
.index-cards
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
- if planting.quantity.to_i.positive? && planting.planted_from.present?
|
||||
= planting.planted_from.pluralize(planting.quantity.to_i)
|
||||
|
||||
- unless planting.finished?
|
||||
- unless planting.finished? || planting.failed?
|
||||
.card.fact-card.grid-sizer
|
||||
%h3 Growing
|
||||
%strong= seedling_icon
|
||||
|
||||
@@ -34,9 +34,7 @@
|
||||
.col-md-4
|
||||
= f.text_field :planted_at,
|
||||
value: @planting.planted_at ? @planting.planted_at.to_fs(:ymd) : '',
|
||||
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
|
||||
class: 'add-datepicker', label: 'When?', title: "Plan out your future plantings by forward dating, and subscribe to your iCalendar feed for reminders to plant"
|
||||
|
||||
.row
|
||||
.col-md-4
|
||||
@@ -49,14 +47,17 @@
|
||||
|
||||
.row
|
||||
.col-md-6
|
||||
= f.check_box :finished, label: 'Mark as finished'
|
||||
%span.help-block= t('.finish_helper')
|
||||
= f.check_box :finished, label: t('buttons.mark_as_finished'), title: 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,10 +1,9 @@
|
||||
%h2 Harvests
|
||||
|
||||
- if can? :edit, planting
|
||||
- if can?(:edit, planting) && !planting.failed
|
||||
= 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,6 +8,8 @@
|
||||
%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,8 +32,10 @@
|
||||
%strong= @planting.crop.name.titleize
|
||||
%small.text-muted= @planting.crop.default_scientific_name
|
||||
%tt
|
||||
- if @planting.finished?
|
||||
Finished
|
||||
- if @planting.failed?
|
||||
%span.badge.badge-danger Failed
|
||||
- elsif @planting.finished?
|
||||
%span.badge.badge-success Finished
|
||||
- elsif @planting.percentage_grown.present?
|
||||
#{@planting.percentage_grown.to_i}%
|
||||
- if @planting.finish_is_predicatable?
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
- @post ||= post if defined?(post)
|
||||
%p
|
||||
Posted by
|
||||
- if @post.author
|
||||
@@ -13,7 +14,7 @@
|
||||
and edited at
|
||||
= @post.updated_at.to_fs(:default)
|
||||
|
||||
= link_to "Permalink", post
|
||||
= link_to "Permalink", @post
|
||||
|
||||
:markdown
|
||||
#{ strip_tags markdownify(@post.body) }
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
- content_for :buttonbar do
|
||||
- if @post.comments.count > 10 && can?(:create, Comment)
|
||||
= link_to 'Comment', new_comment_path(post_id: @post.id), class: 'btn'
|
||||
= link_to 'Comment', new_comment_path(comment: { commentable_type: 'Post', commentable_id: @post.id }), class: 'btn'
|
||||
|
||||
- content_for :breadcrumbs do
|
||||
%li.breadcrumb-item= link_to @post.author, @post.author
|
||||
@@ -48,12 +48,12 @@
|
||||
= render 'likes/likes', object: @post
|
||||
.float-right
|
||||
- if can? :create, Comment
|
||||
= link_to new_comment_path(post_id: @post.id), class: 'btn' do
|
||||
= link_to new_comment_path(comment: { commentable_type: 'Post', commentable_id: @post.id }), class: 'btn' do
|
||||
= icon 'fas', 'comment'
|
||||
Comment
|
||||
|
||||
%section.comments
|
||||
= render "comments", post: @post
|
||||
= render "comments/comments", commentable: @post
|
||||
|
||||
.col-md-4.col-12
|
||||
= render @post.author
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
.row
|
||||
.col-12.col-md-4
|
||||
= f.check_box :finished, label: 'Mark as finished'
|
||||
= f.check_box :finished, label: t('buttons.mark_as_finished')
|
||||
.col-12.col-md-4
|
||||
= f.text_field :finished_at, class: 'add-datepicker', value: @seed.finished_at ? @seed.finished_at.to_fs(:ymd) : ''
|
||||
.col-12.col-md-4
|
||||
|
||||
@@ -17,6 +17,14 @@
|
||||
= check_box_tag 'active', 'all', @show_all
|
||||
include finished
|
||||
%hr/
|
||||
%section.filters
|
||||
%h2 Tradeable
|
||||
%ul.nav.flex-column
|
||||
%li.nav-item= link_to "All tradable seeds", seeds_path(tradeable_to: ['locally', 'nationally', 'internationally'])
|
||||
- Seed::TRADABLE_TO_VALUES.each do |value|
|
||||
- unless value == 'nowhere'
|
||||
%li.nav-item= link_to value.capitalize, seeds_path(tradeable_to: value)
|
||||
%hr/
|
||||
- if @owner
|
||||
= render @owner
|
||||
- if @crop
|
||||
|
||||
@@ -5,7 +5,7 @@ Mailboxer.setup do |config|
|
||||
config.uses_emails = true
|
||||
|
||||
# Configures the default from for emails sent for Messages and Notifications
|
||||
config.default_from = "no-reply@growstuff.org"
|
||||
config.default_from = "Growstuff <#{ENV.fetch('GROWSTUFF_EMAIL', "no-reply@growstuff.org")}>"
|
||||
|
||||
# Configures the methods needed by mailboxer
|
||||
# config.email_method = :email
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
Rails.application.config.middleware.use OmniAuth::Builder do
|
||||
provider :twitter, ENV.fetch('GROWSTUFF_TWITTER_KEY', nil), ENV.fetch('GROWSTUFF_TWITTER_SECRET', nil)
|
||||
provider :flickr, ENV.fetch('GROWSTUFF_FLICKR_KEY', nil), ENV.fetch('GROWSTUFF_FLICKR_SECRET', nil), scope: 'read'
|
||||
end
|
||||
|
||||
@@ -78,6 +78,7 @@ en:
|
||||
harvest_crop: Harvest %{crop_name}
|
||||
mark_as_active: Mark as active
|
||||
mark_as_finished: Mark as finished
|
||||
mark_as_failed: Mark as failed
|
||||
mark_as_inactive: Mark as inactive
|
||||
my_gardens: My Gardens
|
||||
new_seeds: New saved seed
|
||||
@@ -307,6 +308,8 @@ en:
|
||||
finish_helper: >
|
||||
A planting is finished when you've harvested all of the crop, or it dies, or it's otherwise
|
||||
no longer growing in your garden.
|
||||
failed_helper: >
|
||||
Mark this planting as failed if it died or was removed without any harvest.
|
||||
index:
|
||||
title:
|
||||
crop_plantings: Everyone's %{crop} plantings
|
||||
|
||||
7
config/locales/mailboxer.en.yml
Normal file
7
config/locales/mailboxer.en.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
en:
|
||||
mailboxer:
|
||||
message_mailer:
|
||||
subject_new: "New Notification: %{subject}"
|
||||
subject_reply: "New Reply: %{subject}"
|
||||
notification_mailer:
|
||||
subject: "New notification: %{subject}"
|
||||
@@ -40,6 +40,9 @@ Rails.application.routes.draw do
|
||||
collection do
|
||||
get 'crop/:crop' => 'plantings#index', as: 'plantings_by_crop'
|
||||
end
|
||||
member do
|
||||
post :transplant
|
||||
end
|
||||
end
|
||||
|
||||
resources :seeds, concerns: :has_photos, param: :slug do
|
||||
@@ -78,7 +81,6 @@ Rails.application.routes.draw do
|
||||
get 'sunniness' => 'charts/crops#sunniness', constraints: { format: 'json' }
|
||||
get 'planted_from' => 'charts/crops#planted_from', constraints: { format: 'json' }
|
||||
get 'harvested_for' => 'charts/crops#harvested_for', constraints: { format: 'json' }
|
||||
post :openfarm
|
||||
post :gbif
|
||||
|
||||
collection do
|
||||
|
||||
22
crowdin.yml
Normal file
22
crowdin.yml
Normal file
@@ -0,0 +1,22 @@
|
||||
# Hi there!
|
||||
#
|
||||
# This is a configuration file for the Crowdin CLI.
|
||||
# You'll need to replace the placeholder project_id with your actual
|
||||
# project ID from CrowdIn.
|
||||
#
|
||||
# For more information, see the Crowdin CLI documentation:
|
||||
# https://support.crowdin.com/enterprise/cli-v3/
|
||||
#
|
||||
project_id: "your-project-id"
|
||||
api_token_env: "CROWDIN_API_TOKEN"
|
||||
base_path: "."
|
||||
|
||||
files:
|
||||
- source: '/config/locales/en.yml'
|
||||
translation: '/config/locales/%two_letters_code%.yml'
|
||||
# The 'ignore' property is used to exclude files from processing.
|
||||
# We are ignoring the existing Japanese translation file.
|
||||
ignore:
|
||||
- '/config/locales/ja.yml'
|
||||
- source: '/config/locales/*.en.yml'
|
||||
translation: '/config/locales/%file_name%.%two_letters_code%.yml'
|
||||
9
db/migrate/20240716120000_add_social_media_to_members.rb
Normal file
9
db/migrate/20240716120000_add_social_media_to_members.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
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
|
||||
@@ -0,0 +1,5 @@
|
||||
class RenameOtherHandleToOtherUrlInMembers < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
rename_column :members, :other_handle, :other_url
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class AddLanguageToAlternateNames < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
add_column :alternate_names, :language, :string, null: false
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,11 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class SetDefaultLanguageForExistingAlternateNames < ActiveRecord::Migration[7.2]
|
||||
def up
|
||||
AlternateName.update_all(language: 'en')
|
||||
end
|
||||
|
||||
def down
|
||||
AlternateName.update_all(language: nil)
|
||||
end
|
||||
end
|
||||
14
db/migrate/20250810120000_make_notifications_polymorphic.rb
Normal file
14
db/migrate/20250810120000_make_notifications_polymorphic.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
class MakeNotificationsPolymorphic < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :notifications, :notifiable_type, :string
|
||||
rename_column :notifications, :post_id, :notifiable_id
|
||||
|
||||
reversible do |dir|
|
||||
dir.up do
|
||||
ActiveRecord::Base.connection.execute("UPDATE notifications SET notifiable_type = 'Post' WHERE notifiable_type IS NULL")
|
||||
end
|
||||
end
|
||||
|
||||
add_index :notifications, %i(notifiable_type notifiable_id)
|
||||
end
|
||||
end
|
||||
14
db/migrate/20250824081313_change_comments_polymorphic.rb
Normal file
14
db/migrate/20250824081313_change_comments_polymorphic.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
class ChangeCommentsPolymorphic < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
add_column :comments, :commentable_type, :string
|
||||
rename_column :comments, :post_id, :commentable_id
|
||||
|
||||
add_index :comments, %i(commentable_type commentable_id)
|
||||
|
||||
reversible do |dir|
|
||||
dir.up do
|
||||
ActiveRecord::Base.connection.execute("UPDATE comments SET commentable_type = 'Post' WHERE commentable_type IS NULL")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
24
db/migrate/20250824085224_add_photos_comment_count.rb
Normal file
24
db/migrate/20250824085224_add_photos_comment_count.rb
Normal file
@@ -0,0 +1,24 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class AddPhotosCommentCount < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
change_table :photos do |t|
|
||||
t.integer :comments_count, default: 0
|
||||
end
|
||||
reversible do |dir|
|
||||
dir.up { set_counter_value }
|
||||
end
|
||||
end
|
||||
|
||||
def set_counter_value
|
||||
execute <<-SQL.squish
|
||||
UPDATE photos
|
||||
SET comments_count = (
|
||||
SELECT count(1)
|
||||
FROM comments
|
||||
WHERE comments.commentable_id = comments.id
|
||||
AND comments.commentable_type = 'Photo'
|
||||
)
|
||||
SQL
|
||||
end
|
||||
end
|
||||
7
db/migrate/20250824162600_add_failed_to_plantings.rb
Normal file
7
db/migrate/20250824162600_add_failed_to_plantings.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class AddFailedToPlantings < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_column :plantings, :failed, :boolean, default: false, null: false
|
||||
end
|
||||
end
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user