Compare commits

..

10 Commits

Author SHA1 Message Date
Cesy
b3b664b06c Rename for CodeFactor: member_routing_spec.rb to members_controller_routing_spec.rb 2023-12-21 09:30:20 +00:00
Cesy
c04dbd4599 Rename for CodeFactor: follows_routing_spec.rb to follows_controller_routing_spec.rb 2023-12-21 09:29:04 +00:00
Cesy
76da9edc23 Rename for CodeFactor: updates_routing_spec.rb to posts_controller_updates_routing_spec.rb
For codefactor
2023-12-21 09:27:50 +00:00
Cesy
f8ee706023 Rename harvests_routing_spec.rb to harvests_controller_routing_spec.rb
Making codeclimate happier
2023-12-21 09:25:30 +00:00
Cesy
8f5fd12863 Merge branch 'dev' into rubocop-fixes 2023-12-21 09:20:55 +00:00
Daniel O'Connor
65af9c88b1 Merge branch 'dev' into rubocop-fixes 2023-12-13 21:18:42 +10:30
Daniel O'Connor
a3e6edde7c Rubocop 2023-09-16 07:58:26 +00:00
Daniel O'Connor
dcfb088638 Rubocop 2023-09-16 07:57:09 +00:00
Daniel O'Connor
bf0f6c7579 Rubcop 2023-09-16 07:55:57 +00:00
Daniel O'Connor
73566832b9 Fix todo 2023-09-16 07:54:44 +00:00
248 changed files with 1070 additions and 3232 deletions

View File

@@ -1,7 +1,7 @@
FROM mcr.microsoft.com/devcontainers/ruby:0-3.1-bullseye
# Install Rails
RUN gem install rails:7.0.8
RUN gem install rails:7.0.7 webdrivers:5.2.0
# Default value to allow debug server to serve content over GitHub Codespace's port forwarding service
# The value is a comma-separated list of allowed domains
@@ -12,12 +12,8 @@ ENV RAILS_DEVELOPMENT_HOSTS=".githubpreview.dev,.preview.app.github.dev,.app.git
#RUN bundle exec rake db:migrate
# [Optional] Uncomment this section to install additional OS packages.
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends bash-completion
# Chrome for testing packages. https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#chrome-doesnt-launch-on-linux
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends ca-certificates fonts-liberation libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release wget xdg-utils
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>
# [Optional] Uncomment this line to install additional gems.
# RUN gem install <your-gem-names-here>

View File

@@ -14,24 +14,16 @@
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// This can be used to network with other containers or the host.
"forwardPorts": [3000, 5432, 9200, 8081],
"forwardPorts": [3000, 5432, 9200],
// Use 'postCreateCommand' to run commands after the container is created.
// these don't actually work as postCreateCommands, you need to run them manually
// for some unknown reason, Github codespaces use rbenv and rvm simultaneously
// and you need both to be correct for it to work
"postCreateCommand": "nice -n 19 bundle install && nice -n 19 bundle exec rake db:create && nice -n 19 bundle exec rake db:migrate && nice -n19 bundle exec rake db:seed",
"postCreateCommand": "nice -n 19 bundle install && nice -n 19 bundle exec rake db:create && nice -n 19 bundle exec rake db:migrate && nice -n19 bundle exec rake db:seed"
// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": [
"karunamurti.haml",
"redhat.vscode-yaml",
"CraigMaslowski.erb"
]
}
}
// "customizations": {},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"

View File

@@ -76,7 +76,7 @@ jobs:
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Setup yarn cache
uses: actions/cache@v4
uses: actions/cache@v3
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 }}

View File

@@ -7,7 +7,7 @@ AllCops:
Exclude:
- 'db/schema.rb'
- 'vendor/**/*'
TargetRailsVersion: 7.0
TargetRailsVersion: 6.0
Rails:
Enabled: true

View File

