Compare commits

..

33 Commits

Author SHA1 Message Date
Daniel O'Connor
3bfe2329f1 Merge pull request #1032 from Growstuff/dev
Release 14
2016-08-22 19:19:04 +09:30
Cesy
941001c743 Merge pull request #1029 from CloCkWeRX/add_seed_purchase_links
Add links to ebay, which seems to have a variety of seeds to purchase…
2016-08-16 08:53:09 +01:00
Cesy
40cf5ba63a Merge pull request #1030 from CloCkWeRX/fix_998
Ensure we look at the current control, not the entire collection when marking planting finished
2016-08-16 08:50:30 +01:00
Cesy
9a40449f08 Merge pull request #1024 from CloCkWeRX/mapboxv4
#981 Add mapbox v4
2016-08-16 08:49:44 +01:00
Daniel O'Connor
90a88cf69d Fixes #998 Ensure we look at the current control, not the entire collection 2016-08-16 10:33:23 +09:30
Daniel O'Connor
044a992d25 Merge pull request #1025 from polveenomials/nav-header
Enhancement of the navigation bar (header)
2016-08-15 23:30:11 +09:30
Daniel O'Connor
4b066ec37f Merge pull request #1028 from CloCkWeRX/minor_gem_upgrades_august_2016
Minor gem upgrades for August 2016
2016-08-15 23:28:30 +09:30
Daniel O'Connor
c2dc2c5836 Merge pull request #1027 from CloCkWeRX/cve-2016-6317
Fix CVE-2016-6316 CVE-2016-6317
2016-08-15 23:10:27 +09:30
Daniel O'Connor
58452204aa Add links to ebay, which seems to have a variety of seeds to purchase with our affiliate id 2016-08-15 22:42:32 +09:30
Daniel O'Connor
711ba73d6b Upgrade devise to 4.2 2016-08-15 22:12:34 +09:30
Daniel O'Connor
5354f2732f Update bootstrap-sass coveralls friendly_id js-routes sass-rails simplecov 2016-08-15 22:07:39 +09:30
Daniel O'Connor
9bbaaa2211 Upgrade excon ffi autoprefixer-rails multi_json mimemagic pry active_utils activemerchant 2016-08-15 22:04:43 +09:30
Daniel O'Connor
93c47d774e Upgrade minor gems: kramdown, notifany, httparty, codemirror-rails, bootstrap_form, globalid 2016-08-15 22:01:56 +09:30
Daniel O'Connor
d8ad697d09 Swap tokens 2016-08-15 21:53:17 +09:30
Daniel O'Connor
7308a7cf9a Name: actionview
Version: 4.2.6
Advisory: CVE-2016-6316
Criticality: Unknown
URL: https://groups.google.com/forum/#!topic/rubyonrails-security/I-VWr034ouk
Title: Possible XSS Vulnerability in Action View
Solution: upgrade to ~> 3.2.22.3, ~> 4.2.7.1, >= 5.0.0.1

