mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-30 03:36:23 -04:00
Compare commits
9 Commits
2014-01-03
...
2013-10-15
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
58bd464bca | ||
|
|
78ee229205 | ||
|
|
065005395f | ||
|
|
22cb6d2ad5 | ||
|
|
b02091bc00 | ||
|
|
b8cd4cc7cf | ||
|
|
e8d91c6404 | ||
|
|
83f99dd32e | ||
|
|
ec7ccd8500 |
5
Gemfile
5
Gemfile
@@ -1,7 +1,5 @@
|
||||
source 'https://rubygems.org'
|
||||
|
||||
ruby "1.9.3"
|
||||
|
||||
gem 'bundler', '>=1.1.5'
|
||||
|
||||
gem 'rails', '3.2.13'
|
||||
@@ -31,7 +29,6 @@ group :production, :staging do
|
||||
gem 'newrelic_rpm'
|
||||
gem 'dalli'
|
||||
gem 'memcachier'
|
||||
gem 'rails_12factor' # supresses heroku plugin injection
|
||||
end
|
||||
|
||||
# Gems used only for assets and not required
|
||||
@@ -76,8 +73,6 @@ group :development do
|
||||
# Installation of the debugger gem fails on Travis CI,
|
||||
# so we don't use it in the test environment
|
||||
gem 'debugger'
|
||||
gem 'better_errors'
|
||||
gem 'binding_of_caller'
|
||||
end
|
||||
|
||||
# Markdown formatting for updates etc
|
||||
|
||||
15
Gemfile.lock
15
Gemfile.lock
@@ -60,18 +60,12 @@ GEM
|
||||
multi_json (~> 1.0)
|
||||
arel (3.0.2)
|
||||
bcrypt-ruby (3.1.1)
|
||||
better_errors (1.0.1)
|
||||
coderay (>= 1.0.0)
|
||||
erubis (>= 2.6.6)
|
||||
binding_of_caller (0.7.2)
|
||||
debug_inspector (>= 0.0.1)
|
||||
bluecloth (2.2.0)
|
||||
bootstrap-datepicker-rails (1.1.1.3)
|
||||
railties (>= 3.0)
|
||||
builder (3.0.4)
|
||||
cancan (1.6.10)
|
||||
chunky_png (1.2.8)
|
||||
coderay (1.1.0)
|
||||
coffee-rails (3.2.2)
|
||||
coffee-script (>= 2.2.0)
|
||||
railties (~> 3.2.0)
|
||||
@@ -97,7 +91,6 @@ GEM
|
||||
csv_shaper (1.0.0)
|
||||
activesupport (>= 3.0.0)
|
||||
dalli (2.6.4)
|
||||
debug_inspector (0.0.2)
|
||||
debugger (1.6.1)
|
||||
columnize (>= 0.3.1)
|
||||
debugger-linecache (~> 1.2.0)
|
||||
@@ -194,11 +187,6 @@ GEM
|
||||
activesupport (= 3.2.13)
|
||||
bundler (~> 1.0)
|
||||
railties (= 3.2.13)
|
||||
rails_12factor (0.0.2)
|
||||
rails_serve_static_assets
|
||||
rails_stdout_logging
|
||||
rails_serve_static_assets (0.0.1)
|
||||
rails_stdout_logging (0.0.3)
|
||||
railties (3.2.13)
|
||||
actionpack (= 3.2.13)
|
||||
activesupport (= 3.2.13)
|
||||
@@ -267,8 +255,6 @@ PLATFORMS
|
||||
DEPENDENCIES
|
||||
active_utils (= 1.0.5)!
|
||||
activemerchant (= 1.33.0)!
|
||||
better_errors
|
||||
binding_of_caller
|
||||
bluecloth
|
||||
bootstrap-datepicker-rails
|
||||
bundler (>= 1.1.5)
|
||||
@@ -301,7 +287,6 @@ DEPENDENCIES
|
||||
pg
|
||||
rack (~> 1.4.5)
|
||||
rails (= 3.2.13)
|
||||
rails_12factor
|
||||
rake (>= 10.0.0)
|
||||
rspec-rails (~> 2.12.1)
|
||||
sass-rails (~> 3.2.3)
|
||||
|
||||
@@ -155,15 +155,6 @@ p.stats {
|
||||
height: 500px;
|
||||
}
|
||||
|
||||
.member-location {
|
||||
font-size: small;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.member-location a {
|
||||
color: @brown;
|
||||
}
|
||||
|
||||
// Overrides applying only to mobile view
|
||||
|
||||
@media only screen and (max-width: 767px) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class Crop < ActiveRecord::Base
|
||||
extend FriendlyId
|
||||
friendly_id :name, use: :slugged
|
||||
attr_accessible :en_wikipedia_url, :name, :parent_id, :creator_id
|
||||
friendly_id :system_name, use: :slugged
|
||||
attr_accessible :en_wikipedia_url, :system_name, :parent_id, :creator_id
|
||||
|
||||
has_many :scientific_names
|
||||
has_many :plantings
|
||||
@@ -13,7 +13,7 @@ class Crop < ActiveRecord::Base
|
||||
belongs_to :parent, :class_name => 'Crop'
|
||||
has_many :varieties, :class_name => 'Crop', :foreign_key => 'parent_id'
|
||||
|
||||
default_scope order("lower(name) asc")
|
||||
default_scope order("lower(system_name) asc")
|
||||
scope :recent, reorder("created_at desc")
|
||||
scope :toplevel, where(:parent_id => nil)
|
||||
scope :randomized, reorder('random()') # ok on sqlite and psql, but not on mysql
|
||||
@@ -30,7 +30,7 @@ class Crop < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def to_s
|
||||
return name
|
||||
return system_name
|
||||
end
|
||||
|
||||
def default_scientific_name
|
||||
@@ -99,52 +99,4 @@ class Crop < ActiveRecord::Base
|
||||
return interesting_crops
|
||||
end
|
||||
|
||||
# Crop.create_from_csv(row)
|
||||
# used by db/seeds.rb and rake growstuff:import_crops
|
||||
# CSV fields:
|
||||
# - name (required)
|
||||
# - scientific name (optional, can be picked up from parent if it has one)
|
||||
# - en_wikipedia_url (required)
|
||||
# - parent (name, optional)
|
||||
|
||||
def Crop.create_from_csv(row)
|
||||
name,scientific_name,en_wikipedia_url,parent = row
|
||||
|
||||
@cropbot = Member.find_by_login_name('cropbot')
|
||||
raise "cropbot account not found: run rake db:seed" unless @cropbot
|
||||
|
||||
@crop = Crop.find_or_create_by_name(name)
|
||||
@crop.update_attributes(
|
||||
:en_wikipedia_url => en_wikipedia_url,
|
||||
:creator_id => @cropbot.id
|
||||
)
|
||||
if parent
|
||||
@parent = Crop.find_by_name(parent)
|
||||
if @parent
|
||||
@crop.update_attributes(:parent_id => @parent.id)
|
||||
else
|
||||
logger.warn("Warning: parent crop #{parent} not found")
|
||||
end
|
||||
end
|
||||
|
||||
unless @crop.scientific_names.exists?(:scientific_name => scientific_name)
|
||||
@sn = ''
|
||||
if scientific_name
|
||||
@sn = scientific_name
|
||||
elsif @crop.parent
|
||||
@sn = @crop.parent.scientific_names.first.scientific_name
|
||||
end
|
||||
|
||||
if @sn
|
||||
@crop.scientific_names.create(
|
||||
:scientific_name => @sn,
|
||||
:creator_id => @cropbot.id
|
||||
)
|
||||
else
|
||||
logger.warn("Warning: no scientific name (not even on parent crop) for #{@crop}")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,55 +1,21 @@
|
||||
class Garden < ActiveRecord::Base
|
||||
include Geocodable
|
||||
extend FriendlyId
|
||||
friendly_id :garden_slug, use: :slugged
|
||||
|
||||
attr_accessible :name, :slug, :owner_id, :description, :active,
|
||||
:location, :latitude, :longitude, :area, :area_unit
|
||||
|
||||
attr_accessible :name, :slug, :owner_id, :description
|
||||
belongs_to :owner, :class_name => 'Member', :foreign_key => 'owner_id'
|
||||
has_many :plantings, :order => 'created_at DESC', :dependent => :destroy
|
||||
has_many :crops, :through => :plantings
|
||||
|
||||
# set up geocoding
|
||||
geocoded_by :location
|
||||
after_validation :geocode
|
||||
after_validation :empty_unwanted_geocodes
|
||||
# before_create :replace_blank_name
|
||||
|
||||
default_scope order("lower(name) asc")
|
||||
scope :active, where(:active => true)
|
||||
scope :inactive, where(:active => false)
|
||||
|
||||
validates :name,
|
||||
:format => {
|
||||
:with => /\S/
|
||||
}
|
||||
|
||||
validates :area,
|
||||
:numericality => { :only_integer => false },
|
||||
:allow_nil => true
|
||||
|
||||
AREA_UNITS_VALUES = {
|
||||
"square metres" => "square metre",
|
||||
"square feet" => "square foot",
|
||||
"hectares" => "hectare",
|
||||
"acres" => "acre"
|
||||
}
|
||||
validates :area_unit, :inclusion => { :in => AREA_UNITS_VALUES.values,
|
||||
:message => "%{value} is not a valid area unit" },
|
||||
:allow_nil => true,
|
||||
:allow_blank => true
|
||||
|
||||
after_validation :cleanup_area
|
||||
|
||||
def cleanup_area
|
||||
if area == 0
|
||||
self.area = nil
|
||||
end
|
||||
if area.blank?
|
||||
self.area_unit = nil
|
||||
end
|
||||
end
|
||||
|
||||
def garden_slug
|
||||
"#{owner.login_name}-#{name}".downcase.gsub(' ', '-')
|
||||
end
|
||||
|
||||
@@ -8,8 +8,6 @@ class Harvest < ActiveRecord::Base
|
||||
belongs_to :crop
|
||||
belongs_to :owner, :class_name => 'Member'
|
||||
|
||||
default_scope order('created_at DESC')
|
||||
|
||||
validates :quantity,
|
||||
:numericality => { :only_integer => false },
|
||||
:allow_nil => true
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
class Member < ActiveRecord::Base
|
||||
include Geocodable
|
||||
extend FriendlyId
|
||||
|
||||
friendly_id :login_name, use: :slugged
|
||||
|
||||
has_many :posts, :foreign_key => 'author_id'
|
||||
@@ -218,6 +216,22 @@ class Member < ActiveRecord::Base
|
||||
return nearby_members
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def geocode
|
||||
unless self.location.blank?
|
||||
self.latitude, self.longitude =
|
||||
Geocoder.coordinates(location, params: {limit: 1})
|
||||
end
|
||||
end
|
||||
|
||||
def empty_unwanted_geocodes
|
||||
if self.location.blank?
|
||||
self.latitude = nil
|
||||
self.longitude = nil
|
||||
end
|
||||
end
|
||||
|
||||
def update_newsletter_subscription
|
||||
if confirmed_at_changed? and newsletter # just signed up
|
||||
newsletter_subscribe
|
||||
|
||||
@@ -14,7 +14,7 @@ class Planting < ActiveRecord::Base
|
||||
|
||||
default_scope order("created_at desc")
|
||||
|
||||
delegate :name,
|
||||
delegate :system_name,
|
||||
:en_wikipedia_url,
|
||||
:default_scientific_name,
|
||||
:plantings_count,
|
||||
@@ -61,7 +61,7 @@ class Planting < ActiveRecord::Base
|
||||
|
||||
# stringify as "beet in Skud's backyard" or similar
|
||||
def to_s
|
||||
self.crop_name + " in " + self.location
|
||||
self.crop_system_name + " in " + self.location
|
||||
end
|
||||
|
||||
def default_photo
|
||||
|
||||
@@ -55,6 +55,6 @@ class Seed < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def seed_slug
|
||||
"#{owner.login_name}-#{crop.name}".downcase.gsub(' ', '-')
|
||||
"#{owner.login_name}-#{crop.system_name}".downcase.gsub(' ', '-')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -13,8 +13,3 @@
|
||||
%div.pagination
|
||||
= page_entries_info @comments, :model => "comments"
|
||||
= will_paginate @comments
|
||||
|
||||
%p
|
||||
Subscribe to the #{Growstuff::Application.config.site_name}
|
||||
= succeed "." do
|
||||
= link_to "comments RSS feed", comments_path(:format => 'rss')
|
||||
|
||||
@@ -6,8 +6,13 @@
|
||||
%ul
|
||||
- crop.seeds.tradable.each do |seed|
|
||||
%li
|
||||
= link_to "#{seed.owner} will trade #{seed.tradable_to}.", seed_path(seed)
|
||||
= render :partial => 'members/location', :locals => { :member => seed.owner }
|
||||
= link_to seed.owner, seed.owner
|
||||
- if seed.owner.location
|
||||
in #{seed.owner.location}
|
||||
- else
|
||||
(location unknown)
|
||||
will trade #{seed.tradable_to}.
|
||||
= link_to "View details.", seed_path(seed)
|
||||
- if current_member
|
||||
= link_to "List your seeds to trade.", new_seed_path()
|
||||
- else
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
on the Growstuff wiki.
|
||||
|
||||
.control-group
|
||||
= f.label :name, :class => 'control-label'
|
||||
= f.label :system_name, :class => 'control-label'
|
||||
.controls
|
||||
= f.text_field :name
|
||||
= f.text_field :system_name
|
||||
%span.help-inline Name in US English; singular; capitalize proper nouns only.
|
||||
.control-group
|
||||
= f.label :en_wikipedia_url, 'Wikipedia URL', :class => 'control-label'
|
||||
@@ -25,7 +25,7 @@
|
||||
.control-group
|
||||
= f.label :parent_id, 'Parent crop', :class => 'control-label'
|
||||
.controls
|
||||
= collection_select(:crop, :parent_id, Crop.all, :id, :name, {:include_blank => true})
|
||||
= collection_select(:crop, :parent_id, Crop.all, :id, :system_name, {:include_blank => true})
|
||||
%span.help-inline Optional. For setting up crop hierarchies for varieties etc.
|
||||
.form-actions
|
||||
= f.submit 'Save', :class => 'btn btn-primary'
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
%h4 Harvests
|
||||
- if crop.harvests.empty?
|
||||
%p
|
||||
Nobody has harvested this crop yet.
|
||||
- else
|
||||
%ul
|
||||
- crop.harvests.each do |harvest|
|
||||
%li
|
||||
= link_to "#{harvest.owner} harvested #{display_quantity(harvest)}.", harvest_path(harvest)
|
||||
= render :partial => 'members/location', :locals => { :member => harvest.owner }
|
||||
%small
|
||||
= distance_of_time_in_words(harvest.created_at, Time.zone.now)
|
||||
ago.
|
||||
|
||||
- if current_member
|
||||
= link_to "Track your #{crop.name} harvests.", new_harvest_path()
|
||||
- else
|
||||
= render :partial => 'shared/signin_signup', :locals => { :to => "track your #{crop.name} harvests" }
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
= link_to |
|
||||
image_tag( |
|
||||
crop.default_photo ? crop.default_photo.thumbnail_url : 'placeholder_150.png', |
|
||||
:alt => crop.name |
|
||||
:alt => crop.system_name |
|
||||
), |
|
||||
crop, |
|
||||
:rel => "popover", |
|
||||
'data-trigger' => 'hover', |
|
||||
'data-title' => crop.name, |
|
||||
'data-title' => crop.system_name, |
|
||||
'data-content' => "#{ render :partial => 'crops/popover', :locals => { :crop => crop } }", |
|
||||
'data-html' => true
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
.thumbnail(style='height: 220px')
|
||||
- if crop
|
||||
= link_to image_tag((crop.default_photo ? crop.default_photo.thumbnail_url : 'placeholder_150.png'), :alt => crop.name, :class => 'img-rounded'), crop
|
||||
= link_to image_tag((crop.default_photo ? crop.default_photo.thumbnail_url : 'placeholder_150.png'), :alt => crop.system_name, :class => 'img-rounded'), crop
|
||||
%p
|
||||
= link_to crop.name, crop
|
||||
= link_to crop.system_name, crop
|
||||
- if crop.scientific_names.count > 0
|
||||
%br/
|
||||
%i
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
- if crop.parent
|
||||
%p
|
||||
= crop.name
|
||||
= crop.system_name
|
||||
is a variety of
|
||||
= succeed "." do
|
||||
= link_to crop.parent, crop.parent
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
csv.headers :id, :name,
|
||||
csv.headers :id, :system_name,
|
||||
:growstuff_url, :en_wikipedia_url,
|
||||
:default_scientific_name,
|
||||
:scientific_name_count,
|
||||
@@ -30,7 +30,7 @@ csv.headers :id, :name,
|
||||
csv.row c do |csv, crop|
|
||||
|
||||
|
||||
csv.cells :id, :name, :en_wikipedia_url
|
||||
csv.cells :id, :system_name, :en_wikipedia_url
|
||||
csv.cell :growstuff_url, crop_url(c)
|
||||
|
||||
if c.scientific_names.any?
|
||||
@@ -40,7 +40,7 @@ csv.headers :id, :name,
|
||||
|
||||
if c.parent
|
||||
csv.cell :parent_crop_id, c.parent.id
|
||||
csv.cell :parent_crop_name, c.parent.name
|
||||
csv.cell :parent_crop_name, c.parent.system_name
|
||||
end
|
||||
|
||||
csv.cell :plantings_count || 0
|
||||
|
||||
@@ -27,4 +27,3 @@
|
||||
%li The data on this page is available in the following formats:
|
||||
%li= link_to "CSV", crops_path(:format => 'csv')
|
||||
%li= link_to "JSON", crops_path(:format => 'json')
|
||||
%li= link_to "RSS", crops_path(:format => 'rss')
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
%link= crops_url
|
||||
- @crops.each do |crop|
|
||||
%item
|
||||
%title= crop.name
|
||||
%title= crop.system_name
|
||||
%pubDate= crop.created_at.to_s(:rfc822)
|
||||
%link= post_url(crop)
|
||||
%guid= post_url(crop)
|
||||
|
||||
@@ -1,7 +1,21 @@
|
||||
- content_for :title, @crop.name
|
||||
- content_for :title, @crop.system_name
|
||||
|
||||
.row-fluid
|
||||
.span9
|
||||
= render :partial => 'photos', :locals => { :crop => @crop }
|
||||
|
||||
= render :partial => 'varieties', :locals => { :crop => @crop }
|
||||
|
||||
= render :partial => 'planting_advice', :locals => { :crop => @crop }
|
||||
|
||||
%p
|
||||
- if @crop.plantings.size > 0
|
||||
Planted
|
||||
= pluralize(@crop.plantings.size, "time")
|
||||
by #{Growstuff::Application.config.site_name} members
|
||||
- else
|
||||
Nobody is growing this yet. You could be the first!
|
||||
|
||||
%p
|
||||
- if can? :create, Planting
|
||||
= link_to "Plant this", new_planting_path(:crop_id => @crop.id), :class => 'btn btn-primary'
|
||||
@@ -14,25 +28,6 @@
|
||||
- if can? :create, Seed
|
||||
= link_to 'Add seeds to stash', new_seed_path(:params => { :crop_id => @crop.id }), :class => 'btn btn-primary'
|
||||
|
||||
= render :partial => 'photos', :locals => { :crop => @crop }
|
||||
|
||||
= render :partial => 'varieties', :locals => { :crop => @crop }
|
||||
|
||||
= render :partial => 'planting_advice', :locals => { :crop => @crop }
|
||||
|
||||
|
||||
%h2 Who's planted this crop?
|
||||
|
||||
%p
|
||||
- if @crop.plantings.size > 0
|
||||
= @crop.name.titleize
|
||||
has been planted
|
||||
= pluralize(@crop.plantings.size, "time")
|
||||
by #{Growstuff::Application.config.site_name} members.
|
||||
- else
|
||||
Nobody is growing this yet. You could be the first!
|
||||
|
||||
|
||||
- if @crop.plantings.size > 0
|
||||
- @crop.plantings.each do |p|
|
||||
= render :partial => "plantings/thumbnail", :locals => { :planting => p, :title => 'owner' }
|
||||
@@ -67,5 +62,4 @@
|
||||
%ul
|
||||
%li= link_to 'Wikipedia (English)', @crop.en_wikipedia_url
|
||||
|
||||
= render :partial => 'harvests', :locals => { :crop => @crop }
|
||||
= render :partial => 'find_seeds', :locals => { :crop => @crop }
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
%th When
|
||||
- @crops.each do |c|
|
||||
%tr
|
||||
%td= link_to c.name, c
|
||||
%td= link_to c.system_name, c
|
||||
%td= link_to c.en_wikipedia_url, c.en_wikipedia_url
|
||||
%td
|
||||
- c.scientific_names.each do |s|
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
= form_for(@garden, :html => {:class => "form-horizontal"}) do |f|
|
||||
= form_for @garden, :html => {} do |f|
|
||||
- if @garden.errors.any?
|
||||
#error_explanation
|
||||
%h2= "#{pluralize(@garden.errors.count, "error")} prohibited this garden from being saved:"
|
||||
@@ -6,41 +6,12 @@
|
||||
- @garden.errors.full_messages.each do |msg|
|
||||
%li= msg
|
||||
|
||||
.control_group
|
||||
= f.label "Garden name: ", :class => 'control-label'
|
||||
.controls= f.text_field :name
|
||||
.control-group
|
||||
= f.label :name, :class => 'control-label'
|
||||
.controls
|
||||
= f.text_field :name
|
||||
|
||||
.control-group
|
||||
= f.label :description, :class => 'control-label'
|
||||
.controls
|
||||
= f.text_area :description, :rows => 6
|
||||
|
||||
.control-group
|
||||
= f.label :location, :class => 'control-label'
|
||||
.controls
|
||||
= f.text_field :location, :value => @garden.location || current_member.location
|
||||
%span.help-block
|
||||
If you have a location set in your profile, it will be used when
|
||||
you create a new garden.
|
||||
- if current_member.location.blank?
|
||||
=link_to "Set your location now.", edit_member_registration_path
|
||||
- else
|
||||
=link_to "Change your location.", edit_member_registration_path
|
||||
|
||||
.control-group
|
||||
= f.label :area, :class => 'control-label'
|
||||
.controls
|
||||
= f.number_field :area, :class => 'input-small'
|
||||
= f.select(:area_unit, Garden::AREA_UNITS_VALUES, {:include_blank => false}, :class => 'input-medium')
|
||||
|
||||
.control-group
|
||||
= f.label 'Active? ', :class => 'control-label'
|
||||
.controls
|
||||
= f.check_box :active
|
||||
%span.help-inline
|
||||
You can mark a garden as inactive if you no longer use it.
|
||||
|
||||
= f.label 'Description: ', :class => 'control-label'
|
||||
.controls= f.text_area :description, :rows => 6
|
||||
|
||||
.form-actions
|
||||
= f.submit 'Save Garden', :class => 'btn btn-primary'
|
||||
|
||||
@@ -26,9 +26,6 @@
|
||||
%th Owner
|
||||
%th Garden name
|
||||
%th Description
|
||||
%th Location
|
||||
%th Area
|
||||
%th Active?
|
||||
%th Plantings
|
||||
%th
|
||||
|
||||
@@ -38,13 +35,6 @@
|
||||
%td= link_to garden.owner.login_name, garden.owner
|
||||
%td= link_to garden.name, garden
|
||||
%td= garden.description
|
||||
%td
|
||||
- if ! garden.location.blank?
|
||||
= link_to garden.location, place_path(garden.location)
|
||||
%td
|
||||
- if garden.area
|
||||
= pluralize(garden.area, garden.area_unit)
|
||||
%td= garden.active ? "Yes" : "No"
|
||||
%td
|
||||
- if garden.plantings.empty?
|
||||
None
|
||||
@@ -53,7 +43,7 @@
|
||||
- garden.plantings.each do |p|
|
||||
%li
|
||||
= p.quantity
|
||||
= link_to p.crop.name, p
|
||||
= link_to p.crop.system_name, p
|
||||
- if p.planted_at
|
||||
planted on
|
||||
= p.planted_at
|
||||
|
||||
@@ -1,25 +1,22 @@
|
||||
=content_for :title, "#{@garden.owner}'s #{@garden}"
|
||||
|
||||
.row-fluid
|
||||
.span9
|
||||
- if ! @garden.active
|
||||
.alert.alert-notice
|
||||
NOTE: This garden is inactive.
|
||||
- if can? :edit, @garden
|
||||
= link_to 'Set it to active', edit_garden_path(@garden)
|
||||
to plant something in this garden.
|
||||
%p
|
||||
%strong Owner:
|
||||
= link_to @garden.owner, @garden.owner
|
||||
- if ! @garden.location.blank?
|
||||
%p
|
||||
%strong Location:
|
||||
= @garden.location
|
||||
- if ! @garden.area.blank?
|
||||
%p
|
||||
%strong Area:
|
||||
= pluralize(@garden.area, @garden.area_unit)
|
||||
.span3
|
||||
= render :partial => "members/avatar", :locals => { :member => @garden.owner }
|
||||
|
||||
%h4= "#{@garden.owner}'s gardens"
|
||||
%ul
|
||||
- @garden.owner.gardens.each do |othergarden|
|
||||
%li
|
||||
- if @garden == othergarden
|
||||
= @garden
|
||||
- else
|
||||
= link_to "#{othergarden}", garden_path(othergarden)
|
||||
|
||||
- if can? :create, @garden
|
||||
= link_to 'Add New Garden', new_garden_path, :class => 'btn btn-mini'
|
||||
|
||||
.span9
|
||||
%div
|
||||
:markdown
|
||||
#{strip_tags @garden.description}
|
||||
@@ -31,30 +28,9 @@
|
||||
|
||||
%h3
|
||||
What's planted here?
|
||||
- if can? :edit, @garden and @garden.active
|
||||
- if can? :edit, @garden
|
||||
= link_to "Plant something", new_planting_path(:garden_id => @garden.id), :class => 'btn btn-primary'
|
||||
|
||||
- @garden.plantings.each do |p|
|
||||
= render :partial => "plantings/thumbnail", :locals => { :planting => p }
|
||||
|
||||
.span3
|
||||
%h4= "#{@garden.owner}'s gardens"
|
||||
%ul
|
||||
- @garden.owner.gardens.active.each do |othergarden|
|
||||
%li
|
||||
- if @garden == othergarden
|
||||
= @garden
|
||||
- else
|
||||
= link_to "#{othergarden}", garden_path(othergarden)
|
||||
|
||||
%h4= "Inactive gardens"
|
||||
%ul
|
||||
- @garden.owner.gardens.inactive.each do |othergarden|
|
||||
%li
|
||||
- if @garden == othergarden
|
||||
= @garden
|
||||
- else
|
||||
= link_to "#{othergarden}", garden_path(othergarden)
|
||||
|
||||
- if can? :create, @garden
|
||||
= link_to 'Add New Garden', new_garden_path, :class => 'btn btn-mini'
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
.control-group
|
||||
= f.label 'What did you harvest?', :class => 'control-label'
|
||||
.controls
|
||||
= collection_select(:harvest, :crop_id, Crop.all, :id, :name, :selected => @harvest.crop_id || @crop.id)
|
||||
= collection_select(:harvest, :crop_id, Crop.all, :id, :system_name, :selected => @harvest.crop_id || @crop.id)
|
||||
%span.help-inline
|
||||
Can't find what you're looking for?
|
||||
= link_to "Request new crops.", Growstuff::Application.config.new_crops_request_link
|
||||
|
||||
@@ -38,9 +38,11 @@
|
||||
%tr
|
||||
- unless @owner
|
||||
%td= link_to harvest.owner.login_name, harvest.owner
|
||||
%td= link_to harvest.crop.name, harvest.crop
|
||||
%td= link_to harvest.crop.system_name, harvest.crop
|
||||
%td= harvest.harvested_at
|
||||
%td= display_quantity(harvest)
|
||||
%td
|
||||
- if harvest.quantity
|
||||
= display_quantity(harvest)
|
||||
%td= harvest.description
|
||||
%td= link_to 'Details', harvest, :class => 'btn btn-mini'
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
- seeds.each do |seed|
|
||||
%tr
|
||||
%td= link_to seed.owner.login_name, seed.owner
|
||||
%td= link_to seed.crop.name, seed.crop
|
||||
%td= link_to seed.crop.system_name, seed.crop
|
||||
%td.hidden-phone.hidden-tablet= truncate(seed.description, :length => 40, :separator => ' ')
|
||||
%td= seed.tradable? ? seed.tradable_to : ''
|
||||
%td
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
.member-location
|
||||
- if member.location.blank?
|
||||
unknown location
|
||||
- else
|
||||
= link_to member.location, place_path(:place => member.location)
|
||||
@@ -14,4 +14,4 @@
|
||||
%small
|
||||
%br/
|
||||
Recently planted:
|
||||
!= member.plantings.first(3).map{|p| link_to p.crop_name, p }.join(", ")
|
||||
!= member.plantings.first(3).map{|p| link_to p.crop_system_name, p }.join(", ")
|
||||
|
||||
@@ -9,14 +9,14 @@
|
||||
.control-group
|
||||
= f.label 'What did you plant?', :class => 'control-label'
|
||||
.controls
|
||||
= collection_select(:planting, :crop_id, Crop.all, :id, :name, :selected => @planting.crop_id || @crop.id)
|
||||
= collection_select(:planting, :crop_id, Crop.all, :id, :system_name, :selected => @planting.crop_id || @crop.id)
|
||||
%span.help-inline
|
||||
Can't find what you're looking for?
|
||||
= link_to "Request new crops.", Growstuff::Application.config.new_crops_request_link
|
||||
.control-group
|
||||
= f.label 'Where did you plant it?', :class => 'control-label'
|
||||
.controls
|
||||
= collection_select(:planting, :garden_id, Garden.active.where(:owner_id => current_member), :id, :name, :selected => @planting.garden_id || @garden.id)
|
||||
= collection_select(:planting, :garden_id, Garden.where(:owner_id => current_member), :id, :name, :selected => @planting.garden_id || @garden.id)
|
||||
%span.help-inline
|
||||
= link_to "Add a garden.", new_garden_path
|
||||
.control-group
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
- if defined?(title) && title == 'owner'
|
||||
= link_to planting.owner, planting.owner
|
||||
- else
|
||||
= link_to planting.crop.name, planting
|
||||
= link_to planting.crop.system_name, planting
|
||||
|
||||
%p
|
||||
Planted
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
%tr
|
||||
- unless @owner
|
||||
%td= link_to planting.owner.login_name, planting.owner
|
||||
%td= link_to planting.crop.name, planting.crop
|
||||
%td= link_to planting.crop.system_name, planting.crop
|
||||
%td= link_to planting.garden.name, planting.garden
|
||||
%td
|
||||
:markdown
|
||||
|
||||
@@ -25,16 +25,3 @@
|
||||
%div.pagination
|
||||
= page_entries_info @posts, :model => "posts"
|
||||
= will_paginate @posts
|
||||
|
||||
%p
|
||||
- if @author
|
||||
Subscribe to
|
||||
= succeed "." do
|
||||
= link_to "#{@author}'s posts RSS feed", posts_path(:format => 'rss')
|
||||
|
||||
- else
|
||||
Subscribe to the #{Growstuff::Application.config.site_name}
|
||||
= link_to "posts RSS feed", posts_path(:format => 'rss')
|
||||
or
|
||||
= succeed "." do
|
||||
= link_to "comments RSS feed", comments_path(:format => 'rss')
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
.control-group
|
||||
= f.label :crop_id, :class => 'control-label'
|
||||
.controls
|
||||
= collection_select(:scientific_name, :crop_id, Crop.all, :id, :name, :selected => @scientific_name.crop_id || @crop.id)
|
||||
= collection_select(:scientific_name, :crop_id, Crop.all, :id, :system_name, :selected => @scientific_name.crop_id || @crop.id)
|
||||
.control-group
|
||||
= f.label :scientific_name, :class => 'control-label'
|
||||
.controls
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
.control-group
|
||||
= f.label 'Crop:', :class => 'control-label'
|
||||
.controls= collection_select(:seed, :crop_id, Crop.all, :id, :name, :selected => @seed.crop_id || @crop.id)
|
||||
.controls= collection_select(:seed, :crop_id, Crop.all, :id, :system_name, :selected => @seed.crop_id || @crop.id)
|
||||
.control-group
|
||||
= f.label 'Quantity:', :class => 'control-label'
|
||||
.controls
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
%tr
|
||||
- unless @owner
|
||||
%td= link_to seed.owner.login_name, seed.owner
|
||||
%td= link_to seed.crop.name, seed.crop
|
||||
%td= link_to seed.crop.system_name, seed.crop
|
||||
%td= seed.description
|
||||
%td= seed.quantity
|
||||
%td= seed.plant_before
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
require 'geocodable'
|
||||
|
||||
Geocoder.configure(
|
||||
:units => :km,
|
||||
:timeout => 10,
|
||||
|
||||
@@ -13,7 +13,3 @@
|
||||
# ActiveSupport::Inflector.inflections do |inflect|
|
||||
# inflect.acronym 'RESTful'
|
||||
# end
|
||||
|
||||
ActiveSupport::Inflector.inflections do |inflect|
|
||||
inflect.plural 'square foot', 'square feet'
|
||||
end
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
class RenameSystemNameToName < ActiveRecord::Migration
|
||||
def up
|
||||
# Rails is smart enough to alter the column being indexed, but not the name
|
||||
# of the index, and there's no rename_index command.
|
||||
remove_index :crops, :system_name
|
||||
rename_column :crops, :system_name, :name
|
||||
add_index :crops, :name
|
||||
end
|
||||
|
||||
def down
|
||||
remove_index :crops, :name
|
||||
rename_column :crops, :name, :system_name
|
||||
add_index :crops, :system_name
|
||||
end
|
||||
end
|
||||
@@ -1,10 +0,0 @@
|
||||
class AddFieldsToGardens < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :gardens, :active, :boolean, :default => true
|
||||
add_column :gardens, :location, :string
|
||||
add_column :gardens, :latitude, :float
|
||||
add_column :gardens, :longitude, :float
|
||||
add_column :gardens, :area, :decimal
|
||||
add_column :gardens, :area_unit, :string
|
||||
end
|
||||
end
|
||||
20
db/schema.rb
20
db/schema.rb
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20131025104228) do
|
||||
ActiveRecord::Schema.define(:version => 20130925050304) do
|
||||
|
||||
create_table "account_types", :force => true do |t|
|
||||
t.string "name", :null => false
|
||||
@@ -51,7 +51,7 @@ ActiveRecord::Schema.define(:version => 20131025104228) do
|
||||
end
|
||||
|
||||
create_table "crops", :force => true do |t|
|
||||
t.string "name", :null => false
|
||||
t.string "system_name", :null => false
|
||||
t.string "en_wikipedia_url"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
@@ -61,8 +61,8 @@ ActiveRecord::Schema.define(:version => 20131025104228) do
|
||||
t.integer "creator_id"
|
||||
end
|
||||
|
||||
add_index "crops", ["name"], :name => "index_crops_on_name"
|
||||
add_index "crops", ["slug"], :name => "index_crops_on_slug", :unique => true
|
||||
add_index "crops", ["system_name"], :name => "index_crops_on_system_name"
|
||||
|
||||
create_table "forums", :force => true do |t|
|
||||
t.string "name", :null => false
|
||||
@@ -76,18 +76,12 @@ ActiveRecord::Schema.define(:version => 20131025104228) do
|
||||
add_index "forums", ["slug"], :name => "index_forums_on_slug", :unique => true
|
||||
|
||||
create_table "gardens", :force => true do |t|
|
||||
t.string "name", :null => false
|
||||
t.string "name", :null => false
|
||||
t.integer "owner_id"
|
||||
t.string "slug", :null => false
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.string "slug", :null => false
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.text "description"
|
||||
t.boolean "active", :default => true
|
||||
t.string "location"
|
||||
t.float "latitude"
|
||||
t.float "longitude"
|
||||
t.decimal "area"
|
||||
t.string "area_unit"
|
||||
end
|
||||
|
||||
add_index "gardens", ["owner_id"], :name => "index_gardens_on_user_id"
|
||||
|
||||
25
db/seeds.rb
25
db/seeds.rb
@@ -1,5 +1,12 @@
|
||||
# This file should contain all the record creation needed to seed the database with its default values.
|
||||
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
|
||||
# Mayor.create(name: 'Emanuel', city: cities.first)
|
||||
|
||||
# import crops from CSV
|
||||
|
||||
require 'csv'
|
||||
|
||||
@@ -22,12 +29,18 @@ def load_data
|
||||
end
|
||||
|
||||
def load_crops
|
||||
source_path = Rails.root.join('db', 'seeds')
|
||||
Dir.glob("#{source_path}/crops*.csv").each do |crop_file|
|
||||
puts "Loading crops from #{crop_file}..."
|
||||
CSV.foreach(crop_file) do |row|
|
||||
Crop.create_from_csv(row)
|
||||
end
|
||||
puts "Loading crops..."
|
||||
CSV.foreach(Rails.root.join('db', 'seeds', 'crops.csv')) do |row|
|
||||
system_name,scientific_name,en_wikipedia_url = row
|
||||
@crop = Crop.create(
|
||||
:system_name => system_name,
|
||||
:en_wikipedia_url => en_wikipedia_url,
|
||||
:creator_id => @cropbot_user.id
|
||||
)
|
||||
@crop.scientific_names.create(
|
||||
:scientific_name => scientific_name,
|
||||
:creator_id => @cropbot_user.id
|
||||
)
|
||||
end
|
||||
puts "Finished loading crops"
|
||||
end
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
Capsicum,Capsicum,http://en.wikipedia.org/wiki/Capsicum,,This is the top parent variety -- the entire family of all kinds of peppers
|
||||
Capsicum annuum,Capsicum annuum,http://en.wikipedia.org/wiki/Capsicum_annuum,Capsicum,
|
||||
Capsicum baccatum,Capsicum baccatum,http://en.wikipedia.org/wiki/Capsicum_baccatum,Capsicum,
|
||||
Capsicum chinense,Capsicum chinense,http://en.wikipedia.org/wiki/Capsicum_chinense,Capsicum,
|
||||
rocoto,Capsicum pubescens,http://en.wikipedia.org/wiki/Capsicum_pubescens,Capsicum,AKA locoto
|
||||
Capsicum frutescens,Capsicum frutescens,http://en.wikipedia.org/wiki/Capsicum_frutescens,Capsicum,
|
||||
Aleppo pepper,,http://en.wikipedia.org/wiki/Aleppo_pepper,Capsicum annuum,"AKA pul biber, halaby pepper"
|
||||
Anaheim pepper,,http://en.wikipedia.org/wiki/Anaheim_pepper,Capsicum annuum,"AKA New Mexico pepper, California chili, Magdalena chili"
|
||||
banana pepper,,http://en.wikipedia.org/wiki/Banana_pepper,Capsicum annuum,"AKA yellow wax pepper, banana chili"
|
||||
bell pepper,,http://en.wikipedia.org/wiki/Bell_pepper,Capsicum annuum,"AKA capsicum, sweet pepper, pepper, poivron, peperoni, piment"
|
||||
bird's eye chili,,http://en.wikipedia.org/wiki/Bird%27s_eye_chili,Capsicum annuum,"AKA Thai chili pepper, bird's chili"
|
||||
cascabel chili,,http://en.wikipedia.org/wiki/Cascabel_chili,Capsicum annuum,"AKA rattle chile, bola chile, chile bola"
|
||||
cayenne pepper,,http://en.wikipedia.org/wiki/Cayenne_pepper,Capsicum annuum,"AKA Guinea spice, cow-horn pepper, aleva, bird pepper, red pepper"
|
||||
pasilla pepper,,http://en.wikipedia.org/wiki/Pasilla,Capsicum annuum,"AKA chilaca pepper, chile negro"
|
||||
chiltepin pepper,Capsicum annuum var. glabriusculum,http://en.wikipedia.org/wiki/Capsicum_annuum_var._glabriusculum,Capsicum annuum,"AKA wild chiltepin, chiltepe, chile tepin, turkey pepper, bird’s eye pepper, bird pepper"
|
||||
Chungyang red pepper,,http://en.wikipedia.org/wiki/Chungyang_Red_Pepper,Capsicum annuum,
|
||||
cubanelle pepper,,http://en.wikipedia.org/wiki/Cubanelle,Capsicum annuum,
|
||||
chile de árbol pepper,,http://en.wikipedia.org/wiki/Chile_de_%C3%A1rbol,Capsicum annuum,"AKA bird's beak chile, rat's tail chile"
|
||||
dundicut,,http://en.wikipedia.org/wiki/Dundicut,Capsicum annuum,AKA lal mirch
|
||||
facing heaven pepper,Capsicum annuum var. conoides,http://en.wikipedia.org/wiki/Facing_heaven_pepper,Capsicum annuum,
|
||||
Fresno pepper,,http://en.wikipedia.org/wiki/Fresno_pepper,Capsicum annuum,
|
||||
guajillo pepper,,http://en.wikipedia.org/wiki/Guajillo_chili,Capsicum annuum,"AKA guajillo chili, guajillo chilli, chile guajillo"
|
||||
Guntur Sannam chili,Capsicum Annuum var. Longhum,http://en.wikipedia.org/wiki/Guntur_Sannam,Capsicum annuum,
|
||||
Hungarian wax pepper,,http://en.wikipedia.org/wiki/Hungarian_wax_pepper,Capsicum annuum,
|
||||
Italian sweet pepper,,http://en.wikipedia.org/wiki/Italian_sweet_pepper,Capsicum annuum,
|
||||
jalapeño pepper,,http://en.wikipedia.org/wiki/Jalape%C3%B1o,Capsicum annuum,
|
||||
shishito pepper,,http://en.wikipedia.org/wiki/Shishito,Capsicum annuum,
|
||||
medusa pepper,,http://en.wikipedia.org/wiki/Medusa_pepper,Capsicum annuum,
|
||||
mulato pepper,,http://en.wikipedia.org/wiki/Mulato_pepper,Capsicum annuum,
|
||||
peter pepper,Capsicum annuum var. annuum,http://en.wikipedia.org/wiki/Peter_pepper,Capsicum annuum,AKA chilli willy pepper
|
||||
peperoncini pepper,,http://en.wikipedia.org/wiki/Peperoncini,Capsicum annuum,"AKA friggitello, peperone"
|
||||
pequin pepper,"Capsicum annuum var. glabriusculum
|
||||
",http://en.wikipedia.org/wiki/Pequin_pepper,Capsicum annuum,AKA piquin
|
||||
pimento pepper,,http://en.wikipedia.org/wiki/Pimiento,Capsicum annuum,"AKA cherry pepper, pimiento pepper"
|
||||
poblano pepper,,http://en.wikipedia.org/wiki/Poblano,Capsicum annuum,
|
||||
Santa Fe Grande pepper,,http://en.wikipedia.org/wiki/Santa_Fe_Grande_pepper,Capsicum annuum,"AKA yellow hot chili pepper, guero chili pepper"
|
||||
serrano pepper,,http://en.wikipedia.org/wiki/Serrano_pepper,Capsicum annuum,
|
||||
bishop's crown pepper,Capsicum baccatum var. pendulum,http://en.wikipedia.org/wiki/Bishop%27s_Crown,Capsicum baccatum,AKA Christmas bell
|
||||
lemon drop pepper,,http://en.wikipedia.org/wiki/Lemon_drop_%28pepper%29,Capsicum baccatum,"AKA ají limon, kellu uchu, hot lemon"
|
||||
peppadew pepper,,http://en.wikipedia.org/wiki/Peppadew,Capsicum baccatum,
|
||||
Brazilian starfish,,http://en.wikipedia.org/wiki/Capsicum_baccatum,Capsicum baccatum,
|
||||
wild baccatum,,http://en.wikipedia.org/wiki/Capsicum_baccatum,Capsicum baccatum,
|
||||
adjuma pepper,,http://en.wikipedia.org/wiki/Adjuma,Capsicum chinense,"AKA adjoema, aji umba, ojemma"
|
||||
ají dulce pepper,,http://en.wikipedia.org/wiki/Aj%C3%AD_dulce,Capsicum chinense,"AKA ajicito, ajice, rubra, biquinho"
|
||||
datil pepper,,http://en.wikipedia.org/wiki/Datil_pepper,Capsicum chinense,
|
||||
fatalii pepper,,http://en.wikipedia.org/wiki/Fatalii,Capsicum chinense,
|
||||
Madame Jeanette pepper,,http://en.wikipedia.org/wiki/Madame_Jeanette,Capsicum chinense,
|
||||
habanero pepper,,http://en.wikipedia.org/wiki/Habanero,Capsicum chinense,AKA habañero
|
||||
black habanero pepper,,http://en.wikipedia.org/wiki/Habanero,Capsicum chinense,
|
||||
red savino pepper,,http://en.wikipedia.org/wiki/Red_Savina_pepper,Capsicum chinense,
|
||||
bhut jolokia pepper,,http://en.wikipedia.org/wiki/Bhut_Jolokia,Capsicum chinense,"AKA ghost pepper, ghost chili pepper, red naga chilli, ghost chilli, naga jolokia"
|
||||
Scotch bonnet pepper,,http://en.wikipedia.org/wiki/Scotch_bonnet_%28pepper%29,Capsicum chinense,"AKA boabs bonnet, Scotty bons, Bonney peppers, Caribbean red peppers, ball of fire"
|
||||
cachucha pepper,,http://en.wikipedia.org/wiki/Scotch_bonnet_%28pepper%29,Capsicum chinense,
|
||||
Trinidad scorpion butch T pepper,,http://en.wikipedia.org/wiki/Trinidad_Scorpion_Butch_T_pepper,Capsicum chinense,
|
||||
Trinidad Moruga scorpion pepper,,http://en.wikipedia.org/wiki/Trinidad_Moruga_Scorpion,Capsicum chinense,
|
||||
Hainan yellow lantern,,http://en.wikipedia.org/wiki/Hainan_Yellow_Lantern_Chili,Capsicum chinense,AKA yellow emperor chili
|
||||
piri-piri pepper,,http://en.wikipedia.org/wiki/Piri_piri,Capsicum frutescens,"AKA African bird's eye pepper, peri peri, pili pili"
|
||||
Tabasco pepper,,http://en.wikipedia.org/wiki/Tabasco_pepper,Capsicum frutescens,
|
||||
malagueta pepper,,http://en.wikipedia.org/wiki/Malagueta_pepper,Capsicum frutescens,
|
||||
siling labuyo pepper,,http://en.wikipedia.org/wiki/Siling_labuyo,Capsicum frutescens,"AKA chileng bundok, siling palay, pasitis, pasite, katumbal, kitikot, siling kolikot, silit-diablo, lada, rimorimo, paktin"
|
||||
kambuzi,,http://en.wikipedia.org/wiki/Kambuzi,Capsicum frutescens,
|
||||
|
@@ -1,22 +0,0 @@
|
||||
module Geocodable
|
||||
def self.included(base)
|
||||
base.extend(self)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def geocode
|
||||
unless self.location.blank?
|
||||
self.latitude, self.longitude =
|
||||
Geocoder.coordinates(location, params: {limit: 1})
|
||||
end
|
||||
end
|
||||
|
||||
def empty_unwanted_geocodes
|
||||
if self.location.blank?
|
||||
self.latitude = nil
|
||||
self.longitude = nil
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -10,32 +10,6 @@ namespace :growstuff do
|
||||
member.roles << admin
|
||||
end
|
||||
|
||||
desc "Upload crops from a CSV file"
|
||||
# usage: rake growstuff:import_crops file=filename.csv
|
||||
|
||||
task :import_crops => :environment do
|
||||
require 'csv'
|
||||
|
||||
@file = ENV['file'] or raise "Usage: rake growstuff:import_crops file=file.csv"
|
||||
|
||||
puts "Loading crops from #{@file}..."
|
||||
CSV.foreach(@file) do |row|
|
||||
Crop.create_from_csv(row)
|
||||
end
|
||||
puts "Finished loading crops"
|
||||
|
||||
end
|
||||
|
||||
desc "Depopulate Null Island"
|
||||
# this fixes up anyone who has erroneously wound up with a 0,0 lat/long
|
||||
task :depopulate_null_island => :environment do
|
||||
Member.find_each do |m|
|
||||
if m.location and (m.latitude == nil and m.longitude == nil)
|
||||
m.geocode
|
||||
m.save
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
desc "One-off tasks needed at various times and kept for posterity"
|
||||
namespace :oneoff do
|
||||
@@ -193,21 +167,6 @@ namespace :growstuff do
|
||||
end
|
||||
end
|
||||
|
||||
desc "October 2013: set garden locations to member locations"
|
||||
task :initialize_garden_locations => :environment do
|
||||
Member.located.find_each do |m|
|
||||
m.gardens.each do |g|
|
||||
if g.location.blank?
|
||||
g.location = m.location
|
||||
g.latitude = m.latitude
|
||||
g.longitude = m.longitude
|
||||
g.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -10,9 +10,8 @@
|
||||
# echo "YYYY-MM-DD - do something or other"
|
||||
# rake growstuff:oneoff:something
|
||||
|
||||
echo "2013-10-24 - fix zeroed geolocations"
|
||||
rake growstuff:depopulate_null_island
|
||||
|
||||
echo "2013-10-24 - initialize garden locations"
|
||||
rake growstuff:oneoff:initialize_garden_locations
|
||||
echo "2013-08-26 - set planting owner"
|
||||
rake growstuff:oneoff:set_planting_owner
|
||||
|
||||
echo "2013-08-26 - initialize member planting count"
|
||||
rake growstuff:oneoff:initialize_member_planting_count
|
||||
|
||||
@@ -6,7 +6,7 @@ describe CropsController do
|
||||
|
||||
def valid_attributes
|
||||
{
|
||||
:name => "Tomato",
|
||||
:system_name => "Tomato",
|
||||
:en_wikipedia_url => 'http://en.wikipedia.org/wiki/Tomato'
|
||||
}
|
||||
end
|
||||
|
||||
@@ -1,54 +1,54 @@
|
||||
FactoryGirl.define do
|
||||
|
||||
factory :crop do
|
||||
name "Magic bean"
|
||||
system_name "Magic bean"
|
||||
en_wikipedia_url "http://en.wikipedia.org/wiki/Magic_bean"
|
||||
creator
|
||||
|
||||
factory :tomato do
|
||||
name "Tomato"
|
||||
system_name "Tomato"
|
||||
en_wikipedia_url "http://en.wikipedia.org/wiki/Tomato"
|
||||
end
|
||||
|
||||
factory :maize do
|
||||
name "Maize"
|
||||
system_name "Maize"
|
||||
en_wikipedia_url "http://en.wikipedia.org/wiki/Maize"
|
||||
end
|
||||
|
||||
factory :chard do
|
||||
name "Chard"
|
||||
system_name "Chard"
|
||||
end
|
||||
|
||||
factory :walnut do
|
||||
name "Walnut"
|
||||
system_name "Walnut"
|
||||
end
|
||||
|
||||
factory :apple do
|
||||
name "Apple"
|
||||
system_name "Apple"
|
||||
end
|
||||
|
||||
factory :pear do
|
||||
name "Pear"
|
||||
system_name "Pear"
|
||||
end
|
||||
|
||||
# for testing varieties
|
||||
factory :roma do
|
||||
name "Roma tomato"
|
||||
system_name "Roma tomato"
|
||||
end
|
||||
|
||||
factory :popcorn do
|
||||
name "popcorn"
|
||||
system_name "popcorn"
|
||||
end
|
||||
|
||||
|
||||
# This should have a name that is alphabetically earlier than :uppercase
|
||||
# crop to ensure that the ordering tests work.
|
||||
factory :lowercasecrop do
|
||||
name "ffrench bean"
|
||||
system_name "ffrench bean"
|
||||
end
|
||||
|
||||
factory :uppercasecrop do
|
||||
name "Swiss chard"
|
||||
system_name "Swiss chard"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -3,14 +3,6 @@ FactoryGirl.define do
|
||||
name 'Springfield Community Garden'
|
||||
description "This is a **totally** cool garden"
|
||||
owner
|
||||
active true
|
||||
area 23
|
||||
area_unit "acre"
|
||||
location "Greenwich, UK"
|
||||
|
||||
factory :inactive_garden do
|
||||
active false
|
||||
end
|
||||
|
||||
# the following are used for testing alphabetical ordering
|
||||
factory :garden_a do
|
||||
|
||||
@@ -13,7 +13,7 @@ describe Crop do
|
||||
|
||||
it 'should be fetchable from the database' do
|
||||
@crop.save
|
||||
@crop2 = Crop.find_by_name('Tomato')
|
||||
@crop2 = Crop.find_by_system_name('Tomato')
|
||||
@crop2.en_wikipedia_url.should == "http://en.wikipedia.org/wiki/Tomato"
|
||||
@crop2.slug.should == "tomato"
|
||||
end
|
||||
@@ -32,7 +32,7 @@ describe Crop do
|
||||
|
||||
context 'invalid data' do
|
||||
it 'should not save a crop without a system name' do
|
||||
@crop = FactoryGirl.build(:crop, :name => nil)
|
||||
@crop = FactoryGirl.build(:crop, :system_name => nil)
|
||||
expect { @crop.save }.to raise_error ActiveRecord::StatementInvalid
|
||||
end
|
||||
end
|
||||
|
||||
@@ -23,7 +23,7 @@ describe Garden do
|
||||
@garden = FactoryGirl.build(:garden, :name => "")
|
||||
@garden.should_not be_valid
|
||||
end
|
||||
|
||||
|
||||
it "doesn't allow a name with only spaces" do
|
||||
@garden = FactoryGirl.build(:garden, :name => " ")
|
||||
@garden.should_not be_valid
|
||||
@@ -96,73 +96,4 @@ describe Garden do
|
||||
Planting.count.should == all - 2
|
||||
end
|
||||
|
||||
context 'area' do
|
||||
it 'allows numeric area' do
|
||||
@garden = FactoryGirl.build(:garden, :area => 33)
|
||||
@garden.should be_valid
|
||||
end
|
||||
|
||||
it 'allows decimal quantities' do
|
||||
@garden = FactoryGirl.build(:garden, :area => 3.3)
|
||||
@garden.should be_valid
|
||||
end
|
||||
|
||||
it 'allows blank quantities' do
|
||||
@garden = FactoryGirl.build(:garden, :area => '')
|
||||
@garden.should be_valid
|
||||
end
|
||||
|
||||
it 'allows nil quantities' do
|
||||
@garden = FactoryGirl.build(:garden, :area => nil)
|
||||
@garden.should be_valid
|
||||
end
|
||||
|
||||
it 'cleans up zero quantities' do
|
||||
@garden = FactoryGirl.build(:garden, :area => 0)
|
||||
@garden.area.should == 0
|
||||
end
|
||||
|
||||
it "doesn't allow non-numeric quantities" do
|
||||
@garden = FactoryGirl.build(:garden, :area => "99a")
|
||||
@garden.should_not be_valid
|
||||
end
|
||||
end
|
||||
|
||||
context 'units' do
|
||||
Garden::AREA_UNITS_VALUES.values.push(nil, '').each do |s|
|
||||
it "#{s} should be a valid unit" do
|
||||
@garden = FactoryGirl.build(:garden, :area_unit => s)
|
||||
@garden.should be_valid
|
||||
end
|
||||
end
|
||||
|
||||
it 'should refuse invalid unit values' do
|
||||
@garden = FactoryGirl.build(:garden, :area_unit => 'not valid')
|
||||
@garden.should_not be_valid
|
||||
@garden.errors[:area_unit].should include("not valid is not a valid area unit")
|
||||
end
|
||||
|
||||
it 'sets area unit to blank if area is blank' do
|
||||
@garden = FactoryGirl.build(:garden, :area => '', :area_unit => 'acre')
|
||||
@garden.should be_valid
|
||||
@garden.area_unit.should eq nil
|
||||
end
|
||||
end
|
||||
|
||||
context 'active scopes' do
|
||||
before(:each) do
|
||||
@active = FactoryGirl.create(:garden)
|
||||
@inactive = FactoryGirl.create(:inactive_garden)
|
||||
end
|
||||
|
||||
it 'includes active garden in active scope' do
|
||||
Garden.active.should include @active
|
||||
Garden.active.should_not include @inactive
|
||||
end
|
||||
it 'includes inactive garden in inactive scope' do
|
||||
Garden.inactive.should include @inactive
|
||||
Garden.inactive.should_not include @active
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -117,12 +117,4 @@ describe Harvest do
|
||||
@harvest.weight_unit.should eq nil
|
||||
end
|
||||
end
|
||||
|
||||
context 'ordering' do
|
||||
it 'lists most recent harvests first' do
|
||||
@h1 = FactoryGirl.create(:harvest, :created_at => 1.day.ago)
|
||||
@h2 = FactoryGirl.create(:harvest, :created_at => 1.hour.ago)
|
||||
Harvest.all.should eq [@h2, @h1]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -41,7 +41,7 @@ describe Planting do
|
||||
|
||||
context 'delegation' do
|
||||
it 'system name' do
|
||||
@planting.crop_name.should eq @planting.crop.name
|
||||
@planting.crop_system_name.should eq @planting.crop.system_name
|
||||
end
|
||||
it 'wikipedia url' do
|
||||
@planting.crop_en_wikipedia_url.should eq @planting.crop.en_wikipedia_url
|
||||
|
||||
@@ -14,7 +14,7 @@ describe ScientificName do
|
||||
it 'should be fetchable from the database' do
|
||||
@sn.save
|
||||
@sn2 = ScientificName.find_by_scientific_name('Zea mays')
|
||||
@sn2.crop.name.should == "Maize"
|
||||
@sn2.crop.system_name.should == "Maize"
|
||||
end
|
||||
|
||||
it 'has a creator' do
|
||||
|
||||
@@ -21,8 +21,4 @@ describe "comments/index" do
|
||||
rendered.should contain 'OMG LOL'
|
||||
rendered.should contain 'ROFL'
|
||||
end
|
||||
|
||||
it "contains an RSS feed link" do
|
||||
assert_select "a", :href => comments_path(:format => 'rss')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -15,7 +15,7 @@ describe "crops/edit" do
|
||||
|
||||
it "renders the edit crop form" do
|
||||
assert_select "form", :action => crops_path(@crop), :method => "post" do
|
||||
assert_select "input#crop_name", :name => "crop[name]"
|
||||
assert_select "input#crop_system_name", :name => "crop[system_name]"
|
||||
assert_select "input#crop_en_wikipedia_url", :name => "crop[en_wikipedia_url]"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,12 +4,12 @@ describe "crops/hierarchy" do
|
||||
before(:each) do
|
||||
controller.stub(:current_user) { nil }
|
||||
@tomato = FactoryGirl.create(:tomato)
|
||||
@roma = FactoryGirl.create(:crop, :name => 'Roma tomato', :parent => @tomato)
|
||||
@roma = FactoryGirl.create(:crop, :system_name => 'Roma tomato', :parent => @tomato)
|
||||
assign(:crops, [@tomato, @roma])
|
||||
render
|
||||
end
|
||||
|
||||
it "shows crop hierarchy" do
|
||||
assert_select "ul>li>ul>li", :text => @roma.name
|
||||
assert_select "ul>li>ul>li", :text => @roma.system_name
|
||||
end
|
||||
end
|
||||
|
||||
@@ -47,12 +47,11 @@ describe "crops/index" do
|
||||
end
|
||||
|
||||
context "downloads" do
|
||||
it "offers data downloads" do
|
||||
it "offers a CSV download" do
|
||||
render
|
||||
rendered.should contain "The data on this page is available in the following formats:"
|
||||
assert_select "a", :href => crops_path(:format => 'csv')
|
||||
assert_select "a", :href => crops_path(:format => 'json')
|
||||
assert_select "a", :href => crops_path(:format => 'rss')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -12,7 +12,7 @@ describe "crops/new" do
|
||||
it "renders new crop form" do
|
||||
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
||||
assert_select "form", :action => crops_path, :method => "post" do
|
||||
assert_select "input#crop_name", :name => "crop[name]"
|
||||
assert_select "input#crop_system_name", :name => "crop[system_name]"
|
||||
assert_select "input#crop_en_wikipedia_url", :name => "crop[en_wikipedia_url]"
|
||||
assert_select "select#crop_parent_id", :name => "crop[parent_id]"
|
||||
end
|
||||
|
||||
@@ -62,24 +62,13 @@ describe "crops/show" do
|
||||
assert_select "a[href=#{seed_path(seed)}]"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "harvests" do
|
||||
before(:each) do
|
||||
@owner1 = FactoryGirl.create(:london_member)
|
||||
@h1 = FactoryGirl.create(:harvest, :owner => @owner1, :crop => @crop)
|
||||
@h2 = FactoryGirl.create(:harvest, :owner => @owner1, :crop => @crop)
|
||||
render
|
||||
it "shows location if available" do
|
||||
rendered.should contain "#{@owner1} in #{@owner1.location} will trade #{@seed1.tradable_to}"
|
||||
end
|
||||
|
||||
it "shows a heading" do
|
||||
rendered.should contain "Harvests"
|
||||
end
|
||||
|
||||
it "shows a list of people who have harvested this crop" do
|
||||
@crop.harvests.each do |harvest|
|
||||
assert_select "a[href=#{harvest_path(harvest)}]"
|
||||
end
|
||||
it "shows grammatical text if seed trader has no location" do
|
||||
rendered.should contain "#{@owner2} (location unknown) will trade #{@seed2.tradable_to}"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -165,18 +154,18 @@ describe "crops/show" do
|
||||
context 'varieties' do
|
||||
before(:each) do
|
||||
@popcorn = FactoryGirl.create(:popcorn, :parent_id => @crop.id)
|
||||
@ubercrop = FactoryGirl.create(:crop, :name => 'ubercrop')
|
||||
@ubercrop = FactoryGirl.create(:crop, :system_name => 'ubercrop')
|
||||
@crop.parent_id = @ubercrop.id
|
||||
@crop.save
|
||||
render
|
||||
end
|
||||
|
||||
it 'shows popcorn as a child variety' do
|
||||
rendered.should contain @popcorn.name
|
||||
rendered.should contain @popcorn.system_name
|
||||
end
|
||||
|
||||
it 'shows parent crop' do
|
||||
rendered.should contain @ubercrop.name
|
||||
rendered.should contain @ubercrop.system_name
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -18,10 +18,6 @@ describe "gardens/edit" do
|
||||
assert_select "form", :action => gardens_path(@garden), :method => "post" do
|
||||
assert_select "input#garden_name", :name => "garden[name]"
|
||||
assert_select "textarea#garden_description", :name => "garden[description]"
|
||||
assert_select "input#garden_location", :name => "garden[location]"
|
||||
assert_select "input#garden_area", :name => "garden[area]"
|
||||
assert_select "select#garden_area_unit", :name => "garden[area_unit]"
|
||||
assert_select "input#garden_active", :name => "garden[active]"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,12 +4,14 @@ describe "gardens/index" do
|
||||
before(:each) do
|
||||
controller.stub(:current_user) { nil }
|
||||
@owner = FactoryGirl.create(:member)
|
||||
@garden = FactoryGirl.create(:garden, :owner => @owner)
|
||||
page = 1
|
||||
per_page = 2
|
||||
total_entries = 2
|
||||
gardens = WillPaginate::Collection.create(page, per_page, total_entries) do |pager|
|
||||
pager.replace([@garden, @garden])
|
||||
pager.replace([
|
||||
FactoryGirl.create(:garden, :owner => @owner),
|
||||
FactoryGirl.create(:garden, :owner => @owner)
|
||||
])
|
||||
end
|
||||
assign(:gardens, gardens)
|
||||
end
|
||||
@@ -17,9 +19,7 @@ describe "gardens/index" do
|
||||
it "renders a list of gardens" do
|
||||
render
|
||||
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
||||
assert_select "tr>td", :text => @garden.name, :count => 2
|
||||
assert_select "tr>td>a", :text => @garden.location, :count => 2
|
||||
assert_select "tr>td", :text => pluralize(@garden.area, @garden.area_unit), :count => 2
|
||||
assert_select "tr>td", :text => "Springfield Community Garden".to_s, :count => 2
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -2,22 +2,17 @@ require 'spec_helper'
|
||||
|
||||
describe "gardens/new" do
|
||||
before(:each) do
|
||||
@member = FactoryGirl.create(:member)
|
||||
sign_in @member
|
||||
controller.stub(:current_user) { @member }
|
||||
@garden = FactoryGirl.create(:garden, :owner => @member)
|
||||
assign(:garden, @garden)
|
||||
render
|
||||
controller.stub(:current_user) { Member.new }
|
||||
assign(:garden, FactoryGirl.create(:garden))
|
||||
end
|
||||
|
||||
it "renders new garden form" do
|
||||
render
|
||||
|
||||
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
||||
assert_select "form", :action => gardens_path, :method => "post" do
|
||||
assert_select "input#garden_name", :name => "garden[name]"
|
||||
assert_select "textarea#garden_description", :name => "garden[description]"
|
||||
assert_select "input#garden_location", :name => "garden[location]"
|
||||
assert_select "input#garden_area", :name => "garden[area]"
|
||||
assert_select "select#garden_area_unit", :name => "garden[area_unit]"
|
||||
assert_select "input#garden_active", :name => "garden[active]"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -10,14 +10,6 @@ describe "gardens/show" do
|
||||
render
|
||||
end
|
||||
|
||||
it 'should show the location' do
|
||||
rendered.should contain @garden.location
|
||||
end
|
||||
|
||||
it 'should show the area' do
|
||||
rendered.should contain pluralize(@garden.area, @garden.area_unit)
|
||||
end
|
||||
|
||||
it 'should show the description' do
|
||||
rendered.should contain "totally cool garden"
|
||||
end
|
||||
@@ -27,7 +19,7 @@ describe "gardens/show" do
|
||||
end
|
||||
|
||||
it 'should show plantings on the garden page' do
|
||||
rendered.should contain @planting.crop.name
|
||||
rendered.should contain @planting.crop.system_name
|
||||
end
|
||||
|
||||
it "doesn't show the note about random plantings" do
|
||||
|
||||
@@ -28,8 +28,8 @@ describe "harvests/index" do
|
||||
it "renders a list of harvests" do
|
||||
render
|
||||
assert_select "tr>td", :text => @member.login_name
|
||||
assert_select "tr>td", :text => @tomato.name
|
||||
assert_select "tr>td", :text => @maize.name
|
||||
assert_select "tr>td", :text => @tomato.system_name
|
||||
assert_select "tr>td", :text => @maize.system_name
|
||||
end
|
||||
|
||||
it "provides data links" do
|
||||
|
||||
@@ -9,7 +9,7 @@ describe "harvests/show" do
|
||||
end
|
||||
|
||||
it "renders attributes" do
|
||||
rendered.should contain @crop.name
|
||||
rendered.should contain @crop.system_name
|
||||
rendered.should contain @harvest.harvested_at.to_s
|
||||
end
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ describe 'home/_members.html.haml', :type => "view" do
|
||||
it 'Shows members' do
|
||||
rendered.should contain @member.login_name
|
||||
rendered.should contain @member.location
|
||||
rendered.should contain @planting.crop_name
|
||||
rendered.should contain @planting.crop_system_name
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe "members/_location" do
|
||||
context "member with location" do
|
||||
before(:each) do
|
||||
@member = FactoryGirl.create(:london_member)
|
||||
render :partial => 'members/location', :locals => { :member => @member }
|
||||
end
|
||||
|
||||
it 'shows location if available' do
|
||||
rendered.should contain @member.location
|
||||
end
|
||||
|
||||
it "links to the places page" do
|
||||
assert_select "a", :href => place_path(@member.location)
|
||||
end
|
||||
end
|
||||
|
||||
context "member with no location" do
|
||||
before(:each) do
|
||||
@member = FactoryGirl.create(:member)
|
||||
render :partial => 'members/location', :locals => { :member => @member }
|
||||
end
|
||||
|
||||
it 'shows unknown location' do
|
||||
rendered.should contain "unknown location"
|
||||
end
|
||||
|
||||
it "doesn't link anywhere" do
|
||||
assert_select "a", false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@@ -94,7 +94,7 @@ describe "members/show" do
|
||||
end
|
||||
|
||||
it "shows the plantings in the garden" do
|
||||
rendered.should contain @planting.crop.name
|
||||
rendered.should contain @planting.crop.system_name
|
||||
end
|
||||
|
||||
it "doesn't show the note about random plantings" do
|
||||
|
||||
@@ -23,7 +23,7 @@ describe "plantings/_form" do
|
||||
|
||||
context "logged in" do
|
||||
it "orders crops alphabetically" do
|
||||
rendered.should =~ /#{@lowercase.name}.*#{@uppercase.name}/m
|
||||
rendered.should =~ /#{@lowercase.system_name}.*#{@uppercase.system_name}/m
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -27,9 +27,4 @@ describe "posts/index" do
|
||||
it "contains two gravatar icons" do
|
||||
assert_select "img", :src => /gravatar\.com\/avatar/, :count => 2
|
||||
end
|
||||
|
||||
it "contains RSS feed links for posts and comments" do
|
||||
assert_select "a", :href => posts_path(:format => 'rss')
|
||||
assert_select "a", :href => comments_path(:format => 'rss')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -17,7 +17,7 @@ describe "seeds/index" do
|
||||
|
||||
it "renders a list of seeds" do
|
||||
render
|
||||
assert_select "tr>td", :text => @seed1.crop.name, :count => 2
|
||||
assert_select "tr>td", :text => @seed1.crop.system_name, :count => 2
|
||||
assert_select "tr>td", :text => @seed1.owner.login_name, :count => 2
|
||||
assert_select "tr>td", :text => @seed1.quantity.to_s, :count => 2
|
||||
end
|
||||
|
||||
@@ -9,7 +9,7 @@ describe "seeds/show" do
|
||||
|
||||
it "renders attributes in <p>" do
|
||||
render
|
||||
rendered.should contain @seed.crop.name
|
||||
rendered.should contain @seed.crop.system_name
|
||||
end
|
||||
|
||||
context "tradable" do
|
||||
|
||||
Reference in New Issue
Block a user