@@ -93,11 +93,9 @@ submit the change with your pull request.
- Martina Simicic / [simicic](https://github.com/simicic)
- Rowan Crawford / [wombleton](https://github.com/wombleton)
- Ítalo Pires / [italopires](https://github.com/italopires)
- Bennett Zink / [bennett-zink](https://github.com/bennett-zink)
## 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)

28
Gemfile
View File

@@ -5,7 +5,7 @@ source 'https://rubygems.org'
# Match ruby version in .ruby-version
ruby File.read('.ruby-version')
gem 'rails', '~> 7.1.0'
gem 'rails', '~> 7.0.7'
# Keeping old sprockets
# https://github.com/rails/sprockets-rails/issues/444#issuecomment-637817050
@@ -24,7 +24,7 @@ gem 'rswag-api'
gem 'rswag-ui'
# CSS framework
gem "bootstrap", ">= 5.0.0"
gem "bootstrap", ">= 4.6.2"
gem 'material-sass', '4.1.1'
# Icons used by bootstrap/material-sass
@@ -33,18 +33,18 @@ gem 'material_icons'
# icons
gem 'font-awesome-sass'
gem 'terser'
gem 'uglifier' # JavaScript compressor
gem 'oj' # Speeds up json
# planting and harvest predictions
# based on median values for the crop
gem 'active_median'
gem 'active_median', '0.2.0'
gem 'active_record_union'
gem 'flickraw'
gem 'jquery-rails'
gem 'jquery-ui-rails', github: 'jquery-ui-rails/jquery-ui-rails', tag: 'v7.0.0' # See https://github.com/jquery-ui-rails/jquery-ui-rails/issues/146
gem 'jquery-ui-rails'
gem 'cancancan' # for checking member privileges
gem 'csv_shaper' # CSV export
@@ -100,7 +100,7 @@ gem 'omniauth-twitter'
gem "chartkick"
# clever elastic search
gem 'elasticsearch', '~> 7.0.0'
gem 'elasticsearch', '< 7.0.0'
gem 'searchkick'
gem "hashie", ">= 3.5.3"
@@ -124,19 +124,10 @@ gem 'rack-protection', '>= 2.0.1'
gem 'mailboxer', '>= 0.15.1'
gem 'faraday'
gem 'faraday_middleware'
gem 'rack-cors'
gem 'icalendar'
# for signups as requested by email service
gem 'recaptcha'
# External APIs for data
gem "gbifrb"
gem "msgpack"
group :production do
gem 'bonsai-elasticsearch-rails' # Integration with Bonsa-Elasticsearch on heroku
gem 'dalli'
@@ -162,7 +153,6 @@ group :development, :test do
gem 'factory_bot_rails' # for creating test data
gem 'faker'
gem 'haml-rails' # HTML templating language
gem 'pry'
gem 'query_diet'
gem 'rspec-activemodel-mocks'
gem 'rspec-rails' # unit testing framework
@@ -182,13 +172,11 @@ group :development, :test do
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 'webdrivers'
end
group :travis do

View File

@@ -1,11 +1,3 @@
GIT
remote: https://github.com/jquery-ui-rails/jquery-ui-rails.git
revision: 413265e81f790f795239e07e7e25e01429b2f18d
tag: v7.0.0
specs:
jquery-ui-rails (7.0.0)
railties (>= 3.2.16)
GIT
remote: https://github.com/restarone/comfortable-mexican-sofa.git
revision: ccf9415ae220453a199759b8ecbb8e9436c75c85
@@ -33,110 +25,86 @@ GEM
GEM
remote: https://rubygems.org/
specs:
actioncable (7.1.3.2)
actionpack (= 7.1.3.2)
activesupport (= 7.1.3.2)
actioncable (7.0.8)
actionpack (= 7.0.8)
activesupport (= 7.0.8)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
zeitwerk (~> 2.6)
actionmailbox (7.1.3.2)
actionpack (= 7.1.3.2)
activejob (= 7.1.3.2)
activerecord (= 7.1.3.2)
activestorage (= 7.1.3.2)
activesupport (= 7.1.3.2)
actionmailbox (7.0.8)
actionpack (= 7.0.8)
activejob (= 7.0.8)
activerecord (= 7.0.8)
activestorage (= 7.0.8)
activesupport (= 7.0.8)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.1.3.2)
actionpack (= 7.1.3.2)
actionview (= 7.1.3.2)
activejob (= 7.1.3.2)
activesupport (= 7.1.3.2)
actionmailer (7.0.8)
actionpack (= 7.0.8)
actionview (= 7.0.8)
activejob (= 7.0.8)
activesupport (= 7.0.8)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.2)
actionpack (7.1.3.2)
actionview (= 7.1.3.2)
activesupport (= 7.1.3.2)
nokogiri (>= 1.8.5)
racc
rack (>= 2.2.4)
rack-session (>= 1.0.1)
rails-dom-testing (~> 2.0)
actionpack (7.0.8)
actionview (= 7.0.8)
activesupport (= 7.0.8)
rack (~> 2.0, >= 2.2.4)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
actiontext (7.1.3.2)
actionpack (= 7.1.3.2)
activerecord (= 7.1.3.2)
activestorage (= 7.1.3.2)
activesupport (= 7.1.3.2)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (7.0.8)
actionpack (= 7.0.8)
activerecord (= 7.0.8)
activestorage (= 7.0.8)
activesupport (= 7.0.8)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.1.3.2)
activesupport (= 7.1.3.2)
actionview (7.0.8)
activesupport (= 7.0.8)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
active_link_to (1.0.5)
actionpack
addressable
active_median (0.4.1)
activesupport (>= 6.1)
active_median (0.2.0)
activerecord (>= 4.2)
active_record_union (1.3.0)
activerecord (>= 4.0)
active_utils (3.4.1)
activesupport (>= 4.2)
i18n
activejob (7.1.3.2)
activesupport (= 7.1.3.2)
activejob (7.0.8)
activesupport (= 7.0.8)
globalid (>= 0.3.6)
activemodel (7.1.3.2)
activesupport (= 7.1.3.2)
activerecord (7.1.3.2)
activemodel (= 7.1.3.2)
activesupport (= 7.1.3.2)
timeout (>= 0.4.0)
activestorage (7.1.3.2)
actionpack (= 7.1.3.2)
activejob (= 7.1.3.2)
activerecord (= 7.1.3.2)
activesupport (= 7.1.3.2)
activemodel (7.0.8)
activesupport (= 7.0.8)
activerecord (7.0.8)
activemodel (= 7.0.8)
activesupport (= 7.0.8)
activestorage (7.0.8)
actionpack (= 7.0.8)
activejob (= 7.0.8)
activerecord (= 7.0.8)
activesupport (= 7.0.8)
marcel (~> 1.0)
activesupport (7.1.3.2)
base64
bigdecimal
mini_mime (>= 1.1.0)
activesupport (7.0.8)
concurrent-ruby (~> 1.0, >= 1.0.2)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
ast (2.4.2)
autoprefixer-rails (10.4.16.0)
autoprefixer-rails (10.4.7.0)
execjs (~> 2)
axe-core-api (4.9.0)
dumb_delegator
virtus
axe-core-capybara (4.9.0)
axe-core-api
dumb_delegator
axe-core-rspec (4.9.0)
axe-core-api
dumb_delegator
virtus
axiom-types (0.1.1)
descendants_tracker (~> 0.0.4)
ice_nine (~> 0.11.0)
thread_safe (~> 0.3, >= 0.3.1)
base64 (0.2.0)
bcrypt (3.1.19)
better_errors (2.10.1)
erubi (>= 1.0.0)
@@ -149,30 +117,31 @@ GEM
erubi (~> 1.4)
parser (>= 2.4)
smart_properties
bigdecimal (3.1.7)
bigdecimal (3.1.4)
bluecloth (2.2.0)
bonsai-elasticsearch-rails (7.0.1)
elasticsearch-model (< 8)
elasticsearch-rails (< 8)
bootstrap (5.3.2)
bootstrap (4.6.2)
autoprefixer-rails (>= 9.1.0)
popper_js (>= 2.11.8, < 3)
popper_js (>= 1.16.1, < 2)
sassc-rails (>= 2.0.0)
bootstrap-datepicker-rails (1.9.0.1)
railties (>= 3.0)
bootstrap_form (5.4.0)
actionpack (>= 6.1)
activemodel (>= 6.1)
bootstrap_form (4.5.0)
actionpack (>= 5.2)
activemodel (>= 5.2)
builder (3.2.4)
bullet (7.1.6)
bullet (7.1.4)
activesupport (>= 3.0.0)
uniform_notifier (~> 1.11)
byebug (11.1.3)
cancancan (3.5.0)
capybara (3.40.0)
capybara (3.39.2)
addressable
matrix
mini_mime (>= 0.1.3)
nokogiri (~> 1.11)
nokogiri (~> 1.8)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
regexp_parser (>= 1.5, < 3.0)
@@ -183,20 +152,16 @@ GEM
capybara-screenshot (1.0.26)
capybara (>= 1.0, < 4)
launchy
carrierwave (3.0.7)
carrierwave (3.0.5)
activemodel (>= 6.0.0)
activesupport (>= 6.0.0)
addressable (~> 2.6)
image_processing (~> 1.1)
marcel (~> 1.0.0)
ssrf_filter (~> 1.0)
chartkick (5.0.6)
childprocess (5.0.0)
chartkick (5.0.5)
codeclimate-test-reporter (1.0.9)
simplecov (<= 0.13)
coderay (1.1.3)
coercible (1.0.0)
descendants_tracker (~> 0.0.1)
coffee-rails (5.0.0)
coffee-script (>= 2.2.0)
railties (>= 5.2.0)
@@ -206,72 +171,88 @@ GEM
coffee-script-source (1.12.2)
comfy_bootstrap_form (4.0.9)
rails (>= 5.0.0)
concurrent-ruby (1.2.3)
concurrent-ruby (1.2.2)
connection_pool (2.4.1)
crass (1.0.6)
csv_shaper (1.3.2)
activesupport (>= 3.0.0)
dalli (3.2.8)
dalli (3.2.6)
database_cleaner (2.0.2)
database_cleaner-active_record (>= 2, < 3)
database_cleaner-active_record (2.1.0)
activerecord (>= 5.a)
database_cleaner-core (~> 2.0.0)
database_cleaner-core (2.0.1)
date (3.3.4)
descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1)
date (3.3.3)
devise (4.9.3)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0)
responders
warden (~> 1.2.3)
diff-lcs (1.5.1)
diff-lcs (1.5.0)
discard (1.3.0)
activerecord (>= 4.2, < 8)
docile (1.1.5)
dotenv (3.1.0)
dotenv-rails (3.1.0)
dotenv (= 3.1.0)
railties (>= 6.1)
drb (2.2.1)
dumb_delegator (1.0.0)
elasticsearch (7.0.0)
elasticsearch-api (= 7.0.0)
elasticsearch-transport (= 7.0.0)
elasticsearch-api (7.0.0)
dotenv (2.8.1)
dotenv-rails (2.8.1)
dotenv (= 2.8.1)
railties (>= 3.2)
elasticsearch (6.8.3)
elasticsearch-api (= 6.8.3)
elasticsearch-transport (= 6.8.3)
elasticsearch-api (6.8.3)
multi_json
elasticsearch-model (7.1.1)
activesupport (> 3)
elasticsearch (> 1)
hashie
elasticsearch-rails (7.1.0)
elasticsearch-transport (7.0.0)
faraday
elasticsearch-transport (6.8.3)
faraday (~> 1)
multi_json
erubi (1.12.0)
erubis (2.7.0)
excon (0.109.0)
execjs (2.9.1)
factory_bot (6.4.5)
excon (0.93.1)
execjs (2.8.1)
factory_bot (6.4.2)
activesupport (>= 5.0.0)
factory_bot_rails (6.4.3)
factory_bot_rails (6.4.2)
factory_bot (~> 6.4)
railties (>= 5.0.0)
faker (3.3.1)
faker (3.2.2)
i18n (>= 1.8.11, < 2)
faraday (2.9.0)
faraday-net_http (>= 2.0, < 3.2)
faraday-net_http (3.1.0)
net-http
faraday (1.10.3)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
faraday-httpclient (~> 1.0)
faraday-multipart (~> 1.0)
faraday-net_http (~> 1.0)
faraday-net_http_persistent (~> 1.0)
faraday-patron (~> 1.0)
faraday-rack (~> 1.0)
faraday-retry (~> 1.0)
ruby2_keywords (>= 0.0.4)
faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-httpclient (1.0.1)
faraday-multipart (1.0.4)
multipart-post (~> 2)
faraday-net_http (1.0.1)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
faraday-rack (1.0.0)
faraday-retry (1.0.3)
faraday_middleware (1.2.0)
faraday (~> 1.0)
ffi (1.16.3)
flickraw (0.9.10)
font-awesome-sass (5.15.1)
sassc (>= 1.11)
friendly_id (5.5.1)
activerecord (>= 4.0.0)
gbifrb (0.2.0)
geocoder (1.8.2)
gibbon (1.2.1)
httparty
@@ -281,9 +262,8 @@ GEM
gravatar-ultimate (2.0.0)
activesupport (>= 2.3.14)
rack
haml (6.3.0)
temple (>= 0.8.2)
thor
haml (5.2.2)
temple (>= 0.8.0)
tilt
haml-i18n-extractor (0.5.9)
activesupport
@@ -296,8 +276,8 @@ GEM
activesupport (>= 5.1)
haml (>= 4.0.6)
railties (>= 5.1)
haml_lint (0.57.0)
haml (>= 5.0)
haml_lint (0.52.0)
haml (>= 4.0)
parallel (~> 1.10)
rainbow
rubocop (>= 1.0)
@@ -313,7 +293,7 @@ GEM
httparty (0.21.0)
mini_mime (>= 1.0.0)
multi_xml (>= 0.5.2)
i18n (1.14.4)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
i18n-tasks (1.0.13)
activesupport (>= 4.0.2)
@@ -326,22 +306,16 @@ GEM
rails-i18n
rainbow (>= 2.2.2, < 4.0)
terminal-table (>= 1.5.1)
icalendar (2.10.1)
ice_cube (~> 0.16)
ice_cube (0.16.4)
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.7.2)
irb (1.12.0)
rdoc
reline (>= 0.4.2)
jquery-rails (4.6.0)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (2.7.2)
jquery-ui-rails (6.0.1)
railties (>= 3.2.16)
json (2.7.1)
json-schema (4.1.1)
addressable (>= 2.8)
jsonapi-resources (0.10.7)
@@ -353,15 +327,14 @@ GEM
kramdown (2.4.0)
rexml
language_server-protocol (3.17.0.3)
launchy (3.0.0)
addressable (~> 2.8)
childprocess (~> 5.0)
launchy (2.5.0)
addressable (~> 2.7)
leaflet-rails (1.9.4)
actionpack (>= 4.2.0)
railties (>= 4.2.0)
letter_opener (1.10.0)
launchy (>= 2.2, < 4)
listen (3.9.0)
letter_opener (1.8.1)
launchy (>= 2.2, < 3)
listen (3.8.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
loofah (2.22.0)
@@ -375,7 +348,7 @@ GEM
mailboxer (0.15.1)
carrierwave (>= 0.5.8)
rails (>= 5.0.0)
marcel (1.0.4)
marcel (1.0.2)
material-sass (4.1.1)
autoprefixer-rails (>= 6.0.3)
sass (>= 3.5.2)
@@ -390,28 +363,25 @@ GEM
mini_magick (4.12.0)
mini_mime (1.1.5)
mini_portile2 (2.8.5)
minitest (5.22.3)
minitest (5.20.0)
moneta (1.0.0)
msgpack (1.7.2)
multi_json (1.15.0)
multi_xml (0.6.0)
mutex_m (0.2.0)
net-http (0.4.1)
uri
net-imap (0.4.10)
multipart-post (2.2.3)
net-imap (0.3.7)
date
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.2.2)
net-protocol (0.2.1)
timeout
net-smtp (0.4.0.1)
net-smtp (0.3.3)
net-protocol
nio4r (2.7.0)
nokogiri (1.16.3)
nio4r (2.5.9)
nokogiri (1.15.5)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
nokogiri (1.16.3-x86_64-linux)
nokogiri (1.15.5-x86_64-linux)
racc (~> 1.4)
oauth (0.5.6)
oj (3.16.3)
@@ -430,54 +400,43 @@ GEM
rack
orm_adapter (0.5.0)
parallel (1.24.0)
parser (3.3.0.5)
parser (3.2.2.4)
ast (~> 2.4.1)
racc
percy-capybara (5.0.0)
capybara (>= 3)
pg (1.5.6)
platform-api (3.6.0)
pg (1.5.4)
platform-api (3.5.0)
heroics (~> 0.1.1)
moneta (~> 1.0.0)
rate_throttle_client (~> 0.1.0)
popper_js (2.11.8)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
psych (5.1.2)
stringio
public_suffix (5.0.5)
puma (6.4.2)
popper_js (1.16.1)
public_suffix (5.0.4)
puma (6.4.0)
nio4r (~> 2.0)
query_diet (0.7.1)
racc (1.7.3)
rack (2.2.9)
rack-cors (2.0.2)
rack (2.2.8)
rack-cors (2.0.1)
rack (>= 2.0.0)
rack-protection (3.2.0)
base64 (>= 0.1.0)
rack-protection (3.1.0)
rack (~> 2.2, >= 2.2.4)
rack-session (1.0.2)
rack (< 3)
rack-test (2.1.0)
rack (>= 1.3)
rackup (1.0.0)
rack (< 3)
webrick
rails (7.1.3.2)
actioncable (= 7.1.3.2)
actionmailbox (= 7.1.3.2)
actionmailer (= 7.1.3.2)
actionpack (= 7.1.3.2)
actiontext (= 7.1.3.2)
actionview (= 7.1.3.2)
activejob (= 7.1.3.2)
activemodel (= 7.1.3.2)
activerecord (= 7.1.3.2)
activestorage (= 7.1.3.2)
activesupport (= 7.1.3.2)
rails (7.0.8)
actioncable (= 7.0.8)
actionmailbox (= 7.0.8)
actionmailer (= 7.0.8)
actionpack (= 7.0.8)
actiontext (= 7.0.8)
actionview (= 7.0.8)
activejob (= 7.0.8)
activemodel (= 7.0.8)
activerecord (= 7.0.8)
activestorage (= 7.0.8)
activesupport (= 7.0.8)
bundler (>= 1.15.0)
railties (= 7.1.3.2)
railties (= 7.0.8)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
@@ -497,59 +456,53 @@ GEM
rails_stdout_logging
rails_serve_static_assets (0.0.5)
rails_stdout_logging (0.0.5)
railties (7.1.3.2)
actionpack (= 7.1.3.2)
activesupport (= 7.1.3.2)
irb
rackup (>= 1.0.0)
railties (7.0.8)
actionpack (= 7.0.8)
activesupport (= 7.0.8)
method_source
rake (>= 12.2)
thor (~> 1.0, >= 1.2.2)
zeitwerk (~> 2.6)
thor (~> 1.0)
zeitwerk (~> 2.5)
rainbow (3.1.1)
raindrops (0.20.0)
rake (13.2.1)
rake (13.1.0)
rate_throttle_client (0.1.2)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
rdoc (6.6.3.1)
psych (>= 4.0.0)
recaptcha (5.16.0)
redis-client (0.20.0)
redis-client (0.18.0)
connection_pool
regexp_parser (2.9.0)
reline (0.4.3)
io-console (~> 0.5)
regexp_parser (2.8.3)
responders (3.1.1)
actionpack (>= 5.2)
railties (>= 5.2)
rexml (3.2.6)
rouge (4.1.2)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
rspec-mocks (~> 3.12.0)
rspec-activemodel-mocks (1.2.0)
activemodel (>= 3.0)
activesupport (>= 3.0)
rspec-mocks (>= 2.99, < 4.0)
rspec-core (3.13.0)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.0)
rspec-core (3.12.2)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.6)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-rails (6.1.2)
rspec-support (~> 3.12.0)
rspec-rails (6.1.0)
actionpack (>= 6.1)
activesupport (>= 6.1)
railties (>= 6.1)
rspec-core (~> 3.13)
rspec-expectations (~> 3.13)
rspec-mocks (~> 3.13)
rspec-support (~> 3.13)
rspec-support (3.13.1)
rspec-core (~> 3.12)
rspec-expectations (~> 3.12)
rspec-mocks (~> 3.12)
rspec-support (~> 3.12)
rspec-support (3.12.1)
rspectre (0.1.0)
parser (>= 3.2.2.1)
rspec (~> 3.9)
@@ -564,39 +517,37 @@ GEM
rswag-ui (2.13.0)
actionpack (>= 3.1, < 7.2)
railties (>= 3.1, < 7.2)
rubocop (1.63.0)
rubocop (1.59.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
parser (>= 3.2.2.4)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.31.2)
parser (>= 3.3.0.4)
rubocop-capybara (2.20.0)
rubocop-ast (1.30.0)
parser (>= 3.2.1.0)
rubocop-capybara (2.19.0)
rubocop (~> 1.41)
rubocop-factory_bot (2.25.1)
rubocop (~> 1.41)
rubocop-rails (2.24.1)
rubocop-factory_bot (2.24.0)
rubocop (~> 1.33)
rubocop-rails (2.23.0)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rspec (2.29.1)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-rspec (2.25.0)
rubocop (~> 1.40)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
rubocop-rspec_rails (~> 2.28)
rubocop-rspec_rails (2.28.2)
rubocop (~> 1.40)
ruby-progressbar (1.13.0)
ruby-units (4.0.3)
ruby-vips (2.2.1)
ruby-units (4.0.1)
ruby-vips (2.2.0)
ffi (~> 1.12)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
sass (3.7.4)
sass-listen (~> 4.0.0)
@@ -611,29 +562,28 @@ GEM
sprockets (> 3.0)
sprockets-rails
tilt
scout_apm (5.3.8)
scout_apm (5.3.5)
parser
searchkick (5.3.1)
activemodel (>= 6.1)
searchkick (4.6.3)
activemodel (>= 5)
elasticsearch (>= 6, < 7.14)
hashie
selenium-webdriver (4.19.0)
base64 (~> 0.2)
selenium-webdriver (4.10.0)
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
sidekiq (7.2.2)
sidekiq (7.2.0)
concurrent-ruby (< 2)
connection_pool (>= 2.3.0)
rack (>= 2.2.4)
redis-client (>= 0.19.0)
redis-client (>= 0.14.0)
simplecov (0.13.0)
docile (~> 1.1.0)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
smart_properties (1.17.0)
sprockets (3.7.3)
base64
sprockets (3.7.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.4.2)
@@ -641,43 +591,39 @@ GEM
activesupport (>= 5.2)
sprockets (>= 3.0.0)
ssrf_filter (1.1.2)
stringio (3.1.0)
sysexits (1.2.0)
temple (0.10.3)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
terser (1.2.2)
execjs (>= 0.3.0, < 3)
thor (1.3.1)
thread_safe (0.3.6)
thor (1.3.0)
tilt (2.3.0)
timecop (0.9.8)
timeout (0.4.1)
timeout (0.4.0)
trollop (1.16.2)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
unicode-display_width (2.5.0)
unicorn (6.1.0)
kgio (~> 2.6)
raindrops (~> 0.7)
uniform_notifier (1.16.0)
uri (0.13.0)
validate_url (1.0.15)
activemodel (>= 3.0.0)
public_suffix
vcr (6.2.0)
virtus (2.0.0)
axiom-types (~> 0.1)
coercible (~> 1.0)
descendants_tracker (~> 0.0, >= 0.0.3)
warden (1.2.9)
rack (>= 2.0.9)
webdrivers (5.3.1)
nokogiri (~> 1.6)
rubyzip (>= 1.3.0)
selenium-webdriver (~> 4.0, < 4.11)
webrat (0.7.3)
nokogiri (>= 1.2.0)
rack (>= 1.0)
rack-test (>= 0.5.3)
webrick (1.8.1)
websocket (1.2.10)
websocket (1.2.9)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
@@ -688,22 +634,20 @@ GEM
webrick
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.6.13)
zeitwerk (2.6.12)
PLATFORMS
ruby
x86_64-linux
DEPENDENCIES
active_median
active_median (= 0.2.0)
active_record_union
active_utils
axe-core-capybara
axe-core-rspec
better_errors
bluecloth
bonsai-elasticsearch-rails
bootstrap (>= 5.0.0)
bootstrap (>= 4.6.2)
bootstrap-datepicker-rails
bootstrap_form (>= 4.5.0)
bullet
@@ -723,14 +667,14 @@ DEPENDENCIES
devise
discard (>= 1.2)
dotenv-rails
elasticsearch (~> 7.0.0)
elasticsearch (< 7.0.0)
factory_bot_rails
faker
faraday
faraday_middleware
flickraw
font-awesome-sass
friendly_id
gbifrb
geocoder
gibbon (~> 1.2.0)
gravatar-ultimate
@@ -740,9 +684,8 @@ DEPENDENCIES
haml_lint (>= 0.25.1)
hashie (>= 3.5.3)
i18n-tasks
icalendar
jquery-rails
jquery-ui-rails!
jquery-ui-rails
jsonapi-resources
jsonapi-swagger
leaflet-rails (>= 1.9.2)
@@ -753,7 +696,6 @@ DEPENDENCIES
material-sass (= 4.1.1)
material_icons
memcachier
msgpack
oj
omniauth (~> 1.3)
omniauth-flickr (>= 0.0.15)
@@ -761,17 +703,15 @@ DEPENDENCIES
percy-capybara (~> 5.0.0)
pg
platform-api
pry
puma
query_diet
rack-cors
rack-protection (>= 2.0.1)
rails (~> 7.1.0)
rails (~> 7.0.7)
rails-assets-leaflet.markercluster!
rails-controller-testing
rails_12factor
rake (>= 10.0.0)
recaptcha
responders
rspec-activemodel-mocks
rspec-rails
@@ -789,18 +729,18 @@ DEPENDENCIES
selenium-webdriver
sidekiq
sprockets (< 4)
terser
timecop
uglifier
unicorn
validate_url
vcr
webdrivers
webrat
will_paginate
will_paginate-bootstrap-style
xmlrpc
RUBY VERSION
ruby 3.1.4p223
ruby 3.1.4p223
BUNDLED WITH
2.3.11

