mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-25 09:19:15 -04:00
Compare commits
67 Commits
release52
...
feature/pa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
76db8177d0 | ||
|
|
6735fa7535 | ||
|
|
e92600a07e | ||
|
|
dba9a7b2b5 | ||
|
|
8c69652f4e | ||
|
|
70e9c029d7 | ||
|
|
08c1a4e80d | ||
|
|
1ed8befb64 | ||
|
|
0ba32ab15e | ||
|
|
42ce0d2b9b | ||
|
|
8eb101138d | ||
|
|
d2aa8d2e9b | ||
|
|
7450dc43e2 | ||
|
|
0ec892171c | ||
|
|
74c7b79eaa | ||
|
|
a8daccc621 | ||
|
|
9490960063 | ||
|
|
e7980631d6 | ||
|
|
9d78dd603c | ||
|
|
224e17352f | ||
|
|
9f1671cbc5 | ||
|
|
503b54da1f | ||
|
|
8aa7fdda2d | ||
|
|
ba86a480bb | ||
|
|
45780ac3f0 | ||
|
|
e4942a6646 | ||
|
|
f77ab839ff | ||
|
|
b63c9ca7eb | ||
|
|
d68acafd41 | ||
|
|
80e2487b1b | ||
|
|
26a3d6968c | ||
|
|
84717a7937 | ||
|
|
3c4ecef985 | ||
|
|
a59db8c090 | ||
|
|
757394ddd9 | ||
|
|
037dd8c548 | ||
|
|
30fff768f2 | ||
|
|
a23b8f34f8 | ||
|
|
e6a01473fd | ||
|
|
7b42d86921 | ||
|
|
a66187fe41 | ||
|
|
1e897ac671 | ||
|
|
989750ac47 | ||
|
|
61363305b5 | ||
|
|
4a8f76e21a | ||
|
|
2bddc15cb0 | ||
|
|
2cf449800c | ||
|
|
30d1fd67ab | ||
|
|
aa2648784f | ||
|
|
282e76b599 | ||
|
|
31dc367298 | ||
|
|
ca3265841c | ||
|
|
99ae2da126 | ||
|
|
df2aacd7ff | ||
|
|
d629e0d976 | ||
|
|
bf9e3328eb | ||
|
|
40989aeefe | ||
|
|
a11db6767b | ||
|
|
fc72f0072c | ||
|
|
0e02ee749f | ||
|
|
94e6576b36 | ||
|
|
1bfd3851e8 | ||
|
|
d590a4337d | ||
|
|
d0455c25ab | ||
|
|
7c55ce628a | ||
|
|
95bc0a927c | ||
|
|
8eb8275493 |
@@ -1,33 +1,25 @@
|
||||
plugins:
|
||||
engines:
|
||||
rubocop:
|
||||
enabled: true
|
||||
channel: "rubocop-0-88"
|
||||
scss-lint:
|
||||
enabled: true
|
||||
shellcheck:
|
||||
enabled: true
|
||||
eslint:
|
||||
enabled: true
|
||||
coffeelint:
|
||||
enabled: true
|
||||
brakeman:
|
||||
enabled: false # codeclimate's brakeman is stuck in rails 5 rules
|
||||
bundler-audit:
|
||||
enabled: true
|
||||
coffeelint:
|
||||
enabled: true
|
||||
duplication:
|
||||
enabled: true
|
||||
config:
|
||||
languages:
|
||||
- ruby
|
||||
- javascript
|
||||
editorconfig:
|
||||
enabled: true
|
||||
eslint:
|
||||
enabled: true
|
||||
fixme:
|
||||
enabled: true
|
||||
haml-lint:
|
||||
enabled: true
|
||||
nodesecurity:
|
||||
enabled: true
|
||||
rubocop:
|
||||
enabled: true
|
||||
channel: "rubocop-1-11"
|
||||
scss-lint:
|
||||
enabled: true
|
||||
shellcheck:
|
||||
enabled: true
|
||||
ratings:
|
||||
paths:
|
||||
- "**.rb"
|
||||
|
||||
59
.github/dependabot.yml
vendored
59
.github/dependabot.yml
vendored
@@ -1,59 +0,0 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: bundler
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: daily
|
||||
time: "07:00"
|
||||
open-pull-requests-limit: 20
|
||||
versioning-strategy: lockfile-only
|
||||
ignore:
|
||||
- dependency-name: active_median
|
||||
versions:
|
||||
- "< 0.2.2, >= 0.2.1.a"
|
||||
- dependency-name: rubocop
|
||||
versions:
|
||||
- "< 0.63, >= 0.62.a"
|
||||
- dependency-name: rubocop
|
||||
versions:
|
||||
- "< 0.64, >= 0.63.a"
|
||||
- dependency-name: sidekiq
|
||||
versions:
|
||||
- 5.2.4
|
||||
- dependency-name: oj
|
||||
versions:
|
||||
- 3.11.4
|
||||
- dependency-name: listen
|
||||
versions:
|
||||
- 3.5.0
|
||||
- dependency-name: rspec-rails
|
||||
versions:
|
||||
- 4.1.0
|
||||
- 5.0.0
|
||||
- dependency-name: searchkick
|
||||
versions:
|
||||
- 4.4.3
|
||||
- dependency-name: rswag-api
|
||||
versions:
|
||||
- 2.3.3
|
||||
- dependency-name: rswag-specs
|
||||
versions:
|
||||
- 2.3.3
|
||||
- dependency-name: rswag-ui
|
||||
versions:
|
||||
- 2.3.3
|
||||
- dependency-name: timecop
|
||||
versions:
|
||||
- 0.9.3
|
||||
- dependency-name: puma
|
||||
versions:
|
||||
- 5.2.0
|
||||
- dependency-name: capybara
|
||||
versions:
|
||||
- 3.35.1
|
||||
- package-ecosystem: github-actions
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: daily
|
||||
time: "07:00"
|
||||
open-pull-requests-limit: 10
|
||||
40
.github/workflows/brakeman-analysis.yml
vendored
40
.github/workflows/brakeman-analysis.yml
vendored
@@ -1,40 +0,0 @@
|
||||
# This workflow integrates Brakeman with GitHub's Code Scanning feature
|
||||
# Brakeman is a static analysis security vulnerability scanner for Ruby on Rails applications
|
||||
|
||||
name: Brakeman Scan
|
||||
|
||||
# This section configures the trigger for the workflow. Feel free to customize depending on your convention
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ dev ]
|
||||
|
||||
jobs:
|
||||
brakeman-scan:
|
||||
name: Brakeman Scan
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# Checkout the repository to the GitHub Actions runner
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# Customize the ruby version depending on your needs
|
||||
- name: Setup Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
|
||||
- name: Setup Brakeman
|
||||
env:
|
||||
BRAKEMAN_VERSION: '5.1.1' # SARIF support is provided in Brakeman version 4.10+
|
||||
run: |
|
||||
gem install brakeman --version $BRAKEMAN_VERSION
|
||||
|
||||
# Execute Brakeman CLI and generate a SARIF output with the security issues identified during the analysis
|
||||
- name: Scan
|
||||
continue-on-error: true
|
||||
run: |
|
||||
brakeman -f sarif -o output.sarif.json .
|
||||
|
||||
# Upload the SARIF file generated in the previous step
|
||||
- name: Upload SARIF
|
||||
uses: github/codeql-action/upload-sarif@v2
|
||||
with:
|
||||
sarif_file: output.sarif.json
|
||||
113
.github/workflows/ci.yml
vendored
113
.github/workflows/ci.yml
vendored
@@ -6,117 +6,10 @@ jobs:
|
||||
contributors:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v1
|
||||
|
||||
- name: Install ruby version specified in .ruby-version
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
bundler-cache: true
|
||||
- name: Install gem bundle
|
||||
run: |
|
||||
gem install bundler
|
||||
bundle install
|
||||
- name: Check contributors
|
||||
run: |
|
||||
bundle exec script/check_contributors_md.rb
|
||||
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@v3
|
||||
|
||||
- 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@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 }}
|
||||
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@v3
|
||||
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 (report results to Percy.io and CodeClimate)
|
||||
run: bundle exec rspec spec -fd
|
||||
|
||||
- name: Report to code climate
|
||||
run: |
|
||||
gem install codeclimate-test-reporter
|
||||
codeclimate-test-reporter
|
||||
./script/check_contributors_md.rb
|
||||
|
||||
82
.rubocop.yml
82
.rubocop.yml
@@ -1,9 +1,6 @@
|
||||
inherit_from: .rubocop_todo.yml
|
||||
require:
|
||||
- rubocop-rails
|
||||
- rubocop-rspec
|
||||
require: rubocop-rails
|
||||
AllCops:
|
||||
NewCops: enable
|
||||
Exclude:
|
||||
- 'db/schema.rb'
|
||||
- 'vendor/**/*'
|
||||
@@ -18,11 +15,6 @@ Naming/FileName:
|
||||
- 'Gemfile'
|
||||
- 'Gemfile.lock'
|
||||
|
||||
RSpec/DescribeClass:
|
||||
Exclude:
|
||||
- 'spec/views/**/*.rb'
|
||||
- 'spec/features/**/*.rb'
|
||||
|
||||
Layout/MultilineMethodCallIndentation:
|
||||
EnforcedStyle: indented
|
||||
|
||||
@@ -68,3 +60,75 @@ Rails/SkipsModelValidations:
|
||||
Exclude:
|
||||
- 'db/migrate/20190317023129_finished_boolean.rb'
|
||||
- 'db/seeds.rb'
|
||||
|
||||
|
||||
Layout/EmptyLinesAroundAttributeAccessor:
|
||||
Enabled: true
|
||||
Layout/SpaceAroundMethodCallOperator:
|
||||
Enabled: true
|
||||
Lint/DeprecatedOpenSSLConstant:
|
||||
Enabled: true
|
||||
Lint/DuplicateElsifCondition:
|
||||
Enabled: true
|
||||
Lint/MixedRegexpCaptureTypes:
|
||||
Enabled: true
|
||||
Lint/RaiseException:
|
||||
Enabled: true
|
||||
Lint/StructNewOverride:
|
||||
Enabled: true
|
||||
Style/AccessorGrouping:
|
||||
Enabled: true
|
||||
Style/ArrayCoercion:
|
||||
Enabled: true
|
||||
Style/BisectedAttrAccessor:
|
||||
Enabled: false
|
||||
Style/CaseLikeIf:
|
||||
Enabled: true
|
||||
Style/ExponentialNotation:
|
||||
Enabled: true
|
||||
Style/HashAsLastArrayItem:
|
||||
Enabled: true
|
||||
Style/HashEachMethods:
|
||||
Enabled: true
|
||||
Style/HashLikeCase:
|
||||
Enabled: true
|
||||
Style/HashTransformKeys:
|
||||
Enabled: true
|
||||
Style/HashTransformValues:
|
||||
Enabled: true
|
||||
Style/RedundantAssignment:
|
||||
Enabled: true
|
||||
Style/RedundantFetchBlock:
|
||||
Enabled: true
|
||||
Style/RedundantFileExtensionInRequire:
|
||||
Enabled: true
|
||||
Style/RedundantRegexpCharacterClass:
|
||||
Enabled: true
|
||||
Style/RedundantRegexpEscape:
|
||||
Enabled: true
|
||||
Style/SlicingWithRange:
|
||||
Enabled: true
|
||||
Rails/ActiveRecordCallbacksOrder:
|
||||
Enabled: true
|
||||
Rails/FindById:
|
||||
Enabled: true
|
||||
Rails/Inquiry:
|
||||
Enabled: true
|
||||
Rails/MailerName:
|
||||
Enabled: true
|
||||
Rails/MatchRoute:
|
||||
Enabled: true
|
||||
Rails/NegateInclude:
|
||||
Enabled: true
|
||||
Rails/Pluck:
|
||||
Enabled: true
|
||||
Rails/PluckInWhere:
|
||||
Enabled: true
|
||||
Rails/RenderInline:
|
||||
Enabled: true
|
||||
Rails/RenderPlainText:
|
||||
Enabled: true
|
||||
Rails/ShortI18n:
|
||||
Enabled: true
|
||||
Rails/WhereExists:
|
||||
Enabled: true
|
||||
|
||||
@@ -1,384 +1,21 @@
|
||||
# This configuration was generated by
|
||||
# `rubocop --auto-gen-config`
|
||||
# on 2022-11-07 13:39:24 UTC using RuboCop version 1.38.0.
|
||||
# `rubocop --auto-gen-config --no-offense-counts`
|
||||
# on 2019-12-16 21:01:58 +1300 using RuboCop version 0.77.0.
|
||||
# The point is for the user to remove these configuration records
|
||||
# one by one as the offenses are removed from the code base.
|
||||
# Note that changes in the inspected code, or installation of new
|
||||
# versions of RuboCop, may require this file to be generated again.
|
||||
|
||||
# Offense count: 5
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: EmptyLineBetweenMethodDefs, EmptyLineBetweenClassDefs, EmptyLineBetweenModuleDefs, AllowAdjacentOneLineDefs, NumberOfEmptyLines.
|
||||
Layout/EmptyLineBetweenDefs:
|
||||
Lint/AmbiguousOperator:
|
||||
Exclude:
|
||||
- 'db/migrate/20171129041341_create_photographings.rb'
|
||||
- 'db/migrate/20190130090437_add_crop_to_photographings.rb'
|
||||
- 'spec/controllers/crops_controller_spec.rb'
|
||||
|
||||
# Offense count: 10
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: AutoCorrect, EnforcedStyle.
|
||||
# SupportedStyles: space, no_space
|
||||
Layout/LineContinuationSpacing:
|
||||
Exclude:
|
||||
- 'app/mailers/notifier_mailer.rb'
|
||||
- 'app/models/seed.rb'
|
||||
- 'lib/tasks/growstuff.rake'
|
||||
- 'spec/features/rss/plantings_spec.rb'
|
||||
- 'spec/features/rss/posts_spec.rb'
|
||||
- 'spec/features/rss/seeds_spec.rb'
|
||||
- 'spec/models/seed_spec.rb'
|
||||
|
||||
# Offense count: 9
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
||||
# SupportedStyles: aligned, indented
|
||||
Layout/LineEndStringConcatenationIndentation:
|
||||
Exclude:
|
||||
- 'app/mailers/notifier_mailer.rb'
|
||||
- 'app/models/seed.rb'
|
||||
- 'lib/tasks/growstuff.rake'
|
||||
- 'spec/features/rss/plantings_spec.rb'
|
||||
- 'spec/features/rss/posts_spec.rb'
|
||||
- 'spec/features/rss/seeds_spec.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
|
||||
# URISchemes: http, https
|
||||
Layout/LineLength:
|
||||
Max: 304
|
||||
|
||||
# Offense count: 3
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
Lint/AmbiguousOperatorPrecedence:
|
||||
Exclude:
|
||||
- 'db/seeds.rb'
|
||||
- 'spec/helpers/gardens_helper_spec.rb'
|
||||
- 'spec/helpers/seeds_helper_spec.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: RequireParenthesesForMethodChains.
|
||||
Lint/AmbiguousRange:
|
||||
Exclude:
|
||||
- 'app/models/concerns/search_harvests.rb'
|
||||
- 'app/models/concerns/search_plantings.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches.
|
||||
Lint/DuplicateBranch:
|
||||
Exclude:
|
||||
- 'app/models/harvest.rb'
|
||||
- 'lib/actions/oauth_signup_action.rb'
|
||||
|
||||
# Offense count: 8
|
||||
# Configuration parameters: AllowComments, AllowEmptyLambdas.
|
||||
Lint/EmptyBlock:
|
||||
Exclude:
|
||||
- 'db/migrate/20171022032108_all_the_predictions.rb'
|
||||
- 'spec/controllers/home_controller_spec.rb'
|
||||
- 'spec/controllers/likes_controller_spec.rb'
|
||||
- 'spec/controllers/plant_parts_controller_spec.rb'
|
||||
- 'spec/factories/crop_companions.rb'
|
||||
- 'spec/features/crops/crop_detail_page_spec.rb'
|
||||
- 'spec/requests/authentications_spec.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
Lint/RedundantDirGlobSort:
|
||||
Exclude:
|
||||
- 'spec/rails_helper.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Configuration parameters: AllowComments, AllowNil.
|
||||
Lint/SuppressedException:
|
||||
Exclude:
|
||||
- 'lib/tasks/testing.rake'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: strict, consistent
|
||||
Lint/SymbolConversion:
|
||||
Exclude:
|
||||
- 'app/controllers/likes_controller.rb'
|
||||
|
||||
# Offense count: 8
|
||||
Lint/UselessAssignment:
|
||||
Exclude:
|
||||
- 'config.rb'
|
||||
- 'config/compass.rb'
|
||||
- 'lib/actions/oauth_signup_action.rb'
|
||||
|
||||
# Offense count: 44
|
||||
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes.
|
||||
Metrics/AbcSize:
|
||||
Max: 151
|
||||
|
||||
# Offense count: 10
|
||||
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods, inherit_mode.
|
||||
# AllowedMethods: refine
|
||||
Metrics/BlockLength:
|
||||
Max: 61
|
||||
|
||||
# Offense count: 6
|
||||
# Configuration parameters: CountComments, CountAsOne.
|
||||
Metrics/ClassLength:
|
||||
Max: 171
|
||||
|
||||
# Offense count: 4
|
||||
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
|
||||
Metrics/CyclomaticComplexity:
|
||||
Max: 32
|
||||
|
||||
# Offense count: 59
|
||||
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
|
||||
Metrics/MethodLength:
|
||||
Max: 59
|
||||
|
||||
# Offense count: 3
|
||||
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
|
||||
Metrics/PerceivedComplexity:
|
||||
Max: 32
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: lowercase, uppercase
|
||||
Naming/HeredocDelimiterCase:
|
||||
Exclude:
|
||||
- 'config/environments/production.rb'
|
||||
|
||||
# Offense count: 3
|
||||
RSpec/AnyInstance:
|
||||
Exclude:
|
||||
- 'spec/controllers/harvests_controller_spec.rb'
|
||||
- 'spec/controllers/photos_controller_spec.rb'
|
||||
|
||||
# Offense count: 15
|
||||
RSpec/Capybara/SpecificMatcher:
|
||||
Exclude:
|
||||
- 'spec/features/crops/browse_crops_spec.rb'
|
||||
- 'spec/features/footer_spec.rb'
|
||||
- 'spec/features/gardens/adding_gardens_spec.rb'
|
||||
- 'spec/features/harvests/harvesting_a_crop_spec.rb'
|
||||
- 'spec/features/plantings/planting_a_crop_spec.rb'
|
||||
- 'spec/features/seeds/adding_seeds_spec.rb'
|
||||
|
||||
# Offense count: 1
|
||||
RSpec/Capybara/VisibilityMatcher:
|
||||
Exclude:
|
||||
- 'spec/features/shared_examples/crop_suggest.rb'
|
||||
|
||||
# Offense count: 292
|
||||
# Configuration parameters: Prefixes, AllowedPatterns.
|
||||
# Prefixes: when, with, without
|
||||
RSpec/ContextWording:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 36
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: SkipBlocks, EnforcedStyle.
|
||||
# SupportedStyles: described_class, explicit
|
||||
RSpec/DescribedClass:
|
||||
Exclude:
|
||||
- 'spec/models/like_spec.rb'
|
||||
- 'spec/models/member_spec.rb'
|
||||
- 'spec/services/timeline_service_spec.rb'
|
||||
|
||||
# Offense count: 13
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
RSpec/EmptyExampleGroup:
|
||||
Exclude:
|
||||
- 'spec/controllers/authentications_controller_spec.rb'
|
||||
- 'spec/controllers/forums_controller_spec.rb'
|
||||
- 'spec/controllers/home_controller_spec.rb'
|
||||
- 'spec/controllers/likes_controller_spec.rb'
|
||||
- 'spec/controllers/plant_parts_controller_spec.rb'
|
||||
- 'spec/controllers/seeds_controller_spec.rb'
|
||||
- 'spec/features/crops/crop_detail_page_spec.rb'
|
||||
- 'spec/features/plantings/planting_a_crop_spec.rb'
|
||||
- 'spec/requests/authentications_spec.rb'
|
||||
- 'spec/views/home/index_spec.rb'
|
||||
- 'spec/views/photos/edit.html.haml_spec.rb'
|
||||
- 'spec/views/posts/_single.html.haml_spec.rb'
|
||||
|
||||
# Offense count: 136
|
||||
# Configuration parameters: CountAsOne.
|
||||
RSpec/ExampleLength:
|
||||
Max: 25
|
||||
|
||||
# Offense count: 2
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
RSpec/ExcessiveDocstringSpacing:
|
||||
Exclude:
|
||||
- 'spec/controllers/crops_controller_spec.rb'
|
||||
- 'spec/features/crops/crop_photos_spec.rb'
|
||||
|
||||
# Offense count: 30
|
||||
RSpec/ExpectInHook:
|
||||
Exclude:
|
||||
- 'spec/controllers/garden_types_controller_spec.rb'
|
||||
- 'spec/controllers/gardens_controller_spec.rb'
|
||||
- 'spec/features/admin/forums_spec.rb'
|
||||
- 'spec/features/crops/crop_photos_spec.rb'
|
||||
- 'spec/features/members/list_spec.rb'
|
||||
- 'spec/features/plantings/planting_a_crop_spec.rb'
|
||||
- 'spec/features/shared_examples/append_date.rb'
|
||||
|
||||
# Offense count: 1135
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
RSpec/FactoryBot/SyntaxMethods:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 3
|
||||
# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
|
||||
# Include: **/*_spec*rb*, **/spec/**/*
|
||||
RSpec/FilePath:
|
||||
Exclude:
|
||||
- 'spec/controllers/member_controller_spec.rb'
|
||||
- 'spec/features/seeds/seed_photos.rb'
|
||||
- 'spec/models/garden_type.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: implicit, each, example
|
||||
RSpec/HookArgument:
|
||||
Exclude:
|
||||
- 'spec/requests/api/v1/plantings_request_spec.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
RSpec/HooksBeforeExamples:
|
||||
Exclude:
|
||||
- 'spec/features/crops/creating_a_crop_spec.rb'
|
||||
|
||||
# Offense count: 710
|
||||
# Configuration parameters: AssignmentOnly.
|
||||
RSpec/InstanceVariable:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 40
|
||||
RSpec/LetSetup:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 2
|
||||
RSpec/MessageChain:
|
||||
Exclude:
|
||||
- 'spec/models/member_spec.rb'
|
||||
|
||||
# Offense count: 23
|
||||
# Configuration parameters: .
|
||||
# SupportedStyles: have_received, receive
|
||||
RSpec/MessageSpies:
|
||||
EnforcedStyle: receive
|
||||
|
||||
# Offense count: 1
|
||||
RSpec/MultipleDescribes:
|
||||
Exclude:
|
||||
- 'spec/features/crops/crop_wranglers_spec.rb'
|
||||
|
||||
# Offense count: 149
|
||||
RSpec/MultipleExpectations:
|
||||
Max: 19
|
||||
|
||||
# Offense count: 137
|
||||
# Configuration parameters: AllowSubject.
|
||||
RSpec/MultipleMemoizedHelpers:
|
||||
Max: 14
|
||||
|
||||
# Offense count: 132
|
||||
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
|
||||
# SupportedStyles: always, named_only
|
||||
RSpec/NamedSubject:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 111
|
||||
# Configuration parameters: AllowedGroups.
|
||||
RSpec/NestedGroups:
|
||||
Max: 6
|
||||
|
||||
# Offense count: 407
|
||||
# Configuration parameters: AllowedPatterns.
|
||||
# AllowedPatterns: ^expect_, ^assert_
|
||||
RSpec/NoExpectationExample:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 4
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
RSpec/Rails/HaveHttpStatus:
|
||||
Exclude:
|
||||
- 'spec/controllers/api/v1/plantings_controller_spec.rb'
|
||||
- 'spec/controllers/harvests_controller_spec.rb'
|
||||
- 'spec/requests/harvests_spec.rb'
|
||||
|
||||
# Offense count: 16
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: Inferences.
|
||||
RSpec/Rails/InferredSpecType:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 2
|
||||
RSpec/RepeatedDescription:
|
||||
Exclude:
|
||||
- 'spec/models/like_spec.rb'
|
||||
|
||||
# Offense count: 6
|
||||
RSpec/RepeatedExample:
|
||||
Exclude:
|
||||
- 'spec/controllers/photos_controller_spec.rb'
|
||||
- 'spec/features/members/following_spec.rb'
|
||||
- 'spec/models/like_spec.rb'
|
||||
|
||||
# Offense count: 4
|
||||
RSpec/RepeatedExampleGroupBody:
|
||||
Exclude:
|
||||
- 'spec/controllers/crops_controller_spec.rb'
|
||||
|
||||
# Offense count: 6
|
||||
RSpec/ScatteredSetup:
|
||||
Exclude:
|
||||
- 'spec/features/percy/percy_spec.rb'
|
||||
- 'spec/features/plantings/prediction_spec.rb'
|
||||
|
||||
# Offense count: 3
|
||||
RSpec/StubbedMock:
|
||||
Exclude:
|
||||
- 'spec/controllers/garden_types_controller_spec.rb'
|
||||
- 'spec/controllers/gardens_controller_spec.rb'
|
||||
- 'spec/models/member_spec.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: constant, string
|
||||
RSpec/VerifiedDoubleReference:
|
||||
Exclude:
|
||||
- 'spec/models/member_spec.rb'
|
||||
|
||||
# Offense count: 3
|
||||
# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
|
||||
RSpec/VerifiedDoubles:
|
||||
Exclude:
|
||||
- 'spec/controllers/garden_types_controller_spec.rb'
|
||||
- 'spec/controllers/gardens_controller_spec.rb'
|
||||
- 'spec/views/devise/shared/_links_spec.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
Rails/ActionControllerFlashBeforeRender:
|
||||
Exclude:
|
||||
- 'app/controllers/authentications_controller.rb'
|
||||
|
||||
# Offense count: 26
|
||||
# Configuration parameters: Database, Include.
|
||||
# SupportedDatabases: mysql, postgresql
|
||||
# Include: db/migrate/*.rb
|
||||
Rails/BulkChangeTable:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 11
|
||||
# Configuration parameters: Include.
|
||||
# Include: db/migrate/*.rb
|
||||
Rails/CreateTableWithTimestamps:
|
||||
@@ -393,14 +30,12 @@ Rails/CreateTableWithTimestamps:
|
||||
- 'db/migrate/20161201154922_add_photos_seeds_table.rb'
|
||||
- 'db/migrate/20171022032108_all_the_predictions.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Configuration parameters: EnforcedStyle, AllowToTime.
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: strict, flexible
|
||||
Rails/Date:
|
||||
Exclude:
|
||||
- 'app/mailers/notifier_mailer.rb'
|
||||
- 'app/mailers/notifier.rb'
|
||||
|
||||
# Offense count: 5
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: slashes, arguments
|
||||
Rails/FilePath:
|
||||
@@ -410,7 +45,6 @@ Rails/FilePath:
|
||||
- 'config/environments/development.rb'
|
||||
- 'db/seeds.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# Configuration parameters: Include.
|
||||
# Include: app/models/**/*.rb
|
||||
Rails/HasAndBelongsToMany:
|
||||
@@ -418,39 +52,23 @@ Rails/HasAndBelongsToMany:
|
||||
- 'app/models/member.rb'
|
||||
- 'app/models/role.rb'
|
||||
|
||||
# Offense count: 5
|
||||
# Configuration parameters: Include.
|
||||
# Include: app/models/**/*.rb
|
||||
Rails/HasManyOrHasOneDependent:
|
||||
Exclude:
|
||||
- 'app/models/member.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Configuration parameters: Include.
|
||||
# Include: spec/**/*.rb, test/**/*.rb
|
||||
Rails/I18nLocaleAssignment:
|
||||
# Include: app/models/**/*.rb
|
||||
Rails/InverseOf:
|
||||
Exclude:
|
||||
- 'spec/features/locale_spec.rb'
|
||||
- 'app/models/concerns/ownable.rb'
|
||||
|
||||
# Offense count: 33
|
||||
Rails/I18nLocaleTexts:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 2
|
||||
# Configuration parameters: Include.
|
||||
# Include: app/controllers/**/*.rb, app/mailers/**/*.rb
|
||||
Rails/LexicallyScopedActionFilter:
|
||||
Exclude:
|
||||
- 'app/controllers/data_controller.rb'
|
||||
|
||||
# Offense count: 2
|
||||
Rails/OutputSafety:
|
||||
Exclude:
|
||||
- 'app/helpers/auto_suggest_helper.rb'
|
||||
- 'app/helpers/gardens_helper.rb'
|
||||
|
||||
# Offense count: 4
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: Include.
|
||||
# Include: **/Rakefile, **/*.rake
|
||||
Rails/RakeEnvironment:
|
||||
@@ -459,53 +77,27 @@ Rails/RakeEnvironment:
|
||||
- 'lib/tasks/i18n.rake'
|
||||
- 'lib/tasks/testing.rake'
|
||||
|
||||
# Offense count: 5
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
Rails/RedundantPresenceValidationOnBelongsTo:
|
||||
Exclude:
|
||||
- 'app/models/alternate_name.rb'
|
||||
- 'app/models/like.rb'
|
||||
- 'app/models/planting.rb'
|
||||
- 'app/models/scientific_name.rb'
|
||||
|
||||
# Offense count: 9
|
||||
# Configuration parameters: Include.
|
||||
# Include: db/**/*.rb
|
||||
# Include: db/migrate/*.rb
|
||||
Rails/ReversibleMigration:
|
||||
Exclude:
|
||||
- 'db/migrate/20130326092227_change_planted_at_to_date.rb'
|
||||
- 'db/migrate/20191119020643_upgrade_cms.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
Rails/RootPathnameMethods:
|
||||
# Configuration parameters: Blacklist, Whitelist.
|
||||
# Blacklist: decrement!, decrement_counter, increment!, increment_counter, toggle!, touch, update_all, update_attribute, update_column, update_columns, update_counters
|
||||
Rails/SkipsModelValidations:
|
||||
Exclude:
|
||||
- 'app/controllers/crops_controller.rb'
|
||||
- 'app/helpers/icons_helper.rb'
|
||||
- 'db/migrate/20190317023129_finished_boolean.rb'
|
||||
- 'db/seeds.rb'
|
||||
- 'db/migrate/20190910022329_add_photo_source.rb'
|
||||
|
||||
# Offense count: 6
|
||||
# Configuration parameters: Include.
|
||||
# Include: app/models/**/*.rb
|
||||
Rails/UniqueValidationWithoutIndex:
|
||||
# Configuration parameters: AllowedChars.
|
||||
Style/AsciiComments:
|
||||
Exclude:
|
||||
- 'app/models/follow.rb'
|
||||
- 'app/models/garden.rb'
|
||||
- 'app/models/like.rb'
|
||||
- 'app/models/member.rb'
|
||||
- 'app/models/plant_part.rb'
|
||||
- 'app/models/role.rb'
|
||||
- 'config/initializers/comfortable_mexican_sofa.rb'
|
||||
|
||||
# Offense count: 3
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
Rails/WhereEquals:
|
||||
Exclude:
|
||||
- 'app/models/crop.rb'
|
||||
- 'app/models/harvest.rb'
|
||||
- 'app/models/planting.rb'
|
||||
|
||||
# Offense count: 3
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: AutoCorrect, EnforcedStyle.
|
||||
# SupportedStyles: nested, compact
|
||||
Style/ClassAndModuleChildren:
|
||||
Exclude:
|
||||
@@ -513,133 +105,23 @@ Style/ClassAndModuleChildren:
|
||||
- 'lib/haml/filters/escaped_markdown.rb'
|
||||
- 'lib/haml/filters/growstuff_markdown.rb'
|
||||
|
||||
# Offense count: 6
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
Style/CommentedKeyword:
|
||||
Exclude:
|
||||
- 'db/migrate/20191119030244_cms_tags.rb'
|
||||
- 'spec/models/crop_spec.rb'
|
||||
- 'spec/models/photo_spec.rb'
|
||||
- 'spec/models/planting_spec.rb'
|
||||
|
||||
# Offense count: 42
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: AllowedVars.
|
||||
Style/FetchEnvVar:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 4
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: always, always_true, never
|
||||
Style/FrozenStringLiteralComment:
|
||||
Exclude:
|
||||
- 'config/initializers/new_framework_defaults_6_0.rb'
|
||||
- 'db/migrate/20200801084007_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.active_storage.rb'
|
||||
- 'db/migrate/20200815012538_remove_median_function.rb'
|
||||
- 'spec/lib/haml/filters/growstuff_markdown_spec.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
Style/GlobalStdStream:
|
||||
Exclude:
|
||||
- 'config/environments/production.rb'
|
||||
- 'lib/tasks/openfarm.rake'
|
||||
|
||||
# Offense count: 2
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
Style/IfUnlessModifier:
|
||||
Exclude:
|
||||
- 'bin/setup'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: AllowedMethods.
|
||||
# AllowedMethods: nonzero?
|
||||
Style/IfWithBooleanLiteralBranches:
|
||||
Exclude:
|
||||
- 'app/controllers/gardens_controller.rb'
|
||||
|
||||
# Offense count: 2
|
||||
Style/MixinUsage:
|
||||
Exclude:
|
||||
- 'bin/setup'
|
||||
- 'bin/update'
|
||||
- 'spec/rails_helper.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
Style/NegatedIfElseCondition:
|
||||
Exclude:
|
||||
- 'app/helpers/crops_helper.rb'
|
||||
|
||||
# Offense count: 3
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns, IgnoredMethods.
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods.
|
||||
# SupportedStyles: predicate, comparison
|
||||
Style/NumericPredicate:
|
||||
Exclude:
|
||||
- 'spec/**/*'
|
||||
- 'app/helpers/harvests_helper.rb'
|
||||
- 'app/helpers/plantings_helper.rb'
|
||||
|
||||
# Offense count: 6
|
||||
Style/OpenStructUse:
|
||||
Exclude:
|
||||
- 'spec/helpers/event_helper_spec.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# Configuration parameters: AllowedMethods.
|
||||
# AllowedMethods: respond_to_missing?
|
||||
Style/OptionalBooleanParameter:
|
||||
Exclude:
|
||||
- 'app/models/concerns/member_newsletter.rb'
|
||||
|
||||
# Offense count: 5
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: same_as_string_literals, single_quotes, double_quotes
|
||||
Style/QuotedSymbols:
|
||||
Exclude:
|
||||
- 'app/models/seed.rb'
|
||||
- 'spec/controllers/crops_controller_spec.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: Methods.
|
||||
Style/RedundantArgument:
|
||||
Exclude:
|
||||
- 'app/helpers/application_helper.rb'
|
||||
|
||||
# Offense count: 4
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: SafeForConstants.
|
||||
Style/RedundantFetchBlock:
|
||||
Exclude:
|
||||
- 'config/puma.rb'
|
||||
|
||||
# Offense count: 3
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: AllowModifier.
|
||||
Style/SoleNestedConditional:
|
||||
Exclude:
|
||||
- 'app/controllers/application_controller.rb'
|
||||
- 'app/controllers/messages_controller.rb'
|
||||
- 'app/models/photo_association.rb'
|
||||
|
||||
# Offense count: 20
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: Mode.
|
||||
Style/StringConcatenation:
|
||||
Exclude:
|
||||
- 'app/controllers/messages_controller.rb'
|
||||
- 'app/helpers/buttons_helper.rb'
|
||||
- 'config/initializers/rswag_api.rb'
|
||||
- 'spec/helpers/gardens_helper_spec.rb'
|
||||
- 'spec/helpers/seeds_helper_spec.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, IgnoredMethods, AllowComments.
|
||||
# AllowedMethods: define_method, mail, respond_to
|
||||
Style/SymbolProc:
|
||||
Exclude:
|
||||
- 'app/controllers/crops_controller.rb'
|
||||
|
||||
@@ -1 +1 @@
|
||||
3.1.3
|
||||
2.6.5
|
||||
|
||||
41
.travis.yml
41
.travis.yml
@@ -1,18 +1,52 @@
|
||||
sudo: required
|
||||
language: ruby
|
||||
dist: bionic
|
||||
services:
|
||||
- postgresql
|
||||
- xvfb
|
||||
branches:
|
||||
only:
|
||||
- mainline
|
||||
- dev
|
||||
- mainline
|
||||
- dev
|
||||
cache:
|
||||
bundler: true
|
||||
yarn: true
|
||||
directories:
|
||||
- tmp/cache/assets/test/sprockets
|
||||
addons:
|
||||
postgresql: "9.4" # Matches production
|
||||
code_climate:
|
||||
repo_token:
|
||||
secure: "PfhLGBKRgNqhKuYCJsK+VPhdAzcgWFGeeOyxC/eS8gtlvIISVdgyZE+r30uIei0DFI6zEiN62eW4d+xtT4j7/e2ZcAcx7U52mza/SnQNuu3nCGQDJB8VOvV5NbnwXfi8vfr4e889Mt7k3ocd2c4gqB4UtRqrzhygj7HN+B/GfEk="
|
||||
env:
|
||||
matrix:
|
||||
- "TEST_GROUP=1"
|
||||
- "TEST_GROUP=2"
|
||||
- "TEST_GROUP=3"
|
||||
global:
|
||||
- secure: "Z5TpM2jEX4UCvNePnk/LwltQX48U2u9BRc+Iypr1x9QW2o228QJhPIOH39a8RMUrepGnkQIq9q3ZRUn98RfrJz1yThtlNFL3NmzdQ57gKgjGwfpa0e4Dwj/ZJqV2D84tDGjvdVYLP7zzaYZxQcwk/cgNpzKf/jq97HLNP7CYuf4="
|
||||
- ELASTIC_SEARCH_VERSION="7.5.1-amd64"
|
||||
- COVERAGE=true
|
||||
- GROWSTUFF_EMAIL="noreply@test.growstuff.org"g
|
||||
- GROWSTUFF_SITE_NAME="Growstuff (travis)"
|
||||
- RAILS_SECRET_TOKEN='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx']
|
||||
- RAILS_ENV=test
|
||||
before_install:
|
||||
- sudo apt clean
|
||||
- sudo apt update
|
||||
- sudo apt install dpkg
|
||||
- ./script/install_elasticsearch.sh
|
||||
- sudo apt install google-chrome-stable
|
||||
- ./bin/setup
|
||||
script:
|
||||
# - bundle exec rails db:create db:migrate
|
||||
# - bundle exec rails assets:precompile
|
||||
# - bundle exec rails search:reindex
|
||||
# - bundle exec rspec spec -fd
|
||||
- bundle exec parallel_test spec/ -n 3 --only-group $TEST_GROUP --group-by filesize --type rspec
|
||||
after_script:
|
||||
- >
|
||||
gem install codeclimate-test-reporter
|
||||
codeclimate-test-reporter
|
||||
before_deploy:
|
||||
- bundle exec script/heroku_maintenance.rb on
|
||||
deploy:
|
||||
@@ -25,6 +59,7 @@ deploy:
|
||||
dev: growstuff-staging
|
||||
mainline: growstuff-prod
|
||||
run:
|
||||
- "rake db:migrate"
|
||||
- "script/deploy-tasks.sh"
|
||||
- restart
|
||||
after_deploy:
|
||||
|
||||
@@ -91,11 +91,9 @@ submit the change with your pull request.
|
||||
- Taylor William / [bestest-mensch](https://github.com/bestest-mensch)
|
||||
- André Aubin / [lambda2](https://github.com/lambda2)
|
||||
- Martina Simicic / [simicic](https://github.com/simicic)
|
||||
- Rowan Crawford / [wombleton](https://github.com/wombleton)
|
||||
- Ítalo Pires / [italopires](https://github.com/italopires)
|
||||
|
||||
## Bots
|
||||
|
||||
### Security and Dependency Updates
|
||||
- DeppBot / [deppbot](https://github.com/deppbot)
|
||||
- `dependabot[bot]` [dependabot](https://github.com/dependabot-bot) / [dependabot-preview](https://github.com/apps/dependabot-preview)
|
||||
- dependabot-preview[bot] [dependabot](https://github.com/dependabot-bot) / [dependabot-preview](https://github.com/apps/dependabot-preview)
|
||||
|
||||
29
Gemfile
29
Gemfile
@@ -2,16 +2,15 @@
|
||||
|
||||
source 'https://rubygems.org'
|
||||
|
||||
# Match ruby version in .ruby-version
|
||||
ruby File.read('.ruby-version')
|
||||
ruby '2.6.5'
|
||||
|
||||
gem 'rails', '~> 7.0.4'
|
||||
gem 'rails', '6.0.3.2'
|
||||
|
||||
# Keeping old sprockets
|
||||
# https://github.com/rails/sprockets-rails/issues/444#issuecomment-637817050
|
||||
gem "sprockets", "<4"
|
||||
|
||||
gem 'bundler', '>= 2.3.10'
|
||||
gem 'bundler', '>=1.1.5'
|
||||
|
||||
gem 'coffee-rails'
|
||||
gem 'haml'
|
||||
@@ -24,7 +23,7 @@ gem 'rswag-api'
|
||||
gem 'rswag-ui'
|
||||
|
||||
# CSS framework
|
||||
gem "bootstrap", ">= 4.6.2"
|
||||
gem "bootstrap", ">= 4.3.1"
|
||||
gem 'material-sass', '4.1.1'
|
||||
|
||||
# Icons used by bootstrap/material-sass
|
||||
@@ -52,14 +51,14 @@ gem 'csv_shaper' # CSV export
|
||||
gem 'gibbon', '~>1.2.0' # for Mailchimp newsletter subscriptions
|
||||
|
||||
# Maps
|
||||
gem 'leaflet-rails', '>= 1.9.2'
|
||||
gem 'leaflet-rails'
|
||||
gem 'rails-assets-leaflet.markercluster', source: 'https://rails-assets.org'
|
||||
|
||||
gem 'pg'
|
||||
gem 'pg', '< 1.0.0' # Upstream bug, see https://github.com/Growstuff/growstuff/pull/1539
|
||||
gem 'ruby-units' # for unit conversion
|
||||
gem 'unicorn' # http server
|
||||
|
||||
gem "comfortable_mexican_sofa", git: "https://github.com/restarone/comfortable-mexican-sofa.git"
|
||||
gem "comfortable_mexican_sofa", "~> 2.0.0"
|
||||
|
||||
gem 'active_utils'
|
||||
gem 'sidekiq'
|
||||
@@ -90,10 +89,11 @@ gem 'geocoder'
|
||||
gem 'bootstrap-datepicker-rails'
|
||||
|
||||
# DRY-er easier bootstrap 4 forms
|
||||
gem "bootstrap_form", ">= 4.5.0"
|
||||
gem "bootstrap_form", ">= 4.2.0"
|
||||
|
||||
# For connecting to other services (eg Twitter)
|
||||
gem 'omniauth', '~> 1.3'
|
||||
gem 'omniauth-facebook'
|
||||
gem 'omniauth-flickr', '>= 0.0.15'
|
||||
gem 'omniauth-twitter'
|
||||
|
||||
@@ -112,17 +112,17 @@ gem 'rake', '>= 10.0.0'
|
||||
gem "responders"
|
||||
|
||||
# allows soft delete. Used for members.
|
||||
gem 'discard', '>= 1.2'
|
||||
gem 'discard', '~> 1.2'
|
||||
|
||||
gem 'xmlrpc' # fixes rake error - can be removed if not needed later
|
||||
|
||||
gem 'puma'
|
||||
|
||||
gem 'loofah', '>= 2.19.1'
|
||||
gem 'loofah', '>= 2.2.1'
|
||||
gem 'rack-protection', '>= 2.0.1'
|
||||
|
||||
# Member to member messaging system
|
||||
gem 'mailboxer', '>= 0.15.1'
|
||||
gem 'mailboxer'
|
||||
|
||||
gem 'faraday'
|
||||
gem 'faraday_middleware'
|
||||
@@ -155,6 +155,7 @@ group :development, :test do
|
||||
gem 'faker'
|
||||
gem 'haml-rails' # HTML templating language
|
||||
gem 'query_diet'
|
||||
gem 'parallel_tests'
|
||||
gem 'rspec-activemodel-mocks'
|
||||
gem 'rspec-rails' # unit testing framework
|
||||
gem 'rswag-specs'
|
||||
@@ -165,6 +166,7 @@ group :development, :test do
|
||||
gem 'dotenv-rails'
|
||||
|
||||
# cli utils
|
||||
gem 'coveralls', require: false # coverage analysis
|
||||
gem 'haml-i18n-extractor', require: false
|
||||
gem 'haml_lint', '>= 0.25.1', require: false # Checks haml files for goodness
|
||||
gem 'i18n-tasks', require: false # adds tests for finding missing and unused translations
|
||||
@@ -174,6 +176,7 @@ end
|
||||
|
||||
group :test do
|
||||
gem 'codeclimate-test-reporter', require: false
|
||||
gem 'percy-capybara', '~> 4.0.0'
|
||||
gem 'rails-controller-testing'
|
||||
gem 'selenium-webdriver'
|
||||
gem 'timecop'
|
||||
@@ -183,5 +186,3 @@ end
|
||||
group :travis do
|
||||
gem 'platform-api'
|
||||
end
|
||||
|
||||
gem "percy-capybara", "~> 5.0.0"
|
||||
|
||||
741
Gemfile.lock
741
Gemfile.lock
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,7 @@
|
||||
# 🌱 Growstuff
|
||||
|
||||

|
||||
[](https://travis-ci.org/Growstuff/growstuff)
|
||||
[](https://coveralls.io/github/Growstuff/growstuff?branch=dev)
|
||||
[](https://codeclimate.com/github/Growstuff/growstuff)
|
||||
|
||||
Welcome to the Growstuff project.
|
||||
@@ -20,7 +21,7 @@ encourage participation from people of all backgrounds and skill levels.
|
||||
* [Issues](https://github.com/orgs/Growstuff/projects/1) (features we're
|
||||
working on, known bugs, etc)
|
||||
* [](https://gitter.im/Growstuff/growstuff?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||
* [Wiki](https://github.com/Growstuff/growstuff/wiki) (general documentation, etc.)
|
||||
* [Wiki](https://github.com/Growstuff/growstuff/wiki) (general documentation, etc. Help by migrating from the [old wiki](https://web.archive.org/web/*/wiki.growstuff.org))
|
||||
|
||||
## For coders
|
||||
|
||||
@@ -29,6 +30,7 @@ frontend features. We welcome contributions -- see
|
||||
[CONTRIBUTING](CONTRIBUTING.md) for details.
|
||||
|
||||
* To set up your development environment, see [Getting started](https://github.com/Growstuff/growstuff/wiki/New-contributor-guide).
|
||||
* We encourage [pair programming](http://wiki.growstuff.org/index.php/Pairing), especially for newer developers.
|
||||
* You may also be interested in our [API](https://github.com/Growstuff/growstuff/wiki/API).
|
||||
|
||||
## For designers, writers, researchers, data wranglers, and other contributors
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
function showCropMap(cropmap) {
|
||||
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
|
||||
var mapbox_map_id = "<%= Rails.env == 'test' ? 0 : Rails.application.config.mapbox_map_id %>";
|
||||
var mapbox_access_token = "<%= Rails.env == 'test' ? 0 : Rails.application.config.mapbox_access_token %>";
|
||||
var mapbox_base_url = "https://a.tiles.mapbox.com/v4/" + mapbox_map_id + "/{z}/{x}/{y}.png?access_token=" + mapbox_access_token;
|
||||
|
||||
L.tileLayer(mapbox_base_url, {
|
||||
attribution: 'Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors under <a href="https://www.openstreetmap.org/copyright">ODbL</a> | Map imagery © <a href="https://mapbox.com">Mapbox</a>',
|
||||
maxZoom: 18
|
||||
}).addTo(cropmap);
|
||||
var markers = new L.MarkerClusterGroup({showCoverageOnHover: false, maxClusterRadius: 20 });
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
if (document.getElementById("membermap") !== null) {
|
||||
var mapbox_map_id = "<%= Rails.env == 'test' ? 0 : Rails.application.config.mapbox_map_id %>";
|
||||
var mapbox_access_token = "<%= Rails.env == 'test' ? 0 : Rails.application.config.mapbox_access_token %>";
|
||||
var mapbox_base_url = "https://a.tiles.mapbox.com/v4/" + mapbox_map_id + "/{z}/{x}/{y}.png?access_token=" + mapbox_access_token;
|
||||
|
||||
L.Icon.Default.imagePath = '/assets'
|
||||
|
||||
L.Icon.Default.imagePath = '/assets';
|
||||
|
||||
var default_marker_icon = L.icon({
|
||||
@@ -12,8 +18,8 @@ if (document.getElementById("membermap") !== null) {
|
||||
if (member.latitude && member.longitude) {
|
||||
var membermap = L.map('membermap').setView([member.latitude, member.longitude], 4);
|
||||
|
||||
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
|
||||
L.tileLayer(mapbox_base_url, {
|
||||
attribution: 'Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors under <a href="https://www.openstreetmap.org/copyright">ODbL</a> | Map imagery © <a href="https://mapbox.com">Mapbox</a>',
|
||||
maxZoom: 18
|
||||
}).addTo(membermap);
|
||||
var marker = new L.Marker(new L.LatLng(member.latitude, member.longitude),
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
if (document.getElementById("placesmap") !== null) {
|
||||
var places_base_path = "/places";
|
||||
var mapbox_map_id = "<%= Rails.env == 'test' ? 0 : Rails.application.config.mapbox_map_id %>";
|
||||
var mapbox_access_token = "<%= Rails.env == 'test' ? 0 : Rails.application.config.mapbox_access_token %>";
|
||||
var mapbox_base_url = "https://a.tiles.mapbox.com/v4/" + mapbox_map_id + "/{z}/{x}/{y}.png?access_token=" + mapbox_access_token;
|
||||
var nominatim_base_url = 'https://nominatim.openstreetmap.org/search/';
|
||||
var nominatim_user_agent_email = "<%= Rails.env == 'test' ? 0 : Rails.application.config.user_agent_email %>";
|
||||
|
||||
@@ -28,8 +31,8 @@ if (document.getElementById("placesmap") !== null) {
|
||||
}
|
||||
|
||||
function showMap(placesmap) {
|
||||
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
|
||||
L.tileLayer(mapbox_base_url, {
|
||||
attribution: 'Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors under <a href="https://www.openstreetmap.org/copyright">ODbL</a> | Map imagery © <a href="https://mapbox.com">Mapbox</a>',
|
||||
maxZoom: 18
|
||||
}).addTo(placesmap);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
bottom: 0;
|
||||
color: $white;
|
||||
margin: 0;
|
||||
opacity: 0.8;
|
||||
opacity: .8;
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
@@ -22,7 +22,7 @@
|
||||
h5.crop-sci-name {
|
||||
background-color: $beige;
|
||||
color: $black;
|
||||
font-size: 0.7em;
|
||||
font-size: .7em;
|
||||
margin-top: 0;
|
||||
padding-top: 0;
|
||||
}
|
||||
@@ -45,7 +45,7 @@
|
||||
.planting {
|
||||
.crop-card {
|
||||
height: 100%;
|
||||
margin: 0.1em;
|
||||
margin: .1em;
|
||||
min-height: 300px;
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
@include media-breakpoint-down(xs) {
|
||||
.index-cards {
|
||||
.crop-thumbnail {
|
||||
margin: 0.2em;
|
||||
margin: .2em;
|
||||
width: 30%;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
.text {
|
||||
color: $white;
|
||||
margin: 0;
|
||||
opacity: 0.8;
|
||||
opacity: .8;
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
top: 30%;
|
||||
@@ -12,7 +12,7 @@
|
||||
h3,
|
||||
h4,
|
||||
h5 {
|
||||
margin: 0;
|
||||
margin: 0
|
||||
}
|
||||
|
||||
h3 {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
border-radius: 12px;
|
||||
height: 200px;
|
||||
margin: 1em;
|
||||
padding: 0.25em;
|
||||
padding: .25em;
|
||||
|
||||
div {
|
||||
display: inline-block;
|
||||
@@ -11,11 +11,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
.member-thumbnail div ~ div {
|
||||
.member-thumbnail div~div {
|
||||
padding-left: 1em;
|
||||
width: 15em;
|
||||
}
|
||||
|
||||
|
||||
.member-chip {
|
||||
background-color: lighten($green, 30%);
|
||||
|
||||
@@ -34,7 +35,7 @@
|
||||
}
|
||||
|
||||
.location-not-set {
|
||||
background-image: image-url("location-not-set.en.png");
|
||||
background-image: image-url('location-not-set.en.png');
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
height: 250px;
|
||||
|
||||
@@ -15,36 +15,30 @@ $body-bg: $beige;
|
||||
$text-color: $brown;
|
||||
$link-color: $green;
|
||||
|
||||
$default-font: "Raleway", "Fira Sans", Helvetica, Arial, sans-serif;
|
||||
$default-font: 'Raleway',
|
||||
"Fira Sans",
|
||||
Helvetica,
|
||||
Arial,
|
||||
sans-serif;
|
||||
|
||||
$primary: (
|
||||
color: $green,
|
||||
$primary: (color: $green,
|
||||
dark: darken($green, 20%),
|
||||
light: lighten($green, 20%),
|
||||
);
|
||||
$secondary: (
|
||||
color: $blue,
|
||||
light: lighten($green, 20%));
|
||||
$secondary: (color: $blue,
|
||||
dark: darken($blue, 20%),
|
||||
light: lighten($blue, 20%),
|
||||
);
|
||||
$success: (
|
||||
color: $green,
|
||||
light: lighten($blue, 20%));
|
||||
$success: (color: $green,
|
||||
dark: darken($green, 20%),
|
||||
light: lighten($green, 20%),
|
||||
);
|
||||
$danger: (
|
||||
color: $red,
|
||||
light: lighten($green, 20%));
|
||||
$danger: (color: $red,
|
||||
dark: darken($red, 20%),
|
||||
light: lighten($red, 20%),
|
||||
);
|
||||
$dark: (
|
||||
color: $brown,
|
||||
light: lighten($red, 20%));
|
||||
$dark: (color: $brown,
|
||||
dark: darken($brown, 20%),
|
||||
light: lighten($brown, 20%),
|
||||
);
|
||||
light: lighten($brown, 20%));
|
||||
|
||||
$grid-breakpoints: (
|
||||
// Extra small screen / phone
|
||||
|
||||
$grid-breakpoints: ( // Extra small screen / phone
|
||||
xs: 0,
|
||||
// Small screen / phone
|
||||
sm: 576px,
|
||||
@@ -53,8 +47,7 @@ $grid-breakpoints: (
|
||||
// Large screen / desktop
|
||||
lg: 1200px,
|
||||
// Extra large screen / wide desktop
|
||||
xl: 1800px
|
||||
);
|
||||
xl: 1800px);
|
||||
|
||||
// Nav bar
|
||||
$navbar-default-bg: $brown;
|
||||
|
||||
@@ -1,32 +1,33 @@
|
||||
// Import original variables so they can be used in overrides
|
||||
|
||||
@import "variables";
|
||||
@import "material";
|
||||
@import 'variables';
|
||||
@import 'material';
|
||||
|
||||
@import 'jquery-ui/autocomplete';
|
||||
@import 'bootstrap-datepicker';
|
||||
@import 'leaflet';
|
||||
@import 'leaflet.markercluster';
|
||||
|
||||
@import "jquery-ui/autocomplete";
|
||||
@import "bootstrap-datepicker";
|
||||
@import "leaflet";
|
||||
@import "leaflet.markercluster";
|
||||
|
||||
// Font Awesome
|
||||
@import "font-awesome-sprockets";
|
||||
@import "font-awesome";
|
||||
@import "material_icons";
|
||||
@import "rails_bootstrap_forms";
|
||||
@import 'font-awesome-sprockets';
|
||||
@import 'font-awesome';
|
||||
@import 'material_icons';
|
||||
@import 'rails_bootstrap_forms';
|
||||
|
||||
@import "overrides";
|
||||
@import "mobile";
|
||||
@import 'overrides';
|
||||
@import 'mobile';
|
||||
|
||||
@import "crops";
|
||||
@import "harvests";
|
||||
@import "likes";
|
||||
@import "members";
|
||||
@import "notifications";
|
||||
@import "plantings";
|
||||
@import "photos";
|
||||
@import "posts";
|
||||
@import "seeds";
|
||||
@import 'crops';
|
||||
@import 'harvests';
|
||||
@import 'likes';
|
||||
@import 'members';
|
||||
@import 'notifications';
|
||||
@import 'plantings';
|
||||
@import 'photos';
|
||||
@import 'posts';
|
||||
@import 'seeds';
|
||||
|
||||
@import "predictions";
|
||||
@import "homepage";
|
||||
@import "maps";
|
||||
@import 'predictions';
|
||||
@import 'homepage';
|
||||
@import 'maps';
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Overrides applying only to mobile view. This must be at the end of the overrides file.
|
||||
// Extra small devices (portrait phones, less than 576px)
|
||||
@include media-breakpoint-down(md) {
|
||||
|
||||
.container {
|
||||
margin: 2px;
|
||||
padding: 0;
|
||||
@@ -10,7 +11,7 @@
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.navbar .nav > li {
|
||||
.navbar .nav>li {
|
||||
display: block;
|
||||
}
|
||||
|
||||
@@ -32,10 +33,11 @@
|
||||
}
|
||||
|
||||
.site-name:after {
|
||||
content: "";
|
||||
content: '';
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
h1 {
|
||||
@@ -64,13 +66,14 @@
|
||||
height: 300px;
|
||||
}
|
||||
|
||||
|
||||
section .btn {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.index-cards {
|
||||
.card {
|
||||
margin: 0.2em;
|
||||
margin: .2em;
|
||||
width: 48%;
|
||||
|
||||
// Shrink title to fit more on page
|
||||
@@ -84,6 +87,7 @@
|
||||
object-fit: cover;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,9 +10,9 @@ body {
|
||||
|
||||
.navbar-brand {
|
||||
.site-name {
|
||||
font-family: "Modak", cursive;
|
||||
font-family: 'Modak', cursive;
|
||||
font-size: 3em;
|
||||
margin: 0.3em;
|
||||
margin: .3em;
|
||||
}
|
||||
|
||||
img {
|
||||
@@ -46,6 +46,7 @@ body {
|
||||
font-size: 5em;
|
||||
}
|
||||
|
||||
|
||||
.ellipsis {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
@@ -81,8 +82,9 @@ h3 {
|
||||
font-size: 120%;
|
||||
}
|
||||
|
||||
|
||||
section {
|
||||
margin: 0.5em 0 0;
|
||||
margin: .5em 0 0;
|
||||
padding: 0 0 1em;
|
||||
|
||||
h2 {
|
||||
@@ -90,7 +92,7 @@ section {
|
||||
box-shadow: 1px 1px 1px 1px darken($beige, 20%);
|
||||
color: $white;
|
||||
font-weight: normal;
|
||||
padding: 0.2em;
|
||||
padding: .2em;
|
||||
|
||||
a {
|
||||
color: $white;
|
||||
@@ -98,16 +100,7 @@ section {
|
||||
}
|
||||
|
||||
.card {
|
||||
background: $white;
|
||||
box-shadow: 1px 3px 3px 1px darken($beige, 20%);
|
||||
cursor: pointer;
|
||||
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: 0 10px 20px darken($beige, 30%), 0 4px 8px darken($beige, 40%);
|
||||
transform: scale(1.1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +117,7 @@ section {
|
||||
.card {
|
||||
background: $white;
|
||||
border-radius: 5%;
|
||||
margin: 0.5em 0.5em 0.5em 0;
|
||||
margin: .5em .5em .5em 0;
|
||||
width: 200px;
|
||||
|
||||
.img-card {
|
||||
@@ -239,6 +232,7 @@ ul.associations {
|
||||
|
||||
// footer
|
||||
footer {
|
||||
|
||||
#footer1,
|
||||
#footer2,
|
||||
#footer3 {
|
||||
@@ -376,7 +370,7 @@ ul.thumbnail-buttons {
|
||||
}
|
||||
|
||||
.info {
|
||||
padding: 0.5em;
|
||||
padding: .5em;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
@@ -392,7 +386,7 @@ ul.thumbnail-buttons {
|
||||
display: inline-block;
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
margin: 0.2em;
|
||||
margin: .2em;
|
||||
padding: 0 25px;
|
||||
|
||||
a {
|
||||
@@ -417,14 +411,14 @@ ul.thumbnail-buttons {
|
||||
.progress-fade::before {
|
||||
background: $beige;
|
||||
bottom: 0;
|
||||
content: "";
|
||||
content: '';
|
||||
display: block;
|
||||
left: 0;
|
||||
opacity: 0.7;
|
||||
opacity: .7;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
transition: background 0.3s linear;
|
||||
transition: background .3s linear;
|
||||
}
|
||||
|
||||
.progress-fade:hover::before {
|
||||
|
||||
@@ -13,6 +13,12 @@ module Admin
|
||||
@members = @members.order(:login_name).paginate(page: params[:page])
|
||||
end
|
||||
|
||||
def destroy
|
||||
@member = Member.find_by!(slug: params[:slug])
|
||||
@member.discard
|
||||
redirect_to admin_members_path
|
||||
end
|
||||
|
||||
def edit
|
||||
@member = Member.find_by!(slug: params[:slug])
|
||||
end
|
||||
@@ -24,12 +30,6 @@ module Admin
|
||||
respond_with @member, location: admin_members_path
|
||||
end
|
||||
|
||||
def destroy
|
||||
@member = Member.find_by!(slug: params[:slug])
|
||||
@member.discard
|
||||
redirect_to admin_members_path
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def search_term
|
||||
|
||||
@@ -14,14 +14,14 @@ class AuthenticationsController < ApplicationController
|
||||
|
||||
@authentication = current_member.authentications
|
||||
.create_with(
|
||||
name:,
|
||||
name: name,
|
||||
token: auth['credentials']['token'],
|
||||
secret: auth['credentials']['secret']
|
||||
)
|
||||
.find_or_create_by(
|
||||
provider: auth['provider'],
|
||||
uid: auth['uid'],
|
||||
name:
|
||||
name: name
|
||||
)
|
||||
|
||||
flash[:notice] = "Authentication successful."
|
||||
|
||||
@@ -71,7 +71,7 @@ class ConversationsController < ApplicationController
|
||||
@conversation = Mailboxer::Conversation.find_by(id: params[:id])
|
||||
return unless @conversation.nil? || !@conversation.is_participant?(current_member)
|
||||
|
||||
redirect_to conversations_path(box:)
|
||||
redirect_to conversations_path(box: box)
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
@@ -57,11 +57,14 @@ class CropsController < ApplicationController
|
||||
@crops = CropSearchService.search(@term,
|
||||
page: params[:page],
|
||||
per_page: Crop.per_page,
|
||||
current_member:)
|
||||
current_member: current_member)
|
||||
respond_with @crops
|
||||
end
|
||||
|
||||
def show
|
||||
@crop = Crop.includes(
|
||||
:scientific_names, :alternate_names, :parent, :varieties
|
||||
).find_by!(slug: params[:slug])
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
@posts = @crop.posts.order(created_at: :desc).paginate(page: params[:page])
|
||||
@@ -86,6 +89,7 @@ class CropsController < ApplicationController
|
||||
end
|
||||
|
||||
def edit
|
||||
@crop = Crop.find_by!(slug: params[:slug])
|
||||
@crop.alternate_names.build if @crop.alternate_names.blank?
|
||||
@crop.scientific_names.build if @crop.scientific_names.blank?
|
||||
end
|
||||
@@ -106,13 +110,14 @@ class CropsController < ApplicationController
|
||||
end
|
||||
|
||||
def update
|
||||
@crop = Crop.find_by!(slug: params[:slug])
|
||||
|
||||
if can?(:wrangle, @crop)
|
||||
@crop.approval_status = 'rejected' if params.fetch("reject", false)
|
||||
@crop.approval_status = 'approved' if params.fetch("approve", false)
|
||||
end
|
||||
|
||||
@crop.creator = current_member if @crop.approval_status == "pending"
|
||||
|
||||
if @crop.update(crop_params)
|
||||
recreate_names('alt_name', 'alternate')
|
||||
recreate_names('sci_name', 'scientific')
|
||||
@@ -147,8 +152,12 @@ class CropsController < ApplicationController
|
||||
end
|
||||
|
||||
def save_crop_names
|
||||
AlternateName.create!(names_params(:alt_name).map { |n| { name: n, creator_id: current_member.id, crop_id: @crop.id } })
|
||||
ScientificName.create!(names_params(:sci_name).map { |n| { name: n, creator_id: current_member.id, crop_id: @crop.id } })
|
||||
params[:alt_name]&.values&.each do |value|
|
||||
create_name!('alternate', value) unless value.empty?
|
||||
end
|
||||
params[:sci_name]&.values&.each do |value|
|
||||
create_name!('scientific', value) unless value.empty?
|
||||
end
|
||||
end
|
||||
|
||||
def notify_wranglers
|
||||
@@ -178,20 +187,21 @@ class CropsController < ApplicationController
|
||||
|
||||
def crop_params
|
||||
params.require(:crop).permit(
|
||||
:name, :en_wikipedia_url,
|
||||
:parent_id, :perennial,
|
||||
:request_notes, :reason_for_rejection,
|
||||
:en_wikipedia_url,
|
||||
:name,
|
||||
:parent_id,
|
||||
:perennial,
|
||||
:request_notes,
|
||||
:reason_for_rejection,
|
||||
:rejection_notes,
|
||||
scientific_names_attributes: %i(scientific_name _destroy id)
|
||||
scientific_names_attributes: %i(scientific_name
|
||||
_destroy
|
||||
id)
|
||||
)
|
||||
end
|
||||
|
||||
def names_params(name_type)
|
||||
params.require(name_type).values&.reject { |n| n.empty? }
|
||||
end
|
||||
|
||||
def filename
|
||||
"Growstuff-Crops-#{Time.zone.now.to_fs(:number)}.csv"
|
||||
"Growstuff-Crops-#{Time.zone.now.to_s(:number)}.csv"
|
||||
end
|
||||
|
||||
def crop_json_fields
|
||||
@@ -202,7 +212,8 @@ class CropsController < ApplicationController
|
||||
owner: { only: %i(id login_name location latitude longitude) }
|
||||
}
|
||||
},
|
||||
scientific_names: { only: [:name] }, alternate_names: { only: [:name] }
|
||||
scientific_names: { only: [:name] },
|
||||
alternate_names: { only: [:name] }
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
@@ -5,10 +5,6 @@ class FollowsController < ApplicationController
|
||||
load_and_authorize_resource
|
||||
skip_load_resource only: :create
|
||||
|
||||
def index
|
||||
@follows = @member.followed.paginate(page: params[:page])
|
||||
end
|
||||
|
||||
def create
|
||||
@follow = current_member.follows.build(followed: Member.find(params[:followed]))
|
||||
|
||||
@@ -29,6 +25,10 @@ class FollowsController < ApplicationController
|
||||
redirect_to @unfollowed
|
||||
end
|
||||
|
||||
def index
|
||||
@follows = @member.followed.paginate(page: params[:page])
|
||||
end
|
||||
|
||||
def followers
|
||||
@followers = @member.followers.paginate(page: params[:page])
|
||||
end
|
||||
|
||||
@@ -20,7 +20,7 @@ class HarvestsController < DataController
|
||||
where['planting_id'] = @planting.id
|
||||
end
|
||||
|
||||
@harvests = Harvest.search('*', where:,
|
||||
@harvests = Harvest.search('*', where: where,
|
||||
limit: 100,
|
||||
page: params[:page],
|
||||
load: false,
|
||||
@@ -92,7 +92,7 @@ class HarvestsController < DataController
|
||||
elsif @crop
|
||||
"#{@crop.to_param}-"
|
||||
end
|
||||
"Growstuff-#{specifics}Harvests-#{Time.zone.now.to_fs(:number)}.csv"
|
||||
"Growstuff-#{specifics}Harvests-#{Time.zone.now.to_s(:number)}.csv"
|
||||
end
|
||||
|
||||
def update_crop_medians
|
||||
|
||||
@@ -39,7 +39,7 @@ class LikesController < ApplicationController
|
||||
{
|
||||
id: like.likeable.id,
|
||||
like_count: like.likeable.likes.count,
|
||||
liked_by_member:,
|
||||
liked_by_member: liked_by_member,
|
||||
description: ActionController::Base.helpers.pluralize(like.likeable.likes.count, "like")
|
||||
}
|
||||
end
|
||||
@@ -50,7 +50,7 @@ class LikesController < ApplicationController
|
||||
format.json do
|
||||
render(json: render_json(
|
||||
like,
|
||||
liked_by_member:
|
||||
liked_by_member: liked_by_member
|
||||
), status: status_code)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -18,6 +18,7 @@ class MembersController < ApplicationController
|
||||
@member = Member.confirmed.kept.find_by!(slug: params[:slug])
|
||||
@twitter_auth = @member.auth('twitter')
|
||||
@flickr_auth = @member.auth('flickr')
|
||||
@facebook_auth = @member.auth('facebook')
|
||||
@posts = @member.posts
|
||||
|
||||
@activity = TimelineService.member_query(@member).limit(30)
|
||||
|
||||
@@ -9,6 +9,10 @@ require './lib/actions/oauth_signup_action'
|
||||
# Heavily overlaps with Authentications controller
|
||||
#
|
||||
class OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
||||
def facebook
|
||||
create
|
||||
end
|
||||
|
||||
def failure
|
||||
flash[:alert] = "Authentication failed."
|
||||
redirect_to request.env['omniauth.origin'] || "/"
|
||||
@@ -28,7 +32,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
||||
@authentication = action.establish_authentication(auth, member)
|
||||
|
||||
if action.member_created?
|
||||
raise "Invalid provider" unless %w(twitter flickr).index(auth['provider'].to_s)
|
||||
raise "Invalid provider" unless %w(facebook twitter flickr).index(auth['provider'].to_s)
|
||||
|
||||
session["devise.#{auth['provider']}_data"] = request.env["omniauth.auth"]
|
||||
sign_in member
|
||||
|
||||
@@ -8,6 +8,11 @@ class PhotosController < ApplicationController
|
||||
respond_to :html, :json
|
||||
responders :flash
|
||||
|
||||
def show
|
||||
@crops = Crop.distinct.joins(:photo_associations).where(photo_associations: { photo: @photo })
|
||||
respond_with(@photo)
|
||||
end
|
||||
|
||||
def index
|
||||
@photos = Photo.search(
|
||||
load: false,
|
||||
@@ -19,11 +24,6 @@ class PhotosController < ApplicationController
|
||||
respond_with(@photos)
|
||||
end
|
||||
|
||||
def show
|
||||
@crops = Crop.distinct.joins(:photo_associations).where(photo_associations: { photo: @photo })
|
||||
respond_with(@photo)
|
||||
end
|
||||
|
||||
def new
|
||||
@photo = Photo.new
|
||||
@item = item_to_link_to
|
||||
@@ -92,15 +92,8 @@ class PhotosController < ApplicationController
|
||||
|
||||
def retrieve_from_flickr
|
||||
@flickr_auth = current_member.auth('flickr')
|
||||
return if @flickr_auth.nil?
|
||||
|
||||
unless current_member.flickr_auth_valid?
|
||||
current_member.remove_stale_flickr_auth
|
||||
@please_reconnect_flickr = true
|
||||
return
|
||||
end
|
||||
|
||||
@current_set = params[:set]
|
||||
return unless @flickr_auth
|
||||
|
||||
page = params[:page] || 1
|
||||
|
||||
|
||||
@@ -17,18 +17,18 @@ class PlantingsController < DataController
|
||||
|
||||
if params[:crop_slug]
|
||||
@crop = Crop.find_by(slug: params[:crop_slug])
|
||||
where['crop_id'] = @crop.id unless @crop.nil?
|
||||
where['crop_id'] = @crop.id
|
||||
end
|
||||
|
||||
@plantings = Planting.search(
|
||||
where:,
|
||||
where: where,
|
||||
page: params[:page],
|
||||
limit: 30,
|
||||
boost_by: [:created_at],
|
||||
load: false
|
||||
)
|
||||
|
||||
@filename = "Growstuff-#{specifics}Plantings-#{Time.zone.now.to_fs(:number)}.csv"
|
||||
@filename = "Growstuff-#{specifics}Plantings-#{Time.zone.now.to_s(:number)}.csv"
|
||||
|
||||
respond_with(@plantings)
|
||||
end
|
||||
|
||||
@@ -6,6 +6,7 @@ class RegistrationsController < Devise::RegistrationsController
|
||||
def edit
|
||||
@twitter_auth = current_member.auth('twitter')
|
||||
@flickr_auth = current_member.auth('flickr')
|
||||
@facebook_auth = current_member.auth('facebook')
|
||||
render "edit"
|
||||
end
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ class SeedsController < DataController
|
||||
|
||||
@filename = csv_filename
|
||||
@seeds = Seed.search(
|
||||
where:,
|
||||
where: where,
|
||||
page: params[:page],
|
||||
limit: 30,
|
||||
boost_by: [:created_at],
|
||||
@@ -89,9 +89,9 @@ class SeedsController < DataController
|
||||
|
||||
def csv_filename
|
||||
if @owner
|
||||
"Growstuff-#{@owner.to_param}-Seeds-#{Time.zone.now.to_fs(:number)}.csv"
|
||||
"Growstuff-#{@owner.to_param}-Seeds-#{Time.zone.now.to_s(:number)}.csv"
|
||||
else
|
||||
"Growstuff-Seeds-#{Time.zone.now.to_fs(:number)}.csv"
|
||||
"Growstuff-Seeds-#{Time.zone.now.to_s(:number)}.csv"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -24,7 +24,7 @@ module ApplicationHelper
|
||||
# Produces a cache key for uniquely identifying cached fragments.
|
||||
def cache_key_for(klass, identifier = "all")
|
||||
count = klass.count
|
||||
max_updated_at = klass.maximum(:updated_at).try(:utc).try(:to_fs, :number)
|
||||
max_updated_at = klass.maximum(:updated_at).try(:utc).try(:to_s, :number)
|
||||
"#{klass.name.downcase.pluralize}/#{identifier}-#{count}-#{max_updated_at}"
|
||||
end
|
||||
|
||||
@@ -55,7 +55,7 @@ module ApplicationHelper
|
||||
return uri.to_s
|
||||
end
|
||||
|
||||
Gravatar.new(member.email).image_url(size:,
|
||||
Gravatar.new(member.email).image_url(size: size,
|
||||
default: :identicon,
|
||||
ssl: true)
|
||||
end
|
||||
@@ -70,11 +70,11 @@ module ApplicationHelper
|
||||
all = show_all ? '' : 1
|
||||
|
||||
if owner.present?
|
||||
public_send("member_#{type}_path", owner, all:)
|
||||
public_send("member_#{type}_path", owner, all: all)
|
||||
elsif crop.present?
|
||||
public_send("crop_#{type}_path", crop, all:)
|
||||
public_send("crop_#{type}_path", crop, all: all)
|
||||
else
|
||||
public_send("#{type}_path", all:)
|
||||
public_send("#{type}_path", all: all)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -44,19 +44,19 @@ module ButtonsHelper
|
||||
end
|
||||
|
||||
def seed_edit_button(seed, classes: "btn btn-raised btn-info")
|
||||
edit_button(edit_seed_path(seed), classes:)
|
||||
edit_button(edit_seed_path(seed), classes: classes)
|
||||
end
|
||||
|
||||
def harvest_edit_button(harvest, classes: "btn btn-raised btn-info")
|
||||
edit_button(edit_harvest_path(harvest), classes:)
|
||||
edit_button(edit_harvest_path(harvest), classes: classes)
|
||||
end
|
||||
|
||||
def garden_edit_button(garden, classes: "btn btn-raised btn-info")
|
||||
edit_button(edit_garden_path(garden), classes:)
|
||||
edit_button(edit_garden_path(garden), classes: classes)
|
||||
end
|
||||
|
||||
def planting_edit_button(planting, classes: "btn btn-raised btn-info")
|
||||
edit_button(edit_planting_path(planting), classes:)
|
||||
edit_button(edit_planting_path(planting), classes: classes)
|
||||
end
|
||||
|
||||
def planting_finish_button(planting, classes: 'btn btn-default btn-secondary')
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
module CropsHelper
|
||||
def display_seed_availability(member, crop)
|
||||
seeds = member.seeds.where(crop:)
|
||||
seeds = member.seeds.where(crop: crop)
|
||||
total_quantity = seeds.where.not(quantity: nil).sum(:quantity)
|
||||
|
||||
return "You don't have any seeds of this crop." if seeds.none?
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
module EditableFormHelper
|
||||
def editable(field_type, model, field, display_field:, collection: [])
|
||||
render 'shared/editable/form', field_type:,
|
||||
model:, field:, display_field:, collection:
|
||||
render 'shared/editable/form', field_type: field_type,
|
||||
model: model, field: field, display_field: display_field, collection: collection
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
module PostsHelper
|
||||
def display_post_truncated(post, length: 300)
|
||||
truncate(strip_tags(post.body), length:,
|
||||
truncate(strip_tags(post.body), length: length,
|
||||
separator: ' ', omission: '... ') { link_to "Read more", post_path(post) }
|
||||
end
|
||||
|
||||
def post_stripped_tags(post, length: 300)
|
||||
truncate(strip_tags(post.body), length:)
|
||||
truncate(strip_tags(post.body), length: length)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -70,7 +70,7 @@ class Ability
|
||||
can :create, Notification do |n|
|
||||
n.recipient_id != member.id
|
||||
end
|
||||
# NOTE: we don't support update for notifications
|
||||
# note we don't support update for notifications
|
||||
|
||||
# only crop wranglers can create/edit/destroy crops
|
||||
if member.role? :crop_wrangler
|
||||
|
||||
@@ -15,7 +15,7 @@ class Comment < ApplicationRecord
|
||||
recipient_id: recipient,
|
||||
sender_id: sender,
|
||||
subject: "#{author} commented on #{post.subject}",
|
||||
body:,
|
||||
body: body,
|
||||
post_id: post.id
|
||||
)
|
||||
end
|
||||
|
||||
@@ -19,24 +19,6 @@ module MemberFlickr
|
||||
@flickr
|
||||
end
|
||||
|
||||
def flickr_auth_valid?
|
||||
# no flickr token saved for this member
|
||||
return false if flickr.nil?
|
||||
|
||||
# test the token/secret we have
|
||||
flickr.test.login # This throws exception if fails
|
||||
|
||||
# success!
|
||||
true
|
||||
rescue FlickRaw::FailedResponse, FlickRaw::OAuthClient::FailedResponse
|
||||
# token for this user doesn't work
|
||||
false
|
||||
end
|
||||
|
||||
def remove_stale_flickr_auth
|
||||
authentications.find_by(provider: "flickr")&.delete
|
||||
end
|
||||
|
||||
# Fetches a collection of photos from Flickr
|
||||
# Returns a [[page of photos], total] pair.
|
||||
# Total is needed for pagination.
|
||||
|
||||
@@ -32,8 +32,8 @@ module MemberNewsletter
|
||||
|
||||
gibbon.lists.subscribe(
|
||||
id: Rails.application.config.newsletter_list_id,
|
||||
email: { email: },
|
||||
merge_vars: { login_name: },
|
||||
email: { email: email },
|
||||
merge_vars: { login_name: login_name },
|
||||
double_optin: false # they already confirmed their email with us
|
||||
)
|
||||
end
|
||||
@@ -42,7 +42,7 @@ module MemberNewsletter
|
||||
return true if Rails.env.test? && !testing
|
||||
|
||||
gibbon.lists.unsubscribe(id: Rails.application.config.newsletter_list_id,
|
||||
email: { email: })
|
||||
email: { email: email })
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -33,7 +33,7 @@ module PredictHarvest
|
||||
days_to_first_harvest = (first_harvest_date - planted_at).to_i
|
||||
days_to_last_harvest = (last_harvest_date - planted_at).to_i if finished?
|
||||
end
|
||||
update(days_to_first_harvest:, days_to_last_harvest:)
|
||||
update(days_to_first_harvest: days_to_first_harvest, days_to_last_harvest: days_to_last_harvest)
|
||||
end
|
||||
|
||||
# status
|
||||
|
||||
@@ -29,19 +29,19 @@ module SearchCrops
|
||||
|
||||
def search_data
|
||||
{
|
||||
name:,
|
||||
description:,
|
||||
slug:,
|
||||
name: name,
|
||||
description: description,
|
||||
slug: slug,
|
||||
alternate_names: alternate_names.pluck(:name),
|
||||
scientific_names: scientific_names.pluck(:name),
|
||||
photos_count: photo_associations_count,
|
||||
# boost the crops that are planted the most
|
||||
plantings_count:,
|
||||
harvests_count:,
|
||||
plantings_count: plantings_count,
|
||||
harvests_count: harvests_count,
|
||||
# boost this crop for these members
|
||||
planters_ids: plantings.pluck(:owner_id),
|
||||
has_photos: photos.size.positive?,
|
||||
thumbnail_url:,
|
||||
thumbnail_url: thumbnail_url,
|
||||
scientific_name: default_scientific_name&.name,
|
||||
created_at: created_at.to_i
|
||||
}
|
||||
|
||||
@@ -17,22 +17,22 @@ module SearchHarvests
|
||||
|
||||
def search_data
|
||||
{
|
||||
slug:,
|
||||
quantity:,
|
||||
slug: slug,
|
||||
quantity: quantity,
|
||||
|
||||
# crop
|
||||
crop_id:,
|
||||
crop_name:,
|
||||
crop_id: crop_id,
|
||||
crop_name: crop_name,
|
||||
crop_slug: crop.slug,
|
||||
|
||||
# owner
|
||||
owner_id:,
|
||||
owner_login_name:,
|
||||
owner_slug:,
|
||||
owner_id: owner_id,
|
||||
owner_login_name: owner_login_name,
|
||||
owner_slug: owner_slug,
|
||||
plant_part_name: plant_part&.name,
|
||||
|
||||
# planting
|
||||
planting_id:,
|
||||
planting_id: planting_id,
|
||||
planting_slug: planting&.slug,
|
||||
|
||||
# photo
|
||||
@@ -43,7 +43,7 @@ module SearchHarvests
|
||||
photos_count: photos.count,
|
||||
|
||||
# timestamps
|
||||
harvested_at:,
|
||||
harvested_at: harvested_at,
|
||||
created_at: created_at.to_i
|
||||
}
|
||||
end
|
||||
@@ -58,7 +58,7 @@ module SearchHarvests
|
||||
}
|
||||
one_record = search('*',
|
||||
limit: 1,
|
||||
where:,
|
||||
where: where,
|
||||
boost_by: [:created_at],
|
||||
load: false).first
|
||||
return records if one_record.nil?
|
||||
|
||||
@@ -15,20 +15,20 @@ module SearchPhotos
|
||||
|
||||
def search_data
|
||||
{
|
||||
id:,
|
||||
title:,
|
||||
thumbnail_url:,
|
||||
fullsize_url:,
|
||||
id: id,
|
||||
title: title,
|
||||
thumbnail_url: thumbnail_url,
|
||||
fullsize_url: fullsize_url,
|
||||
# crops
|
||||
crops: crops.pluck(:id),
|
||||
# likes
|
||||
liked_by_members_names:,
|
||||
liked_by_members_names: liked_by_members_names,
|
||||
# owner
|
||||
owner_id:,
|
||||
owner_login_name:,
|
||||
owner_slug:,
|
||||
owner_id: owner_id,
|
||||
owner_login_name: owner_login_name,
|
||||
owner_slug: owner_slug,
|
||||
# counts
|
||||
likes_count:,
|
||||
likes_count: likes_count,
|
||||
|
||||
created_at: created_at.to_i
|
||||
}
|
||||
|
||||
@@ -18,39 +18,39 @@ module SearchPlantings
|
||||
|
||||
def search_data
|
||||
{
|
||||
slug:,
|
||||
active:,
|
||||
slug: slug,
|
||||
active: active,
|
||||
finished: finished?,
|
||||
has_photos: photos.size.positive?,
|
||||
location:,
|
||||
location: location,
|
||||
percentage_grown: percentage_grown.to_i,
|
||||
planted_at:,
|
||||
planted_from:,
|
||||
planted_at: planted_at,
|
||||
planted_from: planted_from,
|
||||
planted_year: planted_at&.year,
|
||||
quantity:,
|
||||
sunniness:,
|
||||
garden_id:,
|
||||
quantity: quantity,
|
||||
sunniness: sunniness,
|
||||
garden_id: garden_id,
|
||||
|
||||
first_harvest_predicted_at:,
|
||||
finish_predicted_at:,
|
||||
first_harvest_predicted_at: first_harvest_predicted_at,
|
||||
finish_predicted_at: finish_predicted_at,
|
||||
|
||||
# crops
|
||||
crop_id:,
|
||||
crop_name:,
|
||||
crop_slug:,
|
||||
crop_perennial:,
|
||||
crop_id: crop_id,
|
||||
crop_name: crop_name,
|
||||
crop_slug: crop_slug,
|
||||
crop_perennial: crop_perennial,
|
||||
|
||||
# owner
|
||||
owner_id:,
|
||||
owner_location:,
|
||||
owner_login_name:,
|
||||
owner_slug:,
|
||||
owner_id: owner_id,
|
||||
owner_location: owner_location,
|
||||
owner_login_name: owner_login_name,
|
||||
owner_slug: owner_slug,
|
||||
|
||||
# photos
|
||||
thumbnail_url: default_photo&.thumbnail_url || crop.default_photo&.thumbnail_url,
|
||||
# counts
|
||||
photos_count: photos.size,
|
||||
harvests_count:,
|
||||
harvests_count: harvests_count,
|
||||
|
||||
# timestamps
|
||||
created_at: created_at.to_i
|
||||
@@ -67,7 +67,7 @@ module SearchPlantings
|
||||
}
|
||||
one_record = search('*',
|
||||
limit: 1,
|
||||
where:,
|
||||
where: where,
|
||||
boost_by: [:created_at],
|
||||
load: false).first
|
||||
return records if one_record.nil?
|
||||
|
||||
@@ -18,31 +18,31 @@ module SearchSeeds
|
||||
|
||||
def search_data
|
||||
{
|
||||
slug:,
|
||||
slug: slug,
|
||||
finished: finished?,
|
||||
gmo:,
|
||||
active:,
|
||||
heirloom:,
|
||||
gmo: gmo,
|
||||
active: active,
|
||||
heirloom: heirloom,
|
||||
location: owner.location,
|
||||
organic:,
|
||||
quantity:,
|
||||
plant_before: plant_before&.to_fs(:ymd),
|
||||
tradable_to:,
|
||||
tradable:,
|
||||
organic: organic,
|
||||
quantity: quantity,
|
||||
plant_before: plant_before&.to_s(:ymd),
|
||||
tradable_to: tradable_to,
|
||||
tradable: tradable,
|
||||
|
||||
# crop
|
||||
crop_id:,
|
||||
crop_id: crop_id,
|
||||
crop_name: crop.name,
|
||||
crop_slug: crop.slug,
|
||||
|
||||
# owner
|
||||
owner_id:,
|
||||
owner_location:,
|
||||
owner_login_name:,
|
||||
owner_slug:,
|
||||
owner_id: owner_id,
|
||||
owner_location: owner_location,
|
||||
owner_login_name: owner_login_name,
|
||||
owner_slug: owner_slug,
|
||||
|
||||
# planting
|
||||
parent_planting:,
|
||||
parent_planting: parent_planting,
|
||||
|
||||
# counts
|
||||
photos_count: photos.size,
|
||||
@@ -56,7 +56,7 @@ module SearchSeeds
|
||||
end
|
||||
|
||||
def self.homepage_records(limit)
|
||||
search('*', limit:,
|
||||
search('*', limit: limit,
|
||||
where: {
|
||||
finished: false,
|
||||
tradable: true
|
||||
|
||||
@@ -10,9 +10,9 @@ class CsvImporter
|
||||
def import_crop(row)
|
||||
name, en_wikipedia_url, parent_name, scientific_names, alternate_names = row
|
||||
|
||||
@crop = Crop.find_or_create_by(name:)
|
||||
@crop = Crop.find_or_create_by(name: name)
|
||||
@crop.update(
|
||||
en_wikipedia_url:,
|
||||
en_wikipedia_url: en_wikipedia_url,
|
||||
creator_id: cropbot.id
|
||||
)
|
||||
|
||||
@@ -47,8 +47,8 @@ class CsvImporter
|
||||
return if names_to_add.empty?
|
||||
|
||||
names_to_add.each do |name|
|
||||
sciname = ScientificName.find_by(name:, crop: @crop)
|
||||
sciname ||= ScientificName.create!(name:, crop: @crop, creator: cropbot)
|
||||
sciname = ScientificName.find_by(name: name, crop: @crop)
|
||||
sciname ||= ScientificName.create!(name: name, crop: @crop, creator: cropbot)
|
||||
@crop.scientific_names << sciname
|
||||
end
|
||||
end
|
||||
@@ -58,7 +58,7 @@ class CsvImporter
|
||||
return if alternate_names.blank?
|
||||
|
||||
alternate_names.split(/,\s*/).each do |name|
|
||||
altname = AlternateName.find_by(name:, crop: @crop)
|
||||
altname = AlternateName.find_by(name: name, crop: @crop)
|
||||
altname ||= AlternateName.create! name: name, crop: @crop, creator: cropbot
|
||||
@crop.alternate_names << altname
|
||||
end
|
||||
|
||||
@@ -21,7 +21,7 @@ class Member < ApplicationRecord
|
||||
has_many :harvests, 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"
|
||||
has_many :sent_notifications, foreign_key: 'sender_id', inverse_of: :sender
|
||||
has_many :authentications, dependent: :destroy
|
||||
has_many :photos, inverse_of: :owner
|
||||
has_many :likes, dependent: :destroy
|
||||
@@ -127,7 +127,7 @@ class Member < ApplicationRecord
|
||||
end
|
||||
|
||||
def auth(provider)
|
||||
authentications.find_by(provider:)
|
||||
authentications.find_by(provider: provider)
|
||||
end
|
||||
|
||||
def unread_count
|
||||
|
||||
@@ -27,7 +27,7 @@ class Photo < ApplicationRecord
|
||||
source_type: type
|
||||
end
|
||||
|
||||
scope :by_crop, ->(crop) { joins(:photo_associations).where(photo_associations: { crop: }) }
|
||||
scope :by_crop, ->(crop) { joins(:photo_associations).where(photo_associations: { crop: crop }) }
|
||||
scope :by_model, lambda { |model_name|
|
||||
joins(:photo_associations).where(photo_associations: { photographable_type: model_name.to_s })
|
||||
}
|
||||
|
||||
@@ -33,8 +33,8 @@ class PhotoAssociation < ApplicationRecord
|
||||
end
|
||||
|
||||
def crop_present
|
||||
return unless %w(Planting Seed Harvest).include?(photographable_type)
|
||||
|
||||
errors.add(:crop_id, "failed to calculate crop") if crop_id.blank?
|
||||
if %w(Planting Seed Harvest).include?(photographable_type)
|
||||
errors.add(:crop_id, "failed to calculate crop") if crop_id.blank?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -89,7 +89,7 @@ class Planting < ApplicationRecord
|
||||
|
||||
# stringify as "beet in Skud's backyard" or similar
|
||||
def to_s
|
||||
I18n.t('plantings.string', crop: crop.name, garden: garden.name, owner:)
|
||||
I18n.t('plantings.string', crop: crop.name, garden: garden.name, owner: owner)
|
||||
end
|
||||
|
||||
def finished?
|
||||
@@ -109,7 +109,7 @@ class Planting < ApplicationRecord
|
||||
|
||||
# latitude, longitude = Geocoder.coordinates(location, params: { limit: 1 })
|
||||
Planting.joins(:garden)
|
||||
.where(crop:)
|
||||
.where(crop: crop)
|
||||
.located
|
||||
.where('gardens.latitude < ? AND gardens.latitude > ?',
|
||||
latitude + 10, latitude - 10)
|
||||
|
||||
@@ -90,10 +90,10 @@ class Post < ApplicationRecord
|
||||
next unless recipient_id != sender
|
||||
|
||||
Notification.create(
|
||||
recipient_id:,
|
||||
recipient_id: recipient_id,
|
||||
sender_id: sender,
|
||||
subject: "#{author} mentioned you in their post #{subject}",
|
||||
body:
|
||||
body: body
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -11,7 +11,7 @@ class Role < ApplicationRecord
|
||||
%i(crop_wranglers admins).each do |method|
|
||||
define_method method do
|
||||
slug = method.to_s.singularize.dasherize
|
||||
Role.where(slug:).try(:first).try(:members)
|
||||
Role.where(slug: slug).try(:first).try(:members)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -69,6 +69,6 @@ class Seed < ApplicationRecord
|
||||
end
|
||||
|
||||
def to_s
|
||||
I18n.t('seeds.string', crop: crop.name, owner:)
|
||||
I18n.t('seeds.string', crop: crop.name, owner: owner)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,10 +5,10 @@ module Api
|
||||
class MemberResource < BaseResource
|
||||
immutable
|
||||
|
||||
has_many :gardens, foreign_key: 'owner_id'
|
||||
has_many :plantings, foreign_key: 'owner_id'
|
||||
has_many :harvests, foreign_key: 'owner_id'
|
||||
has_many :seeds, foreign_key: 'owner_id'
|
||||
has_many :gardens
|
||||
has_many :plantings
|
||||
has_many :harvests
|
||||
has_many :seeds
|
||||
|
||||
has_many :photos
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ module Api
|
||||
filter :planted_from
|
||||
filter :garden
|
||||
filter :owner
|
||||
filter :owner_id
|
||||
filter :finished
|
||||
|
||||
attribute :percentage_grown
|
||||
|
||||
@@ -4,8 +4,8 @@ class CropSearchService
|
||||
# Crop.search(string)
|
||||
def self.search(query, page: 1, per_page: 12, current_member: nil)
|
||||
search_params = {
|
||||
page:,
|
||||
per_page:,
|
||||
page: page,
|
||||
per_page: per_page,
|
||||
fields: %i(name^5 alternate_names scientific_names),
|
||||
match: :word_start,
|
||||
boost_by: [:plantings_count],
|
||||
@@ -16,28 +16,28 @@ class CropSearchService
|
||||
# prioritise crops the member has planted
|
||||
search_params[:boost_where] = { planters_ids: current_member.id } if current_member
|
||||
|
||||
Crop.search(query, **search_params)
|
||||
Crop.search(query, search_params)
|
||||
end
|
||||
|
||||
def self.random_with_photos(limit)
|
||||
body = {
|
||||
query: {
|
||||
function_score: {
|
||||
query: { query_string: { query: 'has_photos:true' } },
|
||||
random_score: { seed: DateTime.now.to_i }
|
||||
"query": {
|
||||
"function_score": {
|
||||
"query": { "query_string": { "query": 'has_photos:true' } },
|
||||
"random_score": { "seed": DateTime.now.to_i }
|
||||
}
|
||||
}
|
||||
}
|
||||
Crop.search(
|
||||
limit:,
|
||||
limit: limit,
|
||||
load: false,
|
||||
body:
|
||||
body: body
|
||||
)
|
||||
end
|
||||
|
||||
def self.recent(limit)
|
||||
Crop.search(
|
||||
limit:,
|
||||
limit: limit,
|
||||
load: false,
|
||||
boost_by: { created_at: { factor: 100 } } # default factor is 1
|
||||
)
|
||||
|
||||
@@ -10,7 +10,7 @@ class OpenfarmService
|
||||
|
||||
def import!
|
||||
Crop.all.order(updated_at: :desc).each do |crop|
|
||||
Rails.logger.debug { "#{crop.id}, #{crop.name}" }
|
||||
Rails.logger.debug("#{crop.id}, #{crop.name}")
|
||||
update_crop(crop) if crop.valid?
|
||||
end
|
||||
end
|
||||
@@ -64,9 +64,9 @@ class OpenfarmService
|
||||
if photo.valid?
|
||||
Photo.transaction do
|
||||
photo.save
|
||||
PhotoAssociation.find_or_create_by! photo:, photographable: crop
|
||||
PhotoAssociation.find_or_create_by! photo: photo, photographable: crop
|
||||
end
|
||||
Rails.logger.debug { "\t saved photo #{photo.id} #{photo.source_id}" }
|
||||
Rails.logger.debug "\t saved photo #{photo.id} #{photo.source_id}"
|
||||
else
|
||||
Rails.logger.warn "Photo not valid"
|
||||
end
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
|
||||
class ApprovedValidator < ActiveModel::EachValidator
|
||||
def validate_each(record, attribute, _value)
|
||||
record.errors.add(attribute, options[:message] || 'must be approved') unless record.crop.try(:approved?)
|
||||
record.errors[attribute] << (options[:message] || 'must be approved') unless record.crop.try(:approved?)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -16,6 +16,6 @@
|
||||
:escaped_markdown
|
||||
#{ strip_tags comment.body }
|
||||
|
||||
%pubdate= comment.created_at.to_fs(:rfc822)
|
||||
%pubdate= comment.created_at.to_s(:rfc822)
|
||||
%link= post_url(comment.post)
|
||||
%guid= comment_url(comment)
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
%p
|
||||
%span.help-block
|
||||
For detailed crop wrangling guidelines, please consult the
|
||||
= link_to "crop wrangling guide", "https://github.com/Growstuff/growstuff/wiki/Crop-Wrangling"
|
||||
= link_to "crop wrangling guide", "http://wiki.growstuff.org/index.php/Crop_wrangling"
|
||||
on the Growstuff wiki.
|
||||
|
||||
-# Everyone (wranglers and requesters) sees the basic info section
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
- else
|
||||
Nobody is growing this yet. You could be the first!
|
||||
- if @crop.description.present?
|
||||
%p= simple_format @crop.description
|
||||
%p= @crop.description
|
||||
.col-md-3
|
||||
= image_tag crop_image_path(@crop),
|
||||
class: 'img-responsive shadow rounded crop-hero-photo', alt: 'photo of crop'
|
||||
|
||||
@@ -107,8 +107,8 @@ csv.headers *all_headers
|
||||
|
||||
csv.cell :added_by_member_id, c.creator.id
|
||||
csv.cell :added_by_member_name, c.creator.to_s
|
||||
csv.cell :date_added, c.created_at.to_fs(:db)
|
||||
csv.cell :last_modified, c.updated_at.to_fs(:db)
|
||||
csv.cell :date_added, c.created_at.to_s(:db)
|
||||
csv.cell :last_modified, c.updated_at.to_s(:db)
|
||||
|
||||
csv.cell :license, "CC-BY-SA Growstuff http://growstuff.org/"
|
||||
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
- @crops.each do |crop|
|
||||
%item
|
||||
%title= crop.name
|
||||
%pubdate= crop.created_at.to_fs(:rfc822)
|
||||
%pubdate= crop.created_at.to_s(:rfc822)
|
||||
%link= crop_url(crop)
|
||||
%guid= crop_url(crop)
|
||||
|
||||
@@ -34,21 +34,18 @@
|
||||
= cute_icon
|
||||
= render 'crops/photos', crop: @crop
|
||||
|
||||
- if @crop.plantings.any? or @crop.harvests.any?
|
||||
- if @crop.plantings.any?
|
||||
%section.charts
|
||||
.row
|
||||
- if @crop.sunniness.any?
|
||||
.col-lg-4.col-12
|
||||
%h2 Sunniness
|
||||
= pie_chart crop_sunniness_path(@crop, format: :json), legend: "bottom"
|
||||
- if @crop.planted_from.any?
|
||||
.col-lg-4.col-12
|
||||
%h2 Planted from
|
||||
= pie_chart crop_planted_from_path(@crop, format: :json), legend: "bottom"
|
||||
- if @crop.harvests.any?
|
||||
.col-lg-4.col-12
|
||||
%h2 Harvested for
|
||||
= pie_chart crop_harvested_for_path(@crop, format: :json), legend: "bottom"
|
||||
.col-lg-4.col-12
|
||||
%h2 Sunniness
|
||||
= pie_chart crop_sunniness_path(@crop, format: :json), legend: "bottom"
|
||||
.col-lg-4.col-12
|
||||
%h2 Planted from
|
||||
= pie_chart crop_planted_from_path(@crop, format: :json), legend: "bottom"
|
||||
.col-lg-4.col-12
|
||||
%h2 Harvested for
|
||||
= pie_chart crop_harvested_for_path(@crop, format: :json), legend: "bottom"
|
||||
|
||||
- if @crop.varieties.any?
|
||||
%section.varieties
|
||||
|
||||
@@ -28,3 +28,17 @@
|
||||
method: :delete, class: "remove btn btn-danger"
|
||||
- else
|
||||
= link_to 'Connect to Flickr', '/members/auth/flickr', class: 'btn'
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
%p
|
||||
= image_tag "facebook_32.png", size: "32x32", alt: 'Facebook logo'
|
||||
- if @facebook_auth
|
||||
You are connected to Facebook as
|
||||
= succeed "." do
|
||||
= link_to @facebook_auth.name, "https://facebook.com/profile/#{@facebook_auth.uid}"
|
||||
= link_to "Disconnect", @facebook_auth,
|
||||
confirm: "Are you sure you want to remove this connection?",
|
||||
method: :delete, class: "remove btn btn-danger"
|
||||
- else
|
||||
= link_to 'Connect to Facebook', '/members/auth/facebook', class: 'btn'
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
= link_to "Request new crops.", new_crop_path
|
||||
|
||||
.col-md-4
|
||||
= f.text_field :harvested_at, value: @harvest.harvested_at ? @harvest.harvested_at.to_fs(:ymd) : '',
|
||||
= f.text_field :harvested_at, value: @harvest.harvested_at ? @harvest.harvested_at.to_s(:ymd) : '',
|
||||
class: 'add-datepicker', label: 'When?'
|
||||
.col-12
|
||||
= f.form_group :plant_part_id, label: { text: "Harvested Plant Part" } do
|
||||
|
||||
@@ -34,12 +34,12 @@ csv.headers :id,
|
||||
|
||||
csv.cells :quantity, :unit, :weight_quantity, :weight_unit, :si_weight
|
||||
|
||||
csv.cell :date_harvested, h.created_at.to_fs(:db)
|
||||
csv.cell :date_harvested, h.created_at.to_s(:db)
|
||||
|
||||
csv.cell :description
|
||||
|
||||
csv.cell :date_added, h.created_at.to_fs(:db)
|
||||
csv.cell :last_modified, h.updated_at.to_fs(:db)
|
||||
csv.cell :date_added, h.created_at.to_s(:db)
|
||||
csv.cell :last_modified, h.updated_at.to_s(:db)
|
||||
|
||||
csv.cell :license, "CC-BY-SA Growstuff http://growstuff.org/"
|
||||
|
||||
|
||||
@@ -30,6 +30,6 @@
|
||||
= csrf_meta_tags
|
||||
= stylesheet_link_tag "application", media: "all"
|
||||
|
||||
%link{ href: path_to_image("growstuff-apple-touch-icon-precomposed.png"), rel: "apple-touch-icon-precomposed" }
|
||||
%link{ href: "/growstuff-apple-touch-icon-precomposed.png", rel: "apple-touch-icon-precomposed" }
|
||||
%link{ href: "https://fonts.googleapis.com/css?family=Modak|Raleway&display=swap", rel: "stylesheet" }
|
||||
= favicon_link_tag 'favicon.ico'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
- if twitter_auth || flickr_auth || member.show_email
|
||||
- if twitter_auth || flickr_auth || facebook_auth || member.show_email
|
||||
%h4 Contact
|
||||
|
||||
- if twitter_auth
|
||||
@@ -11,6 +11,11 @@
|
||||
= image_tag "flickr_32.png", size: "32x32", alt: 'Flickr logo'
|
||||
= link_to flickr_auth.name, "https://flickr.com/photos/#{flickr_auth.uid}"
|
||||
|
||||
- if facebook_auth
|
||||
%p
|
||||
= image_tag "facebook_32.png", size: "32x32", alt: 'Facebook logo'
|
||||
= link_to facebook_auth.name, "https://facebook.com/profile/#{facebook_auth.uid}"
|
||||
|
||||
- if member.show_email
|
||||
%p
|
||||
Email:
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
- cache member do
|
||||
.card.card-double
|
||||
.card-body
|
||||
%h4.login-name= link_to member, member
|
||||
%div
|
||||
= render "members/avatar", member: member
|
||||
%div
|
||||
= link_to "view all #{member}'s gardens", member_gardens_path(member)
|
||||
%p
|
||||
%small
|
||||
Joined
|
||||
= distance_of_time_in_words(member.created_at, Time.zone.now)
|
||||
ago.
|
||||
- if member.location.present?
|
||||
= link_to member.location, place_path(member.location)
|
||||
.row
|
||||
.col-12.col-md-6
|
||||
= render "members/avatar", member: member
|
||||
.col-12.col-md-6
|
||||
%h4.login-name= link_to member, member
|
||||
= link_to "view all #{member}'s gardens", member_gardens_path(member)
|
||||
%p
|
||||
%small
|
||||
Joined
|
||||
= distance_of_time_in_words(member.created_at, Time.zone.now)
|
||||
ago.
|
||||
- if member.location.present?
|
||||
= link_to member.location, place_path(member.location)
|
||||
.card-footer
|
||||
%ul.nav.nav-justified.small
|
||||
%li.nav-item.border-right
|
||||
|
||||
@@ -2,39 +2,39 @@
|
||||
%h3 Activity
|
||||
%ul.list-group.list-group-flush
|
||||
%li.list-group-item
|
||||
- if member.gardens.present?
|
||||
- if !member.gardens.empty?
|
||||
= link_to localize_plural(member.gardens, Garden), member_gardens_path(member)
|
||||
- else
|
||||
0 gardens
|
||||
%li.list-group-item
|
||||
- if member.plantings.present?
|
||||
- if !member.plantings.empty?
|
||||
= link_to localize_plural(member.plantings, Planting), member_plantings_path(member)
|
||||
- else
|
||||
0 plantings
|
||||
%li.list-group-item
|
||||
- if member.harvests.present?
|
||||
- if !member.harvests.empty?
|
||||
= link_to localize_plural(member.harvests, Harvest), member_harvests_path(member)
|
||||
- else
|
||||
0 harvests
|
||||
%li.list-group-item
|
||||
- if member.seeds.present?
|
||||
- if !member.seeds.empty?
|
||||
= link_to localize_plural(member.seeds, Seed), member_seeds_path(member)
|
||||
- else
|
||||
0 seeds
|
||||
%li.list-group-item
|
||||
- if member.posts.present?
|
||||
- if !member.posts.empty?
|
||||
= link_to localize_plural(member.posts, Post), member_posts_path(member)
|
||||
- else
|
||||
0 posts
|
||||
|
||||
%li.list-group-item
|
||||
- if member.followed.present?
|
||||
- if !member.followed.empty?
|
||||
= link_to localize_plural(member.followed, Follow), member_follows_path(member)
|
||||
- else
|
||||
0 following
|
||||
|
||||
%li.list-group-item
|
||||
- if member.followers.present?
|
||||
- if !member.followers.empty?
|
||||
= link_to pluralize(member.followers.size, "follower"), member_followers_path(member)
|
||||
- else
|
||||
0 followers
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
= truncate(@member.location, length: 25, separator: ' ', omission: '... ')
|
||||
%p
|
||||
%strong Member since
|
||||
= @member.created_at.to_fs(:date)
|
||||
= @member.created_at.to_s(:date)
|
||||
%p
|
||||
%strong Last Login
|
||||
= @member.last_sign_in_at
|
||||
@@ -57,7 +57,8 @@
|
||||
= render "stats", member: @member
|
||||
.card-footer
|
||||
= render "contact", member: @member, twitter_auth: @twitter_auth,
|
||||
flickr_auth: @flickr_auth
|
||||
flickr_auth: @flickr_auth,
|
||||
facebook_auth: @facebook_auth
|
||||
|
||||
.col-md-10
|
||||
%section= render "map", member: @member
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
- @member.posts.each do |post|
|
||||
%item
|
||||
%title #{post.subject} by #{post.author.login_name}
|
||||
%pubdate= post.created_at.to_fs(:rfc822)
|
||||
%pubdate= post.created_at.to_s(:rfc822)
|
||||
%link= post_url(post)
|
||||
%guid= post_url(post)
|
||||
%description
|
||||
|
||||
@@ -3,17 +3,7 @@
|
||||
%h1 New Photo
|
||||
%h2 Choose photo for #{link_to @item, @item}
|
||||
|
||||
- if @please_reconnect_flickr
|
||||
%h2.alert Please reconnect your flickr account
|
||||
|
||||
%p the token has expired or been revoked.
|
||||
|
||||
= link_to '/members/auth/flickr', class: "btn btn-lg" do
|
||||
= icon 'fab', 'flickr'
|
||||
Reconnect Flickr
|
||||
|
||||
|
||||
- elsif @flickr_auth
|
||||
- if @flickr_auth
|
||||
%p
|
||||
Connected to Flickr as
|
||||
= succeed "." do
|
||||
@@ -47,9 +37,7 @@
|
||||
.row.pagination
|
||||
.col-md-12= will_paginate @photos
|
||||
- else
|
||||
%h2.alert You must connect your account to Flickr to add photos.
|
||||
|
||||
%p
|
||||
= link_to '/members/auth/flickr', class: :btn do
|
||||
= icon 'fab', 'flickr'
|
||||
connect to Flickr
|
||||
.alert
|
||||
You must
|
||||
= link_to "connect your account to Flickr", '/members/auth/flickr'
|
||||
to add photos.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
%form.form-inline{ action: search_places_path, method: :get, role: 'form' }
|
||||
.form-group
|
||||
= label_tag :new_place, "Change location:", class: 'sr-only'
|
||||
= text_field_tag :new_place, '', class: 'form-control', placeholder: "Search for city, suburb or state..."
|
||||
= text_field_tag :new_place, '', class: 'form-control', placeholder: "New location..."
|
||||
= submit_tag "Search", class: 'btn btn-primary', id: "search_button"
|
||||
%br/
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
= link_to "Add a garden.", new_garden_path
|
||||
.col-md-4
|
||||
= f.text_field :planted_at,
|
||||
value: @planting.planted_at ? @planting.planted_at.to_fs(:ymd) : '',
|
||||
value: @planting.planted_at ? @planting.planted_at.to_s(:ymd) : '',
|
||||
class: 'add-datepicker', label: 'When?'
|
||||
|
||||
.row
|
||||
@@ -52,7 +52,7 @@
|
||||
%span.help-block= t('.finish_helper')
|
||||
.col-md-6
|
||||
= f.text_field :finished_at,
|
||||
value: @planting.finished_at ? @planting.finished_at.to_fs(:ymd) : '',
|
||||
value: @planting.finished_at ? @planting.finished_at.to_s(:ymd) : '',
|
||||
class: 'add-datepicker',
|
||||
label: 'Finished date',
|
||||
placeholder: 'optional'
|
||||
|
||||
@@ -34,15 +34,15 @@ csv.headers :id,
|
||||
|
||||
csv.cells :quantity, :planted_from, :sunniness
|
||||
|
||||
csv.cell :date_planted, p.planted_at ? p.planted_at.to_fs(:db) : ''
|
||||
csv.cell :date_planted, p.planted_at ? p.planted_at.to_s(:db) : ''
|
||||
|
||||
csv.cell :finished
|
||||
csv.cell :date_finished, p.finished_at ? p.finished_at.to_fs(:db) : ''
|
||||
csv.cell :date_finished, p.finished_at ? p.finished_at.to_s(:db) : ''
|
||||
|
||||
csv.cell :description
|
||||
|
||||
csv.cell :date_added, p.created_at.to_fs(:db)
|
||||
csv.cell :last_modified, p.updated_at.to_fs(:db)
|
||||
csv.cell :date_added, p.created_at.to_s(:db)
|
||||
csv.cell :last_modified, p.updated_at.to_s(:db)
|
||||
|
||||
csv.cell :license, "CC-BY-SA Growstuff http://growstuff.org/"
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
- @plantings.each do |planting|
|
||||
%item
|
||||
%title #{planting['crop_name']} in #{planting['location']}
|
||||
%pubdate= planting['created_at'].to_fs(:rfc822)
|
||||
%pubdate= planting['created_at'].to_s(:rfc822)
|
||||
%description
|
||||
:escaped
|
||||
<p>Quantity: #{planting['quantity'] ? planting['quantity'] : 'unknown' }</p>
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
- unless posts.empty?
|
||||
%table.table.table-striped
|
||||
%tr
|
||||
%th.col-6 Subject
|
||||
%th.col-2.hidden-xs Posted by
|
||||
%th.col-2 Most recent activity
|
||||
%th.col-2.hidden-xs Comments
|
||||
%th Subject
|
||||
%th.hidden-xs Posted by
|
||||
%th Most recent activity
|
||||
%th.hidden-xs Comments
|
||||
|
||||
- posts.recently_active[0..howmany - 1].each do |post|
|
||||
- cache post do
|
||||
|
||||
@@ -10,6 +10,6 @@
|
||||
%description
|
||||
:escaped_markdown
|
||||
#{ strip_tags post.body }
|
||||
%pubdate= post.created_at.to_fs(:rfc822)
|
||||
%pubdate= post.created_at.to_s(:rfc822)
|
||||
%link= post_url(post)
|
||||
%guid= post_url(post)
|
||||
|
||||
@@ -17,6 +17,6 @@
|
||||
:escaped_markdown
|
||||
#{ strip_tags comment.body }
|
||||
|
||||
%pubdate= comment.created_at.to_fs(:rfc822)
|
||||
%pubdate= comment.created_at.to_s(:rfc822)
|
||||
%link= post_url(@post)
|
||||
%guid= comment_url(comment)
|
||||
|
||||
@@ -30,18 +30,18 @@
|
||||
.row
|
||||
.col-12.col-md-4
|
||||
= f.text_field :saved_at,
|
||||
value: @seed.saved_at ? @seed.saved_at.to_fs(:ymd) : '',
|
||||
value: @seed.saved_at ? @seed.saved_at.to_s(:ymd) : '',
|
||||
class: 'add-datepicker', label: 'When were the seeds harvested/saved?'
|
||||
.col-12.col-md-4= f.number_field :quantity, label: 'Quantity'
|
||||
.col-12.col-md-4
|
||||
= f.text_field :plant_before, class: 'add-datepicker',
|
||||
value: @seed.plant_before ? @seed.plant_before.to_fs(:ymd) : ''
|
||||
value: @seed.plant_before ? @seed.plant_before.to_s(:ymd) : ''
|
||||
|
||||
.row
|
||||
.col-12.col-md-4
|
||||
= f.check_box :finished, label: 'Mark as finished'
|
||||
.col-12.col-md-4
|
||||
= f.text_field :finished_at, class: 'add-datepicker', value: @seed.finished_at ? @seed.finished_at.to_fs(:ymd) : ''
|
||||
= f.text_field :finished_at, class: 'add-datepicker', value: @seed.finished_at ? @seed.finished_at.to_s(:ymd) : ''
|
||||
.col-12.col-md-4
|
||||
%span.help-inline= t('.finish_helper')
|
||||
|
||||
|
||||
@@ -44,8 +44,8 @@ csv.headers :id,
|
||||
csv.cell :gmo
|
||||
csv.cell :heirloom
|
||||
|
||||
csv.cell :date_added, s.created_at.to_fs(:db)
|
||||
csv.cell :last_modified, s.updated_at.to_fs(:db)
|
||||
csv.cell :date_added, s.created_at.to_s(:db)
|
||||
csv.cell :last_modified, s.updated_at.to_s(:db)
|
||||
|
||||
csv.cell :license, "CC-BY-SA Growstuff http://growstuff.org/"
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
- @seeds.each do |seed|
|
||||
%item
|
||||
%title #{seed.owner_login_name}'s #{seed.crop_name} seeds
|
||||
%pubdate= seed.created_at.to_fs(:rfc822)
|
||||
%pubdate= seed.created_at.to_s(:rfc822)
|
||||
%description
|
||||
:escaped
|
||||
<p>Quantity: #{seed.quantity ||= 'unknown' }</p>
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
.hide{id: "date--#{model.id}-#{field.to_s}"}
|
||||
= bootstrap_form_for(model) do |f|
|
||||
= f.text_field field,
|
||||
value: model.send(field) ? model.send(field).to_fs(:ymd) : '',
|
||||
value: model.send(field) ? model.send(field).to_s(:ymd) : '',
|
||||
class: 'add-datepicker', label: 'When?'
|
||||
= f.submit :save
|
||||
|
||||
@@ -13,6 +13,6 @@
|
||||
= f.select field, collection
|
||||
- elsif field_type == :date
|
||||
= f.text_field field,
|
||||
value: model.send(field) ? model.send(field).to_fs(:ymd) : '',
|
||||
value: model.send(field) ? model.send(field).to_s(:ymd) : '',
|
||||
class: 'add-datepicker', label: 'When?'
|
||||
= f.submit :save
|
||||
|
||||
@@ -12,19 +12,15 @@ Bundler.require(*Rails.groups)
|
||||
module Growstuff
|
||||
class Application < Rails::Application
|
||||
# Initialize configuration defaults for originally generated Rails version.
|
||||
config.load_defaults 7.0
|
||||
config.load_defaults 6.0
|
||||
|
||||
I18n.config.enforce_available_locales = true
|
||||
|
||||
config.active_record.legacy_connection_handling = false
|
||||
|
||||
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
||||
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
||||
config.time_zone = 'UTC'
|
||||
config.active_record.default_timezone = :local
|
||||
|
||||
config.active_record.yaml_column_permitted_classes = [Symbol, Date, Time, ActiveSupport::TimeWithZone, ActiveSupport::TimeZone]
|
||||
|
||||
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
||||
I18n.load_path += Dir[Rails.root.join('config', 'locales', '*.{rb,yml}')]
|
||||
I18n.default_locale = :en
|
||||
|
||||
@@ -4,7 +4,7 @@ development:
|
||||
|
||||
test:
|
||||
adapter: postgresql
|
||||
database: growstuff_test
|
||||
database: growstuff_test<%= ENV['TEST_ENV_NUMBER'] %>
|
||||
|
||||
production:
|
||||
adapter: postgresql
|
||||
|
||||
@@ -1,16 +1,10 @@
|
||||
development:
|
||||
adapter: postgresql
|
||||
database: growstuff_dev
|
||||
host: localhost
|
||||
user: postgres
|
||||
password: postgres
|
||||
|
||||
test:
|
||||
adapter: postgresql
|
||||
database: growstuff_test
|
||||
host: localhost
|
||||
user: postgres
|
||||
password: postgres
|
||||
database: growstuff_test<%= ENV['TEST_ENV_NUMBER'] %>
|
||||
|
||||
production:
|
||||
adapter: postgresql
|
||||
|
||||
@@ -69,6 +69,11 @@ Rails.application.configure do
|
||||
config.host = 'localhost:3000'
|
||||
config.analytics_code = ''
|
||||
|
||||
# this config variable cannot be put in application.yml as it is needed
|
||||
# by the assets pipeline, which doesn't have access to ENV.
|
||||
config.mapbox_map_id = 'growstuff.i3n2il6a'
|
||||
config.mapbox_access_token = 'pk.eyJ1IjoiZ3Jvd3N0dWZmIiwiYSI6IkdxMkx4alUifQ.n0igaBsw97s14zMa0lwKCA'
|
||||
|
||||
config.action_controller.action_on_unpermitted_parameters = :raise
|
||||
|
||||
config.active_job.queue_adapter = :sidekiq
|
||||
|
||||
@@ -92,10 +92,10 @@ Rails.application.configure do
|
||||
config.action_mailer.default_url_options = { host: ENV['HOST'] }
|
||||
|
||||
config.action_mailer.smtp_settings = {
|
||||
user_name: ENV['MAILGUN_SMTP_LOGIN'],
|
||||
password: ENV['MAILGUN_SMTP_PASSWORD'],
|
||||
user_name: ENV['SENDGRID_USERNAME'],
|
||||
password: ENV['SENDGRID_PASSWORD'],
|
||||
domain: ENV['GROWSTUFF_EMAIL_DOMAIN'],
|
||||
address: ENV['MAILGUN_SMTP_SERVER'],
|
||||
address: 'smtp.sendgrid.net',
|
||||
port: 587,
|
||||
authentication: :plain,
|
||||
enable_starttls_auto: true
|
||||
@@ -109,6 +109,11 @@ Rails.application.configure do
|
||||
<noscript><p><img alt="Clicky" width="1" height="1" src="//in.getclicky.com/100594260ns.gif" /></p></noscript>
|
||||
eos
|
||||
|
||||
# this config variable cannot be put in application.yml as it is needed
|
||||
# by the assets pipeline, which doesn't have access to ENV.
|
||||
config.mapbox_map_id = ENV['GROWSTUFF_MAPBOX_MAP_ID']
|
||||
config.mapbox_access_token = ENV['GROWSTUFF_MAPBOX_ACCESS_TOKEN']
|
||||
|
||||
config.active_job.queue_adapter = :sidekiq
|
||||
# Use a different logger for distributed setups.
|
||||
# require 'syslog/logger'
|
||||
|
||||
@@ -104,3 +104,16 @@ Capybara.configure do |config|
|
||||
end
|
||||
|
||||
OmniAuth.config.test_mode = true
|
||||
# Fake the omniauth
|
||||
OmniAuth.config.mock_auth[:facebook] = OmniAuth::AuthHash.new(provider: 'facebook',
|
||||
uid: '123545',
|
||||
info: {
|
||||
name: "John Testerson",
|
||||
nickname: 'JohnnyT',
|
||||
email: 'example.oauth.facebook@example.com',
|
||||
image: 'http://findicons.com/files/icons/1072/face_avatars/300/i04.png'
|
||||
},
|
||||
credentials: {
|
||||
token: "token",
|
||||
secret: "donttell"
|
||||
})
|
||||
|
||||
@@ -86,7 +86,7 @@ Devise.setup do |config|
|
||||
config.stretches = Rails.env.test? ? 1 : 10
|
||||
|
||||
# Setup a pepper to generate the encrypted password.
|
||||
# config.pepper = "..."
|
||||
# config.pepper = "dd24b97208cc11ebae765edd19bee764aacafa99b3711440f08fe92e8f790d0b4ab60ebb6bc3bcc2c526438eefa50326eddf4d3e429a2431f8a646d8a7d7bd1f"
|
||||
|
||||
# ==> Configuration for :confirmable
|
||||
# A period that the user is allowed to access the website even without
|
||||
@@ -233,4 +233,7 @@ Devise.setup do |config|
|
||||
# When using omniauth, Devise cannot automatically set Omniauth path,
|
||||
# so you need to do it manually. For the users scope, it would be:
|
||||
# config.omniauth_path_prefix = "/my_engine/users/auth"
|
||||
|
||||
# Later we may wish to ask for user_photos,user_location, however this means we need to be reviewed by facebook
|
||||
config.omniauth :facebook, ENV['GROWSTUFF_FACEBOOK_KEY'], ENV['GROWSTUFF_FACEBOOK_SECRET'], scope: 'email,public_profile', display: 'page', info_fields: 'email,name,first_name,last_name,id'
|
||||
end
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
|
||||
Rails.application.config.middleware.use OmniAuth::Builder do
|
||||
provider :twitter, ENV['GROWSTUFF_TWITTER_KEY'], ENV['GROWSTUFF_TWITTER_SECRET']
|
||||
provider :flickr, ENV['GROWSTUFF_FLICKR_KEY'], ENV['GROWSTUFF_FLICKR_SECRET'], scope: 'read'
|
||||
provider :flickr, ENV['GROWSTUFF_FLICKR_KEY'], ENV['GROWSTUFF_FLICKR_SECRET']
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
if ENV['MY_RUBY_HOME']&.include?('rvm')
|
||||
begin
|
||||
require 'rvm'
|
||||
RVM.use_from_path! File.dirname(__FILE__, 2)
|
||||
RVM.use_from_path! File.dirname(File.dirname(__FILE__))
|
||||
rescue LoadError
|
||||
# RVM is unavailable at this point.
|
||||
raise "RVM ruby lib is currently unavailable."
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user