mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-25 09:19:15 -04:00
Compare commits
1 Commits
feature/pr
...
fix-ci
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4857b13dfc |
102
.github/workflows/ci-features-places.yml
vendored
102
.github/workflows/ci-features-places.yml
vendored
@@ -1,102 +0,0 @@
|
||||
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@v4
|
||||
|
||||
- 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
|
||||
102
.github/workflows/ci-features-posts.yml
vendored
102
.github/workflows/ci-features-posts.yml
vendored
@@ -1,102 +0,0 @@
|
||||
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@v4
|
||||
|
||||
- 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
|
||||
9
.github/workflows/ci-features.yml
vendored
9
.github/workflows/ci-features.yml
vendored
@@ -107,5 +107,14 @@ 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
|
||||
@@ -1 +1 @@
|
||||
3.3.8
|
||||
3.3.7
|
||||
|
||||
5
Gemfile
5
Gemfile
@@ -175,7 +175,6 @@ 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
|
||||
@@ -193,12 +192,10 @@ group :test do
|
||||
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"
|
||||
|
||||
110
Gemfile.lock
110
Gemfile.lock
@@ -156,7 +156,7 @@ GEM
|
||||
actionpack (>= 6.1)
|
||||
activemodel (>= 6.1)
|
||||
builder (3.3.0)
|
||||
bullet (8.0.8)
|
||||
bullet (8.0.7)
|
||||
activesupport (>= 3.0.0)
|
||||
uniform_notifier (~> 1.11)
|
||||
byebug (12.0.0)
|
||||
@@ -200,14 +200,6 @@ GEM
|
||||
concurrent-ruby (1.3.5)
|
||||
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)
|
||||
@@ -228,10 +220,10 @@ GEM
|
||||
railties (>= 4.1.0)
|
||||
responders
|
||||
warden (~> 1.2.3)
|
||||
diff-lcs (1.6.2)
|
||||
diff-lcs (1.6.1)
|
||||
discard (1.4.0)
|
||||
activerecord (>= 4.2, < 9.0)
|
||||
domain_name (0.6.20240107)
|
||||
docile (1.1.5)
|
||||
dotenv (3.1.8)
|
||||
dotenv-rails (3.1.8)
|
||||
dotenv (= 3.1.8)
|
||||
@@ -257,18 +249,18 @@ GEM
|
||||
excon (1.2.5)
|
||||
logger
|
||||
execjs (2.10.0)
|
||||
factory_bot (6.5.4)
|
||||
activesupport (>= 6.1.0)
|
||||
factory_bot_rails (6.5.0)
|
||||
factory_bot (6.5.0)
|
||||
activesupport (>= 5.0.0)
|
||||
factory_bot_rails (6.4.4)
|
||||
factory_bot (~> 6.5)
|
||||
railties (>= 6.1.0)
|
||||
faker (3.5.2)
|
||||
railties (>= 5.0.0)
|
||||
faker (3.5.1)
|
||||
i18n (>= 1.8.11, < 2)
|
||||
faraday (2.13.4)
|
||||
faraday (2.13.1)
|
||||
faraday-net_http (>= 2.0, < 3.5)
|
||||
json
|
||||
logger
|
||||
faraday-net_http (3.4.1)
|
||||
faraday-net_http (3.4.0)
|
||||
net-http (>= 0.5.0)
|
||||
ffi (1.16.3)
|
||||
flickraw (0.9.10)
|
||||
@@ -283,8 +275,6 @@ 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)
|
||||
@@ -305,7 +295,7 @@ GEM
|
||||
activesupport (>= 5.1)
|
||||
haml (>= 4.0.6)
|
||||
railties (>= 5.1)
|
||||
haml_lint (0.66.0)
|
||||
haml_lint (0.62.0)
|
||||
haml (>= 5.0)
|
||||
parallel (~> 1.10)
|
||||
rainbow
|
||||
@@ -321,9 +311,6 @@ 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)
|
||||
@@ -341,7 +328,7 @@ GEM
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
ruby-progressbar (~> 1.8, >= 1.8.1)
|
||||
terminal-table (>= 1.5.1)
|
||||
icalendar (2.11.2)
|
||||
icalendar (2.11.0)
|
||||
base64
|
||||
ice_cube (~> 0.16)
|
||||
logger
|
||||
@@ -360,7 +347,7 @@ GEM
|
||||
rails-dom-testing (>= 1, < 3)
|
||||
railties (>= 4.2.0)
|
||||
thor (>= 0.14, < 2.0)
|
||||
json (2.13.2)
|
||||
json (2.12.2)
|
||||
json-schema (5.1.0)
|
||||
addressable (~> 2.8)
|
||||
jsonapi-resources (0.10.7)
|
||||
@@ -405,10 +392,6 @@ 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
|
||||
@@ -432,12 +415,11 @@ GEM
|
||||
timeout
|
||||
net-smtp (0.5.0)
|
||||
net-protocol
|
||||
netrc (0.11.0)
|
||||
nio4r (2.7.4)
|
||||
nokogiri (1.18.9)
|
||||
nokogiri (1.18.8)
|
||||
mini_portile2 (~> 2.8.2)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.18.9-x86_64-linux-gnu)
|
||||
nokogiri (1.18.8-x86_64-linux-gnu)
|
||||
racc (~> 1.4)
|
||||
oauth (0.5.6)
|
||||
oj (3.16.10)
|
||||
@@ -455,17 +437,15 @@ GEM
|
||||
omniauth-twitter (1.4.0)
|
||||
omniauth-oauth (~> 1.1)
|
||||
rack
|
||||
open-uri (0.1.0)
|
||||
orm_adapter (0.5.0)
|
||||
ostruct (0.6.2)
|
||||
ostruct (0.6.1)
|
||||
parallel (1.27.0)
|
||||
parser (3.3.9.0)
|
||||
parser (3.3.8.0)
|
||||
ast (~> 2.4.1)
|
||||
racc
|
||||
percy-capybara (5.0.0)
|
||||
capybara (>= 3)
|
||||
pg (1.6.1)
|
||||
pg (1.6.1-x86_64-linux)
|
||||
pg (1.5.9)
|
||||
platform-api (3.8.0)
|
||||
heroics (~> 0.1.1)
|
||||
moneta (~> 1.0.0)
|
||||
@@ -482,7 +462,7 @@ GEM
|
||||
date
|
||||
stringio
|
||||
public_suffix (6.0.1)
|
||||
puma (6.6.1)
|
||||
puma (6.6.0)
|
||||
nio4r (~> 2.0)
|
||||
query_diet (0.7.2)
|
||||
racc (1.8.1)
|
||||
@@ -542,47 +522,42 @@ GEM
|
||||
zeitwerk (~> 2.6)
|
||||
rainbow (3.1.1)
|
||||
raindrops (0.20.1)
|
||||
rake (13.3.0)
|
||||
rake (13.2.1)
|
||||
rate_throttle_client (0.1.2)
|
||||
rb-fsevent (0.11.2)
|
||||
rb-inotify (0.10.1)
|
||||
ffi (~> 1.0)
|
||||
rdoc (6.14.2)
|
||||
rdoc (6.14.0)
|
||||
erb
|
||||
psych (>= 4.0.0)
|
||||
recaptcha (5.20.1)
|
||||
recaptcha (5.19.0)
|
||||
redis-client (0.23.2)
|
||||
connection_pool
|
||||
regexp_parser (2.11.1)
|
||||
regexp_parser (2.10.0)
|
||||
reline (0.6.1)
|
||||
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.3.0)
|
||||
rspec-activemodel-mocks (1.2.1)
|
||||
activemodel (>= 3.0)
|
||||
activesupport (>= 3.0)
|
||||
rspec-mocks (>= 2.99, < 4.0)
|
||||
rspec-core (3.13.5)
|
||||
rspec-core (3.13.3)
|
||||
rspec-support (~> 3.13.0)
|
||||
rspec-expectations (3.13.5)
|
||||
rspec-expectations (3.13.4)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.13.0)
|
||||
rspec-mocks (3.13.5)
|
||||
rspec-mocks (3.13.4)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.13.0)
|
||||
rspec-rails (8.0.1)
|
||||
rspec-rails (8.0.0)
|
||||
actionpack (>= 7.2)
|
||||
activesupport (>= 7.2)
|
||||
railties (>= 7.2)
|
||||
@@ -590,9 +565,7 @@ GEM
|
||||
rspec-expectations (~> 3.13)
|
||||
rspec-mocks (~> 3.13)
|
||||
rspec-support (~> 3.13)
|
||||
rspec-rebound (0.2.1)
|
||||
rspec-core (~> 3.3)
|
||||
rspec-support (3.13.4)
|
||||
rspec-support (3.13.3)
|
||||
rspectre (0.2.0)
|
||||
parser (>= 3.3.7.1)
|
||||
prism (~> 1.3)
|
||||
@@ -608,7 +581,7 @@ GEM
|
||||
rswag-ui (2.16.0)
|
||||
actionpack (>= 5.2, < 8.1)
|
||||
railties (>= 5.2, < 8.1)
|
||||
rubocop (1.79.2)
|
||||
rubocop (1.76.0)
|
||||
json (~> 2.3)
|
||||
language_server-protocol (~> 3.17.0.2)
|
||||
lint_roller (~> 1.1.0)
|
||||
@@ -616,10 +589,10 @@ GEM
|
||||
parser (>= 3.3.0.2)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
regexp_parser (>= 2.9.3, < 3.0)
|
||||
rubocop-ast (>= 1.46.0, < 2.0)
|
||||
rubocop-ast (>= 1.45.0, < 2.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 2.4.0, < 4.0)
|
||||
rubocop-ast (1.46.0)
|
||||
rubocop-ast (1.45.0)
|
||||
parser (>= 3.3.7.2)
|
||||
prism (~> 1.4)
|
||||
rubocop-capybara (2.22.1)
|
||||
@@ -662,13 +635,13 @@ GEM
|
||||
sprockets (> 3.0)
|
||||
sprockets-rails
|
||||
tilt
|
||||
scout_apm (5.7.0)
|
||||
scout_apm (5.6.4)
|
||||
parser
|
||||
searchkick (5.3.1)
|
||||
activemodel (>= 6.1)
|
||||
hashie
|
||||
securerandom (0.4.1)
|
||||
selenium-webdriver (4.34.0)
|
||||
selenium-webdriver (4.32.0)
|
||||
base64 (~> 0.2)
|
||||
logger (~> 1.4)
|
||||
rexml (~> 3.2, >= 3.2.5)
|
||||
@@ -680,6 +653,11 @@ 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)
|
||||
sprockets (3.7.5)
|
||||
base64
|
||||
concurrent-ruby (~> 1.0)
|
||||
@@ -691,14 +669,14 @@ GEM
|
||||
ssrf_filter (1.1.2)
|
||||
stringio (3.1.7)
|
||||
sysexits (1.2.0)
|
||||
temple (0.10.4)
|
||||
temple (0.10.3)
|
||||
terminal-table (4.0.0)
|
||||
unicode-display_width (>= 1.1.1, < 4)
|
||||
terser (1.2.5)
|
||||
execjs (>= 0.3.0, < 3)
|
||||
thor (1.4.0)
|
||||
thor (1.3.2)
|
||||
thread_safe (0.3.6)
|
||||
tilt (2.6.1)
|
||||
tilt (2.6.0)
|
||||
timecop (0.9.10)
|
||||
timeout (0.4.3)
|
||||
trollop (1.16.2)
|
||||
@@ -768,7 +746,6 @@ DEPENDENCIES
|
||||
chartkick
|
||||
coffee-rails
|
||||
comfortable_mexican_sofa!
|
||||
crowdin-cli
|
||||
csv_shaper
|
||||
dalli
|
||||
database_cleaner
|
||||
@@ -827,7 +804,6 @@ DEPENDENCIES
|
||||
responders
|
||||
rspec-activemodel-mocks
|
||||
rspec-rails
|
||||
rspec-rebound
|
||||
rspectre
|
||||
rswag-api
|
||||
rswag-specs
|
||||
@@ -857,7 +833,7 @@ DEPENDENCIES
|
||||
xmlrpc
|
||||
|
||||
RUBY VERSION
|
||||
ruby 3.3.8p144
|
||||
ruby 3.3.7p123
|
||||
|
||||
BUNDLED WITH
|
||||
2.4.22
|
||||
|
||||
@@ -30,7 +30,3 @@
|
||||
@import "predictions";
|
||||
@import "homepage";
|
||||
@import "maps";
|
||||
|
||||
@view-transition {
|
||||
navigation: auto;
|
||||
}
|
||||
@@ -75,7 +75,6 @@ class CropsController < ApplicationController
|
||||
end
|
||||
|
||||
def show
|
||||
@problems = Problem.joins(plantings: :crop).where(crops: { id: @crop.id }).distinct
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
@posts = @crop.posts.order(created_at: :desc).paginate(page: params[:page])
|
||||
|
||||
@@ -107,7 +107,7 @@ class PlantingsController < DataController
|
||||
:crop_id, :description, :garden_id, :planted_at,
|
||||
:parent_seed_id,
|
||||
:quantity, :sunniness, :planted_from, :finished,
|
||||
:finished_at, :failed, problem_ids: []
|
||||
:finished_at
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ProblemsController < ApplicationController
|
||||
before_action :authenticate_member!, except: %i(index show)
|
||||
load_and_authorize_resource id_param: :slug, class: Problem
|
||||
respond_to :html, :json
|
||||
|
||||
def index
|
||||
@problems = Problem.approved.popular.paginate(page: params[:page])
|
||||
@num_requested_problems = requested_problems.size if current_member
|
||||
respond_with @problems
|
||||
end
|
||||
|
||||
def requested
|
||||
@requested = requested_problems.paginate(page: params[:page])
|
||||
respond_with @requested
|
||||
end
|
||||
|
||||
def show
|
||||
@problem = Problem.friendly.find(params[:id])
|
||||
@plantings = @problem.plantings.paginate(page: params[:page])
|
||||
respond_with @problem
|
||||
end
|
||||
|
||||
def new
|
||||
@problem = Problem.new
|
||||
respond_with @problem
|
||||
end
|
||||
|
||||
def edit; end
|
||||
|
||||
def create
|
||||
@problem = Problem.new(problem_params)
|
||||
if current_member.role? :problem_wrangler
|
||||
@problem.creator = current_member
|
||||
else
|
||||
@problem.requester = current_member
|
||||
@problem.approval_status = "pending"
|
||||
end
|
||||
@problem.save
|
||||
respond_with @problem
|
||||
end
|
||||
|
||||
def update
|
||||
if can?(:wrangle, @problem)
|
||||
@problem.approval_status = 'rejected' if params.fetch("reject", false)
|
||||
@problem.approval_status = 'approved' if params.fetch("approve", false)
|
||||
end
|
||||
@problem.update(problem_params)
|
||||
respond_with @problem
|
||||
end
|
||||
|
||||
def wrangle
|
||||
@approval_status = params[:approval_status]
|
||||
@problems = case @approval_status
|
||||
when "pending"
|
||||
Problem.pending_approval
|
||||
when "rejected"
|
||||
Problem.rejected
|
||||
else
|
||||
Problem.recent
|
||||
end.paginate(page: params[:page])
|
||||
@problem_wranglers = Role.problem_wranglers
|
||||
respond_with @problems
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def problem_params
|
||||
params.require(:problem).permit(:name, :reason_for_rejection, :rejection_notes)
|
||||
end
|
||||
|
||||
def requested_problems
|
||||
current_member.requested_problems.pending_approval
|
||||
end
|
||||
end
|
||||
@@ -19,10 +19,6 @@ 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
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ module ApplicationHelper
|
||||
# of HAML, Tilt, and dynamic compilation with interpolated ruby.
|
||||
def markdownify(text)
|
||||
translator = Haml::Filters::GrowstuffMarkdown.new
|
||||
translator.expand_members!(translator.expand_problems!(translator.expand_crops!(text.to_s)))
|
||||
translator.expand_members!(translator.expand_crops!(text.to_s))
|
||||
end
|
||||
|
||||
#
|
||||
|
||||
@@ -34,8 +34,6 @@ class Ability
|
||||
# are wranglers or admins
|
||||
cannot :read, Crop
|
||||
can :read, Crop, approval_status: "approved"
|
||||
cannot :read, Problem
|
||||
can :read, Problem, approval_status: "approved"
|
||||
# scientific names should only be viewable if associated crop is approved
|
||||
cannot :read, ScientificName
|
||||
can :read, ScientificName do |sn|
|
||||
@@ -58,8 +56,6 @@ class Ability
|
||||
# members can see even rejected or pending crops if they requested it
|
||||
can :read, Crop, requester_id: member.id
|
||||
can :requested, Crop # see list of crops they've requested
|
||||
can :read, Problem, requester_id: member.id
|
||||
can :requested, Problem
|
||||
|
||||
# managing your own user settings
|
||||
can :update, Member, id: member.id
|
||||
@@ -86,14 +82,8 @@ class Ability
|
||||
can :gbif, Crop
|
||||
end
|
||||
|
||||
if member.role? :problem_wrangler
|
||||
can :wrangle, Problem
|
||||
can :manage, Problem
|
||||
end
|
||||
|
||||
# any member can create a crop provisionally
|
||||
can :create, Crop
|
||||
can :create, Problem
|
||||
|
||||
# can create & destroy their own authentications against other sites.
|
||||
can :create, Authentication
|
||||
|
||||
@@ -17,7 +17,6 @@ class Crop < ApplicationRecord
|
||||
has_many :scientific_names, dependent: :delete_all
|
||||
has_many :alternate_names, dependent: :delete_all
|
||||
has_many :plantings, dependent: :destroy
|
||||
has_many :problems, through: :plantings
|
||||
has_many :seeds, dependent: :destroy
|
||||
has_many :harvests, dependent: :destroy
|
||||
has_many :photo_associations, dependent: :delete_all, inverse_of: :crop
|
||||
|
||||
@@ -42,10 +42,6 @@ class Member < ApplicationRecord
|
||||
inverse_of: :requester
|
||||
has_many :created_crops, class_name: 'Crop', foreign_key: 'creator_id', dependent: :nullify,
|
||||
inverse_of: :creator
|
||||
has_many :requested_problems, class_name: 'Problem', foreign_key: 'requester_id', dependent: :nullify,
|
||||
inverse_of: :requester
|
||||
has_many :created_problems, class_name: 'Problem', foreign_key: 'creator_id', dependent: :nullify,
|
||||
inverse_of: :creator
|
||||
has_many :created_alternate_names, class_name: 'AlternateName', foreign_key: 'creator_id', inverse_of: :creator
|
||||
has_many :created_scientific_names, class_name: 'ScientificName', foreign_key: 'creator_id', inverse_of: :creator
|
||||
|
||||
|
||||
@@ -24,8 +24,6 @@ class Planting < ApplicationRecord
|
||||
belongs_to :crop, counter_cache: true
|
||||
has_many :harvests, dependent: :destroy
|
||||
has_many :activities, dependent: :destroy
|
||||
has_many :planting_problems, dependent: :destroy
|
||||
has_many :problems, through: :planting_problems
|
||||
|
||||
#
|
||||
# Ancestry of food
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class PlantingProblem < ApplicationRecord
|
||||
include PhotoCapable
|
||||
|
||||
belongs_to :planting
|
||||
belongs_to :problem
|
||||
end
|
||||
@@ -13,14 +13,11 @@ class Post < ApplicationRecord
|
||||
has_many :comments, dependent: :destroy
|
||||
has_many :crop_posts, dependent: :delete_all
|
||||
has_many :crops, through: :crop_posts
|
||||
has_many :problem_posts, dependent: :delete_all
|
||||
has_many :problems, through: :problem_posts
|
||||
|
||||
after_create :send_notification
|
||||
#
|
||||
# Triggers
|
||||
after_save :update_crop_posts_association
|
||||
after_save :update_problem_posts_association
|
||||
|
||||
default_scope { joins(:author).merge(Member.kept) } # Ensures the owner still exists
|
||||
|
||||
@@ -78,17 +75,6 @@ class Post < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
def update_problem_posts_association
|
||||
problems.clear
|
||||
# look for problems mentioned in the post. eg. [aphids](problem)
|
||||
body.scan(Haml::Filters::GrowstuffMarkdown::PROBLEM_REGEX) do |_m|
|
||||
problem_name = Regexp.last_match(1)
|
||||
problem = Problem.case_insensitive_name(problem_name).first
|
||||
# create association
|
||||
problems << problem if problem && problems.exclude?(problem)
|
||||
end
|
||||
end
|
||||
|
||||
def send_notification
|
||||
recipients = []
|
||||
sender = author.id
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Problem < ApplicationRecord
|
||||
extend FriendlyId
|
||||
include PhotoCapable
|
||||
include SearchCrops # Note: This might need to be adapted to SearchProblems
|
||||
|
||||
friendly_id :name, use: %i(slugged finders)
|
||||
|
||||
##
|
||||
## Relationships
|
||||
belongs_to :creator, class_name: 'Member', optional: true, inverse_of: :created_problems
|
||||
belongs_to :requester, class_name: 'Member', optional: true, inverse_of: :requested_problems
|
||||
has_many :planting_problems, dependent: :delete_all
|
||||
has_many :plantings, through: :planting_problems
|
||||
has_many :problem_posts, dependent: :delete_all
|
||||
has_many :posts, through: :problem_posts, dependent: :delete_all
|
||||
|
||||
##
|
||||
## Scopes
|
||||
scope :recent, -> { approved.order(created_at: :desc) }
|
||||
scope :popular, -> { approved.order(Arel.sql("plantings_count desc, lower(name) asc")) }
|
||||
scope :pending_approval, -> { where(approval_status: "pending") }
|
||||
scope :approved, -> { where(approval_status: "approved") }
|
||||
scope :rejected, -> { where(approval_status: "rejected") }
|
||||
scope :interesting, -> { approved.has_photos }
|
||||
scope :has_photos, -> { includes(:photos).where.not(photos: { id: nil }) }
|
||||
|
||||
##
|
||||
## Validations
|
||||
validates :reason_for_rejection, presence: true, if: :rejected?
|
||||
validate :must_be_rejected_if_rejected_reasons_present
|
||||
validate :must_have_meaningful_reason_for_rejection
|
||||
validates :name, uniqueness: { scope: :approval_status }, if: :pending?
|
||||
|
||||
def to_s
|
||||
name
|
||||
end
|
||||
|
||||
def to_param
|
||||
slug
|
||||
end
|
||||
|
||||
def pending?
|
||||
approval_status == "pending"
|
||||
end
|
||||
|
||||
def approved?
|
||||
approval_status == "approved"
|
||||
end
|
||||
|
||||
def rejected?
|
||||
approval_status == "rejected"
|
||||
end
|
||||
|
||||
def approval_statuses
|
||||
%w(rejected pending approved)
|
||||
end
|
||||
|
||||
def reasons_for_rejection
|
||||
["already in database", "not a pest or disease", "not enough information", "other"]
|
||||
end
|
||||
|
||||
def rejection_explanation
|
||||
return rejection_notes if reason_for_rejection == "other"
|
||||
|
||||
reason_for_rejection
|
||||
end
|
||||
|
||||
def self.case_insensitive_name(name)
|
||||
where(["lower(problems.name) = :value", { value: name.downcase }])
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def must_be_rejected_if_rejected_reasons_present
|
||||
return if rejected?
|
||||
return unless reason_for_rejection.present? || rejection_notes.present?
|
||||
|
||||
errors.add(:approval_status, "must be rejected if a reason for rejection is present")
|
||||
end
|
||||
|
||||
def must_have_meaningful_reason_for_rejection
|
||||
return unless reason_for_rejection == "other" && rejection_notes.blank?
|
||||
|
||||
errors.add(:rejection_notes, "must be added if the reason for rejection is \"other\"")
|
||||
end
|
||||
end
|
||||
@@ -1,6 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ProblemPost < ApplicationRecord
|
||||
belongs_to :problem
|
||||
belongs_to :post
|
||||
end
|
||||
@@ -8,7 +8,7 @@ class Role < ApplicationRecord
|
||||
has_and_belongs_to_many :members
|
||||
|
||||
class << self
|
||||
%i(crop_wranglers admins problem_wranglers).each do |method|
|
||||
%i(crop_wranglers admins).each do |method|
|
||||
define_method method do
|
||||
slug = method.to_s.singularize.dasherize
|
||||
Role.where(slug:).try(:first).try(:members)
|
||||
|
||||
@@ -3,3 +3,4 @@
|
||||
There are
|
||||
= link_to "https://openfarm.cc/en/crops/#{CGI.escape @crop.name.gsub(' ', '-').downcase}" do
|
||||
#{crop.guides_count} growing guides on Open Farm
|
||||
|
||||
|
||||
@@ -30,15 +30,6 @@
|
||||
- @crop.companions.each do |companion|
|
||||
= render 'crops/tiny', crop: companion
|
||||
|
||||
- if @problems.any?
|
||||
%section.problems
|
||||
%h2 Problems
|
||||
- @problems.group_by(&:name).each do |problem_name, problems|
|
||||
- problem = problems.first
|
||||
= link_to problem_path(problem) do
|
||||
= problem_name
|
||||
%span.badge.badge-secondary= problems.size
|
||||
|
||||
%section.photos
|
||||
= cute_icon
|
||||
= render 'crops/photos', crop: @crop
|
||||
|
||||
@@ -5,3 +5,5 @@
|
||||
number_crops: link_to(t('.number_crops_linktext', count: Crop.count.to_i), crops_path),
|
||||
number_plantings: link_to(t('.number_plantings_linktext', count: Planting.count.to_i), plantings_path),
|
||||
number_gardens: link_to(t('.number_gardens_linktext', count: Garden.count.to_i), gardens_path))
|
||||
|
||||
|
||||
|
||||
@@ -51,8 +51,7 @@
|
||||
%section.seeds
|
||||
= cute_icon
|
||||
= render 'seeds'
|
||||
%p.text-right
|
||||
= link_to "#{t('home.seeds.view_all')} »", seeds_path(tradeable_to: ['locally', 'nationally', 'internationally']), class: 'btn btn-block'
|
||||
%p.text-right= link_to "#{t('home.seeds.view_all')} »", seeds_path, class: 'btn btn-block'
|
||||
.col-12.col-lg-6
|
||||
%section.discussion.text-center
|
||||
= cute_icon
|
||||
|
||||
@@ -47,11 +47,6 @@
|
||||
= f.number_field :quantity, label: 'How many?', min: 1
|
||||
= f.text_area :description, rows: 6, label: 'Tell us more about it'
|
||||
|
||||
= f.collection_check_boxes :problem_ids, Problem.approved.order(:name), :id, :name do |b|
|
||||
.form-check
|
||||
= b.check_box
|
||||
= b.label
|
||||
|
||||
.row
|
||||
.col-md-6
|
||||
= f.check_box :finished, label: 'Mark as finished'
|
||||
|
||||
@@ -51,23 +51,6 @@
|
||||
|
||||
.col-md-8.col-xs-12
|
||||
%section= render 'facts', planting: @planting
|
||||
|
||||
- if @planting.problems.any?
|
||||
%section.problems
|
||||
%h2 Problems
|
||||
- @planting.planting_problems.each do |planting_problem|
|
||||
.card
|
||||
.card-header
|
||||
%h3= planting_problem.problem.name
|
||||
.card-body
|
||||
- if planting_problem.photos.any?
|
||||
.row
|
||||
- planting_problem.photos.each do |photo|
|
||||
.col-md-4
|
||||
= image_tag photo.thumbnail_url, class: 'img-fluid'
|
||||
- else
|
||||
%p No photos of this problem for this planting yet.
|
||||
|
||||
- if @planting.description.present?
|
||||
= cute_icon
|
||||
.card
|
||||
|
||||
@@ -9,3 +9,4 @@
|
||||
|
||||
- else
|
||||
%h2 There are no comments yet
|
||||
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
= bootstrap_form_for(@problem) do |f|
|
||||
- if @problem.errors.any?
|
||||
#error_explanation.alert.alert-warning{role: "alert"}
|
||||
%h3
|
||||
= pluralize(@problem.errors.size, "error")
|
||||
prohibited this problem from being saved:
|
||||
%ul
|
||||
- @problem.errors.full_messages.each do |msg|
|
||||
%li= msg
|
||||
|
||||
.card.col-12.col-md-8.mx-auto.float-none.white
|
||||
.card-header
|
||||
- if content_for? :title
|
||||
%h1.h2-responsive.text-center
|
||||
%strong=yield :title
|
||||
.card-body
|
||||
- if can? :wrangle, @problem
|
||||
%p
|
||||
%span.help-block
|
||||
As a problem wrangler, you can approve or reject problem suggestions.
|
||||
|
||||
%h2 Basic information
|
||||
|
||||
.form-group#new_problem
|
||||
= f.text_field :name, required: true
|
||||
%span.help-block
|
||||
The common name for the problem, in English (required).
|
||||
- if can? :wrangle, @problem
|
||||
Wranglers: please ensure this is singular, and capitalize
|
||||
proper nouns only.
|
||||
|
||||
- if (can?(:wrangle, @problem) && @problem.requester) || (cannot?(:wrangle, @problem) && @problem.new_record?)
|
||||
%h2 Problem request notes
|
||||
= f.text_area :request_notes, rows: 3, id: 'request_notes', label: 'Comments'
|
||||
|
||||
- unless can? :wrangle, @problem
|
||||
%p
|
||||
When you submit this form, your suggestion will be sent to our team of
|
||||
volunteer problem wranglers for review. We'll let you know the outcome as soon as we can.
|
||||
|
||||
- if can?(:wrangle, @problem) && @problem.requester
|
||||
= f.select(:reason_for_rejection, @problem.reasons_for_rejection, include_blank: true)
|
||||
|
||||
= f.text_area :rejection_notes, rows: 3
|
||||
%span.help-block
|
||||
Please provide additional notes why this problem request was rejected if the above reasons do not apply.
|
||||
|
||||
.card-footer
|
||||
.text-right
|
||||
- if @problem.approved?
|
||||
= f.submit 'Save'
|
||||
- else
|
||||
= f.submit 'Reject', class: 'btn btn-danger', name: 'reject'
|
||||
= f.submit 'Approve and save', class: 'btn btn-success', name: 'approve'
|
||||
@@ -1,10 +0,0 @@
|
||||
- cache problem do
|
||||
.card.problem-thumbnail
|
||||
= link_to problem_path(id: problem.slug) do
|
||||
= image_tag(problem.thumbnail_url.presence || placeholder_image,
|
||||
alt: "Image of #{problem.name}",
|
||||
class: 'img img-card')
|
||||
|
||||
|
||||
.text
|
||||
%h3.problem-name= link_to problem.name, problem_path(id: problem.slug)
|
||||
@@ -1,30 +0,0 @@
|
||||
- content_for :title, "Edit problem: #{@problem.name}"
|
||||
|
||||
- if @problem.approval_status == "approved"
|
||||
- if @problem.requester
|
||||
%p
|
||||
Requested by #{link_to @problem.requester, @problem.requester}
|
||||
#{distance_of_time_in_words(@problem.created_at, Time.zone.now)} ago.
|
||||
%p
|
||||
Approved by #{link_to @problem.creator, @problem.creator}.
|
||||
- else
|
||||
%p
|
||||
Added by
|
||||
= link_to @problem.creator, @problem.creator
|
||||
#{distance_of_time_in_words(@problem.created_at, Time.zone.now)} ago.
|
||||
- elsif @problem.approval_status == "pending"
|
||||
.alert.alert-danger
|
||||
%p
|
||||
Requested by #{link_to @problem.requester, @problem.requester}
|
||||
#{distance_of_time_in_words(@problem.created_at, Time.zone.now)} ago.
|
||||
%p
|
||||
Status: #{@problem.approval_status}.
|
||||
- elsif @problem.approval_status == "rejected"
|
||||
.alert.alert-danger
|
||||
%p
|
||||
Requested by #{link_to @problem.requester, @problem.requester}
|
||||
#{distance_of_time_in_words(@problem.created_at, Time.zone.now)} ago.
|
||||
%p
|
||||
Status: #{@problem.approval_status} by #{link_to @problem.creator, @problem.creator}.
|
||||
|
||||
= render 'form'
|
||||
@@ -1,13 +0,0 @@
|
||||
- content_for :title, t('.title')
|
||||
|
||||
- content_for :breadcrumbs do
|
||||
%li.breadcrumb-item.active= link_to 'Problems', problems_path
|
||||
|
||||
%section.problems
|
||||
%h2= t('.title')
|
||||
= will_paginate @problems
|
||||
.index-cards
|
||||
- @problems.each do |p|
|
||||
= render 'problems/thumbnail', problem: p
|
||||
|
||||
= will_paginate @problems
|
||||
@@ -1,15 +0,0 @@
|
||||
- content_for :title, (can?(:wrangle, @problem) ? "New problem" : "Suggest a problem")
|
||||
|
||||
- unless can? :wrangle, @problem
|
||||
%p
|
||||
Thanks for taking the time to suggest a problem! Our problem database is
|
||||
managed by volunteers, and we appreciate your help. Here are some
|
||||
things to consider when suggesting a new problem:
|
||||
%ul
|
||||
%li
|
||||
First, you might want to search our problems
|
||||
to make sure we don't have it already, perhaps under an alternate name.
|
||||
%li
|
||||
The Growstuff database only contains problems related to growing edible plants.
|
||||
|
||||
= render 'form'
|
||||
@@ -1,26 +0,0 @@
|
||||
- content_for :title, @problem.name
|
||||
|
||||
- content_for :breadcrumbs do
|
||||
%li.breadcrumb-item= link_to 'Problems', problems_path
|
||||
%li.breadcrumb-item.active= link_to @problem.name.capitalize, @problem
|
||||
|
||||
.jumbotron
|
||||
%h1= @problem.name
|
||||
|
||||
.row
|
||||
.col-md-9
|
||||
%section.plantings
|
||||
%h2 Plantings with this problem
|
||||
= will_paginate @plantings
|
||||
.index-cards
|
||||
- @plantings.each do |p|
|
||||
= render 'plantings/thumbnail', planting: p
|
||||
= will_paginate @plantings
|
||||
.col-md-3
|
||||
.card
|
||||
.card-body
|
||||
%h4.card-title= @problem.name
|
||||
%p.card-text
|
||||
This problem has been reported on
|
||||
= pluralize(@problem.plantings.count, 'planting')
|
||||
so far.
|
||||
@@ -1,51 +0,0 @@
|
||||
- content_for :title, "Problem Wrangling"
|
||||
|
||||
%h1 Problem Wrangling
|
||||
|
||||
%nav.nav
|
||||
= link_to "Add Problem", new_problem_path, class: 'btn'
|
||||
|
||||
%section.problem_wranglers
|
||||
%h2 Problem Wranglers
|
||||
- @problem_wranglers.each do |problem_wrangler|
|
||||
= render 'members/tiny', member: problem_wrangler
|
||||
|
||||
%hr/
|
||||
|
||||
%section
|
||||
%h2 Problems
|
||||
|
||||
%ul#myTab.nav.nav-tabs{role: "tablist"}
|
||||
%li.nav-item
|
||||
%a#home-tab.nav-link{ href: wrangle_problems_path, role: "tab", class: @approval_status.blank? ? 'active' : ''}
|
||||
Recently added
|
||||
%li.nav-item
|
||||
%a#profile-tab.nav-link{ href: wrangle_problems_path(approval_status: "pending"), role: "tab", class: @approval_status == "pending" ? 'active' : ''}
|
||||
Pending approval
|
||||
%li.nav-item
|
||||
%a#contact-tab.nav-link{ href: wrangle_problems_path(approval_status: "rejected"), role: "tab", class: @approval_status == "rejected" ? 'active' : ''} Rejected
|
||||
|
||||
%table.table.table-striped.table-bordered.table-sm{id: @approval_status.blank? ? 'recently-added-problems' : "#{@approval_status}-problems" }
|
||||
%tr
|
||||
%th Name
|
||||
%th Requested by
|
||||
- if @approval_status == "rejected"
|
||||
%th Rejected by
|
||||
- if @approval_status != "rejected" && @approval_status != "pending"
|
||||
%th Added by
|
||||
%th When
|
||||
- @problems.each do |p|
|
||||
%tr
|
||||
%td
|
||||
= link_to edit_problem_path(p) do
|
||||
= icon 'fas', 'bug'
|
||||
= p.name
|
||||
%td= p.requester.present? ? (link_to p.requester, p.requester) : "N/A"
|
||||
- unless @approval_status == "pending"
|
||||
%td= p.creator.present? ? (link_to p.creator, p.creator) : "N/A"
|
||||
%td
|
||||
= distance_of_time_in_words(p.created_at, Time.zone.now)
|
||||
ago.
|
||||
|
||||
= page_entries_info @problems
|
||||
= will_paginate @problems
|
||||
@@ -17,14 +17,6 @@
|
||||
= 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 = "Growstuff <#{ENV.fetch('GROWSTUFF_EMAIL', "no-reply@growstuff.org")}>"
|
||||
config.default_from = "no-reply@growstuff.org"
|
||||
|
||||
# Configures the methods needed by mailboxer
|
||||
# config.email_method = :email
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
en:
|
||||
mailboxer:
|
||||
message_mailer:
|
||||
subject_new: "New Notification: %{subject}"
|
||||
subject_reply: "New Reply: %{subject}"
|
||||
notification_mailer:
|
||||
subject: "New notification: %{subject}"
|
||||
@@ -89,13 +89,6 @@ Rails.application.routes.draw do
|
||||
end
|
||||
end
|
||||
|
||||
resources :problems, param: :slug do
|
||||
collection do
|
||||
get 'requested'
|
||||
get 'wrangle'
|
||||
end
|
||||
end
|
||||
|
||||
resources :comments
|
||||
resources :forums
|
||||
|
||||
|
||||
22
crowdin.yml
22
crowdin.yml
@@ -1,22 +0,0 @@
|
||||
# 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'
|
||||
@@ -4,7 +4,6 @@
|
||||
class Haml::Filters
|
||||
class GrowstuffMarkdown
|
||||
CROP_REGEX = /(?<!\\)\[([^\[\]]+?)\]\(crop\)/
|
||||
PROBLEM_REGEX = /(?<!\\)\[([^\[\]]+?)\]\(problem\)/
|
||||
MEMBER_REGEX = /(?<!\\)\[([^\[\]]+?)\]\(member\)/
|
||||
MEMBER_AT_REGEX = /(?<!\\)(@\w+)/
|
||||
MEMBER_ESCAPE_AT_REGEX = /(?<!\\)\\(?=@\w+)/
|
||||
@@ -43,25 +42,6 @@ class Haml::Filters
|
||||
end
|
||||
end
|
||||
|
||||
def expand_problems!(text)
|
||||
# turn [aphids](problem) into [aphids](http://growstuff.org/problems/aphids)
|
||||
text.gsub(PROBLEM_REGEX) do
|
||||
problem_str = Regexp.last_match(1)
|
||||
# find problem case-insensitively
|
||||
problem = Problem.where('lower(name) = ?', problem_str.downcase).first
|
||||
problem_link problem, problem_str
|
||||
end
|
||||
end
|
||||
|
||||
def problem_link(problem, link_text)
|
||||
if problem
|
||||
url = Rails.application.routes.url_helpers.problem_url(problem, only_path: true)
|
||||
"[#{link_text}](#{url})"
|
||||
else
|
||||
link_text
|
||||
end
|
||||
end
|
||||
|
||||
def crop_link(crop, link_text)
|
||||
if crop
|
||||
url = Rails.application.routes.url_helpers.crop_url(crop, only_path: true)
|
||||
|
||||
@@ -8,18 +8,4 @@ namespace :openfarm do
|
||||
Rails.logger = Logger.new(STDOUT)
|
||||
OpenfarmService.new.import!
|
||||
end
|
||||
|
||||
desc "Delete all pictures with source OpenFarm"
|
||||
task delete_pictures: :environment do
|
||||
puts "Deleting pictures with source OpenFarm..."
|
||||
photos_to_delete = Photo.where(source: 'openfarm')
|
||||
count = photos_to_delete.count
|
||||
photos_to_delete.each do |photo|
|
||||
photo.associations.each do |photo_association|
|
||||
photo_association.delete
|
||||
end
|
||||
photo.delete
|
||||
end
|
||||
puts "Deleted #{count} pictures."
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
|
||||
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
||||
ENV["RAILS_ENV"] ||= 'test'
|
||||
require 'simplecov'
|
||||
|
||||
# output coverage locally AND send it to coveralls
|
||||
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([SimpleCov::Formatter::HTMLFormatter])
|
||||
|
||||
require 'spec_helper'
|
||||
require File.expand_path('../config/environment', __dir__)
|
||||
require 'rspec/rails'
|
||||
@@ -15,13 +20,13 @@ require 'capybara-screenshot/rspec'
|
||||
require 'axe-capybara'
|
||||
require 'axe-rspec'
|
||||
|
||||
# TODO: We may want to trial options.add_argument('--disable-dev-shm-usage') ### optional
|
||||
|
||||
# Required for running in the dev container
|
||||
Capybara.register_driver :selenium_chrome_customised_headless do |app|
|
||||
options = Selenium::WebDriver::Options.chrome
|
||||
options.add_argument("--headless")
|
||||
options.add_argument("--no-sandbox")
|
||||
options.add_argument("--window-size=1920,1080")
|
||||
options.add_argument("--disable-dev-shm-usage")
|
||||
|
||||
# driver = Selenium::WebDriver.for :chrome, options: options
|
||||
|
||||
@@ -120,8 +125,8 @@ RSpec.configure do |config|
|
||||
# Prevent Poltergeist from fetching external URLs during feature tests
|
||||
config.before(:each, :js) do
|
||||
# TODO: Why are we setting this page size then straight afterwards, maximising?
|
||||
width = 1920
|
||||
height = 1080
|
||||
width = 1280
|
||||
height = 1280
|
||||
Capybara.current_session.driver.browser.manage.window.resize_to(width, height)
|
||||
|
||||
if page.driver.browser.respond_to?(:url_blacklist)
|
||||
@@ -132,9 +137,6 @@ RSpec.configure do |config|
|
||||
]
|
||||
end
|
||||
|
||||
# Historically, we wanted to .maximize; but this actually undoes the resize_to step above
|
||||
# with chrome headless
|
||||
# page.driver.browser.manage.window.maximize if page.driver.browser.respond_to?(:manage)
|
||||
# puts "Maximized window size: #{page.driver.browser.manage.window.size}"
|
||||
page.driver.browser.manage.window.maximize if page.driver.browser.respond_to?(:manage)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#
|
||||
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
||||
require 'percy/capybara'
|
||||
require 'rspec/rebound'
|
||||
require 'vcr'
|
||||
|
||||
VCR.configure do |c|
|
||||
@@ -27,6 +26,8 @@ VCR.configure do |c|
|
||||
c.configure_rspec_metadata!
|
||||
end
|
||||
|
||||
SimpleCov.start
|
||||
|
||||
RSpec.configure do |config|
|
||||
# rspec-expectations config goes here. You can use an alternate
|
||||
# assertion/expectation library such as wrong or the stdlib/minitest
|
||||
@@ -124,20 +125,4 @@ RSpec.configure do |config|
|
||||
|
||||
# Remember which tests failed, so you can run rspec with the `--only-failures` flag.
|
||||
config.example_status_persistence_file_path = "tmp/examples.txt"
|
||||
|
||||
# show retry status in spec process
|
||||
config.verbose_retry = true
|
||||
# show exception that triggers a retry if verbose_retry is set to true
|
||||
config.display_try_failure_messages = true
|
||||
|
||||
# run retry only on features
|
||||
config.around :each, :js do |ex|
|
||||
ex.run_with_retry retry: 3
|
||||
end
|
||||
|
||||
# callback to be run between retries
|
||||
config.retry_callback = proc do |ex|
|
||||
# run some additional clean up task - can be filtered by example metadata
|
||||
Capybara.reset! if ex.metadata[:js]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
require 'rake'
|
||||
|
||||
describe 'openfarm:delete_pictures' do
|
||||
before(:all) do
|
||||
Rails.application.load_tasks
|
||||
end
|
||||
|
||||
# We need to do this because Rake tasks normally output to STDOUT, but we
|
||||
# don't want to clutter up the test output.
|
||||
before(:each) do
|
||||
$stdout = StringIO.new
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
$stdout = STDOUT
|
||||
end
|
||||
|
||||
it 'deletes pictures with source OpenFarm' do
|
||||
create(:photo, source: 'OpenFarm')
|
||||
create(:photo, source: 'flickr')
|
||||
|
||||
expect(Photo.where(source: 'OpenFarm').count).to eq(1)
|
||||
expect(Photo.where(source: 'flickr').count).to eq(1)
|
||||
|
||||
Rake::Task['openfarm:delete_pictures'].invoke
|
||||
|
||||
expect(Photo.where(source: 'OpenFarm').count).to eq(0)
|
||||
expect(Photo.where(source: 'flickr').count).to eq(1)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user