View File

@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<!-- MIT Licenced, https://www.svgrepo.com/svg/336823/plan -->
<svg width="800px" height="800px" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="48" height="48" fill="white" fill-opacity="0.01"/>
<path d="M5 19H43V41C43 42.1046 42.1046 43 41 43H7C5.89543 43 5 42.1046 5 41V19Z" fill="#2F88FF" stroke="#000000" stroke-width="4" stroke-linejoin="round"/>
<path d="M5 10C5 8.89543 5.89543 8 7 8H41C42.1046 8 43 8.89543 43 10V19H5V10Z" stroke="#000000" stroke-width="4" stroke-linejoin="round"/>
<path d="M16 31L22 37L34 25" stroke="white" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M16 5V13" stroke="#000000" stroke-width="4" stroke-linecap="round"/>
<path d="M32 5V13" stroke="#000000" stroke-width="4" stroke-linecap="round"/>
</svg>

Before

Width:  |  Height:  |  Size: 916 B

View File

@@ -18,17 +18,6 @@
// = require jquery-ui/widgets/autocomplete
// = require bootstrap-sprockets
// = require bootstrap-datepicker
// = require bootstrap
// = require material
// = require_tree .
document.addEventListener('DOMContentLoaded', function(event) {
var popoverTrigger = Array.prototype.slice.call(document.querySelectorAll('[data-bs-toggle="popover"]'));
popoverTrigger.map(function(popoverTrigger2) {
return new bootstrap.Popover(popoverTrigger2);
});
var tooltipTrigger = Array.prototype.slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
tooltipTrigger.map(function(tooltipTrigger2) {
return new bootstrap.Tooltip(tooltipTrigger2);
});
});

View File

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
jQuery ->
$("a[rel=popover]").popover()
$(".tooltip").tooltip()
$("a[rel=tooltip]").tooltip()

View File

@@ -5,7 +5,7 @@ jQuery ->
$(".remove-altname-row").css("display", "inline-block")
-$ ->
sci_template = "<div id='sci_template[INDEX]' class='template col-md-12'><div class='col-md-2'><label>Scientific name INDEX:</label></div><div class='col-md-8'><input name='sci_name[INDEX]' class='scientific-name-auto-suggest form-control' id='sci_name[INDEX]' data-source-url='/scientific_names/gbif_suggest')'></input><span class='help-block'>Scientific name of crop</span><input type='text' id='sci_gbif_key[INDEX]' class=''></div><div class='col-md-2'></div></div>"
sci_template = "<div id='sci_template[INDEX]' class='template col-md-12'><div class='col-md-2'><label>Scientific name INDEX:</label></div><div class='col-md-8'><input name='sci_name[INDEX]' class='form-control', id='sci_name[INDEX]')'></input><span class='help-block'>Scientific name of crop.</span></div><div class='col-md-2'></div></div>"
sci_index = $('#scientific_names .template').length + 1
@@ -21,7 +21,7 @@ jQuery ->
element = document.getElementById(tmp)
element.remove()
alt_template = "<div id='alt_template[INDEX]' class='template col-md-12'><div class='col-md-2'><label>Alternate name INDEX:</label></div><div class='col-md-8'><input name='alt_name[INDEX]' class='form-control' id='alt_name[INDEX]')'></input><span class='help-block'>Alternate name of crop.</span></div><div class='col-md-2'></div></div>"
alt_template = "<div id='alt_template[INDEX]' class='template col-md-12'><div class='col-md-2'><label>Alternate name INDEX:</label></div><div class='col-md-8'><input name='alt_name[INDEX]' class='form-control', id='alt_name[INDEX]')'></input><span class='help-block'>Alternate name of crop.</span></div><div class='col-md-2'></div></div>"
alt_index = $('#alternate_names .template').length + 1

View File

@@ -0,0 +1 @@
$('.dropdown-toggle').dropdown();

View File

@@ -1,31 +0,0 @@
# TODO: This assumes one autocomplete per page.
# Needs to be a function so that when we append one of these, it gets uniquely associated with the hidden controls.
jQuery ->
if el = $( '.scientific-name-auto-suggest' )
id = $( '.scientific-name-auto-suggest-id' )
el.autocomplete
minLength: 3,
source: el.attr( 'data-source-url' ),
focus: ( event, ui ) ->
el.val( ui.item.canonicalName )
id.val( ui.item.nameKey )
false
select: ( event, ui ) ->
el.val( ui.item.canonicalName )
id.val( ui.item.nameKey )
false
response: ( event, ui ) ->
id.val( "" )
for item in ui.content
if item.name == el.val()
id.val( item.nameKey )
if el.data( 'uiAutocomplete' )
el.data( 'uiAutocomplete' )._renderItem = ( ul, item ) ->
$( '<li class="list-group-item"></li>' )
.data( 'item.autocomplete', item )
.append( "<a>#{item.canonicalName} (#{item.scientificName}) - #{item.rank}</a>" )
.appendTo( ul )

View File

@@ -0,0 +1,3 @@
$(function() {
$('[data-toggle="tooltip"]').tooltip();
});

View File

