mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-26 01:37:39 -04:00
Compare commits
147 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3325e1e388 | ||
|
|
7947fd6e91 | ||
|
|
70bf5499b2 | ||
|
|
6b059cb4f4 | ||
|
|
efd112c4b8 | ||
|
|
5c7b760f34 | ||
|
|
81ae473972 | ||
|
|
a8171bb739 | ||
|
|
c803ed4ee6 | ||
|
|
9e41a65749 | ||
|
|
a7539df5b5 | ||
|
|
3950619877 | ||
|
|
7373fd4aa9 | ||
|
|
c3d9885525 | ||
|
|
4b5dee7bdb | ||
|
|
55d846b9e0 | ||
|
|
f2d8349a88 | ||
|
|
7c7dd7c609 | ||
|
|
d8f2c580ee | ||
|
|
2a0602468d | ||
|
|
89a9c18188 | ||
|
|
8b426da149 | ||
|
|
cab98f9750 | ||
|
|
27b7a26fee | ||
|
|
7261fae9f2 | ||
|
|
628ebd6841 | ||
|
|
61bbf7c30d | ||
|
|
e33803343a | ||
|
|
b08a448fdc | ||
|
|
7210ebfb22 | ||
|
|
039978357b | ||
|
|
7ce2481cbc | ||
|
|
5bc6af87c5 | ||
|
|
a5eaf3566e | ||
|
|
63d89be698 | ||
|
|
1b7be9f9b0 | ||
|
|
7a53e96d52 | ||
|
|
b28d146de7 | ||
|
|
55c8be8dc5 | ||
|
|
38a273459a | ||
|
|
1b07632c69 | ||
|
|
4a12523793 | ||
|
|
6aa601b8ab | ||
|
|
a66a040207 | ||
|
|
547a408a99 | ||
|
|
8cd224b7fa | ||
|
|
8428e93b47 | ||
|
|
483143f2fe | ||
|
|
1b3d106b6d | ||
|
|
e7be006fa7 | ||
|
|
b9f40151d8 | ||
|
|
fd467acc29 | ||
|
|
e1ad0c31c8 | ||
|
|
ee604dc2b0 | ||
|
|
0620646c6d | ||
|
|
df9cf3f5c4 | ||
|
|
944349760a | ||
|
|
7fe75ee52a | ||
|
|
e3d7bf9a62 | ||
|
|
deaf49c18f | ||
|
|
53543fff4c | ||
|
|
ea5e710a70 | ||
|
|
ad5a52ae74 | ||
|
|
c0cc5ab085 | ||
|
|
cf784cbedd | ||
|
|
5c68830919 | ||
|
|
370aab41c3 | ||
|
|
081f4021bc | ||
|
|
36f846fabf | ||
|
|
f6d094f57c | ||
|
|
9ce097b7d6 | ||
|
|
b03ccce575 | ||
|
|
63b8788c80 | ||
|
|
faa3beddbc | ||
|
|
5dbd5bc1d2 | ||
|
|
b8b0d98e07 | ||
|
|
b911ebfd07 | ||
|
|
1ca515bd4e | ||
|
|
905710b6e9 | ||
|
|
12e0f674bc | ||
|
|
18739c2a24 | ||
|
|
f3dc2ff7e5 | ||
|
|
e6209a5906 | ||
|
|
dbf64a4e90 | ||
|
|
a8961c3466 | ||
|
|
6931952688 | ||
|
|
936aa17ecc | ||
|
|
f3d7420b8a | ||
|
|
e419acea6e | ||
|
|
95ae15b780 | ||
|
|
ed468e79fc | ||
|
|
130565af75 | ||
|
|
ad8f360336 | ||
|
|
15775403fd | ||
|
|
e1b83c32af | ||
|
|
3fc7c65247 | ||
|
|
c8d1239b79 | ||
|
|
7885257fae | ||
|
|
a8d22709e6 | ||
|
|
31b7b45ae3 | ||
|
|
681798b582 | ||
|
|
f05ea56179 | ||
|
|
ed4269ea4c | ||
|
|
085fcc958e | ||
|
|
8f33fe3595 | ||
|
|
980a7d79d3 | ||
|
|
9c5c07e087 | ||
|
|
faaf07cad8 | ||
|
|
0e83a230b9 | ||
|
|
c278b36858 | ||
|
|
0805f86b86 | ||
|
|
aad88f1da6 | ||
|
|
7550bc860f | ||
|
|
fc38e1edea | ||
|
|
88a66a705b | ||
|
|
f77fd00931 | ||
|
|
b5c030905a | ||
|
|
2844e13298 | ||
|
|
3e4dc1f9e3 | ||
|
|
259c1e1731 | ||
|
|
870aa674b0 | ||
|
|
b1ab319bf7 | ||
|
|
857422719a | ||
|
|
235314bc13 | ||
|
|
ac1cd88ae1 | ||
|
|
f93ea3c0a1 | ||
|
|
0075040aab | ||
|
|
f9d51e623c | ||
|
|
dcd36dcd67 | ||
|
|
608a921fce | ||
|
|
4bedf1e6ac | ||
|
|
ac14c310f6 | ||
|
|
f979da315a | ||
|
|
a74ef7de6b | ||
|
|
10064121a6 | ||
|
|
f8a1ef6066 | ||
|
|
40d7b11d90 | ||
|
|
1600dd9e0b | ||
|
|
fbf5164eca | ||
|
|
21d86a8c2d | ||
|
|
848c7e117b | ||
|
|
369868672b | ||
|
|
321f3517a7 | ||
|
|
6dd7ec9f95 | ||
|
|
90f444dc1a | ||
|
|
32b98a7e40 | ||
|
|
8648db5518 |
@@ -8,7 +8,7 @@ engines:
|
||||
eslint:
|
||||
enabled: true
|
||||
coffeelint:
|
||||
enabled: true
|
||||
enabled: true
|
||||
brakeman:
|
||||
enabled: true
|
||||
bundler-audit:
|
||||
@@ -25,7 +25,7 @@ ratings:
|
||||
paths:
|
||||
- "**.rb"
|
||||
- "**.js"
|
||||
- "**.coffee"
|
||||
- "**.coffee"
|
||||
- "**.sass"
|
||||
- "**.haml"
|
||||
- Gemfile.lock
|
||||
|
||||
@@ -1 +1 @@
|
||||
2.2.4
|
||||
2.3.1
|
||||
|
||||
@@ -8,10 +8,12 @@ env:
|
||||
global:
|
||||
secure: "Z5TpM2jEX4UCvNePnk/LwltQX48U2u9BRc+Iypr1x9QW2o228QJhPIOH39a8RMUrepGnkQIq9q3ZRUn98RfrJz1yThtlNFL3NmzdQ57gKgjGwfpa0e4Dwj/ZJqV2D84tDGjvdVYLP7zzaYZxQcwk/cgNpzKf/jq97HLNP7CYuf4="
|
||||
rvm:
|
||||
- 2.2.4
|
||||
- 2.3.1
|
||||
before_script:
|
||||
- psql -c 'create database growstuff_test;' -U postgres
|
||||
script:
|
||||
- script/gemfile_check
|
||||
- bundle exec script/check_contributors_md
|
||||
- bundle exec rake db:migrate --trace
|
||||
- bundle exec rspec spec/
|
||||
services:
|
||||
@@ -34,4 +36,6 @@ deploy:
|
||||
- restart
|
||||
after_deploy:
|
||||
- bundle exec script/heroku_maintenance.rb off
|
||||
|
||||
addons:
|
||||
code_climate:
|
||||
repo_token: 462e015bbdaabfb20910fc07f2fea253410ecb131444e00f97dbf32dc6789ca6
|
||||
|
||||
@@ -68,3 +68,5 @@ submit the change with your pull request.
|
||||
- Daniel O'Connor / [CloCkWeRX](https://github.com/CloCkWeRX)
|
||||
- DV Dasari / [dv2](https://github.com/dv2)
|
||||
- Eric Tillberg / [Thrillberg](https://github.com/Thrillberg)
|
||||
- Lucas Nogueira / [lucasnogueira](https://github.com/lucasnogueira)
|
||||
- Charley Lewittes / [ctlewitt](https://github.com/ctlewitt)
|
||||
|
||||
4
Capfile
4
Capfile
@@ -1,4 +0,0 @@
|
||||
load 'deploy'
|
||||
# Uncomment if you are using Rails' asset pipeline
|
||||
# load 'deploy/assets'
|
||||
load 'config/deploy' # remove this line to skip loading any of the default tasks
|
||||
24
Gemfile
24
Gemfile
@@ -1,8 +1,8 @@
|
||||
source 'https://rubygems.org'
|
||||
|
||||
ruby '2.2.4'
|
||||
ruby '2.3.1'
|
||||
|
||||
gem 'rails', '~> 4.1.11'
|
||||
gem 'rails', '~> 4.2.0'
|
||||
|
||||
gem 'bundler', '>=1.1.5'
|
||||
|
||||
@@ -36,13 +36,8 @@ gem 'comfortable_mexican_sofa', '~> 1.12.0' # content management system
|
||||
gem 'kaminari' # pagination
|
||||
gem 'bootstrap-kaminari-views' # bootstrap views for kaminari
|
||||
|
||||
# vendored activemerchant for testing- needed for bogus paypal
|
||||
# gateway monkeypatch
|
||||
gem 'activemerchant', '1.33.0',
|
||||
:path => 'vendor/gems/activemerchant-1.33.0',
|
||||
:require => 'active_merchant'
|
||||
gem 'active_utils', '1.0.5',
|
||||
:path => 'vendor/gems/active_utils-1.0.5'
|
||||
gem 'activemerchant'
|
||||
gem 'active_utils'
|
||||
|
||||
# Markdown formatting for updates etc
|
||||
gem 'bluecloth'
|
||||
@@ -51,7 +46,7 @@ gem 'bluecloth'
|
||||
gem 'will_paginate', '~> 3.0'
|
||||
|
||||
# user signup/login/etc
|
||||
gem 'devise', '~> 3.5.0'
|
||||
gem 'devise', '>= 4.0.0'
|
||||
|
||||
# nicely formatted URLs
|
||||
gem 'friendly_id', '~> 5.0.4'
|
||||
@@ -60,9 +55,7 @@ gem 'friendly_id', '~> 5.0.4'
|
||||
gem 'gravatar-ultimate'
|
||||
|
||||
# For geolocation
|
||||
gem 'geocoder',
|
||||
:git => 'https://github.com/alexreisner/geocoder.git',
|
||||
:ref => '104d46'
|
||||
gem 'geocoder'
|
||||
|
||||
# For easy calendar selection
|
||||
gem 'bootstrap-datepicker-rails'
|
||||
@@ -103,12 +96,12 @@ end
|
||||
|
||||
group :development, :test do
|
||||
gem 'haml-rails' # HTML templating language
|
||||
gem 'rspec-rails', '~> 3.4.0' # unit testing framework
|
||||
gem 'rspec-rails' # unit testing framework
|
||||
gem 'rspec-activemodel-mocks'
|
||||
gem 'byebug' # debugging
|
||||
gem 'database_cleaner', '~> 1.5.0'
|
||||
gem 'webrat' # provides HTML matchers for view tests
|
||||
gem 'factory_girl_rails', '~> 4.5.0' # for creating test data
|
||||
gem 'factory_girl_rails' # for creating test data
|
||||
gem 'coveralls', require: false # coverage analysis
|
||||
gem 'capybara' # integration tests
|
||||
gem 'capybara-email' # integration tests for email
|
||||
@@ -117,6 +110,7 @@ group :development, :test do
|
||||
gem 'i18n-tasks' # adds tests for finding missing and unused translations
|
||||
gem 'selenium-webdriver'
|
||||
gem "codeclimate-test-reporter", group: :test, require: nil
|
||||
gem "active_merchant-paypal-bogus-gateway"
|
||||
end
|
||||
|
||||
group :travis do
|
||||
|
||||
230
Gemfile.lock
230
Gemfile.lock
@@ -1,57 +1,57 @@
|
||||
GIT
|
||||
remote: https://github.com/alexreisner/geocoder.git
|
||||
revision: 104d466ba7097b7dce5ba19f8e4091b7f69ccdf6
|
||||
ref: 104d46
|
||||
specs:
|
||||
geocoder (1.1.8)
|
||||
|
||||
PATH
|
||||
remote: vendor/gems/active_utils-1.0.5
|
||||
specs:
|
||||
active_utils (1.0.5)
|
||||
activesupport (>= 2.3.11)
|
||||
i18n
|
||||
|
||||
PATH
|
||||
remote: vendor/gems/activemerchant-1.33.0
|
||||
specs:
|
||||
activemerchant (1.33.0)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actionmailer (4.1.15)
|
||||
actionpack (= 4.1.15)
|
||||
actionview (= 4.1.15)
|
||||
actionmailer (4.2.6)
|
||||
actionpack (= 4.2.6)
|
||||
actionview (= 4.2.6)
|
||||
activejob (= 4.2.6)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
actionpack (4.1.15)
|
||||
actionview (= 4.1.15)
|
||||
activesupport (= 4.1.15)
|
||||
rack (~> 1.5.2)
|
||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||
actionpack (4.2.6)
|
||||
actionview (= 4.2.6)
|
||||
activesupport (= 4.2.6)
|
||||
rack (~> 1.6)
|
||||
rack-test (~> 0.6.2)
|
||||
actionview (4.1.15)
|
||||
activesupport (= 4.1.15)
|
||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||
actionview (4.2.6)
|
||||
activesupport (= 4.2.6)
|
||||
builder (~> 3.1)
|
||||
erubis (~> 2.7.0)
|
||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||
active_link_to (1.0.3)
|
||||
actionpack
|
||||
activemodel (4.1.15)
|
||||
activesupport (= 4.1.15)
|
||||
active_merchant-paypal-bogus-gateway (0.1.0)
|
||||
activemerchant
|
||||
active_utils (3.2.0)
|
||||
activesupport (>= 3.2)
|
||||
i18n
|
||||
activejob (4.2.6)
|
||||
activesupport (= 4.2.6)
|
||||
globalid (>= 0.3.0)
|
||||
activemerchant (1.59.0)
|
||||
activesupport (>= 3.2.14, < 5.1)
|
||||
builder (>= 2.1.2, < 4.0.0)
|
||||
i18n (>= 0.6.9)
|
||||
nokogiri (~> 1.4)
|
||||
activemodel (4.2.6)
|
||||
activesupport (= 4.2.6)
|
||||
builder (~> 3.1)
|
||||
activerecord (4.1.15)
|
||||
activemodel (= 4.1.15)
|
||||
activesupport (= 4.1.15)
|
||||
arel (~> 5.0.0)
|
||||
activesupport (4.1.15)
|
||||
i18n (~> 0.6, >= 0.6.9)
|
||||
activerecord (4.2.6)
|
||||
activemodel (= 4.2.6)
|
||||
activesupport (= 4.2.6)
|
||||
arel (~> 6.0)
|
||||
activesupport (4.2.6)
|
||||
i18n (~> 0.7)
|
||||
json (~> 1.7, >= 1.7.7)
|
||||
minitest (~> 5.1)
|
||||
thread_safe (~> 0.1)
|
||||
thread_safe (~> 0.3, >= 0.3.4)
|
||||
tzinfo (~> 1.1)
|
||||
addressable (2.4.0)
|
||||
arel (5.0.1.20140414130214)
|
||||
ast (2.2.0)
|
||||
autoprefixer-rails (6.3.6.1)
|
||||
arel (6.0.3)
|
||||
ast (2.3.0)
|
||||
autoprefixer-rails (6.3.6.2)
|
||||
execjs
|
||||
bcrypt (3.1.11)
|
||||
better_errors (2.1.1)
|
||||
@@ -72,8 +72,8 @@ GEM
|
||||
sass (>= 3.3.4)
|
||||
bootstrap_form (2.3.0)
|
||||
builder (3.2.2)
|
||||
byebug (9.0.4)
|
||||
cancancan (1.14.0)
|
||||
byebug (9.0.5)
|
||||
cancancan (1.15.0)
|
||||
capybara (2.7.1)
|
||||
addressable
|
||||
mime-types (>= 1.16)
|
||||
@@ -94,7 +94,7 @@ GEM
|
||||
cliver (0.3.2)
|
||||
cocaine (0.5.8)
|
||||
climate_control (>= 0.0.3, < 1.0)
|
||||
codeclimate-test-reporter (0.5.0)
|
||||
codeclimate-test-reporter (0.6.0)
|
||||
simplecov (>= 0.7.1, < 1.0.0)
|
||||
codemirror-rails (5.11)
|
||||
railties (>= 3.0, < 5)
|
||||
@@ -133,12 +133,11 @@ GEM
|
||||
dalli (2.7.6)
|
||||
database_cleaner (1.5.3)
|
||||
debug_inspector (0.0.2)
|
||||
devise (3.5.10)
|
||||
devise (4.1.1)
|
||||
bcrypt (~> 3.0)
|
||||
orm_adapter (~> 0.1)
|
||||
railties (>= 3.2.6, < 5)
|
||||
railties (>= 4.1.0, < 5.1)
|
||||
responders
|
||||
thread_safe (~> 0.1)
|
||||
warden (~> 1.2.3)
|
||||
diff-lcs (1.2.5)
|
||||
docile (1.1.5)
|
||||
@@ -146,41 +145,44 @@ GEM
|
||||
json
|
||||
thread
|
||||
thread_safe
|
||||
elasticsearch (1.0.17)
|
||||
elasticsearch-api (= 1.0.17)
|
||||
elasticsearch-transport (= 1.0.17)
|
||||
elasticsearch-api (1.0.17)
|
||||
elasticsearch (1.0.18)
|
||||
elasticsearch-api (= 1.0.18)
|
||||
elasticsearch-transport (= 1.0.18)
|
||||
elasticsearch-api (1.0.18)
|
||||
multi_json
|
||||
elasticsearch-model (0.1.9)
|
||||
activesupport (> 3)
|
||||
elasticsearch (> 0.4)
|
||||
hashie
|
||||
elasticsearch-rails (0.1.9)
|
||||
elasticsearch-transport (1.0.17)
|
||||
elasticsearch-transport (1.0.18)
|
||||
faraday
|
||||
multi_json
|
||||
erubis (2.7.0)
|
||||
excon (0.49.0)
|
||||
excon (0.50.1)
|
||||
execjs (2.7.0)
|
||||
factory_girl (4.5.0)
|
||||
factory_girl (4.7.0)
|
||||
activesupport (>= 3.0.0)
|
||||
factory_girl_rails (4.5.0)
|
||||
factory_girl (~> 4.5.0)
|
||||
factory_girl_rails (4.7.0)
|
||||
factory_girl (~> 4.7.0)
|
||||
railties (>= 3.0.0)
|
||||
faraday (0.9.2)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
ffi (1.9.10)
|
||||
figaro (1.1.1)
|
||||
thor (~> 0.14)
|
||||
flickraw (0.9.8)
|
||||
flickraw (0.9.9)
|
||||
font-awesome-sass (4.6.2)
|
||||
sass (>= 3.2)
|
||||
formatador (0.2.5)
|
||||
friendly_id (5.0.5)
|
||||
activerecord (>= 4.0.0)
|
||||
gibbon (1.2.0)
|
||||
geocoder (1.3.7)
|
||||
gibbon (1.2.1)
|
||||
httparty
|
||||
multi_json (>= 1.9.0)
|
||||
globalid (0.3.6)
|
||||
activesupport (>= 4.1.0)
|
||||
gravatar-ultimate (2.0.0)
|
||||
activesupport (>= 2.3.14)
|
||||
rack
|
||||
@@ -194,7 +196,7 @@ GEM
|
||||
shellany (~> 0.0)
|
||||
thor (>= 0.18.1)
|
||||
guard-compat (1.2.1)
|
||||
guard-rspec (4.6.5)
|
||||
guard-rspec (4.7.2)
|
||||
guard (~> 2.1)
|
||||
guard-compat (~> 1.1)
|
||||
rspec (>= 2.99.0, < 4.0)
|
||||
@@ -216,7 +218,7 @@ GEM
|
||||
haml (~> 4.0.0)
|
||||
nokogiri (~> 1.6.0)
|
||||
ruby_parser (~> 3.5)
|
||||
httparty (0.13.3)
|
||||
httparty (0.13.7)
|
||||
json (~> 1.8)
|
||||
multi_xml (>= 0.5.2)
|
||||
i18n (0.7.0)
|
||||
@@ -230,16 +232,17 @@ GEM
|
||||
parser (>= 2.2.3.0)
|
||||
term-ansicolor (>= 1.3.2)
|
||||
terminal-table (>= 1.5.1)
|
||||
jquery-rails (3.1.4)
|
||||
railties (>= 3.0, < 5.0)
|
||||
jquery-rails (4.1.1)
|
||||
rails-dom-testing (>= 1, < 3)
|
||||
railties (>= 4.2.0)
|
||||
thor (>= 0.14, < 2.0)
|
||||
jquery-ui-rails (5.0.5)
|
||||
railties (>= 3.2.16)
|
||||
js-routes (1.2.5)
|
||||
js-routes (1.2.6)
|
||||
railties (>= 3.2)
|
||||
sprockets-rails
|
||||
json (1.8.3)
|
||||
kaminari (0.16.3)
|
||||
kaminari (0.17.0)
|
||||
actionpack (>= 3.0.0)
|
||||
activesupport (>= 3.0.0)
|
||||
kgio (2.10.0)
|
||||
@@ -255,24 +258,27 @@ GEM
|
||||
rb-fsevent (~> 0.9, >= 0.9.4)
|
||||
rb-inotify (~> 0.9, >= 0.9.7)
|
||||
ruby_dep (~> 1.2)
|
||||
loofah (2.0.3)
|
||||
nokogiri (>= 1.5.9)
|
||||
lumberjack (1.0.10)
|
||||
mail (2.6.4)
|
||||
mime-types (>= 1.16, < 4)
|
||||
memcachier (0.0.2)
|
||||
method_source (0.8.2)
|
||||
mime-types (3.0)
|
||||
mime-types (3.1)
|
||||
mime-types-data (~> 3.2015)
|
||||
mime-types-data (3.2016.0221)
|
||||
mime-types-data (3.2016.0521)
|
||||
mimemagic (0.3.0)
|
||||
mini_portile2 (2.0.0)
|
||||
mini_portile2 (2.1.0)
|
||||
minitest (5.9.0)
|
||||
multi_json (1.11.3)
|
||||
multi_xml (0.5.5)
|
||||
multipart-post (2.0.0)
|
||||
nenv (0.3.0)
|
||||
newrelic_rpm (3.15.2.317)
|
||||
nokogiri (1.6.7.2)
|
||||
mini_portile2 (~> 2.0.0.rc2)
|
||||
newrelic_rpm (3.16.0.318)
|
||||
nokogiri (1.6.8)
|
||||
mini_portile2 (~> 2.1.0)
|
||||
pkg-config (~> 1.1.7)
|
||||
notiffany (0.1.0)
|
||||
nenv (~> 0.1)
|
||||
shellany (~> 0.0)
|
||||
@@ -296,15 +302,15 @@ GEM
|
||||
cocaine (~> 0.5.5)
|
||||
mime-types
|
||||
mimemagic (= 0.3.0)
|
||||
parser (2.3.1.0)
|
||||
parser (2.3.1.2)
|
||||
ast (~> 2.2)
|
||||
pg (0.18.4)
|
||||
pkg-config (1.1.7)
|
||||
plupload-rails (1.2.1)
|
||||
rails (>= 3.1)
|
||||
poltergeist (1.9.0)
|
||||
poltergeist (1.10.0)
|
||||
capybara (~> 2.1)
|
||||
cliver (~> 0.3.1)
|
||||
multi_json (~> 1.0)
|
||||
websocket-driver (>= 0.2.0)
|
||||
pry (0.10.3)
|
||||
coderay (~> 1.1.0)
|
||||
@@ -312,19 +318,28 @@ GEM
|
||||
slop (~> 3.4)
|
||||
quiet_assets (1.1.0)
|
||||
railties (>= 3.1, < 5.0)
|
||||
rack (1.5.5)
|
||||
rack (1.6.4)
|
||||
rack-test (0.6.3)
|
||||
rack (>= 1.0)
|
||||
rails (4.1.15)
|
||||
actionmailer (= 4.1.15)
|
||||
actionpack (= 4.1.15)
|
||||
actionview (= 4.1.15)
|
||||
activemodel (= 4.1.15)
|
||||
activerecord (= 4.1.15)
|
||||
activesupport (= 4.1.15)
|
||||
rails (4.2.6)
|
||||
actionmailer (= 4.2.6)
|
||||
actionpack (= 4.2.6)
|
||||
actionview (= 4.2.6)
|
||||
activejob (= 4.2.6)
|
||||
activemodel (= 4.2.6)
|
||||
activerecord (= 4.2.6)
|
||||
activesupport (= 4.2.6)
|
||||
bundler (>= 1.3.0, < 2.0)
|
||||
railties (= 4.1.15)
|
||||
sprockets-rails (~> 2.0)
|
||||
railties (= 4.2.6)
|
||||
sprockets-rails
|
||||
rails-deprecated_sanitizer (1.0.3)
|
||||
activesupport (>= 4.2.0.alpha)
|
||||
rails-dom-testing (1.0.7)
|
||||
activesupport (>= 4.2.0.beta, < 5.0)
|
||||
nokogiri (~> 1.6.0)
|
||||
rails-deprecated_sanitizer (>= 1.0.1)
|
||||
rails-html-sanitizer (1.0.3)
|
||||
loofah (~> 2.0)
|
||||
rails-i18n (4.0.8)
|
||||
i18n (~> 0.7)
|
||||
railties (~> 4.0)
|
||||
@@ -333,18 +348,18 @@ GEM
|
||||
rails_stdout_logging
|
||||
rails_serve_static_assets (0.0.5)
|
||||
rails_stdout_logging (0.0.5)
|
||||
railties (4.1.15)
|
||||
actionpack (= 4.1.15)
|
||||
activesupport (= 4.1.15)
|
||||
railties (4.2.6)
|
||||
actionpack (= 4.2.6)
|
||||
activesupport (= 4.2.6)
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.18.1, < 2.0)
|
||||
raindrops (0.16.0)
|
||||
rake (11.1.2)
|
||||
rake (11.2.2)
|
||||
rb-fsevent (0.9.7)
|
||||
rb-inotify (0.9.7)
|
||||
ffi (>= 0.5.0)
|
||||
responders (1.1.2)
|
||||
railties (>= 3.2, < 4.2)
|
||||
responders (2.2.0)
|
||||
railties (>= 4.2.0, < 5.1)
|
||||
rspec (3.4.0)
|
||||
rspec-core (~> 3.4.0)
|
||||
rspec-expectations (~> 3.4.0)
|
||||
@@ -376,13 +391,13 @@ GEM
|
||||
sexp_processor (~> 4.1)
|
||||
rubyzip (1.2.0)
|
||||
sass (3.4.22)
|
||||
sass-rails (5.0.4)
|
||||
railties (>= 4.0.0, < 5.0)
|
||||
sass-rails (5.0.5)
|
||||
railties (>= 4.0.0, < 6)
|
||||
sass (~> 3.1)
|
||||
sprockets (>= 2.8, < 4.0)
|
||||
sprockets-rails (>= 2.0, < 4.0)
|
||||
tilt (>= 1.1, < 3)
|
||||
selenium-webdriver (2.53.0)
|
||||
selenium-webdriver (2.53.4)
|
||||
childprocess (~> 0.5)
|
||||
rubyzip (~> 1.0)
|
||||
websocket (~> 1.0)
|
||||
@@ -394,20 +409,20 @@ GEM
|
||||
simplecov-html (~> 0.10.0)
|
||||
simplecov-html (0.10.0)
|
||||
slop (3.6.0)
|
||||
sprockets (3.6.0)
|
||||
sprockets (3.6.2)
|
||||
concurrent-ruby (~> 1.0)
|
||||
rack (> 1, < 3)
|
||||
sprockets-rails (2.3.3)
|
||||
actionpack (>= 3.0)
|
||||
activesupport (>= 3.0)
|
||||
sprockets (>= 2.8, < 4.0)
|
||||
sprockets-rails (3.1.1)
|
||||
actionpack (>= 4.0)
|
||||
activesupport (>= 4.0)
|
||||
sprockets (>= 3.0.0)
|
||||
term-ansicolor (1.3.2)
|
||||
tins (~> 1.0)
|
||||
terminal-table (1.5.2)
|
||||
terminal-table (1.6.0)
|
||||
thor (0.19.1)
|
||||
thread (0.2.2)
|
||||
thread_safe (0.3.5)
|
||||
tilt (2.0.4)
|
||||
tilt (2.0.5)
|
||||
tins (1.6.0)
|
||||
tzinfo (1.2.2)
|
||||
thread_safe (~> 0.1)
|
||||
@@ -435,8 +450,9 @@ PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
active_utils (= 1.0.5)!
|
||||
activemerchant (= 1.33.0)!
|
||||
active_merchant-paypal-bogus-gateway
|
||||
active_utils
|
||||
activemerchant
|
||||
better_errors
|
||||
binding_of_caller
|
||||
bluecloth
|
||||
@@ -457,15 +473,15 @@ DEPENDENCIES
|
||||
csv_shaper
|
||||
dalli
|
||||
database_cleaner (~> 1.5.0)
|
||||
devise (~> 3.5.0)
|
||||
devise (>= 4.0.0)
|
||||
elasticsearch-model
|
||||
elasticsearch-rails
|
||||
factory_girl_rails (~> 4.5.0)
|
||||
factory_girl_rails
|
||||
figaro
|
||||
flickraw
|
||||
font-awesome-sass
|
||||
friendly_id (~> 5.0.4)
|
||||
geocoder!
|
||||
geocoder
|
||||
gibbon (~> 1.2.0)
|
||||
gravatar-ultimate
|
||||
guard
|
||||
@@ -490,11 +506,11 @@ DEPENDENCIES
|
||||
poltergeist (~> 1.6)
|
||||
pry
|
||||
quiet_assets
|
||||
rails (~> 4.1.11)
|
||||
rails (~> 4.2.0)
|
||||
rails_12factor
|
||||
rake (>= 10.0.0)
|
||||
rspec-activemodel-mocks
|
||||
rspec-rails (~> 3.4.0)
|
||||
rspec-rails
|
||||
ruby-units
|
||||
sass-rails (~> 5.0.4)
|
||||
selenium-webdriver
|
||||
@@ -504,7 +520,7 @@ DEPENDENCIES
|
||||
will_paginate (~> 3.0)
|
||||
|
||||
RUBY VERSION
|
||||
ruby 2.1.8p440
|
||||
ruby 2.3.1p112
|
||||
|
||||
BUNDLED WITH
|
||||
1.12.4
|
||||
1.12.5
|
||||
|
||||
18
README.md
18
README.md
@@ -19,8 +19,9 @@ encourage participation from people of all backgrounds and skill levels.
|
||||
|
||||
* [Issues](http://github.com/Growstuff/growstuff/issues) (features we're
|
||||
working on, known bugs, etc)
|
||||
* [Discussion forums](http://wiki.growstuff.org/index.php/Discussion_forums) (mailing lists, IRC, etc)
|
||||
* [Wiki](http://wiki.growstuff.org/) (general documentation)
|
||||
* [Discussion forums](http://talk.growstuff.org/) (design ideas, planning releases)
|
||||
* [IRC](https://webchat.freenode.net/) growstuff channel (general chat, brainstorming and troubleshooting) or [Gitter](https://gitter.im/Growstuff/growstuff)
|
||||
* [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
|
||||
|
||||
@@ -28,19 +29,11 @@ Growstuff is built in Ruby on Rails and also uses JavaScript for
|
||||
frontend features. We welcome contributions -- see
|
||||
[CONTRIBUTING](CONTRIBUTING.md) for details.
|
||||
|
||||
* To set up your development environment, see [Getting started](http://wiki.growstuff.org/index.php/Development/Getting_Started).
|
||||
* 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. [Find a pair programming partner.](http://talk.growstuff.org/t/find-a-pair-programming-partner/13)
|
||||
* Drop in to one of our [discussion forums](http://wiki.growstuff.org/index.php/Discussion_forums) to chat to other developers, get help, etc.
|
||||
* Drop in to our [discussion forums](http://talk.growstuff.org/), IRC or Gitter to chat to other developers, get help, etc.
|
||||
* You may also be interested in our [API](http://wiki.growstuff.org/index.php/API).
|
||||
|
||||
The wiki is down right now, so here's what you need to do on Mac OS X to get set up.
|
||||
|
||||
```
|
||||
gem install bundle
|
||||
gem install pg -v '0.18.4' -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/latest/bin/pg_config
|
||||
bundle install
|
||||
```
|
||||
|
||||
## For designers, writers, researchers, data wranglers, and other contributors
|
||||
|
||||
There are heaps of ways to get involved and contribute no matter what
|
||||
@@ -58,6 +51,7 @@ Here on Github, you might find these useful:
|
||||
* [needs: visual design](https://github.com/Growstuff/growstuff/labels/needs:%20visual design) - tasks requiring visual/graphical design
|
||||
* [needs: documentation](https://github.com/Growstuff/growstuff/labels/needs:%20documentation)
|
||||
* [needs: data](https://github.com/Growstuff/growstuff/labels/needs:%20data) - tasks requiring data entry, data design, data import, or similar
|
||||
* [curated:beginner](https://github.com/Growstuff/growstuff/labels/curated:%20beginner) - tasks that are ideal for beginner programmers or people new to the project
|
||||
|
||||
Feel free to comment on any of the issues you find there, or open up a broader conversation on [Growstuff Talk](http://talk.growstuff.org).
|
||||
|
||||
|
||||
BIN
app/assets/images/facebook-thumbnail.png
Normal file
BIN
app/assets/images/facebook-thumbnail.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
@@ -13,17 +13,6 @@ class AlternateNamesController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
# GET /alternate_names/1
|
||||
# GET /alternate_names/1.json
|
||||
def show
|
||||
@alternate_name = AlternateName.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.haml
|
||||
format.json { render json: @alternate_name }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /alternate_names/new
|
||||
# GET /alternate_names/new.json
|
||||
def new
|
||||
|
||||
@@ -52,7 +52,7 @@ class ApplicationController < ActionController::Base
|
||||
protected
|
||||
|
||||
def configure_permitted_parameters
|
||||
devise_parameter_sanitizer.for(:sign_up) do |member|
|
||||
devise_parameter_sanitizer.permit(:sign_up) do |member|
|
||||
member.permit(:login_name, :email, :password, :password_confirmation,
|
||||
:remember_me, :login,
|
||||
# terms of service
|
||||
@@ -64,7 +64,7 @@ class ApplicationController < ActionController::Base
|
||||
)
|
||||
end
|
||||
|
||||
devise_parameter_sanitizer.for(:account_update) do |member|
|
||||
devise_parameter_sanitizer.permit(:account_update) do |member|
|
||||
member.permit(:login_name, :email, :password, :password_confirmation,
|
||||
:remember_me, :login,
|
||||
# terms of service
|
||||
|
||||
@@ -14,17 +14,6 @@ class CommentsController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
# GET /comments/1
|
||||
# GET /comments/1.json
|
||||
def show
|
||||
@comment = Comment.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.json { render json: @comment }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /comments/new
|
||||
# GET /comments/new.json
|
||||
def new
|
||||
|
||||
@@ -83,8 +83,16 @@ class CropsController < ApplicationController
|
||||
respond_to do |format|
|
||||
format.html # show.html.haml
|
||||
format.json do
|
||||
# TODO RABL or similar one day to avoid presentation logic here
|
||||
owner_structure = {
|
||||
owner: {
|
||||
only: [:id, :login_name, :location, :latitude, :longitude]
|
||||
}
|
||||
}
|
||||
render json: @crop.to_json(include: {
|
||||
plantings: { include: { owner: { only: [:id, :login_name, :location, :latitude, :longitude] }}}
|
||||
plantings: {
|
||||
include: owner_structure
|
||||
}
|
||||
})
|
||||
end
|
||||
end
|
||||
@@ -136,7 +144,7 @@ class CropsController < ApplicationController
|
||||
end
|
||||
unless current_member.has_role? :crop_wrangler
|
||||
Role.crop_wranglers.each do |w|
|
||||
Notifier.new_crop_request(w, @crop).deliver!
|
||||
Notifier.new_crop_request(w, @crop).deliver_now!
|
||||
end
|
||||
end
|
||||
|
||||
@@ -180,8 +188,8 @@ class CropsController < ApplicationController
|
||||
if previous_status == "pending"
|
||||
requester = @crop.requester
|
||||
new_status = @crop.approval_status
|
||||
Notifier.crop_request_approved(requester, @crop).deliver! if new_status == "approved"
|
||||
Notifier.crop_request_rejected(requester, @crop).deliver! if new_status == "rejected"
|
||||
Notifier.crop_request_approved(requester, @crop).deliver_now! if new_status == "approved"
|
||||
Notifier.crop_request_rejected(requester, @crop).deliver_now! if new_status == "rejected"
|
||||
end
|
||||
format.html { redirect_to @crop, notice: 'Crop was successfully updated.' }
|
||||
format.json { head :no_content }
|
||||
|
||||
@@ -27,17 +27,6 @@ class HarvestsController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
# GET /harvests/1
|
||||
# GET /harvests/1.json
|
||||
def show
|
||||
@harvest = Harvest.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.json { render json: @harvest }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /harvests/new
|
||||
# GET /harvests/new.json
|
||||
def new
|
||||
|
||||
6
app/controllers/pages_controller.rb
Normal file
6
app/controllers/pages_controller.rb
Normal file
@@ -0,0 +1,6 @@
|
||||
class PagesController < ApplicationController
|
||||
def letsencrypt
|
||||
# use your code here, not mine
|
||||
render text: "y9KNck8wqkoQLnlr2RgA2TVwWtyYb4PeY_hzGNx0Tfs.dlIPqFhMDCLyQEccczY3roHZ1UWu6UqVeyb9mkRxheU"
|
||||
end
|
||||
end
|
||||
@@ -13,17 +13,6 @@ class PhotosController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
# GET /photos/1
|
||||
# GET /photos/1.json
|
||||
def show
|
||||
@photo = Photo.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.json { render json: @photo }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /photos/new
|
||||
# GET /photos/new.json
|
||||
def new
|
||||
|
||||
@@ -19,10 +19,24 @@ module ApplicationHelper
|
||||
pid = price_in_dollars(price)
|
||||
currency = Growstuff::Application.config.currency
|
||||
link = "http://www.wolframalpha.com/input/?i=#{pid}+#{currency}"
|
||||
return link_to "(convert)",
|
||||
link,
|
||||
target: "_blank"
|
||||
end
|
||||
|
||||
link_to "(convert)", link, target: "_blank"
|
||||
end
|
||||
|
||||
def build_alert_classes(alert_type = :info)
|
||||
classes = 'alert alert-dismissable '
|
||||
case alert_type.to_sym
|
||||
when :alert, :danger, :error, :validation_errors
|
||||
classes += 'alert-danger'
|
||||
when :warning, :todo
|
||||
classes += 'alert-warning'
|
||||
when :notice, :success
|
||||
classes += 'alert-success'
|
||||
when :info
|
||||
classes += 'alert-info'
|
||||
end
|
||||
classes
|
||||
end
|
||||
|
||||
# Produces a cache key for uniquely identifying cached fragments.
|
||||
def cache_key_for(klass, identifier="all")
|
||||
@@ -50,5 +64,13 @@ module ApplicationHelper
|
||||
default: :identicon
|
||||
})
|
||||
end
|
||||
|
||||
# Returns a string with the quantity and the right pluralization for a
|
||||
# given collection and model.
|
||||
def localize_plural(collection, model)
|
||||
size = collection.size
|
||||
model_name = model.model_name.human(count: size)
|
||||
"#{size} #{model_name}"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
module CropsHelper
|
||||
def display_seed_availability(member, crop)
|
||||
total_quantity = 0
|
||||
member.seeds.each do |seed|
|
||||
if seed.crop.name == crop.name
|
||||
total_quantity = total_quantity + seed.quantity
|
||||
end
|
||||
|
||||
seeds = member.seeds.select {|seed| seed.crop.name == crop.name }
|
||||
|
||||
seeds.each do |seed|
|
||||
total_quantity = total_quantity + seed.quantity if seed.quantity
|
||||
end
|
||||
|
||||
if !seeds.any?
|
||||
return "You don't have any seeds of this crop."
|
||||
end
|
||||
|
||||
if (total_quantity != 0)
|
||||
"You have #{pluralize(total_quantity, "seed")} of this crop."
|
||||
"You have #{total_quantity} #{Seed.model_name.human(count: total_quantity)} of this crop."
|
||||
else
|
||||
"You don't have any seeds of this crop."
|
||||
"You have an unknown quantity of seeds of this crop."
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,12 +2,10 @@ class Notifier < ActionMailer::Base
|
||||
include NotificationsHelper
|
||||
default from: "Growstuff <noreply@growstuff.org>"
|
||||
|
||||
def verifier()
|
||||
if ENV['RAILS_SECRET_TOKEN']
|
||||
return ActiveSupport::MessageVerifier.new(ENV['RAILS_SECRET_TOKEN'])
|
||||
else
|
||||
raise "RAILS_SECRET_TOKEN environment variable not set - have you created config/application.yml?"
|
||||
end
|
||||
def verifier
|
||||
raise "RAILS_SECRET_TOKEN environment variable not set - have you created config/application.yml?" unless ENV['RAILS_SECRET_TOKEN']
|
||||
|
||||
return ActiveSupport::MessageVerifier.new(ENV['RAILS_SECRET_TOKEN'])
|
||||
end
|
||||
|
||||
def notify(notification)
|
||||
|
||||
@@ -206,7 +206,7 @@ class Crop < ActiveRecord::Base
|
||||
# returns a list of interesting crops, for use on the homepage etc
|
||||
def Crop.interesting
|
||||
howmany = 12 # max number to find
|
||||
interesting_crops = Array.new
|
||||
interesting_crops = []
|
||||
Crop.includes(:photos).randomized.each do |c|
|
||||
break if interesting_crops.size == howmany
|
||||
next unless c.interesting?
|
||||
|
||||
@@ -130,7 +130,7 @@ class Member < ActiveRecord::Base
|
||||
def is_paid?
|
||||
if account.account_type.is_permanent_paid
|
||||
return true
|
||||
elsif account.account_type.is_paid and account.paid_until >= Time.zone.now
|
||||
elsif account.account_type.is_paid && account.paid_until >= Time.zone.now
|
||||
return true
|
||||
else
|
||||
return false
|
||||
@@ -200,7 +200,7 @@ class Member < ActiveRecord::Base
|
||||
|
||||
def Member.interesting
|
||||
howmany = 12 # max number to find
|
||||
interesting_members = Array.new
|
||||
interesting_members = []
|
||||
Member.confirmed.located.recently_signed_in.each do |m|
|
||||
break if interesting_members.size == howmany
|
||||
if m.interesting?
|
||||
@@ -222,7 +222,7 @@ class Member < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def update_newsletter_subscription
|
||||
if confirmed_at_changed? and newsletter # just signed up
|
||||
if confirmed_at_changed? && newsletter # just signed up
|
||||
newsletter_subscribe
|
||||
elsif confirmed_at # i.e. after member's confirmed their account
|
||||
if newsletter_changed? # edited member settings
|
||||
|
||||
@@ -23,7 +23,7 @@ class Notification < ActiveRecord::Base
|
||||
|
||||
def send_email
|
||||
if self.recipient.send_notification_email
|
||||
Notifier.notify(self).deliver
|
||||
Notifier.notify(self).deliver_now
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ class Planting < ActiveRecord::Base
|
||||
|
||||
# check that any finished_at date occurs after planted_at
|
||||
def finished_must_be_after_planted
|
||||
return unless planted_at and finished_at # only check if we have both
|
||||
return unless planted_at && finished_at # only check if we have both
|
||||
errors.add(:finished_at, "must be after the planting date") unless planted_at < finished_at
|
||||
end
|
||||
|
||||
@@ -97,7 +97,7 @@ class Planting < ActiveRecord::Base
|
||||
def calculate_days_before_maturity(planting, crop)
|
||||
p_crop = Planting.where(crop_id: crop).where.not(id: planting)
|
||||
differences = p_crop.collect do |p|
|
||||
if p.finished and !p.finished_at.nil?
|
||||
if p.finished && !p.finished_at.nil?
|
||||
(p.finished_at - p.planted_at).to_i
|
||||
end
|
||||
end
|
||||
@@ -133,7 +133,7 @@ class Planting < ActiveRecord::Base
|
||||
# we can't do this via a scope (as far as we know) so sadly we have to
|
||||
# do it this way.
|
||||
def Planting.interesting(howmany=12, require_photo=true)
|
||||
interesting_plantings = Array.new
|
||||
interesting_plantings = []
|
||||
seen_owners = Hash.new(false) # keep track of which owners we've seen already
|
||||
|
||||
Planting.includes(:photos).each do |p|
|
||||
|
||||
@@ -11,17 +11,17 @@ class Post < ActiveRecord::Base
|
||||
# from this direction, so we won't set up an association for now.
|
||||
|
||||
after_create do
|
||||
recipients = Array.new
|
||||
recipients = []
|
||||
sender = self.author.id
|
||||
self.body.scan(Haml::Filters::GrowstuffMarkdown::MEMBER_REGEX) do |m|
|
||||
# find member case-insensitively and add to list of recipients
|
||||
member = Member.where('lower(login_name) = ?', $1.downcase).first
|
||||
recipients << member if member and not recipients.include?(member)
|
||||
recipients << member if member && !recipients.include?(member)
|
||||
end
|
||||
self.body.scan(Haml::Filters::GrowstuffMarkdown::MEMBER_AT_REGEX) do |m|
|
||||
# find member case-insensitively and add to list of recipients
|
||||
member = Member.where('lower(login_name) = ?', $1[1..-1].downcase).first
|
||||
recipients << member if member and not recipients.include?(member)
|
||||
recipients << member if member && !recipients.include?(member)
|
||||
end
|
||||
# don't send notifications to yourself
|
||||
recipients.map{ |r| r.id }.each do |recipient|
|
||||
@@ -64,7 +64,7 @@ class Post < ActiveRecord::Base
|
||||
|
||||
# return posts sorted by recent activity
|
||||
def Post.recently_active
|
||||
Post.all.sort do |a,b|
|
||||
Post.all.sort do |a, b|
|
||||
b.recent_activity <=> a.recent_activity
|
||||
end
|
||||
end
|
||||
@@ -77,7 +77,7 @@ class Post < ActiveRecord::Base
|
||||
# find crop case-insensitively
|
||||
crop = Crop.where('lower(name) = ?', $1.downcase).first
|
||||
# create association
|
||||
self.crops << crop if crop and not self.crops.include?(crop)
|
||||
self.crops << crop if crop && !self.crops.include?(crop)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -79,7 +79,7 @@ class Seed < ActiveRecord::Base
|
||||
# returns a list of interesting seeds, for use on the homepage etc
|
||||
def Seed.interesting
|
||||
howmany = 12 # max number to find
|
||||
interesting_seeds = Array.new
|
||||
interesting_seeds = []
|
||||
|
||||
Seed.tradable.each do |s|
|
||||
break if interesting_seeds.size == howmany
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
= content_for :title, @alternate_name.name
|
||||
- content_for :opengraph do
|
||||
= tag("meta", property: "og:title", content: @alternate_name.name)
|
||||
= tag("meta", property: "og:type", content: "website")
|
||||
= tag("meta", property: "og:url", content: request.original_url)
|
||||
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
|
||||
|
||||
%p#notice= notice
|
||||
|
||||
= render :partial => 'crops/approval_status_message', :locals => { :crop => @alternate_name.crop }
|
||||
|
||||
@@ -5,10 +5,13 @@
|
||||
= render :partial => "members/avatar", :locals => { :member => comment.author }
|
||||
.col-md-11
|
||||
.comment-meta
|
||||
= (comment.created_at == comment.updated_at) ? 'Posted by' : 'Edited by'
|
||||
Posted by
|
||||
= link_to comment.author.login_name, member_path(comment.author)
|
||||
on
|
||||
= (comment.created_at == comment.updated_at) ? comment.created_at : comment.updated_at
|
||||
= comment.created_at
|
||||
- if comment.updated_at > comment.created_at
|
||||
and edited at
|
||||
= comment.updated_at
|
||||
|
||||
.comment-body
|
||||
:growstuff_markdown
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
= content_for :title, @comment.post.subject
|
||||
- content_for :opengraph do
|
||||
= tag("meta", property: "og:image", content: avatar_uri(@comment.post.author, 200))
|
||||
= tag("meta", property: "og:image:user_generated", content: "true")
|
||||
= tag("meta", property: "og:title", content: @comment.post.subject)
|
||||
= tag("meta", property: "og:description", content: strip_tags(@comment.post.body).split(' ')[0..20].join(' '))
|
||||
= tag("meta", property: "og:type", content: "website")
|
||||
= tag("meta", property: "og:url", content: request.original_url)
|
||||
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
|
||||
|
||||
= render :partial => "posts/single", :locals => { :post => @comment.post }
|
||||
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
- content_for :title, @crop.name
|
||||
- content_for :subtitle, @crop.default_scientific_name
|
||||
- content_for :opengraph do
|
||||
- @crop.photos.each do |photo|
|
||||
= tag("meta", property: "og:image", content: photo.fullsize_url)
|
||||
= tag("meta", property: "og:title", content: @crop.name)
|
||||
= tag("meta", property: "og:type", content: "website")
|
||||
= tag("meta", property: "og:url", content: request.original_url)
|
||||
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
|
||||
|
||||
= render :partial => 'approval_status_message', :locals => { :crop => @crop }
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
- @forums.each do |forum|
|
||||
%h2= forum
|
||||
%p
|
||||
= pluralize(forum.posts.size, "post")
|
||||
= localize_plural(forum.posts, Post)
|
||||
|
|
||||
=link_to "Visit forum", forum
|
||||
|
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
- content_for :title, @forum.name
|
||||
- content_for :opengraph do
|
||||
- if @forum.description
|
||||
= tag("meta", property: "og:description", content: strip_tags(@forum.description).split(' ')[0..20].join(' '))
|
||||
= tag("meta", property: "og:title", content: @forum.name)
|
||||
= tag("meta", property: "og:type", content: "website")
|
||||
= tag("meta", property: "og:url", content: request.original_url)
|
||||
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
|
||||
|
||||
%p#notice= notice
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
%dd= garden.active ? "Yes" : "No"
|
||||
.col-md-12
|
||||
%b
|
||||
= "#{pluralize(garden.plantings.size, "Planting")} : "
|
||||
= "#{localize_plural(garden.plantings, Planting)} : "
|
||||
= display_garden_plantings(garden.plantings.current)
|
||||
- if garden.plantings.size > 2
|
||||
%br
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
=content_for :title, "#{@garden.owner}'s #{@garden}"
|
||||
|
||||
- content_for :opengraph do
|
||||
- @garden.photos.each do |photo|
|
||||
= tag("meta", property: "og:image", content: photo.fullsize_url)
|
||||
- if @garden.description
|
||||
= tag("meta", property: "og:description", content: @garden.description)
|
||||
= tag("meta", property: "og:title", content: "#{@garden.owner}'s #{@garden}")
|
||||
= tag("meta", property: "og:type", content: "website")
|
||||
= tag("meta", property: "og:url", content: request.original_url)
|
||||
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
|
||||
.row
|
||||
.col-md-9
|
||||
- if can? :edit, @garden or can? :delete, @garden
|
||||
@@ -39,7 +47,7 @@
|
||||
- if @garden.photos.size > 0 or (can? :edit, @garden and can? :create, Photo)
|
||||
.row-fluid
|
||||
%h3 Photos
|
||||
%p= pluralize(@garden.photos.length, "photo")
|
||||
%p= localize_plural(@garden.photos, Photo)
|
||||
.row-fluid
|
||||
%ul.thumbnails
|
||||
- @garden.photos.each do |p|
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
=content_for :title, "#{@harvest.crop} harvested by #{@harvest.owner}"
|
||||
- content_for :opengraph do
|
||||
- @harvest.photos.each do |photo|
|
||||
= tag("meta", property: "og:image", content: photo.fullsize_url)
|
||||
= tag("meta", property: "og:image:user_generated", content: "true")
|
||||
= tag("meta", property: "og:title", content: "#{@harvest.crop} harvested by #{@harvest.owner}")
|
||||
= tag("meta", property: "og:type", content: "website")
|
||||
= tag("meta", property: "og:url", content: request.original_url)
|
||||
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
|
||||
|
||||
.row
|
||||
.col-md-6
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
%head
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta property="og:image" content="#{image_url 'growstuff-apple-touch-icon-precomposed.png'}"/>
|
||||
<meta property="og:title" content="#{content_for?(:title) ? yield(:title) + " - #{ ENV['GROWSTUFF_SITE_NAME']} " : ENV['GROWSTUFF_SITE_NAME']}" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:url" content="#{root_url}" />
|
||||
<meta property="og:site_name" content="#{ENV['GROWSTUFF_SITE_NAME']}" />
|
||||
- if content_for?(:opengraph)
|
||||
= yield(:opengraph)
|
||||
- else
|
||||
= tag("meta", property: "og:image", content: image_url('facebook-thumbnail.png'))
|
||||
= tag("meta", property: "og:title", content: "#{content_for?(:title) ? yield(:title) + " - #{ ENV['GROWSTUFF_SITE_NAME']} " : ENV['GROWSTUFF_SITE_NAME']}")
|
||||
= tag("meta", property: "og:type", content: "website")
|
||||
= tag("meta", property: "og:url", content: root_url)
|
||||
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
|
||||
|
||||
- if (content_for?(:member_rss_login_name) && content_for(:member_rss_slug))
|
||||
= auto_discovery_link_tag(:rss, { :controller => "/members", :action => 'show', :format => "rss", :id => yield(:member_rss_slug) }, { :title => "#{ ENV['GROWSTUFF_SITE_NAME'] }- #{yield(:member_rss_login_name)}'s posts" })
|
||||
|
||||
@@ -17,12 +17,7 @@
|
||||
%p
|
||||
.btn-group
|
||||
= yield(:buttonbar)
|
||||
- if notice
|
||||
.alert.alert-success
|
||||
= notice
|
||||
- if alert
|
||||
.alert.alert-warning
|
||||
= alert
|
||||
= render :partial => "shared/flash_messages", flash: flash
|
||||
= yield
|
||||
|
||||
%footer
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
- if g.photos.size > 0 or (can? :edit, g and can? :create, Photo)
|
||||
.row
|
||||
%h3 Photos
|
||||
%p= pluralize(g.photos.length, "photo")
|
||||
%p= localize_plural(g.photos, Photo)
|
||||
.row
|
||||
%ul.thumbnails
|
||||
- g.photos.each do |p|
|
||||
|
||||
@@ -3,28 +3,28 @@
|
||||
%ul.list-inline
|
||||
%li
|
||||
- if member.plantings.size > 0
|
||||
= link_to pluralize(member.plantings.size, "planting"), plantings_by_owner_path(:owner => member)
|
||||
= link_to localize_plural(member.plantings, Planting), plantings_by_owner_path(owner: member)
|
||||
- else
|
||||
0 plantings
|
||||
%li
|
||||
- if member.harvests.size > 0
|
||||
= link_to pluralize(member.harvests.size, "harvest"), harvests_by_owner_path(:owner => member)
|
||||
= link_to localize_plural(member.harvests, Harvest), harvests_by_owner_path(owner: member)
|
||||
- else
|
||||
0 harvests
|
||||
%li
|
||||
- if member.seeds.size > 0
|
||||
= link_to pluralize(member.seeds.size, "seeds"), seeds_by_owner_path(:owner => member)
|
||||
= link_to localize_plural(member.seeds, Seed), seeds_by_owner_path(owner: member)
|
||||
- else
|
||||
0 seeds
|
||||
%li
|
||||
- if member.posts.size > 0
|
||||
= link_to pluralize(member.posts.size, "post"), posts_by_author_path(:author => member)
|
||||
= link_to localize_plural(member.posts, Post), posts_by_author_path(author: member)
|
||||
- else
|
||||
0 posts
|
||||
|
||||
%li
|
||||
- if member.followed.size > 0
|
||||
= link_to pluralize(member.followed.size, "follow"), member_follows_path(member)
|
||||
= link_to localize_plural(member.followed, Follow), member_follows_path(member)
|
||||
- else
|
||||
0 following
|
||||
|
||||
|
||||
@@ -21,4 +21,4 @@
|
||||
ago.
|
||||
%p
|
||||
%small
|
||||
= [pluralize(member.gardens.size, "garden"), pluralize(member.plantings.size, "planting"), pluralize(member.seeds.size, "seed")].join(", ")
|
||||
= [localize_plural(member.gardens, Garden), localize_plural(member.plantings, Planting), localize_plural(member.seeds, Seed)].join(", ")
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
- content_for :title, @member.login_name
|
||||
- content_for :subtitle, @member.location
|
||||
- content_for :opengraph do
|
||||
= tag("meta", property: "og:image", content: avatar_uri(@member, 200))
|
||||
= tag("meta", property: "og:image:user_generated", content: "true")
|
||||
= tag("meta", property: "og:title", content: @member.login_name)
|
||||
= tag("meta", property: "og:type", content: "profile")
|
||||
= tag("meta", property: "og:url", content: request.original_url)
|
||||
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
|
||||
- content_for :buttonbar do
|
||||
- if can? :update, @member
|
||||
= link_to 'Edit profile', edit_member_registration_path, :class => 'btn btn-default'
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
-content_for :title, @photo.title
|
||||
- content_for :title, @photo.title
|
||||
- content_for :opengraph do
|
||||
= tag("meta", property: "og:title", content: @photo.title)
|
||||
= tag("meta", property: "og:image", content: @photo.fullsize_url)
|
||||
= tag("meta", property: "og:image:user_generated", content: "true")
|
||||
= tag("meta", property: "og:type", content: "website")
|
||||
= tag("meta", property: "og:url", content: request.original_url)
|
||||
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
|
||||
|
||||
.row
|
||||
.col-md-6
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
-content_for :title, "#{ENV['GROWSTUFF_SITE_NAME']} community near #{@place}"
|
||||
- content_for :opengraph do
|
||||
= tag("meta", property: "og:title", content: "#{ENV['GROWSTUFF_SITE_NAME']} community near #{@place}")
|
||||
= tag("meta", property: "og:type", content: "website")
|
||||
= tag("meta", property: "og:url", content: request.original_url)
|
||||
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
|
||||
|
||||
= render partial: 'search_form'
|
||||
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
- content_for :title, @plant_part.name.titlecase
|
||||
- content_for :opengraph do
|
||||
= tag("meta", property: "og:title", content: @plant_part.name.titlecase)
|
||||
= tag("meta", property: "og:type", content: "website")
|
||||
= tag("meta", property: "og:url", content: request.original_url)
|
||||
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
|
||||
|
||||
- if @plant_part.crops.empty?
|
||||
%p No crops are harvested for this plant part (yet).
|
||||
|
||||
@@ -1,4 +1,13 @@
|
||||
=content_for :title, "#{@planting.crop} in #{@planting.location}"
|
||||
- content_for :opengraph do
|
||||
- @planting.crop.photos.each do |photo|
|
||||
= tag("meta", property: "og:image", content: photo.fullsize_url)
|
||||
= tag("meta", property: "og:title", content: "#{@planting.crop} in #{@planting.location}")
|
||||
- if @planting.description
|
||||
= tag("meta", property: "og:description", content: @planting.description)
|
||||
= tag("meta", property: "og:type", content: "website")
|
||||
= tag("meta", property: "og:url", content: request.original_url)
|
||||
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
|
||||
|
||||
.row.planting
|
||||
.col-md-6
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
%a{:name => "comments"}
|
||||
- if post.comments
|
||||
%h2
|
||||
=pluralize(post.comments.size, "comment")
|
||||
=localize_plural(post.comments, Comment)
|
||||
- post.comments.post_order.each do |c|
|
||||
= render :partial => "comments/single", :locals => { :comment => c }
|
||||
|
||||
|
||||
@@ -9,13 +9,16 @@
|
||||
|
||||
.post-meta
|
||||
%p
|
||||
= (post.created_at == post.updated_at) ? 'Posted by' : 'Edited by'
|
||||
Posted by
|
||||
= link_to post.author.login_name, member_path(post.author)
|
||||
- if post.forum
|
||||
in
|
||||
= link_to post.forum, post.forum
|
||||
on
|
||||
= (post.created_at == post.updated_at) ? post.created_at : post.updated_at
|
||||
= post.created_at
|
||||
- if post.updated_at > post.created_at
|
||||
and edited at
|
||||
= post.updated_at
|
||||
|
||||
.post-body
|
||||
:growstuff_markdown
|
||||
@@ -24,7 +27,7 @@
|
||||
- unless defined?(hide_comments)
|
||||
.post-comments
|
||||
%ul.list-inline
|
||||
%li.first= link_to pluralize(post.comments.size, "comment"),
|
||||
%li.first= link_to localize_plural(post.comments, Comment),
|
||||
post_path(post, :anchor => 'comments')
|
||||
-if can? :create, Comment
|
||||
%li= link_to "Reply", new_comment_path(:post_id => post.id)
|
||||
|
||||
@@ -15,7 +15,10 @@
|
||||
%td.hidden-xs
|
||||
=link_to post.author, post.author
|
||||
%td
|
||||
= post.recent_activity.to_date.to_formatted_s(:short)
|
||||
- if post.updated_at > post.recent_activity
|
||||
= post.updated_at.to_date.to_formatted_s(:short)
|
||||
- else
|
||||
= post.recent_activity.to_date.to_formatted_s(:short)
|
||||
// once the site gets more active, can change this to include time as well
|
||||
// can't make it relative (distance_of_time_in_words) as it's cached
|
||||
%td.hidden-xs
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
= content_for :title, @post.subject
|
||||
- content_for :opengraph do
|
||||
= tag("meta", property: "og:image", content: avatar_uri(@post.author, 200))
|
||||
= tag("meta", property: "og:description", content: "#{strip_tags(@post.body).split(' ')[0..20].join(' ')}...")
|
||||
= tag("meta", property: "og:title", content: @post.subject)
|
||||
= tag("meta", property: "og:type", content: "article")
|
||||
= tag("meta", property: "og:url", content: request.original_url)
|
||||
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
|
||||
|
||||
- unless current_member
|
||||
.alert.alert-info
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
- content_for :opengraph do
|
||||
- @scientific_name.crop.photos.each do |photo|
|
||||
= tag("meta", property: "og:image", content: photo.fullsize_url)
|
||||
|
||||
= tag("meta", property: "og:title", content: @scientific_name.scientific_name)
|
||||
= tag("meta", property: "og:type", content: "website")
|
||||
= tag("meta", property: "og:url", content: request.original_url)
|
||||
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
|
||||
|
||||
%p#notice= notice
|
||||
|
||||
= render :partial => 'crops/approval_status_message', :locals => { :crop => @scientific_name.crop }
|
||||
|
||||
@@ -1,4 +1,13 @@
|
||||
- content_for :title, "#{@seed.owner}'s #{@seed.crop} seeds"
|
||||
- content_for :opengraph do
|
||||
- @seed.crop.photos.each do |photo|
|
||||
= tag("meta", property: "og:image", content: photo.fullsize_url)
|
||||
- if @seed.description
|
||||
= tag("meta", property: "og:description", content: @seed.description)
|
||||
= tag("meta", property: "og:image", content: "#{@seed.owner}'s #{@seed.crop} seeds")
|
||||
= tag("meta", property: "og:type", content: "website")
|
||||
= tag("meta", property: "og:url", content: request.original_url)
|
||||
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
|
||||
|
||||
.row
|
||||
.col-md-6
|
||||
|
||||
6
app/views/shared/_flash_messages.html.haml
Normal file
6
app/views/shared/_flash_messages.html.haml
Normal file
@@ -0,0 +1,6 @@
|
||||
- flash.each do |type, content|
|
||||
%div{ class: build_alert_classes(type), role: "alert" }
|
||||
%button.close{ type: "button", "data-dismiss" => "alert" }
|
||||
%span{ "aria-hidden" => true } ×
|
||||
%span.sr-only Close
|
||||
= content
|
||||
@@ -82,12 +82,6 @@ module Growstuff
|
||||
g.javascripts false
|
||||
end
|
||||
|
||||
config.action_mailer.delivery_method = :sendmail
|
||||
config.action_mailer.sendmail_settings = {
|
||||
location: '/usr/sbin/sendmail',
|
||||
arguments: '-i -t',
|
||||
openssl_verify_mode: 'none'
|
||||
}
|
||||
|
||||
# Growstuff-specific configuration variables
|
||||
config.currency = 'AUD'
|
||||
@@ -112,5 +106,6 @@ module Growstuff
|
||||
# didn't work for us.
|
||||
config.cloudmade_key = '29a2d9e3cb3d429490a8f338b2388b1d'
|
||||
|
||||
config.active_record.raise_in_transactional_callbacks = true
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -15,7 +15,7 @@ Growstuff::Application.configure do
|
||||
config.action_controller.perform_caching = true
|
||||
|
||||
# Disable Rails's static asset server (Apache or nginx will already do this)
|
||||
config.serve_static_assets = false
|
||||
config.serve_static_files = false
|
||||
|
||||
# Compress JavaScripts and CSS.
|
||||
config.assets.js_compressor = :uglifier
|
||||
@@ -69,15 +69,15 @@ Growstuff::Application.configure do
|
||||
# Growstuff configuration
|
||||
config.action_mailer.default_url_options = { host: 'growstuff.org' }
|
||||
|
||||
config.action_mailer.smtp_settings = {
|
||||
port: '587',
|
||||
address: 'smtp.mandrillapp.com',
|
||||
user_name: ENV['GROWSTUFF_MANDRILL_USERNAME'],
|
||||
password: ENV['GROWSTUFF_MANDRILL_APIKEY'],
|
||||
domain: 'heroku.com',
|
||||
authentication: :plain
|
||||
ActionMailer::Base.smtp_settings = {
|
||||
port: ENV['SPARKPOST_SMTP_PORT'],
|
||||
address: ENV['SPARKPOST_SMTP_HOST'],
|
||||
user_name: ENV['SPARKPOST_SMTP_USERNAME'],
|
||||
password: ENV['SPARKPOST_SMTP_PASSWORD'],
|
||||
authentication: :login,
|
||||
enable_starttls_auto: true
|
||||
}
|
||||
config.action_mailer.delivery_method = :smtp
|
||||
ActionMailer::Base.delivery_method = :smtp
|
||||
|
||||
config.host = 'growstuff.org'
|
||||
config.analytics_code = <<-eos
|
||||
|
||||
@@ -17,7 +17,7 @@ Growstuff::Application.configure do
|
||||
config.action_controller.perform_caching = true
|
||||
|
||||
# Disable Rails's static asset server (Apache or nginx will already do this)
|
||||
config.serve_static_assets = false
|
||||
config.serve_static_files = false
|
||||
|
||||
# Compress JavaScripts and CSS.
|
||||
config.assets.js_compressor = :uglifier
|
||||
@@ -71,15 +71,15 @@ Growstuff::Application.configure do
|
||||
# Growstuff configuration
|
||||
config.action_mailer.default_url_options = { host: 'staging.growstuff.org' }
|
||||
|
||||
config.action_mailer.smtp_settings = {
|
||||
port: '587',
|
||||
address: 'smtp.mandrillapp.com',
|
||||
user_name: ENV['GROWSTUFF_MANDRILL_USERNAME'],
|
||||
password: ENV['GROWSTUFF_MANDRILL_APIKEY'],
|
||||
domain: 'heroku.com',
|
||||
authentication: :plain
|
||||
ActionMailer::Base.smtp_settings = {
|
||||
port: ENV['SPARKPOST_SMTP_PORT'],
|
||||
address: ENV['SPARKPOST_SMTP_HOST'],
|
||||
user_name: ENV['SPARKPOST_SMTP_USERNAME'],
|
||||
password: ENV['SPARKPOST_SMTP_PASSWORD'],
|
||||
authentication: :login,
|
||||
enable_starttls_auto: true
|
||||
}
|
||||
config.action_mailer.delivery_method = :smtp
|
||||
ActionMailer::Base.delivery_method = :smtp
|
||||
|
||||
config.host = 'staging.growstuff.org'
|
||||
config.analytics_code = ''
|
||||
|
||||
@@ -15,7 +15,7 @@ Growstuff::Application.configure do
|
||||
config.cache_classes = false
|
||||
|
||||
# Configure static asset server for tests with Cache-Control for performance
|
||||
config.serve_static_assets = true
|
||||
config.serve_static_files = true
|
||||
config.static_cache_control = "public, max-age=3600"
|
||||
|
||||
# Show full error reports and disable caching
|
||||
@@ -49,6 +49,7 @@ Growstuff::Application.configure do
|
||||
end
|
||||
|
||||
config.after_initialize do
|
||||
require "active_merchant/ext/paypal_bogus_gateway"
|
||||
ActiveMerchant::Billing::Base.mode = :test
|
||||
::STANDARD_GATEWAY = ActiveMerchant::Billing::PaypalBogusGateway.new
|
||||
::EXPRESS_GATEWAY = ActiveMerchant::Billing::PaypalBogusGateway.new
|
||||
|
||||
@@ -121,7 +121,7 @@ Devise.setup do |config|
|
||||
# Email regex used to validate email formats. It simply asserts that
|
||||
# an one (and only one) @ exists in the given string. This is mainly
|
||||
# to give user feedback and not to assert the e-mail validity.
|
||||
# config.email_regexp = /\A[^@]+@[^@]+\z/
|
||||
config.email_regexp = /\A[^@]+@[^@]+\z/
|
||||
|
||||
# ==> Configuration for :timeoutable
|
||||
# The time you want to timeout the user session without activity. After this
|
||||
|
||||
@@ -179,6 +179,9 @@ en:
|
||||
crop:
|
||||
one: "crop"
|
||||
other: "crops"
|
||||
follow:
|
||||
one: "follow"
|
||||
other: "follows"
|
||||
garden:
|
||||
one: "garden"
|
||||
other: "gardens"
|
||||
|
||||
@@ -83,6 +83,8 @@ Growstuff::Application.routes.draw do
|
||||
get '/admin/newsletter' => 'admin#newsletter', :as => :admin_newsletter
|
||||
get '/admin/:action' => 'admin#:action'
|
||||
|
||||
get '/.well-known/acme-challenge/:id' => 'pages#letsencrypt'
|
||||
|
||||
# CMS stuff -- must remain LAST
|
||||
comfy_route :cms, path: '/', sitemap: false
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class DeviseCreateUsers < ActiveRecord::Migration
|
||||
# t.string :authentication_token
|
||||
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
|
||||
add_index :users, :email, unique: true
|
||||
|
||||
@@ -3,7 +3,7 @@ class CreateCrops < ActiveRecord::Migration
|
||||
create_table :crops do |t|
|
||||
t.string :system_name
|
||||
t.string :en_wikipedia_url
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,7 +5,7 @@ class CreateGardens < ActiveRecord::Migration
|
||||
t.integer :user_id
|
||||
t.string :slug, null: false
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
|
||||
add_index :gardens, :user_id
|
||||
|
||||
@@ -4,7 +4,7 @@ class CreateScientificNames < ActiveRecord::Migration
|
||||
t.string :scientific_name, null: false
|
||||
t.integer :crop_id, null: false
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,7 +5,7 @@ class CreateUpdates < ActiveRecord::Migration
|
||||
t.string :subject, null: false
|
||||
t.text :body, null: false
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,7 +7,7 @@ class CreatePlantings < ActiveRecord::Migration
|
||||
t.integer :quantity
|
||||
t.text :description
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,7 +5,7 @@ class CreateComments < ActiveRecord::Migration
|
||||
t.integer :author_id
|
||||
t.text :body
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,7 +8,7 @@ class CreateNotifications < ActiveRecord::Migration
|
||||
t.boolean :read
|
||||
t.integer :post_id
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,7 +5,7 @@ class CreateForums < ActiveRecord::Migration
|
||||
t.text :description, null: false
|
||||
t.integer :owner_id, null: false
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,7 +4,7 @@ class CreateRoles < ActiveRecord::Migration
|
||||
t.string :name, null: false
|
||||
t.text :description
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,7 +6,7 @@ class CreateAuthentications < ActiveRecord::Migration
|
||||
t.string :uid
|
||||
t.string :token
|
||||
t.string :secret
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
add_index :authentications, :member_id
|
||||
end
|
||||
|
||||
@@ -5,7 +5,7 @@ class CreateProducts < ActiveRecord::Migration
|
||||
t.string :description, null: false
|
||||
t.decimal :min_price, null: false
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@ class CreateOrders < ActiveRecord::Migration
|
||||
create_table :orders do |t|
|
||||
t.string :member_id, null: false
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,7 +6,7 @@ class CreatePhotos < ActiveRecord::Migration
|
||||
t.string :thumbnail_url, null: false
|
||||
t.string :fullsize_url, null: false
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,7 +6,7 @@ class CreateOrderItems < ActiveRecord::Migration
|
||||
t.decimal :price
|
||||
t.integer :quantity
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,7 +5,7 @@ class CreateAccountDetails < ActiveRecord::Migration
|
||||
t.integer :account_type_id
|
||||
t.datetime :paid_until
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,7 +5,7 @@ class CreateAccountTypes < ActiveRecord::Migration
|
||||
t.boolean :is_paid
|
||||
t.boolean :is_permanent_paid
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,7 +7,7 @@ class CreateSeeds < ActiveRecord::Migration
|
||||
t.integer :quantity
|
||||
t.date :use_by
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,7 +8,7 @@ class CreateHarvests < ActiveRecord::Migration
|
||||
t.string :units
|
||||
t.text :notes
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@ class CreatePlantParts < ActiveRecord::Migration
|
||||
create_table :plant_parts do |t|
|
||||
t.string :name
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,7 +5,7 @@ class CreateAlternateNames < ActiveRecord::Migration
|
||||
t.integer :crop_id, null: false
|
||||
t.integer :creator_id, null: false
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,7 +4,7 @@ class CreateFollows < ActiveRecord::Migration
|
||||
t.integer :member_id
|
||||
t.integer :followed_id
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -33,7 +33,7 @@ class CreateCms < ActiveRecord::Migration
|
||||
t.text :js, text_limit
|
||||
t.integer :position, null: false, default: 0
|
||||
t.boolean :is_shared, null: false, default: false
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
add_index :comfy_cms_layouts, [:parent_id, :position]
|
||||
add_index :comfy_cms_layouts, [:site_id, :identifier], unique: true
|
||||
@@ -52,7 +52,7 @@ class CreateCms < ActiveRecord::Migration
|
||||
t.integer :children_count, null: false, default: 0
|
||||
t.boolean :is_published, null: false, default: true
|
||||
t.boolean :is_shared, null: false, default: false
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
add_index :comfy_cms_pages, [:site_id, :full_path]
|
||||
add_index :comfy_cms_pages, [:parent_id, :position]
|
||||
@@ -62,7 +62,7 @@ class CreateCms < ActiveRecord::Migration
|
||||
t.string :identifier, null: false
|
||||
t.text :content, text_limit
|
||||
t.references :blockable, polymorphic: true
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
add_index :comfy_cms_blocks, [:identifier]
|
||||
add_index :comfy_cms_blocks, [:blockable_id, :blockable_type]
|
||||
@@ -75,7 +75,7 @@ class CreateCms < ActiveRecord::Migration
|
||||
t.text :content, text_limit
|
||||
t.integer :position, null: false, default: 0
|
||||
t.boolean :is_shared, null: false, default: false
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
add_index :comfy_cms_snippets, [:site_id, :identifier], unique: true
|
||||
add_index :comfy_cms_snippets, [:site_id, :position]
|
||||
@@ -90,7 +90,7 @@ class CreateCms < ActiveRecord::Migration
|
||||
t.integer :file_file_size, null: false
|
||||
t.string :description, limit: 2048
|
||||
t.integer :position, null: false, default: 0
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
add_index :comfy_cms_files, [:site_id, :label]
|
||||
add_index :comfy_cms_files, [:site_id, :file_file_name]
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace :growstuff do
|
||||
|
||||
if Date.today.cwday == send_on_day and Date.today.cweek % every_n_weeks == 0
|
||||
Member.confirmed.find_each do |m|
|
||||
Notifier.planting_reminder(m).deliver!
|
||||
Notifier.planting_reminder(m).deliver_now!
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
38
script/check_contributors_md
Executable file
38
script/check_contributors_md
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
puts "Checking to see if you're in CONTRIBUTORS.md..."
|
||||
if ENV['TRAVIS'] then
|
||||
if ENV['TRAVIS_PULL_REQUEST'] then
|
||||
require 'httparty'
|
||||
repo = ENV['TRAVIS_REPO_SLUG']
|
||||
pr = ENV['TRAVIS_PULL_REQUEST']
|
||||
url = "https://api.github.com/repos/#{repo}/pulls/#{pr}"
|
||||
response = HTTParty.get(url).parsed_response
|
||||
author = response['user']['login'] if response && response['user']
|
||||
|
||||
# Could not determine author
|
||||
exit unless author
|
||||
else
|
||||
# We're in a Travis branch build; nothing to check
|
||||
exit
|
||||
end
|
||||
else
|
||||
author = `git config github.user`.chomp
|
||||
if $?.exitstatus > 0 then
|
||||
abort %{
|
||||
Couldn't determine your GitHub username, and not in a Travis PR build
|
||||
Please set it using
|
||||
|
||||
git config --add github.user [username]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
if !system("grep #{author} CONTRIBUTORS.md") then
|
||||
abort %{
|
||||
Thanks for your contribution, #{author}!
|
||||
Please add your name and GitHub handle to the file CONTRIBUTORS.md,
|
||||
commit it, and update your PR.
|
||||
}
|
||||
end
|
||||
|
||||
9
script/gemfile_check
Executable file
9
script/gemfile_check
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require 'set'
|
||||
|
||||
changed_file_list = `git diff --name-only --diff-filter=ACMRTUXB origin/dev...`
|
||||
files = Set.new changed_file_list.split
|
||||
if (files.include? "Gemfile") && !(files.include? "Gemfile.lock") then
|
||||
abort "Looks like you committed changes to Gemfile but not Gemfile.lock"
|
||||
end
|
||||
@@ -6,7 +6,7 @@ require 'yaml'
|
||||
heroku = Heroku::API.new(api_key: ENV['HEROKU_API_KEY'])
|
||||
branch = ENV['TRAVIS_BRANCH']
|
||||
travis_config = YAML.load_file('.travis.yml')
|
||||
if travis_config['deploy']['app'].has_key? branch
|
||||
if travis_config['deploy']['app'].key? branch
|
||||
app = travis_config['deploy']['app'][branch]
|
||||
else
|
||||
abort "No Heroku app found for branch #{branch}"
|
||||
|
||||
@@ -27,7 +27,7 @@ feature 'Commenting on a post' do
|
||||
fill_in "comment_body", with: "Testing edit for comment"
|
||||
click_button "Post comment"
|
||||
expect(page).to have_content "Comment was successfully updated"
|
||||
expect(page).to have_content "Edited by"
|
||||
expect(page).to have_content "edited at"
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -231,7 +231,7 @@ feature "Planting a crop", :js do
|
||||
end
|
||||
|
||||
describe "Planting sunniness" do
|
||||
it "should show the image sunniness_sun.png" do
|
||||
it "should show the a sunny image" do
|
||||
fill_autocomplete "crop", with: "mai"
|
||||
select_from_autocomplete "maize"
|
||||
within "form#new_planting" do
|
||||
@@ -244,11 +244,10 @@ feature "Planting a crop", :js do
|
||||
click_button "Save"
|
||||
end
|
||||
|
||||
expect(page).to have_css("img[src*='sunniness_sun.png']")
|
||||
expect(page).to have_css("img[alt=sun]")
|
||||
expect(page).to have_css("img[alt='sun']")
|
||||
end
|
||||
|
||||
it "should show the image 'not specified.png'" do
|
||||
it "should show a sunniness not specified image" do
|
||||
fill_autocomplete "crop", with: "mai"
|
||||
select_from_autocomplete "maize"
|
||||
within "form#new_planting" do
|
||||
@@ -260,7 +259,6 @@ feature "Planting a crop", :js do
|
||||
click_button "Save"
|
||||
end
|
||||
|
||||
expect(page).to have_css("img[src*='sunniness_not specified.png']")
|
||||
expect(page).to have_css("img[alt='not specified']")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -27,7 +27,7 @@ feature 'Post a post' do
|
||||
fill_in "post_subject", with: "Testing Edit"
|
||||
click_button "Post"
|
||||
expect(page).to have_content "Post was successfully updated"
|
||||
expect(page).to have_content "Edited by"
|
||||
expect(page).to have_content "edited at"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -15,7 +15,7 @@ feature "unsubscribe" do
|
||||
expect(member.send_notification_email).to eq(true)
|
||||
|
||||
# generate planting reminder email
|
||||
Notifier.planting_reminder(member).deliver
|
||||
Notifier.planting_reminder(member).deliver_now
|
||||
open_email(member.email)
|
||||
|
||||
# clicking 'Unsubscribe' link will unsubscribe the member
|
||||
@@ -33,7 +33,7 @@ feature "unsubscribe" do
|
||||
|
||||
# generate inbox notification email
|
||||
notification.recipient = member
|
||||
Notifier.notify(notification).deliver
|
||||
Notifier.notify(notification).deliver_now
|
||||
open_email(member.email)
|
||||
|
||||
# clicking 'Unsubscribe' link will unsubscribe the member
|
||||
|
||||
@@ -43,4 +43,97 @@ describe ApplicationHelper do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#localize_plural' do
|
||||
let(:post) { create(:post) }
|
||||
|
||||
context 'with a populated collection' do
|
||||
context 'with one element' do
|
||||
before { create(:comment, post: post) }
|
||||
|
||||
it 'returns a string with the quantity and the plural of the model' do
|
||||
expect(localize_plural(post.comments, Comment)).to eq '1 comment'
|
||||
end
|
||||
end
|
||||
|
||||
context 'with more than one element' do
|
||||
before { create_list(:comment, 2, post: post) }
|
||||
|
||||
it 'returns a string with the quantity and the plural of the model' do
|
||||
expect(localize_plural(post.comments, Comment)).to eq '2 comments'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'without a populated collection' do
|
||||
it 'returns a string with the quantity and the plural of the model' do
|
||||
expect(localize_plural(post.comments, Comment)).to eq '0 comments'
|
||||
end
|
||||
end
|
||||
|
||||
describe '#build_alert_classes' do
|
||||
context 'danger' do
|
||||
it 'works when :alert' do
|
||||
expect(build_alert_classes(:alert)).to include 'alert-danger'
|
||||
end
|
||||
it 'works when :danger' do
|
||||
expect(build_alert_classes(:danger)).to include 'alert-danger'
|
||||
end
|
||||
it 'works when :error' do
|
||||
expect(build_alert_classes(:error)).to include 'alert-danger'
|
||||
end
|
||||
it 'works when :validation_errors' do
|
||||
expect(build_alert_classes(:validation_errors)).to include 'alert-danger'
|
||||
end
|
||||
it 'includes base classes' do
|
||||
expect(build_alert_classes(:danger)).to include 'alert alert-dismissable'
|
||||
end
|
||||
it 'does not include danger when info' do
|
||||
expect(build_alert_classes(:info)).not_to include ' alert-danger'
|
||||
end
|
||||
end
|
||||
context 'warning' do
|
||||
it 'works when :warning' do
|
||||
expect(build_alert_classes(:warning)).to include 'alert-warning'
|
||||
end
|
||||
it 'works when :todo' do
|
||||
expect(build_alert_classes(:todo)).to include 'alert-warning'
|
||||
end
|
||||
it 'includes base classes' do
|
||||
expect(build_alert_classes(:warning)).to include 'alert alert-dismissable'
|
||||
end
|
||||
it 'does not include warning when info' do
|
||||
expect(build_alert_classes(:info)).not_to include ' alert-warning'
|
||||
end
|
||||
end
|
||||
context 'success' do
|
||||
it 'works when :notice' do
|
||||
expect(build_alert_classes(:notice)).to include 'alert-success'
|
||||
end
|
||||
it 'works when :success' do
|
||||
expect(build_alert_classes(:success)).to include 'alert-success'
|
||||
end
|
||||
it 'includes base classes' do
|
||||
expect(build_alert_classes(:success)).to include 'alert alert-dismissable'
|
||||
end
|
||||
it 'does not include success when info' do
|
||||
expect(build_alert_classes(:info)).not_to include ' alert-success'
|
||||
end
|
||||
end
|
||||
context 'info' do
|
||||
it 'works when :info' do
|
||||
expect(build_alert_classes(:info)).to include 'alert-info'
|
||||
end
|
||||
it 'works when blank' do
|
||||
expect(build_alert_classes()).to include 'alert-info'
|
||||
end
|
||||
it 'includes base classes' do
|
||||
expect(build_alert_classes(:info)).to include 'alert alert-dismissable'
|
||||
end
|
||||
it 'does not include info when danger' do
|
||||
expect(build_alert_classes(:danger)).not_to include ' alert-info'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
41
spec/helpers/crops_helper_spec.rb
Normal file
41
spec/helpers/crops_helper_spec.rb
Normal file
@@ -0,0 +1,41 @@
|
||||
require 'rails_helper'
|
||||
|
||||
describe CropsHelper do
|
||||
describe "display_seed_availability" do
|
||||
before :each do
|
||||
@member = create :member
|
||||
@crop = create :tomato
|
||||
end
|
||||
|
||||
context "with no seeds" do
|
||||
it 'should render' do
|
||||
expect(helper.display_seed_availability(@member, @crop)).to eq "You don't have any seeds of this crop."
|
||||
end
|
||||
end
|
||||
|
||||
context "with an unknown quantity of seeds" do
|
||||
before do
|
||||
create :seed, crop: @crop, quantity: nil, owner: @member
|
||||
end
|
||||
|
||||
it 'should render' do
|
||||
expect(helper.display_seed_availability(@member, @crop)).to eq "You have an unknown quantity of seeds of this crop."
|
||||
end
|
||||
end
|
||||
|
||||
context "with an quantity of seeds" do
|
||||
before do
|
||||
a_different_crop = create :apple
|
||||
|
||||
create :seed, crop: @crop, quantity: 20, owner: @member
|
||||
create :seed, crop: @crop, quantity: 13, owner: @member
|
||||
|
||||
create :seed, crop: a_different_crop, quantity: 3, owner: @member
|
||||
end
|
||||
|
||||
it 'should render' do
|
||||
expect(helper.display_seed_availability(@member, @crop)).to eq "You have 33 seeds of this crop."
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
110
spec/helpers/gardens_helper_spec.rb
Normal file
110
spec/helpers/gardens_helper_spec.rb
Normal file
@@ -0,0 +1,110 @@
|
||||
require 'rails_helper'
|
||||
|
||||
describe GardensHelper do
|
||||
describe "garden description" do
|
||||
it "is missing" do
|
||||
garden = FactoryGirl.create(:garden,
|
||||
description: nil
|
||||
)
|
||||
result = helper.display_garden_description(garden)
|
||||
expect(result).to eq "no description provided."
|
||||
end
|
||||
|
||||
it "is less than 130 characters long" do
|
||||
garden = FactoryGirl.create(:garden,
|
||||
description: 'a' * 20
|
||||
)
|
||||
result = helper.display_garden_description(garden)
|
||||
expect(result).to eq 'a' * 20
|
||||
end
|
||||
|
||||
it "is 130 characters long" do
|
||||
garden = FactoryGirl.create(:garden,
|
||||
description: 'a' * 130
|
||||
)
|
||||
result = helper.display_garden_description(garden)
|
||||
link = link_to("Read more", garden_path(garden))
|
||||
expect(result).to eq 'a' * 130
|
||||
end
|
||||
|
||||
it "is more than 130 characters long" do
|
||||
garden = FactoryGirl.create(:garden,
|
||||
description: 'a' * 140
|
||||
)
|
||||
result = helper.display_garden_description(garden)
|
||||
expect(result).to eq 'a' * 126 + '...' + ' ' + link_to("Read more", garden_path(garden))
|
||||
end
|
||||
end
|
||||
|
||||
describe "garden plantings" do
|
||||
it "is missing" do
|
||||
garden = FactoryGirl.create(:garden)
|
||||
plantings = nil
|
||||
result = helper.display_garden_plantings(plantings)
|
||||
expect(result).to eq "None"
|
||||
end
|
||||
|
||||
it "has 1 planting" do
|
||||
garden = FactoryGirl.create(:garden)
|
||||
plantings = []
|
||||
crop = FactoryGirl.create(:crop)
|
||||
plantings << FactoryGirl.create(:planting, quantity: 10, crop: crop)
|
||||
result = helper.display_garden_plantings(plantings)
|
||||
|
||||
output = "<li>"
|
||||
output += "10 " + link_to(crop.name, crop)
|
||||
output += ", planted on #{plantings.first.planted_at}"
|
||||
output += "</li>"
|
||||
expect(result).to eq output
|
||||
end
|
||||
|
||||
it "has 2 plantings" do
|
||||
garden = FactoryGirl.create(:garden)
|
||||
plantings = []
|
||||
|
||||
crop1 = FactoryGirl.create(:crop)
|
||||
plantings << FactoryGirl.create(:planting, quantity: 10, crop: crop1)
|
||||
|
||||
crop2 = FactoryGirl.create(:crop)
|
||||
plantings << FactoryGirl.create(:planting, quantity: 10, crop: crop2)
|
||||
|
||||
result = helper.display_garden_plantings(plantings)
|
||||
|
||||
output = "<li>"
|
||||
output += "10 " + link_to(crop1.name, crop1)
|
||||
output += ", planted on #{plantings.first.planted_at}"
|
||||
output += "</li>"
|
||||
output += "<li>"
|
||||
output += "10 " + link_to(crop2.name, crop2)
|
||||
output += ", planted on #{plantings.first.planted_at}"
|
||||
output += "</li>"
|
||||
expect(result).to eq output
|
||||
end
|
||||
|
||||
it "has 3 plantings" do
|
||||
garden = FactoryGirl.create(:garden)
|
||||
plantings = []
|
||||
|
||||
crop1 = FactoryGirl.create(:crop)
|
||||
plantings << FactoryGirl.create(:planting, quantity: 10, crop: crop1)
|
||||
|
||||
crop2 = FactoryGirl.create(:crop)
|
||||
plantings << FactoryGirl.create(:planting, quantity: 10, crop: crop2)
|
||||
|
||||
crop3 = FactoryGirl.create(:crop)
|
||||
plantings << FactoryGirl.create(:planting, quantity: 10, crop: crop3)
|
||||
|
||||
result = helper.display_garden_plantings(plantings)
|
||||
|
||||
output = "<li>"
|
||||
output += "10 " + link_to(crop1.name, crop1)
|
||||
output += ", planted on #{plantings.first.planted_at}"
|
||||
output += "</li>"
|
||||
output += "<li>"
|
||||
output += "10 " + link_to(crop2.name, crop2)
|
||||
output += ", planted on #{plantings.first.planted_at}"
|
||||
output += "</li>"
|
||||
expect(result).to eq output
|
||||
end
|
||||
end
|
||||
end
|
||||
38
spec/helpers/seeds_helper_spec.rb
Normal file
38
spec/helpers/seeds_helper_spec.rb
Normal file
@@ -0,0 +1,38 @@
|
||||
require 'rails_helper'
|
||||
|
||||
describe SeedsHelper do
|
||||
describe "seed description" do
|
||||
it "is missing" do
|
||||
seed = FactoryGirl.create(:seed,
|
||||
description: nil
|
||||
)
|
||||
result = helper.display_seed_description(seed)
|
||||
expect(result).to eq "no description provided."
|
||||
end
|
||||
|
||||
it "is less than 130 characters long" do
|
||||
seed = FactoryGirl.create(:seed,
|
||||
description: 'a' * 20
|
||||
)
|
||||
result = helper.display_seed_description(seed)
|
||||
expect(result).to eq 'a' * 20
|
||||
end
|
||||
|
||||
it "is 130 characters long" do
|
||||
seed = FactoryGirl.create(:seed,
|
||||
description: 'a' * 130
|
||||
)
|
||||
result = helper.display_seed_description(seed)
|
||||
link = link_to("Read more", seed_path(seed))
|
||||
expect(result).to eq 'a' * 130
|
||||
end
|
||||
|
||||
it "is more than 130 characters long" do
|
||||
seed = FactoryGirl.create(:seed,
|
||||
description: 'a' * 140
|
||||
)
|
||||
result = helper.display_seed_description(seed)
|
||||
expect(result).to eq 'a' * 126 + '...' + ' ' + link_to("Read more", seed_path(seed))
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -547,11 +547,11 @@ describe Crop do
|
||||
end
|
||||
|
||||
it "should delete the association between post and the crop(tomato)" do
|
||||
expect(Post.find(post).crops).to eq [maize]
|
||||
expect(Post.find(post.id).crops).to eq [maize]
|
||||
end
|
||||
|
||||
it "should not delete the posts" do
|
||||
expect(Post.find(post)).to_not eq nil
|
||||
expect(Post.find(post.id)).to_not eq nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -158,13 +158,13 @@ describe Post do
|
||||
end
|
||||
|
||||
it "should delete the association" do
|
||||
expect(Crop.find(tomato).posts).to eq []
|
||||
expect(Crop.find(maize).posts).to eq []
|
||||
expect(Crop.find(tomato.id).posts).to eq []
|
||||
expect(Crop.find(maize.id).posts).to eq []
|
||||
end
|
||||
|
||||
it "should not delete the crops" do
|
||||
expect(Crop.find(tomato)).to_not eq nil
|
||||
expect(Crop.find(maize)).to_not eq nil
|
||||
expect(Crop.find(tomato.id)).to_not eq nil
|
||||
expect(Crop.find(maize.id)).to_not eq nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,26 +1,27 @@
|
||||
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
||||
ENV["RAILS_ENV"] ||= 'test'
|
||||
require 'spec_helper'
|
||||
require File.expand_path("../../config/environment", __FILE__)
|
||||
require 'rspec/rails'
|
||||
# Add additional requires below this line. Rails is not loaded until this point!
|
||||
require 'simplecov'
|
||||
require 'coveralls'
|
||||
|
||||
# output coverage locally AND send it to coveralls
|
||||
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
||||
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
|
||||
SimpleCov::Formatter::HTMLFormatter,
|
||||
Coveralls::SimpleCov::Formatter
|
||||
]
|
||||
])
|
||||
|
||||
# fail if there's a significant test coverage drop
|
||||
SimpleCov.maximum_coverage_drop 1
|
||||
|
||||
SimpleCov.start :rails do
|
||||
add_filter 'spec/'
|
||||
add_filter 'vendor/'
|
||||
end
|
||||
|
||||
require 'spec_helper'
|
||||
require File.expand_path("../../config/environment", __FILE__)
|
||||
require 'rspec/rails'
|
||||
# Add additional requires below this line. Rails is not loaded until this point!
|
||||
Rails.application.eager_load!
|
||||
|
||||
require 'capybara'
|
||||
require 'capybara/poltergeist'
|
||||
require 'capybara/rspec'
|
||||
@@ -100,4 +101,14 @@ RSpec.configure do |config|
|
||||
|
||||
# Allow just create(:factory) instead of needing to specify FactoryGirl.create(:factory)
|
||||
config.include FactoryGirl::Syntax::Methods
|
||||
|
||||
# Prevent Poltergeist from fetching external URLs during feature tests
|
||||
config.before(:each, js: true) do
|
||||
page.driver.browser.url_blacklist = [
|
||||
'gravatar.com',
|
||||
'mapbox.com',
|
||||
'okfn.org',
|
||||
'googlecode.com',
|
||||
]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -30,7 +30,7 @@ describe "crops/new" do
|
||||
end
|
||||
|
||||
it "shows a link to crop wrangling guidelines" do
|
||||
assert_select "a[href^=http://wiki.growstuff.org]", "crop wrangling guide"
|
||||
assert_select "a[href^='http://wiki.growstuff.org']", "crop wrangling guide"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -35,7 +35,7 @@ describe "forums/show" do
|
||||
|
||||
it 'links to new post with the forum id' do
|
||||
render
|
||||
assert_select "a[href=#{new_post_path(forum_id: @forum.id)}]"
|
||||
assert_select "a[href='#{new_post_path(forum_id: @forum.id)}']"
|
||||
end
|
||||
|
||||
it 'has no posts' do
|
||||
|
||||
@@ -66,7 +66,7 @@ describe "gardens/show" do
|
||||
end
|
||||
|
||||
it "links to the right crop in the planting link" do
|
||||
assert_select("a[href=#{new_planting_path}?garden_id=#{@garden.id}]")
|
||||
assert_select("a[href='#{new_planting_path}?garden_id=#{@garden.id}']")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ describe 'home/_crops.html.haml', type: "view" do
|
||||
|
||||
it 'shows crops section' do
|
||||
assert_select 'h2', text: 'Some of our crops'
|
||||
assert_select "a[href=#{crop_path(@crop)}]"
|
||||
assert_select "a[href='#{crop_path(@crop)}']"
|
||||
end
|
||||
|
||||
it 'shows plantings section' do
|
||||
@@ -45,6 +45,6 @@ describe 'home/_crops.html.haml', type: "view" do
|
||||
end
|
||||
|
||||
it 'includes a link to all crops' do
|
||||
assert_select "a[href=#{crops_path}]", text: /View all crops/
|
||||
assert_select "a[href='#{crops_path}']", text: /View all crops/
|
||||
end
|
||||
end
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user