Name: activerecord
Version: 4.2.6
Advisory: CVE-2016-6317
Criticality: Unknown
URL: https://groups.google.com/forum/#!topic/rubyonrails-security/rgO20zYW33s
Title: Unsafe Query Generation Risk in Active Record
Solution: upgrade to ~> 4.2.7.1
2016-08-15 21:45:26 +09:30
Cesy
c9c49a7e5e Merge pull request #1026 from CloCkWeRX/gardenate_attempt_2
Gardenate attempt 2
2016-08-15 13:15:21 +01:00
Daniel O'Connor
dba6b2a291 Mitigate security concerns with target=_blank via https://www.jitbit.com/alexblog/256-targetblank---the-most-underestimated-vulnerability-ever/ 2016-08-15 21:31:45 +09:30
Daniel O'Connor
7d3991b295 #967 Mitigate security concerns with target=_blank via https://www.jitbit.com/alexblog/256-targetblank---the-most-underestimated-vulnerability-ever/ 2016-08-15 21:30:51 +09:30
Daniel O'Connor
e4c0ecfb5a Add basic test 2016-08-15 21:30:40 +09:30
Daniel O'Connor
fdb0e842de #864 Add links to google, gardenate 2016-08-15 21:30:33 +09:30
polveenomials
85ff36198b Added name to the CONTRIBUTORS.md 2016-08-04 14:27:49 +08:00
Daniel O'Connor
e38321aa33 #981 Add mapbox access token (on my free 50k views account) and update to v4 2016-07-28 14:27:49 +09:30
Kristine Nicole Polvoriza
d1438d1b2e Fixed the nav header in mobile view 2016-07-28 12:31:50 +08:00
pozorvlak
b6f848ef66 Merge pull request #1021 from CloCkWeRX/picture_improvements
If a harvest doesn't have any photos, try to look at the crop's default photo
2016-07-21 18:24:58 +01:00
Daniel O'Connor
ff47784aee Add explicit test coverage 2016-07-21 12:21:56 +09:30
Daniel O'Connor
1dba711057 Add more explicit test coverage 2016-07-21 12:13:37 +09:30
Daniel O'Connor
6911f7b24b Typo 2016-07-21 12:05:37 +09:30
pozorvlak
1e94abd063 Merge pull request #1019 from CloCkWeRX/mobile_searchbar
Use navbar-right, and reposition search box to fix mobile layout
2016-07-20 12:44:03 +01:00
Daniel O'Connor
4b87977e24 It helps to type properly 2016-07-08 18:12:16 +09:30
Daniel O'Connor
dfa28264c6 #1017 When a crop has no photos, look for harvests of the crop with photos. 2016-07-08 18:09:53 +09:30
Daniel O'Connor
f0c1d6d4c2 #997 Use the harvest photo lookup, not the harvest.crop one 2016-07-08 18:01:53 +09:30
Daniel O'Connor
427b98a157 #997 If a harvest doesn't have any photos, try to look at the crop's default photo 2016-07-08 17:59:32 +09:30
Daniel O'Connor
8f5000443f Use navbar-right, and reposition search box to fix mobile layout 2016-07-08 17:45:00 +09:30
23 changed files with 238 additions and 103 deletions

View File