@@ -19,7 +19,7 @@
padding-bottom: 0;
}
.crop-sci-name {
h5.crop-sci-name {
background-color: $beige;
color: $black;
font-size: 0.7em;

View File

@@ -40,22 +40,9 @@
height: 250px;
width: 100%;
}
.card {
.badge-location {
background-color: darken($blue, 10%);
border-radius: 5%;
color: $white;
.fa-map-marker {
padding-right: 0.5em;
}
}
.badge {
text-overflow: ellipsis;
white-space: normal;
align-items: end;
max-height: 1rlh;
-webkit-line-clamp: 1;
}
}
.badge-location {
background-color: darken($blue, 10%);
border-radius: 5%;
color: $white;
}

View File

@@ -1,6 +1,6 @@
.seed-card {
.text {
opacity: 0.95;
opacity: 0.8;
margin: 0;
padding: 0;
position: absolute;

View File

@@ -1,10 +1,10 @@
//$screen-md-min: 1028px
// Base colours
$beige: #f4f2ef;
$beige: #f3f1ee;
$brown: #413f3b;
$green: #57803c;
$green: #5f8e43;
$blue: #2f4365;
$red: #ff4d43;
$orange: #ffa500;

View File

@@ -54,12 +54,6 @@
margin-bottom: 0;
}
.card-footer {
.d-flex {
flex-direction: column;
}
}
.sidebar {
border-left: 0;
margin-left: 0;

View File

@@ -101,15 +101,13 @@ section {
background: $white;
box-shadow: 1px 3px 3px 1px darken($beige, 20%);
cursor: pointer;
transition:
0.1s transform cubic-bezier(0.155, 1.105, 0.295, 1.12),
0.1s box-shadow,
0.1s -webkit-transform cubic-bezier(0.155, 1.105, 0.295, 1.12);
transition: 0.3s transform cubic-bezier(0.155, 1.105, 0.295, 1.12), 0.3s box-shadow,
0.3s -webkit-transform cubic-bezier(0.155, 1.105, 0.295, 1.12);
}
.card:hover {
box-shadow:
1px 3px 3px 1px darken($beige, 30%);
box-shadow: 0 10px 20px darken($beige, 30%), 0 4px 8px darken($beige, 40%);
transform: scale(1.1);
}
}
@@ -146,6 +144,10 @@ section {
color: $brown;
}
}
.card:hover {
background-color: $beige;
}
}
.img-cover,
@@ -352,9 +354,7 @@ ul.thumbnail-buttons {
text-align: center;
}
}
.text-muted {
color: $blue;
}
.jumbotron {
background-color: $beige;
margin-bottom: 1em;
@@ -364,23 +364,15 @@ ul.thumbnail-buttons {
h1 {
font-size: 400%;
}
.stats a {
color: $black;
}
// signup widget on homepage
.signup {
background-color: darken($green, 20%);
border: 1px solid darken($green, 20%);
color: $white;
background-color: lighten($green, 40%);
border: 1px solid lighten($green, 20%);
border-radius: 6px;
line-height: 200%;
padding: 15px;
text-align: center;
.btn-info {
background-color: $blue;
}
}
.info {

View File

@@ -1,88 +0,0 @@
# frozen_string_literal: true
class ActivitiesController < DataController
def index
@show_all = params[:all] == '1'
where = {}
where['active'] = true unless @show_all
if params[:member_slug]
@owner = Member.find_by(slug: params[:member_slug])
where['owner_id'] = @owner.id unless @owner.nil?
end
@activities = Activity.search(
where:,
page: params[:page],
limit: 30,
boost_by: [:created_at],
load: false
)
@filename = "Growstuff-#{specifics}Activities-#{Time.zone.now.to_fs(:number)}.csv"
respond_with(@activities)
end
def show
respond_with @activity
end
def new
@activity = Activity.new(
owner: current_member
)
if params[:garden_id]
@activity.garden = Garden.find_by(
owner: current_member,
id: params[:garden_id]
)
end
if params[:planting_id]
@activity.planting = Planting.find_by(
owner: current_member,
id: params[:planting_id]
)
end
respond_with @activity
end
def edit
# the following are needed to display the form but aren't used
@gardens = @activity.owner.gardens.active.order_by_name
@plantings = @activity.owner.plantings.active
end
def create
@activity = Activity.new(activity_params)
@activity.owner = current_member
@activity.save
respond_with @activity
end
def update
@activity.update(activity_params)
respond_with @activity
end
def destroy
@activity.destroy
respond_with @activity, location: @activity.garden
end
private
def activity_params
params.require(:activity).permit(
:name, :description, :category, :finished,
:garden_id, :planting_id, :due_date
)
end
def specifics
if @owner.present?
"#{@owner.to_param}-"
end
end
end

View File

@@ -8,7 +8,7 @@ module Admin
responders :flash
def index
@roles = Role.all.order(:name).paginate(page: params[:page])
@roles = Role.all.order(:name)
respond_with @roles
end
@@ -33,7 +33,7 @@ module Admin
def destroy
@role.destroy
respond_with @role, location: admin_roles_path, notice: "Role was successfully deleted"
respond_with @role, location: admin_roles_path
end
private

View File

@@ -8,7 +8,7 @@ class AdminController < ApplicationController
def newsletter
authorize! :manage, :all
@members = Member.confirmed.wants_newsletter.all.paginate(page: params[:page], per_page: 100)
@members = Member.confirmed.wants_newsletter.all
respond_with @members
end
end

View File

@@ -9,7 +9,7 @@ class AlternateNamesController < ApplicationController
# GET /alternate_names
# GET /alternate_names.json
def index
@alternate_names = AlternateName.all.order(:name).paginate(page: params[:page], per_page: 100)
@alternate_names = AlternateName.all.order(:name)
respond_with(@alternate_names)
end

View File

@@ -2,10 +2,6 @@
class ApplicationController < ActionController::Base
protect_from_forgery
# Working from codespaces, we want to turn off validation
if Rails.env.development? && ENV['CODESPACE_NAME']
skip_before_action :verify_authenticity_token
end
include ApplicationHelper

View File

@@ -10,6 +10,7 @@ class CropsController < ApplicationController
responders :flash
def index
@sort = params[:sort]
@crops = Crop.search('*', boost_by: %i(plantings_count harvests_count),
limit: 100,
page: params[:page],
@@ -45,12 +46,6 @@ class CropsController < ApplicationController
respond_with @crop, location: @crop
end
def gbif
@crop = Crop.find(params[:crop_slug])
@crop.update_gbif_data!
respond_with @crop, location: @crop
end
def hierarchy
@crops = Crop.toplevel.order(:name)
respond_with @crops
@@ -63,15 +58,7 @@ class CropsController < ApplicationController
page: params[:page],
per_page: Crop.per_page,
current_member:)
respond_to do |format|
format.html do
render
end
format.json do
render json: @crops.to_a
end
end
respond_with @crops
end
def show
@@ -133,7 +120,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
@crop.approval_status = @crop.approval_status_was
@@ -177,7 +163,7 @@ class CropsController < ApplicationController
return if params[param_name].blank?
destroy_names(name_type)
params[param_name].each_value do |value|
params[param_name].each do |_i, value|
create_name!(name_type, value) unless value.empty?
end
end

View File

@@ -16,7 +16,6 @@ class GardensController < DataController
def show
@current_plantings = @garden.plantings.current.includes(:crop, :owner).order(planted_at: :desc)
@current_activities = @garden.activities.current.includes(:owner).order(created_at: :desc)
@finished_plantings = @garden.plantings.finished.includes(:crop)
@suggested_companions = Crop.approved.where(
id: CropCompanion.where(crop_a_id: @current_plantings.select(:crop_id)).select(:crop_b_id)

View File

@@ -41,7 +41,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
def after_sign_in_path_for(resource)
if resource.tos_agreement
super(resource)
super resource
else
finish_signup_path(resource)
end

View File

@@ -63,7 +63,7 @@ class PhotosController < ApplicationController
def photo_params
params.require(:photo).permit(:source_id, :source, :title, :license_name,
:license_url, :thumbnail_url, :fullsize_url, :link_url, :date_taken)
:license_url, :thumbnail_url, :fullsize_url, :link_url)
end
# Item with photos attached

View File

@@ -6,7 +6,7 @@ class PlantPartsController < ApplicationController
responders :flash
def index
@plant_parts = PlantPart.all.order(:name).paginate(page: params[:page], per_page: 100)
@plant_parts = PlantPart.all.order(:name)
respond_with(@plant_parts)
end

View File

@@ -3,7 +3,6 @@
class PlantingsController < DataController
after_action :update_crop_medians, only: %i(create update destroy)
after_action :update_planting_medians, only: :update
respond_to :ics, only: [:index] # TODO: This can be shifted up when all relevant controllers respond to ical
def index
@show_all = params[:all] == '1'
@@ -30,13 +29,13 @@ class PlantingsController < DataController
)
@filename = "Growstuff-#{specifics}Plantings-#{Time.zone.now.to_fs(:number)}.csv"
respond_with(@plantings)
end
def show
@photos = @planting.photos.includes(:owner).order(date_taken: :desc)
@harvests = Harvest.search(where: { planting_id: @planting.id })
@current_activities = @planting.activities.current.includes(:owner).order(created_at: :desc)
@matching_seeds = matching_seeds
@crop = @planting.crop

View File

@@ -3,8 +3,6 @@
class RegistrationsController < Devise::RegistrationsController
respond_to :json
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')
@@ -48,25 +46,6 @@ class RegistrationsController < Devise::RegistrationsController
render "edit"
end
end
private
def sign_up_params
params.require(:member).permit(:login_name, :email, :tos_agreement, :newsletter, :password, :password_confirmation)
end
def check_captcha
return if verify_recaptcha # verify_recaptcha(action: 'signup') for v3
self.resource = resource_class.new sign_up_params
resource.validate # Look for any other validation errors besides reCAPTCHA
set_minimum_password_length
respond_with_navigational(resource) do
flash.discard(:recaptcha_error) # We need to discard flash to avoid showing it on the next page reload
render :new
end
end
end
# check if we need the current password to update fields

View File

@@ -1,15 +1,15 @@
# frozen_string_literal: true
class ScientificNamesController < ApplicationController
before_action :authenticate_member!, except: %i(index show gbif_suggest)
load_and_authorize_resource except: [:gbif_suggest]
before_action :authenticate_member!, except: %i(index show)
load_and_authorize_resource
respond_to :html, :json
responders :flash
# GET /scientific_names
# GET /scientific_names.json
def index
@scientific_names = ScientificName.all.order(:name).paginate(page: params[:page], per_page: 100)
@scientific_names = ScientificName.all.order(:name)
respond_with(@scientific_names)
end
@@ -35,7 +35,7 @@ class ScientificNamesController < ApplicationController
def create
@scientific_name = ScientificName.new(scientific_name_params)
@scientific_name.creator = current_member
gbif_sync!(@scientific_name)
@scientific_name.save
respond_with(@scientific_name.crop)
end
@@ -43,9 +43,7 @@ class ScientificNamesController < ApplicationController
# PUT /scientific_names/1
# PUT /scientific_names/1.json
def update
@scientific_name.assign_attributes(scientific_name_params)
gbif_sync!(@scientific_name)
@scientific_name.save
@scientific_name.update(scientific_name_params)
respond_with(@scientific_name.crop)
end
@@ -58,26 +56,9 @@ class ScientificNamesController < ApplicationController
respond_with(@crop)
end
def gbif_suggest
render json: gbif_service.suggest(params[:term])
end
private
def gbif_sync!(model)
return unless model.gbif_key
result = gbif_service.fetch(model.gbif_key)
model.gbif_rank = result["rank"]
model.gbif_status = result["status"]
end
def scientific_name_params
params.require(:scientific_name).permit(:crop_id, :name, :gbif_key)
end
def gbif_service
GbifService.new
params.require(:scientific_name).permit(:crop_id, :name)
end
end

View File

@@ -35,7 +35,7 @@ class SeedsController < DataController
end
def show
@photos = @seed.photos.includes(:owner).order(created_at: :desc, id: :desc).paginate(page: params[:page], per_page: 30)
@photos = @seed.photos.includes(:owner).order(created_at: :desc).paginate(page: params[:page])
respond_with(@seed)
end

View File

@@ -34,13 +34,6 @@ module ApplicationHelper
tag.div(asterisk + ' '.html_safe + text, class: ['margin-bottom'])
end
# A helper to replace the complex template compilation mess
# of HAML, Tilt, and dynamic compilation with interpolated ruby.
def markdownify(text)
translator = Haml::Filters::GrowstuffMarkdown.new
translator.expand_members!(translator.expand_crops!(text.to_s))
end
#
# Returns an image uri for a given member.
#

View File

@@ -18,30 +18,6 @@ module ButtonsHelper
end
end
def garden_plan_something_button(garden, classes: "btn btn-default")
return unless can? :edit, garden
link_to new_activity_path(garden_id: garden.id), class: classes do
activity_icon + ' ' + t('buttons.new_activity')
end
end
def plan_something_button
return unless can? :create, Activity
link_to new_activity_path, class: "btn btn-default" do
activity_icon + ' ' + t('buttons.new_activity')
end
end
def planting_plan_something_button(planting, classes: "btn btn-default")
return unless can? :edit, planting
link_to new_activity_path(planting_id: planting.id), class: classes do
activity_icon + ' ' + t('buttons.new_activity')
end
end
def garden_mark_active_button(garden, classes: 'btn')
link_to t('buttons.mark_as_active'),
garden_path(garden, garden: { active: 1 }),
@@ -83,19 +59,6 @@ module ButtonsHelper
edit_button(edit_planting_path(planting), classes:)
end
def activity_edit_button(activity, classes: "btn btn-raised btn-info")
edit_button(edit_activity_path(activity), classes:)
end
def activity_finish_button(activity, classes: 'btn btn-default btn-secondary')
return unless can?(:edit, activity) || activity.finished
link_to activity_path(slug: activity.slug, activity: { finished: 1 }),
method: :put, class: "#{classes} append-date" do
finished_icon + ' ' + t('buttons.mark_as_finished')
end
end
def planting_finish_button(planting, classes: 'btn btn-default btn-secondary')
return unless can?(:edit, planting) || planting.finished

View File

@@ -11,12 +11,10 @@ module GardensHelper
end
end
# TODO: Not used?
def display_garden_name(garden)
truncate(garden.name, length: 50, separator: ' ', omission: '... ')
end
# TODO: Only used by specs?
def display_garden_plantings(plantings)
if plantings.blank?
"None"

View File

@@ -71,10 +71,6 @@ module IconsHelper
icon('fas', 'seedling')
end
def activity_icon
icon('fas', 'fa-truck-pickup')
end
def post_icon
image_icon 'post'
end
@@ -97,7 +93,7 @@ module IconsHelper
def plant_part_icon(name)
if File.exist? Rails.root.join('app', 'assets', 'images', 'icons', 'plant_parts', "#{name}.svg")
image_tag "icons/plant_parts/#{name}.svg", class: 'img img-icon', 'aria-hidden' => "true", alt: name
image_tag "icons/plant_parts/#{name}.svg", class: 'img img-icon', 'aria-hidden' => "true"
else
planting_icon
end
@@ -105,7 +101,7 @@ module IconsHelper
def crop_icon(crop)
if crop.svg_icon.present?
image_tag(crop_path(crop, format: 'svg'), class: 'crop-icon', alt: crop)
image_tag(crop_path(crop, format: 'svg'), class: 'crop-icon')
elsif crop.parent.present?
crop_icon(crop.parent)
else
@@ -127,6 +123,6 @@ module IconsHelper
end
def image_icon(icon)
image_tag "icons/#{icon}.svg", class: 'img img-icon', 'aria-hidden' => "true", alt: icon
image_tag "icons/#{icon}.svg", class: 'img img-icon', 'aria-hidden' => "true"
end
end

View File

@@ -1,7 +1,12 @@
# frozen_string_literal: true
module PostsHelper
def display_post_truncated(post, length: 300)
truncate(strip_tags(post.body), length:,
separator: ' ', omission: '... ') { link_to "Read more", post_path(post) }
end
def post_stripped_tags(post, length: 300)
truncate(strip_tags(markdownify(post.body)), length:)
truncate(strip_tags(post.body), length:)
end
end

View File

@@ -79,7 +79,6 @@ class Ability
can :manage, ScientificName
can :manage, AlternateName
can :openfarm, Crop
can :gbif, Crop
end
# any member can create a crop provisionally
@@ -109,10 +108,6 @@ class Ability
can :update, Planting, garden: { owner_id: member.id }, crop: { approval_status: 'approved' }
can :destroy, Planting, garden: { owner_id: member.id }, crop: { approval_status: 'approved' }
can :create, Activity
can :update, Activity, owner_id: member.id
can :destroy, Activity, owner_id: member.id
can :create, Harvest
can :update, Harvest, owner_id: member.id
can :destroy, Harvest, owner_id: member.id
@@ -153,10 +148,5 @@ class Ability
can :destroy, PlantPart do |pp|
pp.harvests.empty?
end
# Admins can't delete themselves
cannot :destroy, Member
can :destroy, Member do |other_member|
other_member&.id != member.id
end
end
end

View File

@@ -1,32 +0,0 @@
# frozen_string_literal: true
class Activity < ApplicationRecord
extend FriendlyId
include Ownable
include Finishable
include SearchActivities
belongs_to :garden, optional: true
belongs_to :planting, optional: true
friendly_id :activity_slug, use: %i(slugged finders)
CATEGORIES = ["General", "Weeding", "Soil Cultivation", "Fertilizing", "Pruning", "Topical Application/Treating", "Watering"]
validates :name, presence: true
validates :category, inclusion: { in: CATEGORIES }, presence: true
validates :owner, presence: true
validates :slug, uniqueness: true
delegate :location, :latitude, :longitude, to: :owner
delegate :login_name, :slug, :location, to: :owner, prefix: true
def activity_slug
"#{owner.login_name}-#{name}-#{id}".downcase.tr(' ', '-')
end
def to_s
name
end
end

View File

@@ -1,11 +0,0 @@
# frozen_string_literal: true
module GbifData
extend ActiveSupport::Concern
included do
def update_gbif_data!
GbifService.new.update_crop(self)
end
end
end

View File

@@ -77,22 +77,9 @@ module PredictPlanting
finish_predicted_at <= Time.zone.today
end
# Deactivate any plantings over time_limit that are super late in small batches.
def self.archive!(time_limit: 3.years.ago, limit: 100)
active_plantings = Planting.annual.active.where("planted_at < ?", time_limit).order(planted_at: :asc).limit(limit)
active_plantings.each do |planting|
if planting.finish_is_predicatable? && planting.super_late?
planting.finished = true
planting.save
end
end
end
private
def calculate_percentage_grown
return 0 if age_in_days < 0
percent = (age_in_days / expected_lifespan.to_f) * 100
(percent > 100 ? 100 : percent)
end

View File

@@ -1,62 +0,0 @@
# frozen_string_literal: true
module SearchActivities
extend ActiveSupport::Concern
included do
searchkick merge_mappings: true,
settings: { number_of_shards: 1, number_of_replicas: 0 },
mappings: {
properties: {
active: { type: :boolean },
created_at: { type: :integer }
}
}
def search_data
{
slug:,
active:,
finished: finished?,
name:,
due_date:,
category:,
garden_id:,
garden_name: garden&.name,
planting_id:,
planting_name: planting&.crop&.name,
description:,
# owner
owner_id:,
owner_login_name:,
owner_slug:,
# timestamps
created_at: created_at.to_i,
updated_at: updated_at.to_i
}
end
def self.homepage_records(limit)
records = []
owners = []
1..limit.times do
where = {
# photos_count: { gt: 0 },
owner_id: { not: owners }
}
one_record = search('*',
limit: 1,
where:,
boost_by: [:created_at],
load: false).first
return records if one_record.nil?
owners << one_record.owner_id
records << one_record
end
records
end
end
end

View File

@@ -30,8 +30,6 @@ module SearchPlantings
quantity:,
sunniness:,
garden_id:,
garden_name: garden&.name,
description:,
first_harvest_predicted_at:,
finish_predicted_at:,
@@ -55,8 +53,7 @@ module SearchPlantings
harvests_count:,
# timestamps
created_at: created_at.to_i,
updated_at: updated_at.to_i
created_at: created_at.to_i
}
end

View File

@@ -4,7 +4,6 @@ class Crop < ApplicationRecord
extend FriendlyId
include PhotoCapable
include OpenFarmData
include GbifData
include SearchCrops
friendly_id :name, use: %i(slugged finders)

View File

@@ -9,7 +9,6 @@ class Garden < ApplicationRecord
has_many :plantings, dependent: :destroy
has_many :crops, through: :plantings
has_many :activities, dependent: :destroy
belongs_to :garden_type, optional: true
@@ -79,16 +78,6 @@ class Garden < ApplicationRecord
def reindex(refresh: false); end
# Deactivate any gardens with no active plantings
def self.archive!(time_limit: 3.years.ago, limit: 100)
Garden.active.where("updated_at < ?", time_limit).order(updated_at: :asc).limit(limit).each do |active_garden|
unless active_garden.plantings.active.any?
garden.active = false
garden.save
end
end
end
protected
def strip_blanks

View File

@@ -19,7 +19,6 @@ class Member < ApplicationRecord
has_many :plantings, foreign_key: 'owner_id', dependent: :destroy, inverse_of: :owner
has_many :seeds, foreign_key: 'owner_id', dependent: :destroy, inverse_of: :owner
has_many :harvests, foreign_key: 'owner_id', dependent: :destroy, inverse_of: :owner
has_many :activities, foreign_key: 'owner_id', dependent: :destroy, inverse_of: :owner
has_and_belongs_to_many :roles
has_many :notifications, foreign_key: 'recipient_id', inverse_of: :recipient
has_many :sent_notifications, foreign_key: 'sender_id', inverse_of: :sender, class_name: "Notification"

View File

@@ -9,20 +9,15 @@ class Photo < ApplicationRecord
has_many :photo_associations, dependent: :delete_all, inverse_of: :photo
# This doesn't work, ActiveRecord tries to use the polymoriphic photographable
# This doesn't work, ActiveRecord tries to use the polymoriphinc photographable
# relationship instead.
# has_many :crops, through: :photo_associations, counter_cache: true
def crops
Crop.distinct.joins(:photo_associations).where(photo_associations: { photo: self })
end
validates :fullsize_url, url: true, presence: true
validates :thumbnail_url, url: true, presence: true
validates :link_url, url: true, presence: true
validates :owner, presence: true
validates :title, presence: true
validates :license_name, presence: true # Should assert this is one of CC-BY, CC-BY-NC, etc
validates :license_url, url: true, allow_blank: true
validates :fullsize_url, url: true
validates :thumbnail_url, url: true
# creates a relationship for each assignee type
PHOTO_CAPABLE.each do |type|

View File

@@ -22,7 +22,6 @@ class Planting < ApplicationRecord
belongs_to :garden
belongs_to :crop, counter_cache: true
has_many :harvests, dependent: :destroy
has_many :activities, dependent: :destroy
#
# Ancestry of food

View File

@@ -24,11 +24,8 @@ class Post < ApplicationRecord
#
# Validations
validates :subject, presence: true, length: { maximum: 255 }
validates :body, presence: true
def author_date_subject
return unless author
# slugs are created before created_at is set
time = created_at || Time.zone.now
"#{author.login_name} #{time.strftime('%Y%m%d')} #{subject}"

View File

@@ -1,193 +0,0 @@
# frozen_string_literal: true
require 'English'
class GbifService
def initialize
@cropbot = Member.find_by(login_name: 'cropbot')
@species = Gbif::Species
end
def suggest(term)
# Query the GBIF name autocomplete and discover the scientific name.
# [
# {
# "key": 2932942,
# "nameKey": 1970347,
# "kingdom": "Plantae",
# "phylum": "Tracheophyta",
# "order": "Solanales",
# "family": "Solanaceae",
# "genus": "Capsicum",
# "species": "Capsicum chinense",
# "kingdomKey": 6,
# "phylumKey": 7707728,
# "classKey": 220,
# "orderKey": 1176,
# "familyKey": 7717,
# "genusKey": 2932937,
# "speciesKey": 2932942,
# "parent": "Capsicum",
# "parentKey": 2932937,
# "nubKey": 2932942,
# "scientificName": "Capsicum chinense Jacq.",
# "canonicalName": "Capsicum chinense",
# "rank": "SPECIES",
# "status": "ACCEPTED",
# "synonym": false,
# "higherClassificationMap": {
# "6": "Plantae",
# "220": "Magnoliopsida",
# "1176": "Solanales",
# "7717": "Solanaceae",
# "2932937": "Capsicum",
# "7707728": "Tracheophyta"
# },
# "class": "Magnoliopsida"
# },
# {
# "key": 12079498,
# "nameKey": 81778754,
# "kingdom": "Plantae",
# "phylum": "Tracheophyta",
# "order": "Solanales",
# "family": "Solanaceae",
# "genus": "Capsicum",
# "species": "Capsicum chinense",
# "kingdomKey": 6,
# "phylumKey": 7707728,
# "classKey": 220,
# "orderKey": 1176,
# "familyKey": 7717,
# "genusKey": 2932937,
# "speciesKey": 2932942,
# "parent": "Capsicum",
# "parentKey": 2932937,
# "nubKey": 12079498,
# "scientificName": "Capsicum annuum var. chinense (Jacq.) Alef.",
# "canonicalName": "Capsicum annuum chinense",
# "rank": "VARIETY",
# "status": "SYNONYM",
# "synonym": true,
# "higherClassificationMap": {
# "6": "Plantae",
# "220": "Magnoliopsida",
# "1176": "Solanales",
# "7717": "Solanaceae",
# "2932937": "Capsicum",
# "2932942": "Capsicum chinense",
# "7707728": "Tracheophyta"
# },
# "class": "Magnoliopsida"
# }
# ]
@species.name_suggest(q: term)
end
def import!
Crop.order(updated_at: :desc).each do |crop|
Rails.logger.debug { "#{crop.id}, #{crop.name}" }
update_crop(crop) if crop.valid?
rescue ActiveRecord::RecordInvalid
Rails.logger.error($ERROR_INFO.message)
end
end
def update_crop(crop)
# Attempt to resolve the scientific names via /species/match.
gbif_usage_key = crop.scientific_names.detect { |sn| sn.gbif_key.present? }&.gbif_key
unless gbif_usage_key
crop.scientific_names.each do |sn|
result = @species.name_backbone(name: sn.name) # , higherTaxonKey: 6, nameType: 'SCIENTIFIC')
next unless result["confidence"] > 95 && result["matchType"] == "EXACT"
sn.gbif_key = result["usageKey"]
sn.gbif_rank = result["rank"]
sn.gbif_status = result["status"]
sn.save!
end
gbif_usage_key = crop.scientific_names.detect { |sn| sn.gbif_key.present? }&.gbif_key
end
# No match? Fall back to common names
unless gbif_usage_key
query_results = @species.name_lookup(q: crop.name, higherTaxonKey: 6)
# We only want one result, otherwise it needs human.
return unless query_results["results"].length == 1
query_result = query_results["results"].first
gbif_usage_key = query_result["key"]
crop.scientific_names.create!(gbif_key: gbif_usage_key, name: query_result["canonicalName"], creator: @cropbot)
end
gbif_record = fetch(gbif_usage_key)
if gbif_record.present?
# crop.update! openfarm_data: gbif_record.fetch('data', false)
# save_companions(crop, gbif_record)
save_photos(crop, gbif_usage_key)
else
Rails.logger.debug "\tcrop not found on GBIF"
# crop.update!(openfarm_data: false)
end
end
def save_photos(crop, key)
# https://api.gbif.org/v1/occurrence/search?taxon_key=3084850
occurrences = Gbif::Occurrences.search(taxonKey: key, mediatype: 'StillImage', limit: 3, hasCoordinate: true)
occurrences["results"].each do |result|
next unless result["media"]
media = result["media"].first
next unless media["identifier"]
# Example: "https://inaturalist-open-data.s3.amazonaws.com/photos/250226497/original.jpg"
url = media["identifier"]
md5 = Digest::MD5.hexdigest(url)
width = 200
thumbnail = "https://api.gbif.org/v1/image/cache/#{width}x/occurrence/#{result['key']}/media/#{md5}"
next unless url.start_with? 'http'
next if Photo.find_by(source_id: result["key"], source: 'gbif')
next if media["references"].blank?
photo = Photo.new(
# This is for the overall observation which may technically have multiple media. However, we're only taking the first.
source_id: result["key"],
source: 'gbif',
owner: @cropbot,
thumbnail_url: thumbnail,
fullsize_url: url,
title: "Photo by #{media['creator']} via #{media['publisher']} (Copyright #{media['rightsHolder']})",
license_name: case media["license"]
when "http://creativecommons.org/licenses/by/4.0/"
"CC BY 4.0"
when "http://creativecommons.org/licenses/by-nc/4.0/"
"CC BY-NC 4.0"
else
media["license"]
end,
license_url: media["license"],
link_url: media["references"]
)
photo.date_taken = DateTime.parse(media["created"]) if media["created"]
if photo.valid?
Photo.transaction do
photo.save
PhotoAssociation.find_or_create_by! photo:, photographable: crop
end
Rails.logger.debug { "\t saved photo #{photo.id} #{photo.source_id}" }
else
Rails.logger.warn "Photo not valid"
end
end
end
def fetch(key)
Gbif::Request.new("species/#{key}", nil, nil, nil).perform
end
end

View File

@@ -17,21 +17,10 @@ class TimelineService
.union_all(comments_query)
.union_all(photos_query)
.union_all(seeds_query)
.union_all(activities_query)
.where.not(event_at: nil)
.order(event_at: :desc)
end
def self.activities_query
Activity.select(
:id,
"'activity' as event_type",
'COALESCE(activities.due_date, activities.created_at) as event_at',
:owner_id,
'null as crop_id'
)
end
def self.plantings_query
Planting.select(
:id,

View File

@@ -1,9 +0,0 @@
- if can?(:edit, activity)
.dropdown.activity-actions
%a#activity-actions-button.btn.btn-info.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", type: "button", href: '#'} Actions
.dropdown-menu.dropdown-menu-xs{"aria-labelledby" => "planting-actions-button"}
= activity_edit_button(activity, classes: 'dropdown-item')
- if activity.active
= activity_finish_button(activity, classes: 'dropdown-item')
.dropdown-divider
= delete_button(activity, classes: 'dropdown-item text-danger')

View File

@@ -1,35 +0,0 @@
- cache activity do
.card.activity{class: activity.active ? '' : 'card-finished'}
= link_to activity_path(slug: activity.slug) do
-# = image_tag activity.thumbnail_url ? activity.thumbnail_url : placeholder_image, class: 'img-card', alt: planting.crop_name
- if member_signed_in? && current_member.id == activity.owner_id
= link_to activity_path(slug: activity.slug) do
.activity-quick-actions
.dropdown
%a.activity-menu.btn.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", type: "button", href: '#'}
.dropdown-menu{"aria-labelledby" => "activity-menu"}
= link_to edit_activity_path(slug: activity.slug), class: 'dropdown-item' do
= edit_icon
= t('buttons.edit')
- if activity.active
= activity_finish_button(activity, classes: 'dropdown-item')
- if can? :destroy, activity
.dropdown-divider
= delete_button(activity, classes: 'dropdown-item text-danger')
= link_to activity_path(slug: activity.slug) do
.card-body.text-center
%h4= activity.name
.text-center= activity.description
- if activity.garden
.text-center= activity.garden
- if activity.planting
.text-center= activity.planting
.card-footer
.float-right
%span.chip.member-chip
= link_to member_path(slug: activity.owner_slug) do
= activity.owner_login_name

View File

@@ -1,7 +0,0 @@
#{link_to event_model.category, event_model} - #{event_model.name}
- if event_model.planting
%span on #{link_to event_model.planting, event_model.planting}
- if event_model.garden
%span in #{link_to event_model.garden, event_model.garden}

View File

@@ -1,55 +0,0 @@
.card.col-md-8.col-lg-7.mx-auto.float-none.white.z-depth-1.py-2.px-2
.card-header
- if content_for? :title
%h1.h2-responsive.text-center
= planting_icon
%strong=yield :title
= bootstrap_form_for(@activity) do |f|
.card-body
= required_field_help_text
- if @activity.errors.any?
#error_explanation
%h2
= pluralize(@activity.errors.size, "error")
prohibited this activity from being saved:
%ul
- @activity.errors.full_messages.each do |msg|
%li= msg
.row
.col-md-12
= f.text_field :name, required: true, label: 'What needs to be done?'
.row
.col-md-4
= f.select(:category, Activity::CATEGORIES, include_blank: true)
.row
.col-md-12
= f.text_area :description, rows: 6, label: 'Tell us more about it'
.row
.col-md-4
= f.collection_radio_buttons(:garden_id, @activity.owner.gardens.active,
:id, :name,
label: 'Is this for a specific garden?')
= link_to "Add a garden.", new_garden_path
.col-md-4
= f.collection_radio_buttons(:planting_id, @activity.owner.plantings.active,
:id, :crop_name,
label: 'Is this for a specific planting?')
= link_to "Add a planting.", new_planting_path
.col-md-4
= f.text_field :due_date,
value: @activity.due_date ? @activity.due_date.to_fs(:ymd) : '',
class: 'add-datepicker', label: 'When?'
%hr
.row
.col-md-6
= f.check_box :finished, label: 'Mark as finished'
%span.help-block= t('.finish_helper')
.card-footer
.text-right= f.submit 'Save'

View File

@@ -1,20 +0,0 @@
.card
.card-body
.row
.col
%h4
Planned by
= link_to @activity.owner, @activity.owner
= link_to "view all #{@activity.owner}'s activities", member_activities_path(@activity.owner)
- if @activity.garden
%p
Planned in
= link_to @activity.garden, @activity.garden
- if @activity.planting
%p
Planned for
= link_to @activity.planting, @activity.planting
.col= render "members/avatar", member: @activity.owner

View File

@@ -1,3 +0,0 @@
= content_for :title, "Editing activity"
= render 'form'

View File

@@ -1,47 +0,0 @@
csv.headers :id,
:growstuff_url,
:name,
:category,
:description,
:owner_id,
:owner_name,
:garden_id,
:garden_name,
:planting_id,
:planting_name,
:due_date,
:finished,
:date_added,
:last_modified,
:license
@activities.each do |a|
csv.row a do |csv, activity|
csv.cell :id
csv.cell :growstuff_url, activity_url(a.slug)
csv.cell :name, a.description
csv.cell :category, a.description
csv.cell :description, a.description
csv.cell :owner_id, a.owner_id
csv.cell :owner_name, a.owner_login_name
csv.cell :garden_id, a.garden_id
csv.cell :garden_name, a.garden_name
csv.cell :planting_id, a.planting_id
csv.cell :planting_name, a.planting_name
csv.cell :due_date, a.due_date ? a.due_date : ''
csv.cell :finished
csv.cell :date_added, Time.at(a.created_at).to_fs(:db)
csv.cell :last_modified, Time.at(a.updated_at).to_fs(:db)
csv.cell :license, "CC-BY-SA Growstuff http://growstuff.org/"
end
end

View File

@@ -1,43 +0,0 @@
- content_for :title, title('activities', @owner, nil, @planting)
- content_for :breadcrumbs do
- if @owner
%li.breadcrumb-item= link_to 'Activities', activities_path
%li.breadcrumb-item.active= link_to "#{@owner}'s activities", activities_path(owner: @owner)
- else
%li.breadcrumb-item.active= link_to 'Activities', activities_path
.row
.col-md-2
%h1
= activity_icon
= title('activities', @owner, nil, @planting)
= render 'layouts/nav', model: Activity
= link_to show_inactive_tickbox_path('activities', owner: @owner, crop: nil, show_all: @show_all) do
= check_box_tag 'active', 'all', @show_all
include finished activities
%hr
- if @owner.present?
= render @owner, cached: true
%section.open-data
%h2 Open Data
%p= t('label.data')
- ['csv', 'json', 'rss'].each do |format|
.badge.badge-info
= link_to (@owner ? member_activities_path(@owner, format: format) : activities_path(format: format)) do
= icon 'fas', format.to_s
= format.upcase
- if @owner
.badge.badge-info= link_to "iCal", member_activities_path(@owner, format: 'ics', protocol: 'webcal', only_path: false)
.badge.badge-success= link_to 'API Methods', '/api-docs'
.col-md-10
%section
%h2= title('activities', @owner, nil, @planting)
= will_paginate @activities
.index-cards
- @activities.each do |a|
= render 'activities/card', activity: a
= will_paginate @activities

View File

@@ -1,37 +0,0 @@
<%
# TODO Refactor to a Activity <-> Ical view class?
cal = Icalendar::Calendar.new
cal.description = "Activities by #{@owner.login_name}"
@activities.each do |activity|
event = Icalendar::Event.new
lines = []
lines << "Garden: #{activity['garden_name'] ? activity['garden_name'] : 'N/A' }"
lines << "Planting: #{activity['planting_name'] ? activity['planting_name'] : 'N/A' }"
lines << activity.description
finish_date = Date.parse(activity['due_date']) rescue nil
event.dtstart = Time.at(activity['created_at'])
event.dtend = finish_date || 1.day.from_now
event.summary = "#{activity['name']} - #{activity['category']}"
event.description = lines.join("\n")
event.ip_class = "PUBLIC"
event.url = activity_url(slug: activity['slug'])
cal.add_event(event)
if finish_date && finish_date > Date.today
todo = Icalendar::Todo.new
todo.dtstart = finish_date || Date.today
todo.due = finish_date
todo.summary = "#{activity['name']} - #{activity['category']}"
todo.description = lines.join("\n")
cal.add_todo(todo)
end
end
cal.publish
%>
<%= cal.to_ical %>

View File

@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
%rss{ version: 2.0 }
%channel
%title
Recent activities from #{@owner ? @owner : 'all members'} (#{ENV['GROWSTUFF_SITE_NAME']})
%link= activities_url
- @activities.each do |activity|
%item
%title #{activity['name']}
%pubdate= activity['created_at'].to_fs(:rfc822)
%description
:escaped
<p>Category: #{activity['category']}</p>
<p>Due Date: #{activity['due_date'] ? activity['due_date'] : 'unknown' }</p>
<p>Garden: #{activity['garden_name'] ? activity['garden_name'] : 'N/A' }</p>
<p>Planting: #{activity['planting_name'] ? activity['planting_name'] : 'N/A' }</p>
:escaped_markdown
#{ strip_tags markdownify(activity['description']) }
%link= activity_url(slug: activity['slug'])
%guid= activity_url(slug: activity['slug'])

View File

@@ -1,3 +0,0 @@
= content_for :title, t('activities.plan_something')
= render 'form'

View File

@@ -1,51 +0,0 @@
= content_for :title, @activity.name
- content_for :opengraph do
= tag("meta", property: "og:title", content: @activity.name)
- if @activity.description
= tag("meta", property: "og:description", content: og_description(@activity.description))
= tag("meta", property: "og:type", content: "website")
= tag("meta", property: "og:url", content: request.original_url)
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
- content_for :breadcrumbs do
%li.breadcrumb-item= link_to 'Activities', activities_path
%li.breadcrumb-item= link_to @activity.owner, member_activities_path(@activity.owner)
%li.breadcrumb-item.active= link_to @activity.name, @activity
.activity
.row
.col-md-8.col-xs-12
.jumbotron
.d-flex.justify-content-between
%h1.display-3
%strong= @activity.name.titleize
%small.text-muted= @activity.category
%tt
= @activity.due_date
.col-md-4.col-xs-12
= render 'activities/owner', planting: @activity
.col-md-8.col-xs-12
- if @activity.description.present?
= cute_icon
.card
.card-header
%h2 Description
.card-body
:markdown
#{strip_tags markdownify(@activity.description)}
- if @activity.garden
%section.gardens
%a{name: 'gardens'}
= render 'gardens/card', garden: @activity.garden
- if @activity.planting
%section.plantings
%a{name: 'plantings'}
= render 'plantings/card', planting: @activity.planting
.col-md-4.col-xs-12
= render 'activities/actions', activity: @activity

View File

@@ -30,7 +30,6 @@
%li= link_to "Crop Wrangling", wrangle_crops_path, class: 'nav-link'
%li= link_to "Alternate names", alternate_names_path, class: 'nav-link'
%li= link_to "Scientific names", scientific_names_path, class: 'nav-link'
%li= link_to "Plant parts", plant_parts_path, class: 'nav-link'
.col-md-4
.card

View File

@@ -4,4 +4,3 @@
- @members.each do |m|
= m.email
%br/
= will_paginate @members

View File

@@ -5,7 +5,7 @@
%li.breadcrumb-item.active= link_to 'Roles', admin_roles_path
- if can? :create, Role
%p= link_to 'New role', new_admin_role_path, class: 'btn btn-primary'
%p= link_to 'New Role', new_admin_role_path, class: 'btn btn-primary'
%table.table.table-striped
%thead
@@ -25,8 +25,6 @@
= edit_icon
= t('.edit')
- if can?(:destroy, role) && ! role.members.any?
= link_to admin_role_path(role), method: :delete, data: { confirm: t(:are_you_sure?) }, class: 'btn btn-default btn-xs text-danger' do
= link_to admin_role_path(role), method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-default btn-xs text-danger' do
= delete_icon
= t('.delete')
= will_paginate(@roles)

View File

@@ -3,7 +3,7 @@
- if content_for? :title
%h1.h2-responsive.text-center
%strong=yield :title
= form_for @alternate_name, html: { class: 'form-horizontal' } do |f|
= form_for @alternate_name, html: { class: 'form-horizontal', role: "form" } do |f|
- if @alternate_name.errors.any?
#error_explanation
%h2

View File

@@ -17,11 +17,10 @@
%td= link_to 'Show', alternate_name
%td
- if can? :edit, alternate_name
= link_to t('buttons.edit'), edit_alternate_name_path(alternate_name), class: 'btn btn-default btn-xs'
= link_to 'Edit', edit_alternate_name_path(alternate_name), class: 'btn btn-default btn-xs'
%td
- if can? :destroy, alternate_name
= link_to t('buttons.delete'), alternate_name,
method: :delete,
data: { confirm: t(:are_you_sure?) },
class: 'btn btn-default btn-xs'
= will_paginate(@alternate_names)
= link_to 'Delete', alternate_name,
method: :delete,
data: { confirm: 'Are you sure?' },
class: 'btn btn-default btn-xs'

View File

@@ -3,7 +3,7 @@
- if content_for? :title
%h1.h2-responsive.text-center
%strong=yield :title
= form_for(@comment, html: { class: "form-horizontal" }) do |f|
= form_for(@comment, html: { class: "form-horizontal", role: "form" }) do |f|
- if @comment.errors.any?
#error_explanation
%h2

View File

@@ -6,7 +6,7 @@
- if can?(:edit, comment) || can?(:destroy, comment)
%hr/
.dropdown
%button#comment-edit-button.btn.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", type: "button"} Actions
%button#comment-edit-button.btn.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", type: "button"} Actions
.dropdown-menu.dropdown-menu-xs{"aria-labelledby" => "comment-edit-button"}
- if can? :edit, comment
= link_to edit_comment_path(comment), class: 'dropdown-item' do
@@ -31,6 +31,6 @@
= comment.updated_at
.comment-body
:markdown
#{ strip_tags markdownify(comment.body) }
:growstuff_markdown
#{ strip_tags comment.body }

View File

@@ -7,14 +7,14 @@
%item
%title Comment by #{comment.author.login_name} on #{comment.post.subject}
%description
:escaped_markdown
:escaped
<p>
Comment on
#{ link_to comment.post.subject, post_url(comment.post) }
</p>
:escaped_markdown
#{ strip_tags markdownify(comment.body) }
#{ strip_tags comment.body }
%pubdate= comment.created_at.to_fs(:rfc822)
%link= post_url(comment.post)

View File

@@ -8,27 +8,33 @@
.col-2.offset-md-2
%h1= @box
.col-8
= button_tag(type: 'submit', class: 'btn btn-default') do
= icon 'fas', 'trash-alt'
= 'Delete Selected'
.row
.col-md-2.py-4
- @boxes.each do |box_name, counts|
= link_to conversations_path(box: box_name), class: "nav-link list-group-item d-flex justify-content-between #{box_name == @box ? 'active' : ''} #{box_name}" do
%span
= box_name
- if counts['unread'].positive?
%span.badge.badge-info=counts['unread']
- else
%span
%span
= icon 'fas', box_name
= box_name
.col-md-10
.list-group
- @conversations.each do |conversation|
.list-group-item
.row
.col-1
.col-md-1
- if conversation.receipts_for(current_member).last.is_unread?
%h1= icon 'far', 'envelope'
- else
%h1.text-muted= icon 'far', 'envelope-open'
.col-9
.col-md-10
.text-right.float-right
- conversation.recipients.each do |member|
- if member != current_member
@@ -44,15 +50,11 @@
#{time_ago_in_words conversation.messages.last.created_at} ago
%span.text-muted= conversation.messages.last.created_at
= truncate(strip_tags(conversation.messages.last.body), length: 150, separator: ' ', omission: '... ')
.col-1
.col-md-1
- if @box == 'trash'
= link_to conversation_path(conversation, box: @box), method: :put, class: 'restore', title: "Restore" do
= link_to conversation_path(conversation, box: @box), method: :put, class: 'restore' do
= icon 'fas', 'trash-restore'
- else
= check_box_tag 'conversation_ids[]', conversation.id, false, class: 'selectable', "aria-label": "Select for deletion"
.offset-9.col-3
= button_tag(type: 'submit', class: 'btn btn-default') do
= icon 'fas', 'trash-alt'
= 'Delete'
= check_box_tag 'conversation_ids[]', conversation.id, false, class: 'selectable'
- unless @conversations.empty?
= will_paginate @conversations

View File

@@ -26,8 +26,8 @@
= render 'members/tiny', member: message.sender
.col-12
%p.text-justify
:markdown
#{ strip_tags markdownify(message.body) }
:growstuff_markdown
#{ strip_tags(message.body) }
%li.list-group-item
= icon 'fas', 'reply'
= render 'messages/form', conversation: @conversation

View File

@@ -4,7 +4,7 @@
- crop.alternate_names.each do |an|
- 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 => '#'}
%a#crop-actions-altnames.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", :type => "button", :href => '#'}
= an.name
.dropdown-menu.dropdown-menu-xs{"aria-labelledby" => "crop-actions-altnames"}
- if can? :edit, an

View File

@@ -1,7 +1,7 @@
.card.card-crop
.crop-image
= link_to image_tag(crop_image_path(crop),
alt: "Image of #{crop.name}",
alt: '',
class: 'img img-card'),
crop
.card-body

View File

@@ -65,12 +65,8 @@
.col-2
= label_tag :scientific_names, "Scientific name #{index + 1}:", class: 'control-label'
.col-8
= text_field_tag "sci_name[#{index + 1}]", sci.name, id: "sci_name[#{index + 1}]",
class: 'scientific-name-auto-suggest form-control',
data: { source_url: gbif_suggest_scientific_names_path }
%span.help-block Searches GBIF to determine scientific name of crop.
= hidden_field_tag "sci_gbif_key[#{index + 1}]", sci.gbif_key, id: "sci_gbif_key[#{index + 1}]",
class: 'scientific-name-auto-suggest-id'
= text_field_tag "sci_name[#{index + 1}]", sci.name, id: "sci_name[#{index + 1}]", class: 'form-control'
%span.help-block Scientific name of crop.
%h2 Alternate names
= button_tag "+", class: "add-altname-row", type: "button"
= button_tag "-", class: "remove-altname-row", type: "button"

View File

@@ -1,10 +1,9 @@
- cache crop do
= link_to image_tag(crop_image_path(crop),
alt: "Image of #{crop.name}", class: 'image-responsive crop-image'),
alt: crop.name, class: 'image-responsive crop-image'),
crop.name,
rel: "popover",
'data-bs-toggle': 'popover',
'data-bs-trigger': 'hover',
'data-bs-title': crop.name,
'data-bs-content': render(partial: 'crops/popover', locals: { crop: crop }),
'data-bs-html': true
'data-trigger': 'hover',
'data-title': crop.name,
'data-content': render(partial: 'crops/popover', locals: { crop: crop }),
'data-html': true

