From c227c1179491a6ca950cda71b16a5b4cbeca4221 Mon Sep 17 00:00:00 2001 From: Skud Date: Tue, 14 May 2013 22:33:55 +1000 Subject: [PATCH 1/3] Added flickr icon, updated twitter icon --- Gemfile | 1 - Gemfile.lock | 2 -- app/assets/images/flickr_32.png | Bin 0 -> 2528 bytes app/assets/images/twitter_32.png | Bin 0 -> 1561 bytes app/views/devise/registrations/edit.html.haml | 1 + app/views/members/show.html.haml | 2 +- 6 files changed, 2 insertions(+), 4 deletions(-) create mode 100644 app/assets/images/flickr_32.png create mode 100644 app/assets/images/twitter_32.png diff --git a/Gemfile b/Gemfile index 3f4318236..3802d0dde 100644 --- a/Gemfile +++ b/Gemfile @@ -79,7 +79,6 @@ gem 'bootstrap-datepicker-rails' gem 'omniauth' gem 'omniauth-twitter' gem 'omniauth-flickr' -gem 'authbuttons-rails' # for phusion passenger (i.e. mod_rails) on the server gem 'passenger' diff --git a/Gemfile.lock b/Gemfile.lock index 35ab7f28b..6493ad58b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -29,7 +29,6 @@ GEM i18n (= 0.6.1) multi_json (~> 1.0) arel (3.0.2) - authbuttons-rails (0.1.2) bcrypt-ruby (3.0.1) bluecloth (2.2.0) bootstrap-datepicker-rails (1.0.0) @@ -233,7 +232,6 @@ PLATFORMS ruby DEPENDENCIES - authbuttons-rails bluecloth bootstrap-datepicker-rails bundler (>= 1.1.5) diff --git a/app/assets/images/flickr_32.png b/app/assets/images/flickr_32.png new file mode 100644 index 0000000000000000000000000000000000000000..82a350e221f874956e6a69f0c8ea28ce9f94ca73 GIT binary patch literal 2528 zcmcIlc~nzp7LTHqNyS0b7f@z+#Ckwl$Od8}L6Lw$Wf3Ba)=Eeo5Fv|6Ff0yB0R@q< zpr}|yDywA^Sp*aaf)a@Zi1 z$$}7gV+;XHY*ZbY>trV9F_r1!DHaZ;v!7;`*CS>Z%6>TL!L}F84ZFU z8e}raXlElEtPR&3@?sti;6aW7wp4n6H=W2p?>9x7_>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4}dNBK=d(15(b?kPhc5263jvWqjT=Z&?5R#?ZiR5W9fxeOCj}>@blAXN0 zjy!2=-HARiC~%7n#~DX8zlj8Fj#rD_uX))Vk9!?|v?%Z70Usmlt4Tf@c@etwaPP~m z9<1W2oE+`VwY8!w`?!q^xm?*bI{Y(l)yFp&$NW7m^njtb1N&l z<`rW3?A)2sb90Z3O5#7WJC!E+QfmCtH~&ZG)lseeCRd?=xgOd4z3clLrcGVSiwlE& z|DoCvc(SIhJ#Ax4@M2%)-gBdE2Hz0pWv^Z1V+}Q>UU>-JADn;ao82d^8EJ0JFZ1U) zYgE6v46SvW^-Pfa)*-GBQKCYN8uwiJN)4g^Z~j>&u(v2d4c*xpxKnzIe~n*qJIE;w zAJ4nL@8~d8&4ui zk*vwLUM~_ch{BTjj=?Qy8*V7Mg*bW9%kJQT n{)=H<{Vf+tEkk(eF^g+@^b*;X9tC1}xDi$swv?QMZr}X@_o@%6 literal 0 HcmV?d00001 diff --git a/app/assets/images/twitter_32.png b/app/assets/images/twitter_32.png new file mode 100644 index 0000000000000000000000000000000000000000..550232344362bdced8c0991dbd374edc57e53f61 GIT binary patch literal 1561 zcmV+!2Il#RP)aqr@}>8fPHmvY)$3D1Mts~kNcAc;4{=W9@rw4ybD%d-gv^94PPdY~gK*13Fad!l- z&~3M;~dofG67p>U0?{IPkU zfJmkiYN`b&F->Xgrb!dDp7y@5mn;`!Z!(940|=2Lu)Xh26eYelUh)wNFh0q)mzt{{ zAS^L6A&L}1v?qcsUJq9dcp@}`rfDU!sPe$h7zt1!<;5~&WHq)#DU!%pMWne!M0tqj zBO_0cRv{5i)bSE|4g$qVHh~B)O?5J=a4&Z?Xb;b?#hS)y{r`C12s#JHVkSjQbj8zm z5#VLUUWSK+ zbfS%-bYv9$%PH( zoDA;i^Q8GGy2Y}KfQqcZRboIXxla#_Vf#JJtYsapjZWgTTt5!|d&B5M*tx0|wLwIM ztuCF!?v0BePn^e*{MeM7LhNI{VWbfVw5CvE=^IVCe|;{GbAzM$a7#@UcCBm2=Z`Pf zHm~*swy>tRYOk#CKyrLSJGhh)P02Z@9E*Zd2?^FhNoMV3HJqQxV0mLrjIe_FtxbzV z!EV*+(kVRDm_}DwVBNfW9J+YjNpKV)V6`USj(%vf?!ghf$xu$$Dg~Raz47Gz_~xnA zAh!8LVMHU~EB|s$AcUtG`qpWPVrJ+m6mfI1{J$Tczw!mFu4ROM>x9IpJ0_6f^GRXe zAjctl3**Q!+#6czXUzO4hvau>FX4|X!#dm(b26HTbiDV*%bi(urdiu46n^g;X7fGV@WU_JkLALXV3DauR0j@inhqUV1ZPexUOrF0&6+ zx6Oy}l0l-QAWaM7jG+&N_UHcm+68E-PKC+FqR~BY6Q_D_+!6EMp)u?|bOs(nuA)jB z+iRr#Anap4pdTasm=KO$=*Nd!?&Am;W!ncieMM6Z9$VCON6aq|jpD^GkE6hjn`y3( ze2fgLjA+TMMFL1NxtfseAHlY-e#iTpS7GP+g)@TvaJCn(ANUP7%M$6vhJd0^&N~nk zG~^1P?4ZNLd4LK$?)d3XZ0)GW_Ki!hsVds?~Z z6(!?j1g?D}0k|GRQBwH&Tjx_*>)@qf9OyodmXyGQ9Zgu!P!r2!T~~*2@_Zi(94U!R z719k2@X}S9hPAVZJ@G-7McK&%B9;r_91px-a60be*$*s??CIB;(rsR*8tJ=IT4U0* zC{``FGhuU$=eYuq5kSPsSN9zc);(sHsVGJ49Wo_cSRhr@&mvY`d2pftD);N+GO&>j z2x|sS*s`JMWfc}6a)6alRZk+kSS3hMIAQ{x|rqnebC$ZPlpy8HfQF&fjEK>YYvELIKP8P1@m#y+WL%sd^ zwmDvaf=)`%CL!BZh?0aUoTGKqbtz}h>2S7lQ{w4r+RXWWTgJm+Z(m;VRtW6Ro$6c$ zu?FpJbK7R)+pz!2z!m11Q@n-#z}UQdEl*ya< "32x32", :alt => 'Flickr logo' - if @flickr_auth You are connected to Flickr as = succeed "." do diff --git a/app/views/members/show.html.haml b/app/views/members/show.html.haml index 44ec0aa5f..90e2a698c 100644 --- a/app/views/members/show.html.haml +++ b/app/views/members/show.html.haml @@ -25,7 +25,7 @@ - if @flickr_auth %p - Flickr: + = image_tag "flickr_32.png", :size => "32x32", :alt => 'Flickr logo' =link_to @flickr_auth.name, "http://flickr.com/photos/#{@flickr_auth.uid}" - if @member.show_email From ebd2446a3307f85b9036b3b269f06c515db6d3e0 Mon Sep 17 00:00:00 2001 From: Skud Date: Tue, 14 May 2013 23:24:06 +1000 Subject: [PATCH 2/3] added crop hierarchy basics --- app/models/crop.rb | 7 +++- app/views/crops/_form.html.haml | 5 +++ app/views/crops/show.html.haml | 13 +++++++ .../20130514124515_add_parent_to_crop.rb | 5 +++ db/schema.rb | 36 ++++++++++++++++++- spec/factories/crop.rb | 10 ++++++ spec/models/crop_spec.rb | 9 +++++ spec/views/crops/new.html.haml_spec.rb | 1 + spec/views/crops/show.html.haml_spec.rb | 19 ++++++++++ 9 files changed, 103 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20130514124515_add_parent_to_crop.rb diff --git a/app/models/crop.rb b/app/models/crop.rb index 99db0166c..105afe0b5 100644 --- a/app/models/crop.rb +++ b/app/models/crop.rb @@ -1,9 +1,14 @@ class Crop < ActiveRecord::Base extend FriendlyId friendly_id :system_name, use: :slugged - attr_accessible :en_wikipedia_url, :system_name + attr_accessible :en_wikipedia_url, :system_name, :parent_id + has_many :scientific_names has_many :plantings + + belongs_to :parent, :class_name => 'Crop' + has_many :varieties, :class_name => 'Crop', :foreign_key => 'parent_id' + default_scope order("lower(system_name) asc") validates :en_wikipedia_url, diff --git a/app/views/crops/_form.html.haml b/app/views/crops/_form.html.haml index a225c1a92..2b75de0b6 100644 --- a/app/views/crops/_form.html.haml +++ b/app/views/crops/_form.html.haml @@ -22,5 +22,10 @@ .controls = f.text_field :en_wikipedia_url %span.help-inline Link to this crop's page on the English language Wikipedia. + .control-group + = f.label :parent_id, 'Parent crop', :class => 'control-label' + .controls + = 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' diff --git a/app/views/crops/show.html.haml b/app/views/crops/show.html.haml index 8756bea56..f9a08a076 100644 --- a/app/views/crops/show.html.haml +++ b/app/views/crops/show.html.haml @@ -2,6 +2,19 @@ .row .span9 + - if @crop.parent + %p + = @crop.system_name + is a variety of + = succeed "." do + = link_to @crop.parent, @crop.parent + - if @crop.varieties.count > 0 + %p + Varieties of + = succeed ":" do + = @crop.system_name + != @crop.varieties.map{ |c| link_to c, c }.join(", ") + - if @crop.plantings_count > 0 %p Planted diff --git a/db/migrate/20130514124515_add_parent_to_crop.rb b/db/migrate/20130514124515_add_parent_to_crop.rb new file mode 100644 index 000000000..8a6019808 --- /dev/null +++ b/db/migrate/20130514124515_add_parent_to_crop.rb @@ -0,0 +1,5 @@ +class AddParentToCrop < ActiveRecord::Migration + def change + add_column :crops, :parent_id, :integer + end +end diff --git a/db/schema.rb b/db/schema.rb index 4c82164fe..024a15b7a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20130418102558) do +ActiveRecord::Schema.define(:version => 20130514124515) do create_table "authentications", :force => true do |t| t.integer "member_id", :null => false @@ -40,6 +40,7 @@ ActiveRecord::Schema.define(:version => 20130418102558) do t.datetime "created_at", :null => false t.datetime "updated_at", :null => false t.string "slug" + t.integer "parent_id" end add_index "crops", ["slug"], :name => "index_crops_on_slug", :unique => true @@ -120,6 +121,18 @@ ActiveRecord::Schema.define(:version => 20130418102558) do t.datetime "updated_at", :null => false end + create_table "orders", :force => true do |t| + t.string "member_id", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.datetime "completed_at" + end + + create_table "orders_products", :id => false, :force => true do |t| + t.integer "order_id" + t.integer "product_id" + end + create_table "payments", :force => true do |t| t.integer "payer_id" t.string "payment_type" @@ -128,6 +141,19 @@ ActiveRecord::Schema.define(:version => 20130418102558) do t.datetime "updated_at", :null => false end + create_table "photos", :force => true do |t| + t.integer "owner_id", :null => false + t.integer "flickr_photo_id", :null => false + t.string "thumbnail_url", :null => false + t.string "fullsize_url", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "title", :null => false + t.string "license_name", :null => false + t.string "license_url" + t.string "link_url", :null => false + end + create_table "plantings", :force => true do |t| t.integer "garden_id", :null => false t.integer "crop_id", :null => false @@ -155,6 +181,14 @@ ActiveRecord::Schema.define(:version => 20130418102558) do add_index "posts", ["created_at", "author_id"], :name => "index_updates_on_created_at_and_user_id" add_index "posts", ["slug"], :name => "index_updates_on_slug", :unique => true + create_table "products", :force => true do |t| + t.string "name", :null => false + t.string "description", :null => false + t.decimal "min_price", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "roles", :force => true do |t| t.string "name", :null => false t.text "description" diff --git a/spec/factories/crop.rb b/spec/factories/crop.rb index 4ae2367d0..76fd31433 100644 --- a/spec/factories/crop.rb +++ b/spec/factories/crop.rb @@ -30,6 +30,16 @@ FactoryGirl.define do system_name "Pear" end + # for testing varieties + factory :roma do + system_name "Roma tomato" + end + + factory :popcorn do + 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 diff --git a/spec/models/crop_spec.rb b/spec/models/crop_spec.rb index aca3d2681..bea69ed01 100644 --- a/spec/models/crop_spec.rb +++ b/spec/models/crop_spec.rb @@ -60,4 +60,13 @@ describe Crop do @crop = FactoryGirl.build(:tomato, :en_wikipedia_url => 'http://en.wikipedia.org/wiki/SomePage') @crop.should be_valid end + + context 'varieties' do + it 'has a crop hierarchy' do + @tomato = FactoryGirl.create(:tomato) + @roma = FactoryGirl.create(:roma, :parent_id => @tomato.id) + @roma.parent.should eq @tomato + @tomato.varieties.should eq [@roma] + end + end end diff --git a/spec/views/crops/new.html.haml_spec.rb b/spec/views/crops/new.html.haml_spec.rb index 4016a27a3..73e22dacc 100644 --- a/spec/views/crops/new.html.haml_spec.rb +++ b/spec/views/crops/new.html.haml_spec.rb @@ -14,6 +14,7 @@ describe "crops/new" do assert_select "form", :action => crops_path, :method => "post" do 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 end diff --git a/spec/views/crops/show.html.haml_spec.rb b/spec/views/crops/show.html.haml_spec.rb index 81099aabd..0b34be50e 100644 --- a/spec/views/crops/show.html.haml_spec.rb +++ b/spec/views/crops/show.html.haml_spec.rb @@ -44,6 +44,25 @@ describe "crops/show" do rendered.should contain "Springfield Community Garden" end + context 'varieties' do + before(:each) do + @popcorn = FactoryGirl.create(:popcorn, :parent_id => @crop.id) + @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.system_name + end + + it 'shows parent crop' do + rendered.should contain @ubercrop.system_name + end + + end + context "logged in and crop wrangler" do before(:each) do From bf9521b98bb7cd3ad21d25fb93d8295013e23166 Mon Sep 17 00:00:00 2001 From: Miles Gould Date: Thu, 16 May 2013 13:25:14 +0100 Subject: [PATCH 3/3] Fix "km miles of" typo. --- app/views/members/nearby.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/members/nearby.html.haml b/app/views/members/nearby.html.haml index cbcf51da6..059196ae2 100644 --- a/app/views/members/nearby.html.haml +++ b/app/views/members/nearby.html.haml @@ -7,7 +7,7 @@ = label_tag :distance, "Find members within", :class => 'control-label' = text_field_tag :distance, @distance, :class => 'input-mini' = select_tag :units, options_for_select({"miles" => :mi, "km" => :km}, @units), :class => 'input-small' - = label_tag :location, "miles of", :class => 'control-label' + = label_tag :location, "of", :class => 'control-label' = text_field_tag :location, @location = submit_tag "Search", :class => 'btn btn-primary'