@@ -70,3 +70,4 @@ submit the change with your pull request.
- Eric Tillberg / [Thrillberg](https://github.com/Thrillberg)
- Lucas Nogueira / [lucasnogueira](https://github.com/lucasnogueira)
- Charley Lewittes / [ctlewitt](https://github.com/ctlewitt)
- Kristine Nicole Polvoriza / [polveenomials](https://github.com/polveenomials)

View File

@@ -1,21 +1,21 @@
GEM
remote: https://rubygems.org/
specs:
actionmailer (4.2.6)
actionpack (= 4.2.6)
actionview (= 4.2.6)
activejob (= 4.2.6)
actionmailer (4.2.7.1)
actionpack (= 4.2.7.1)
actionview (= 4.2.7.1)
activejob (= 4.2.7.1)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.6)
actionview (= 4.2.6)
activesupport (= 4.2.6)
actionpack (4.2.7.1)
actionview (= 4.2.7.1)
activesupport (= 4.2.7.1)
rack (~> 1.6)
rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (4.2.6)
activesupport (= 4.2.6)
actionview (4.2.7.1)
activesupport (= 4.2.7.1)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
@@ -24,25 +24,25 @@ GEM
actionpack
active_merchant-paypal-bogus-gateway (0.1.0)
activemerchant
active_utils (3.2.0)
activesupport (>= 3.2)
active_utils (3.2.2)
activesupport (>= 3.2, < 5.1.0)
i18n
activejob (4.2.6)
activesupport (= 4.2.6)
activejob (4.2.7.1)
activesupport (= 4.2.7.1)
globalid (>= 0.3.0)
activemerchant (1.59.0)
activemerchant (1.60.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)
activemodel (4.2.7.1)
activesupport (= 4.2.7.1)
builder (~> 3.1)
activerecord (4.2.6)
activemodel (= 4.2.6)
activesupport (= 4.2.6)
activerecord (4.2.7.1)
activemodel (= 4.2.7.1)
activesupport (= 4.2.7.1)
arel (~> 6.0)
activesupport (4.2.6)
activesupport (4.2.7.1)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
@@ -51,7 +51,7 @@ GEM
addressable (2.4.0)
arel (6.0.3)
ast (2.3.0)
autoprefixer-rails (6.3.6.2)
autoprefixer-rails (6.4.0.2)
execjs
bcrypt (3.1.11)
better_errors (2.1.1)
@@ -67,10 +67,10 @@ GEM
bootstrap-kaminari-views (0.0.5)
kaminari (>= 0.13)
rails (>= 3.1)
bootstrap-sass (3.3.6)
bootstrap-sass (3.3.7)
autoprefixer-rails (>= 5.2.1)
sass (>= 3.3.4)
bootstrap_form (2.3.0)
bootstrap_form (2.5.0)
builder (3.2.2)
byebug (9.0.5)
cancancan (1.15.0)
@@ -96,8 +96,8 @@ GEM
climate_control (>= 0.0.3, < 1.0)
codeclimate-test-reporter (0.6.0)
simplecov (>= 0.7.1, < 1.0.0)
codemirror-rails (5.11)
railties (>= 3.0, < 5)
codemirror-rails (5.16.0)
railties (>= 3.0, < 6.0)
coderay (1.1.1)
coffee-rails (4.1.1)
coffee-script (>= 2.2.0)
@@ -122,18 +122,18 @@ GEM
rails-i18n (>= 4.0.0)
sass-rails (>= 4.0.3)
concurrent-ruby (1.0.2)
coveralls (0.8.13)
json (~> 1.8)
simplecov (~> 0.11.0)
coveralls (0.8.15)
json (>= 1.8, < 3)
simplecov (~> 0.12.0)
term-ansicolor (~> 1.3)
thor (~> 0.19.1)
tins (~> 1.6.0)
tins (>= 1.6.0, < 2)
csv_shaper (1.2.0)
activesupport (>= 3.0.0)
dalli (2.7.6)
database_cleaner (1.5.3)
debug_inspector (0.0.2)
devise (4.1.1)
devise (4.2.0)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0, < 5.1)
@@ -159,7 +159,7 @@ GEM
faraday
multi_json
erubis (2.7.0)
excon (0.50.1)
excon (0.51.0)
execjs (2.7.0)
factory_girl (4.7.0)
activesupport (>= 3.0.0)
@@ -168,7 +168,7 @@ GEM
railties (>= 3.0.0)
faraday (0.9.2)
multipart-post (>= 1.2, < 3)
ffi (1.9.10)
ffi (1.9.14)
figaro (1.1.1)
thor (~> 0.14)
flickraw (0.9.9)
@@ -181,7 +181,7 @@ GEM
gibbon (1.2.1)
httparty
multi_json (>= 1.9.0)
globalid (0.3.6)
globalid (0.3.7)
activesupport (>= 4.1.0)
gravatar-ultimate (2.0.0)
activesupport (>= 2.3.14)
@@ -218,8 +218,7 @@ GEM
haml (~> 4.0.0)
nokogiri (~> 1.6.0)
ruby_parser (~> 3.5)
httparty (0.13.7)
json (~> 1.8)
httparty (0.14.0)
multi_xml (>= 0.5.2)
i18n (0.7.0)
i18n-tasks (0.9.5)
@@ -238,7 +237,7 @@ GEM
thor (>= 0.14, < 2.0)
jquery-ui-rails (5.0.5)
railties (>= 3.2.16)
js-routes (1.2.6)
js-routes (1.2.9)
railties (>= 3.2)
sprockets-rails
json (1.8.3)
@@ -246,7 +245,7 @@ GEM
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
kgio (2.10.0)
kramdown (1.11.1)
kramdown (1.12.0)
launchy (2.4.3)
addressable (~> 2.3)
leaflet-markercluster-rails (0.7.0)
@@ -279,7 +278,7 @@ GEM
nokogiri (1.6.8)
mini_portile2 (~> 2.1.0)
pkg-config (~> 1.1.7)
notiffany (0.1.0)
notiffany (0.1.1)
nenv (~> 0.1)
shellany (~> 0.0)
oauth (0.5.1)
@@ -312,7 +311,7 @@ GEM
capybara (~> 2.1)
cliver (~> 0.3.1)
websocket-driver (>= 0.2.0)
pry (0.10.3)
pry (0.10.4)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
@@ -321,16 +320,16 @@ GEM
rack (1.6.4)
rack-test (0.6.3)
rack (>= 1.0)
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)
rails (4.2.7.1)
actionmailer (= 4.2.7.1)
actionpack (= 4.2.7.1)
actionview (= 4.2.7.1)
activejob (= 4.2.7.1)
activemodel (= 4.2.7.1)
activerecord (= 4.2.7.1)
activesupport (= 4.2.7.1)
bundler (>= 1.3.0, < 2.0)
railties (= 4.2.6)
railties (= 4.2.7.1)
sprockets-rails
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
@@ -348,9 +347,9 @@ GEM
rails_stdout_logging
rails_serve_static_assets (0.0.5)
rails_stdout_logging (0.0.5)
railties (4.2.6)
actionpack (= 4.2.6)
activesupport (= 4.2.6)
railties (4.2.7.1)
actionpack (= 4.2.7.1)
activesupport (= 4.2.7.1)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
raindrops (0.16.0)
@@ -391,7 +390,7 @@ GEM
sexp_processor (~> 4.1)
rubyzip (1.2.0)
sass (3.4.22)
sass-rails (5.0.5)
sass-rails (5.0.6)
railties (>= 4.0.0, < 6)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
@@ -403,13 +402,13 @@ GEM
websocket (~> 1.0)
sexp_processor (4.7.0)
shellany (0.0.1)
simplecov (0.11.2)
simplecov (0.12.0)
docile (~> 1.1.0)
json (~> 1.8)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.0)
slop (3.6.0)
sprockets (3.6.2)
sprockets (3.7.0)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.1.1)
@@ -423,7 +422,7 @@ GEM
thread (0.2.2)
thread_safe (0.3.5)
tilt (2.0.5)
tins (1.6.0)
tins (1.12.0)
tzinfo (1.2.2)
thread_safe (~> 0.1)
uglifier (2.7.2)