View File

@@ -25,4 +25,4 @@
%p= simple_format @crop.description
.col-md-3
= image_tag crop_image_path(@crop),
class: 'img-responsive shadow rounded crop-hero-photo', alt: "Image of #{@crop.name}"
class: 'img-responsive shadow rounded crop-hero-photo', alt: 'photo of crop'

View File

@@ -6,7 +6,7 @@
- crop.scientific_names.each do |sn|
- if can? :edit, sn
.dropdown.planting-actions
%a#planting-actions-scinames.dropdown-toggle.card-link{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", :type => "button", :href => '#'}= sn.name
%a#planting-actions-scinames.dropdown-toggle.card-link{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", :type => "button", :href => '#'}= sn.name
.dropdown-menu.dropdown-menu-xs{"aria-labelledby" => "planting-actions-button"}
= link_to edit_scientific_name_path(sn), class: 'dropdown-item' do
= edit_icon
@@ -16,13 +16,7 @@
= delete_icon
= t('.delete')
- else
- if sn.gbif_key
= link_to sn.name, "https://www.gbif.org/species/#{sn.gbif_key}",
class: 'card-link',
target: "_blank",
rel: "noopener noreferrer"
- else
.badge= sn.name
.badge= sn.name
%p.text-right
- if can? :edit, crop