View File

@@ -8,13 +8,12 @@ jQuery ->
el.datepicker({'format': 'yyyy-mm-dd'})
href = el.attr('href')
el.click (e) ->
e.stopPropagation()
e.preventDefault()
originalText = $(this).text()
href = $(this).attr('href')
$(this).text('Confirm without date')
$(this).bind('click.confirm', (e) ->
@@ -30,6 +29,8 @@ jQuery ->
el.one 'changeDate', ->
date = $(this).datepicker('getDate')
href = $(this).attr('href')
url = "#{href}&planting[finished_at]=#{date}"
link = $("<a href='#{url}' data-method='put'></a>")

View File

@@ -1,6 +1,7 @@
if (document.getElementById("cropmap") !== null) {
mapbox_map_id = "<%= Rails.env == 'test' ? 0 : Growstuff::Application.config.mapbox_map_id %>";
mapbox_base_url = "https://c.tiles.mapbox.com/v3/" + mapbox_map_id + "/{z}/{x}/{y}.png";
mapbox_access_token = "<%= Rails.env == 'test' ? 0 : Growstuff::Application.config.mapbox_access_token %>";
mapbox_base_url = "http://a.tiles.mapbox.com/v4/" + mapbox_map_id + "/{z}/{x}/{y}.png?access_token=" + mapbox_access_token;
L.Icon.Default.imagePath = '/assets'

View File

@@ -1,6 +1,7 @@
if (document.getElementById("membermap") !== null) {
mapbox_map_id = "<%= Rails.env == 'test' ? 0 : Growstuff::Application.config.mapbox_map_id %>";
mapbox_base_url = "https://c.tiles.mapbox.com/v3/" + mapbox_map_id + "/{z}/{x}/{y}.png";
mapbox_access_token = "<%= Rails.env == 'test' ? 0 : Growstuff::Application.config.mapbox_access_token %>";
mapbox_base_url = "http://a.tiles.mapbox.com/v4/" + mapbox_map_id + "/{z}/{x}/{y}.png?access_token=" + mapbox_access_token;
L.Icon.Default.imagePath = '/assets'

View File

@@ -1,7 +1,8 @@
if (document.getElementById("placesmap") !== null) {
places_base_path = "/places";
mapbox_map_id = "<%= Rails.env == 'test' ? 0 : Growstuff::Application.config.mapbox_map_id %>";
mapbox_base_url = "https://c.tiles.mapbox.com/v3/" + mapbox_map_id + "/{z}/{x}/{y}.png";
mapbox_access_token = "<%= Rails.env == 'test' ? 0 : Growstuff::Application.config.mapbox_access_token %>";
mapbox_base_url = "http://a.tiles.mapbox.com/v4/" + mapbox_map_id + "/{z}/{x}/{y}.png?access_token=" + mapbox_access_token;
nominatim_base_url = 'http://nominatim.openstreetmap.org/search/';
nominatim_user_agent_email = "<%= Rails.env == 'test' ? 0 : Growstuff::Application.config.user_agent_email %>";

View File

@@ -40,6 +40,19 @@ h3
.main
padding-right: 1em
.navbar .navbar-form
padding-top: 0
padding-bottom: 0
margin-right: 0
margin-left: 15px
border: 0
-webkit-box-shadow: none
box-shadow: none
.img-responsive
max-width: 100%
height: auto
.sidebar
border-left: 1px solid darken($beige, 10%)
margin-left: -1px
@@ -115,6 +128,10 @@ p.stats
padding-left: 80px
margin-left: auto
.navbar .navbar-form
width: 250px
#placesmap, #cropmap
height: 500px
@@ -273,6 +290,11 @@ html, body
.navbar .nav > li
display: block
.navbar .navbar-form
width: 185px
padding-left: 0
padding-right: 0
/* override "info" alert boxes to be green, not blue, on Growstuff */
$state-info-text: darken($green, 10%)
$state-info-bg: lighten($green, 50%)

View File

@@ -20,7 +20,7 @@ module ApplicationHelper
currency = Growstuff::Application.config.currency
link = "http://www.wolframalpha.com/input/?i=#{pid}+#{currency}"
link_to "(convert)", link, target: "_blank"
link_to "(convert)", link, target: "_blank", rel: "noopener noreferrer"
end
def build_alert_classes(alert_type = :info)

View File

@@ -128,7 +128,11 @@ class Crop < ActiveRecord::Base
# later we can choose a default photo based on different criteria,
# eg. popularity
def default_photo
return photos.first
return photos.first if photos.any?
# Crop has no photos? Look for the most recent harvest with a photo.
harvest_with_photo = Harvest.where(crop_id: id).joins(:photos).order('harvests.id DESC').limit(1).first
return harvest_with_photo.photos.first if harvest_with_photo
end
# crop.sunniness

View File

@@ -132,7 +132,7 @@ class Harvest < ActiveRecord::Base
end
def default_photo
return photos.first
return photos.first || crop.default_photo
end
end

View File

@@ -1,7 +1,7 @@
%h4 Find #{ crop.name } seeds
- if crop.seeds.empty?
%p
There are no seeds available to trade.
There are no seeds available to trade on Growstuff right now.
- else
%ul
- crop.seeds.tradable.each do |seed|
@@ -10,6 +10,8 @@
= render :partial => 'members/location', :locals => { :member => seed.owner }
%p
= link_to "View all #{crop.name} seeds", seeds_by_crop_path(crop)
%p
= link_to "Purchase seeds via Ebay", "http://rover.ebay.com/rover/1/705-53470-19255-0/1?icep_ff3=9&pub=5575213277&toolid=10001&campid=5337940151&customid=&icep_uq=#{URI.escape crop.name}&icep_sellerId=&icep_ex_kw=&icep_sortBy=12&icep_catId=181003&icep_minPrice=&icep_maxPrice=&ipn=psmain&icep_vectorid=229515&kwid=902099&mtid=824&kw=lg", target: "_blank", rel: "noopener noreferrer"
- if crop.approved?
- if current_member
%p= link_to "List #{crop.name} seeds to trade", new_seed_path(:crop_id => crop.id)

View File

@@ -91,4 +91,9 @@
%h4 Learn more about #{ @crop.name.pluralize }
%ul
%li= link_to 'Wikipedia (English)', @crop.en_wikipedia_url
%li= link_to 'Wikipedia (English)', @crop.en_wikipedia_url, target: "_blank", rel: "noopener noreferrer"
%li
= link_to "Gardenate - Planting reminders", "http://www.gardenate.com/plant/#{URI.escape @crop.name}", target: "_blank", rel: "noopener noreferrer"
- if current_member && current_member.location
%li
= link_to "Google", "http://www.google.com/search?q=#{URI.escape ["Growing", @crop.name, current_member.location].join(" ")}", target: "_blank", rel: "noopener noreferrer"

View File

@@ -8,7 +8,7 @@
.panel-body
.row
.col-md-4
= link_to image_tag((harvest.crop.default_photo ? harvest.crop.default_photo.thumbnail_url : 'placeholder_150.png'), :alt => harvest.crop.name, :class => 'img'), harvest.crop
= link_to image_tag((harvest.default_photo ? harvest.default_photo.thumbnail_url : 'placeholder_150.png'), :alt => harvest.crop.name, :class => 'img'), harvest.crop
.col-md-8
%dl.dl-horizontal
%dt Crop :

View File

@@ -8,16 +8,24 @@
%span.icon-bar
%span.icon-bar
%span.icon-bar
%a.navbar-brand(href=root_path)
%a.navbar-brand.hidden-xs(href=root_path)
= image_tag("growstuff-brand.png", :size => "200x50", :alt => ENV['GROWSTUFF_SITE_NAME'])
= form_tag crops_search_path, :method => :get, :id => 'navbar-search', :class => 'navbar-form pull-right' do
.input
%a.navbar-brand.visible-xs(href=root_path)
= image_tag("growstuff-apple-touch-icon-precomposed.png", :size => "50x50", :class=>"img-responsive", :alt => ENV['GROWSTUFF_SITE_NAME'])
.form.navbar-form.pull-left
= form_tag crops_search_path, :method => :get, :id => 'navbar-search' do
= label_tag :term, "Search crop database:", :class => 'sr-only'
= text_field_tag 'term', nil, :class => 'search-query input-medium form-control', :placeholder => 'Search crops'
= submit_tag "Search", :class => 'btn sr-only'
.input
.input-group
= text_field_tag 'term', nil, :class => 'search-query input-medium form-control', :placeholder => 'Search crops'
.input-group-btn
%button.btn.btn-default{:style => "height: 34px;"}
= submit_tag "Search", :class => 'btn sr-only'
%span.glyphicon.glyphicon-search
.navbar-collapse.collapse#navbar-collapse
%ul.nav.navbar-nav.pull-right
%ul.nav.navbar-nav.navbar-right
%li.dropdown<
%a.dropdown-toggle{'data-toggle' => 'dropdown', :href => crops_path}
Crops

View File

@@ -69,5 +69,9 @@
- if @seed.owner.location
%p
%small
View other seeds, members and more near
= link_to @seed.owner.location, place_path(@seed.owner.location, anchor: "seeds")
View other seeds, members to trade with and more near
= link_to @seed.owner.location, place_path(@seed.owner.location, anchor: "seeds")
%p
%small
Or
= link_to "purchase seeds via Ebay", "http://rover.ebay.com/rover/1/705-53470-19255-0/1?icep_ff3=9&pub=5575213277&toolid=10001&campid=5337940151&customid=&icep_uq=#{URI.escape @seed.crop.name}&icep_sellerId=&icep_ex_kw=&icep_sortBy=12&icep_catId=181003&icep_minPrice=&icep_maxPrice=&ipn=psmain&icep_vectorid=229515&kwid=902099&mtid=824&kw=lg", target: "_blank", rel: "noopener noreferrer"

View File

@@ -61,6 +61,7 @@ Growstuff::Application.configure do
# 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.after_initialize do
ActiveMerchant::Billing::Base.mode = :test

View File

@@ -89,6 +89,7 @@ Growstuff::Application.configure do
# 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.i3n2c4ie'
config.mapbox_access_token = ' pk.eyJ1IjoiZ3Jvd3N0dWZmIiwiYSI6IkdxMkx4alUifQ.n0igaBsw97s14zMa0lwKCA'
config.after_initialize do
ActiveMerchant::Billing::Base.mode = :production

View File

@@ -87,6 +87,7 @@ Growstuff::Application.configure do
# 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.i3n2hao7'
config.mapbox_access_token = 'pk.eyJ1IjoiZ3Jvd3N0dWZmIiwiYSI6IkdxMkx4alUifQ.n0igaBsw97s14zMa0lwKCA'
config.after_initialize do
ActiveMerchant::Billing::Base.mode = :test

View File

@@ -135,7 +135,9 @@ feature "crop detail page", js: true do
expect(page).to have_content "Learn more about #{ crop.name }"
expect(page).to have_link "Wikipedia (English)", href: crop.en_wikipedia_url
end
scenario "has a link to gardenate" do
expect(page).to have_link "Gardenate - Planting reminders", href: "http://www.gardenate.com/plant/#{URI.escape crop.name}"
end
end
end

View File

@@ -108,12 +108,52 @@ describe Crop do
end
context 'photos' do
it 'has a default photo' do
before :each do
@crop = FactoryGirl.create(:tomato)
@planting = FactoryGirl.create(:planting, crop: @crop)
@photo = FactoryGirl.create(:photo)
@planting.photos << @photo
@crop.default_photo.should be_an_instance_of Photo
end
context 'with a planting photo' do
before :each do
@planting = FactoryGirl.create(:planting, crop: @crop)
@photo = FactoryGirl.create(:photo)
@planting.photos << @photo
end
it 'has a default photo' do
@crop.default_photo.should be_an_instance_of Photo
@crop.default_photo.id.should eq @photo.id
end
end
context 'with a harvest photo' do
before :each do
@harvest = FactoryGirl.create(:harvest, crop: @crop)
@photo = FactoryGirl.create(:photo)
@harvest.photos << @photo
end
it 'has a default photo' do
@crop.default_photo.should be_an_instance_of Photo
@crop.default_photo.id.should eq @photo.id
end
context 'and planting photo' do
before :each do
@planting = FactoryGirl.create(:planting, crop: @crop)
@planting_photo = FactoryGirl.create(:photo)
@planting.photos << @planting_photo
end
it 'should prefer the planting photo' do
@crop.default_photo.id.should eq @planting_photo.id
end
end
end
context 'with no plantings or harvests' do
it 'has no default photo' do
@crop.default_photo.should eq nil
end
end
end

View File

@@ -233,31 +233,72 @@ describe Harvest do
context 'photos' do
let(:harvest) { FactoryGirl.create(:harvest) }
let(:photo) { FactoryGirl.create(:photo) }
before do
harvest.photos << photo
before :each do
@harvest = FactoryGirl.create(:harvest)
end
it 'has a photo' do
harvest.photos.first.should eq photo
context 'without a photo' do
it 'should have no default photo' do
@harvest.default_photo.should eq nil
end
context 'and with a crop(planting) photo' do
before :each do
@photo = FactoryGirl.create(:photo)
@planting = FactoryGirl.create(:planting, crop: @harvest.crop)
@planting.photos << @photo
end
it 'should have a default photo' do
@harvest.default_photo.should eq @photo
end
end
end
it 'deletes association with photos when photo is deleted' do
photo.destroy
harvest.reload
harvest.photos.should be_empty
end
context 'with a photo' do
before do
@photo = FactoryGirl.create(:photo)
it 'has a default photo' do
harvest.default_photo.should eq photo
end
@harvest.photos << @photo
end
it 'chooses the most recent photo' do
@photo2 = FactoryGirl.create(:photo)
harvest.photos << @photo2
harvest.default_photo.should eq @photo2
it 'has a photo' do
@harvest.photos.first.should eq @photo
end
it 'deletes association with photos when photo is deleted' do
@photo.destroy
@harvest.reload
@harvest.photos.should be_empty
end
it 'has a default photo' do
@harvest.default_photo.should eq @photo
end
context 'and with a crop(planting) photo' do
before :each do
@crop_photo = FactoryGirl.create(:photo)
@planting = FactoryGirl.create(:planting, crop: @harvest.crop)
@planting.photos << @crop_photo
end
it 'should prefer the harvest photo' do
@harvest.default_photo.should eq @photo
end
end
context 'and a second photo' do
before :each do
@photo2 = FactoryGirl.create(:photo)
@harvest.photos << @photo2
end
it 'chooses the most recent photo' do
@harvest.default_photo.should eq @photo2
end
end
end
end
end

View File

@@ -96,7 +96,7 @@ RSpec.configure do |config|
# controller specs require this to work with Devise
# see https://github.com/plataformatec/devise/wiki/How-To%3a-Controllers-and-Views-tests-with-Rails-3-%28and-rspec%29
config.include Devise::TestHelpers, type: :controller
config.include Devise::Test::ControllerHelpers, type: :controller
config.extend ControllerMacros, type: :controller
# Allow just create(:factory) instead of needing to specify FactoryGirl.create(:factory)

View File

@@ -1,4 +1,4 @@
RSpec.configure do |config|
config.include Devise::TestHelpers, type: :controller
config.include Devise::TestHelpers, type: :view
config.include Devise::Test::ControllerHelpers, type: :controller
config.include Devise::Test::ControllerHelpers, type: :view
end