View File

@@ -2,12 +2,11 @@
.card.crop-thumbnail
= link_to crop_path(slug: crop.slug) do
= image_tag(crop.thumbnail_url.presence || placeholder_image,
alt: "Image of #{crop.name}",
alt: crop.name,
class: 'img img-card')
.text
%h3.crop-name= link_to crop.name, crop_path(slug: crop.slug)
- if crop.scientific_names.any?
%div.crop-sci-name
= crop.scientific_names.first
%h5.crop-sci-name
= crop.scientific_names.first

View File

@@ -4,7 +4,7 @@
You are a
%strong CROP WRANGLER
.dropdown.crop-actions
%a#crop-actions-button.btn.btn-info.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", :type => "button", href: '#'} Actions
%a#crop-actions-button.btn.btn-info.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", :type => "button", href: '#'} Actions
.dropdown-menu.dropdown-menu-xs{"aria-labelledby" => "crop-actions-button"}
= link_to edit_crop_path(crop), class: 'dropdown-item' do
= edit_icon
@@ -14,10 +14,6 @@
= 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
- if can? :destroy, crop
.dropdown-divider
= delete_button(crop, classes: 'dropdown-item text-danger')

View File

@@ -58,10 +58,10 @@ csv.headers *all_headers
end
csv.cell :plantings_count, c.plantings_count || 0
csv.cell :seeds_count, c.seeds.size[]
csv.cell :seeds_count, c.seeds.size
csv.cell :harvests_count, c.harvests.size
# Sunniness
# Sunniness
sunniness = c.sunniness
sunniness_rec = sunniness.max_by{|k,v| v}

View File

@@ -9,6 +9,15 @@
- content_for :breadcrumbs do
%li.breadcrumb-item.active= link_to 'Crops', crops_path
= bootstrap_form_tag(url: crops_path, method: :get, layout: :inline) do |f|
.input-group
= f.select "sort",
options_for_select({ "popularity": 'popular',
"alphabetically": 'alpha' },
@sort || 'popular'),
label: 'Sort by'
= f.submit "Show"
%section.crops
%h2= t('.title')
= will_paginate @crops

View File

@@ -86,7 +86,7 @@
= link_to crop_plantings_path(@crop), class: 'card-link' do
= planting_icon
#{@crop.name.capitalize} plantings
%span.badge.badge-primary.badge-pill=@crop.plantings.active.size
%span.badge.badge-primary.badge-pill=@crop.plantings.size
.list-group-item.d-flex.justify-content-between.align-items-center
= link_to crop_harvests_path(@crop), class: 'card-link' do
= harvest_icon

View File

@@ -10,15 +10,15 @@
.card
%ul#myTab.nav.nav-tabs{role: "tablist"}
%li.nav-item
%a#profile-tab.nav-link.active{"aria-controls" => "profile", "aria-selected" => "true", "data-bs-toggle" => "tab", href: "#profile", role: "tab"} Profile
%a#profile-tab.nav-link.active{"aria-controls" => "profile", "aria-selected" => "true", "data-toggle" => "tab", href: "#profile", role: "tab"} Profile
%li.nav-item
%a#email-tab.nav-link{"aria-controls" => "email", "aria-selected" => "false", "data-bs-toggle" => "tab", href: "#email", role: "tab"} Email
%a#email-tab.nav-link{"aria-controls" => "email", "aria-selected" => "false", "data-toggle" => "tab", href: "#email", role: "tab"} Email
%li.nav-item
%a#apps-tab.nav-link{"aria-controls" => "apps", "aria-selected" => "false", "data-bs-toggle" => "tab", href: "#apps", role: "tab"} Apps
%a#apps-tab.nav-link{"aria-controls" => "apps", "aria-selected" => "false", "data-toggle" => "tab", href: "#apps", role: "tab"} Apps
%li.nav-item
%a#password-tab.nav-link{"aria-controls" => "password", "aria-selected" => "false", "data-bs-toggle" => "tab", href: "#password", role: "tab"} Password
%a#password-tab.nav-link{"aria-controls" => "password", "aria-selected" => "false", "data-toggle" => "tab", href: "#password", role: "tab"} Password
%li.nav-item
%a#delete-tab.nav-link.text-danger{"aria-controls" => "delete", "aria-selected" => "false", "data-bs-toggle" => "tab", href: "#delete", role: "tab"} Delete Account
%a#delete-tab.nav-link.text-danger{"aria-controls" => "delete", "aria-selected" => "false", "data-toggle" => "tab", href: "#delete", role: "tab"} Delete Account
.card-body
#myTabContent.tab-content
#profile.tab-pane.fade.show.active{"aria-labelledby" => "profile-tab", role: "tabpanel"}

View File

@@ -3,10 +3,9 @@
%h1 Join #{ENV['GROWSTUFF_SITE_NAME']}
.card-body
%p Sign up for a #{ENV['GROWSTUFF_SITE_NAME']} account to track your vegetable garden and connect with other local growers.
%p If you have accessibility issues with the captcha, please contact us via the links in the footer and we will help.
= bootstrap_form_for(resource, as: resource_name, url: registration_path(resource_name),
html: { class: "text-center border border-light p-5", data: { turbo: false } }) do |f|
html: { class: "text-center border border-light p-5" }) do |f|
= render 'devise/shared/error_messages', resource: resource
= f.text_field :login_name
@@ -29,9 +28,4 @@
= f.submit "Sign up", class: 'btn btn-block btn-success'
-# START add reCAPTCHA
= flash[:recaptcha_error]
= recaptcha_tags
-# END add reCAPTCHA
.card-footer= render "devise/shared/links"

View File

@@ -14,8 +14,8 @@
- @forum.errors.full_messages.each do |msg|
%li= msg
= f.text_field :name, required: true
= f.text_area :description, rows: 6, required: true
= f.select(:owner_id, Member.all.order(:login_name).pluck(:login_name, :id), required: true)
= f.text_field :name
= f.text_area :description, rows: 6
= f.select(:owner_id, Member.all.order(:login_name).pluck(:login_name, :id))
.card-footer
.text-right= f.submit 'Save'

View File

@@ -16,8 +16,8 @@
= link_to @forum.owner, @forum.owner
%div
:markdown
#{ strip_tags markdownify(@forum.description) }
:growstuff_markdown
#{ strip_tags(@forum.description) }
- if can? :edit, @forum
= link_to "Edit", edit_forum_path(@forum), class: 'btn btn-default btn-xs'

View File

@@ -1,4 +1,4 @@
= form_for @garden_type, html: { class: 'form-horizontal' } do |f|
= form_for @garden_type, html: { class: 'form-horizontal', role: "form" } do |f|
- if @garden_type.errors.any?
#error_explanation
%h2= "#{pluralize(@garden_type.errors.count, "error")} prohibited this garden_type from being saved:"

View File

@@ -1,11 +1,10 @@
- if can?(:edit, garden)
.dropdown.garden-actions
%a#garden-actions-button.btn.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", type: "button", href: '#'} Actions
%a#garden-actions-button.btn.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", type: "button", href: '#'} Actions
.dropdown-menu.dropdown-menu-xs{"aria-labelledby" => "garden-actions-button"}
- if can?(:edit, garden)
= garden_plant_something_button(garden, classes: 'dropdown-item') if garden.active
- if garden.active
= garden_plant_something_button(garden, classes: 'dropdown-item')
= garden_plan_something_button(garden, classes: 'dropdown-item')
= garden_mark_inactive_button(garden, classes: 'dropdown-item')
- else
= garden_mark_active_button(garden, classes: 'dropdown-item')

View File

@@ -1,37 +0,0 @@
.card
.card-header
.row
.col-12.col-md-3
%h2= link_to garden.name, garden, name: "garden-#{garden.id}"
.row
.col-md-3
- if @owner.blank?
owner:
= render 'members/tiny', member: garden.owner
= image_tag garden_image_path(garden), alt: garden.name, class: 'img-card'
.col-md-9
%section
= render 'gardens/actions', garden: garden
- active_plantings = garden.plantings.active
%section
- if active_plantings.perennial.any?
%strong Perennials:
- active_plantings.perennial.each do |planting|
= link_to planting do
= crop_icon planting.crop
= planting.crop
- else
%p No perennial plantings
%hr
%section
- if active_plantings.annual.any?
= render 'plantings/progress_list', plantings: garden.plantings.active.annual
- else
%p No annual plantings

View File

@@ -1,5 +1,5 @@
.card
= link_to garden do
= image_tag garden_image_path(garden), class: 'img-card', alt: "Image of #{garden.name}"
= image_tag garden_image_path(garden), class: 'img-card', alt: garden
.card-body.text-center
%h4.card-title= garden.name

View File

@@ -17,4 +17,4 @@
.col-lg-2.col-sm-4.col-xs-6
= render "plantings/thumbnail", planting: planting
- else
no plantings
no plantings

View File

@@ -1,3 +1,3 @@
= link_to image_tag(garden_image_path(garden),
alt: "Image of #{garden.name}", class: 'img-responsive'),
alt: garden.name, class: 'img-responsive'),
garden_path(garden)

View File

@@ -12,10 +12,9 @@
.row
.col-md-2
= render 'layouts/nav', model: Garden
%label
= link_to show_inactive_tickbox_path('gardens', owner: @owner, show_all: @show_all) do
= check_box_tag 'active', 'all', @show_all
include in-active
= link_to show_inactive_tickbox_path('gardens', owner: @owner, show_all: @show_all) do
= check_box_tag 'active', 'all', @show_all
include in-active
- if @owner.present?
%hr/
= render @owner
@@ -42,7 +41,43 @@
- else
= link_to garden.name, gardens_path(anchor: "garden-#{garden.id}")
- @gardens.each do |garden|
= render 'gardens/card', garden: garden
.card
.card-header
.row
.col-12.col-md-3
%h2= link_to garden.name, garden, name: "garden-#{garden.id}"
.row
.col-md-3
- if @owner.blank?
owner:
= render 'members/tiny', member: garden.owner
= image_tag garden_image_path(garden), alt: garden.name, class: 'img-card'
.col-md-9
%section
= render 'gardens/actions', garden: garden
- active_plantings = garden.plantings.active
%section
- if active_plantings.perennial.any?
%strong Perennials:
- active_plantings.perennial.each do |planting|
= link_to planting do
= crop_icon planting.crop
= planting.crop
- else
%p No perennial plantings
%hr
%section
- if active_plantings.annual.any?
= render 'plantings/progress_list', plantings: garden.plantings.active.annual
- else
%p No annual plantings
.row
.col-12= page_entries_info @gardens

View File

@@ -29,8 +29,8 @@
to plant something in this garden.
%div
%p
:markdown
#{strip_tags markdownify(@garden.description)}
:growstuff_markdown
#{strip_tags @garden.description}
- unless @garden.description
.row-fluid
%p No description available yet.
@@ -56,21 +56,10 @@
.col-md-12
%p Nothing is currently planted here.
%section
%h2 Current activities in garden
.index-cards
- if @current_activities&.size&.positive?
- @current_activities.each do |activity|
= render "activities/card", activity: activity
- else
.col-md-12
%p Nothing is currently planned here.
- if @suggested_companions.any?
%section.companions
%h2 Suggestioned companions
- @suggested_companions.each do |companion|
= render 'crops/tiny', crop: companion
%section.companions
%h2 Suggestioned companions
- @suggested_companions.each do |companion|
= render 'crops/tiny', crop: companion
%section= render 'previously'

View File

@@ -1,6 +1,6 @@
- if can?(:edit, harvest)
.dropdown.harvest-actions
%a#harvest-actions-button.btn.btn-info.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", type: "button", href: '#'} Actions
%a#harvest-actions-button.btn.btn-info.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", type: "button", href: '#'} Actions
.dropdown-menu.dropdown-menu-xs{"aria-labelledby" => "harvest-actions-button"}
= harvest_edit_button(harvest, classes: 'dropdown-item')
= add_photo_button(harvest, classes: 'dropdown-item')

Some files were not shown because too many files have changed in this diff Show More