From 8790c0a2b00b9e71c08d69c9c1d20036f5a2c3e1 Mon Sep 17 00:00:00 2001 From: cephLpod Date: Fri, 14 Dec 2012 16:07:29 -0600 Subject: [PATCH 1/3] Added crop count to Crops page --- app/views/crops/index.html.haml | 3 +++ spec/views/crops/index.html.haml_spec.rb | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/views/crops/index.html.haml b/app/views/crops/index.html.haml index f385ef4b4..762cd7923 100644 --- a/app/views/crops/index.html.haml +++ b/app/views/crops/index.html.haml @@ -1,6 +1,9 @@ - content_for :title, "Crops" - c = 0 +%p + = "Displaying #{@crops.length} crops" + %ul.thumbnails .row - @crops.each do |crop| diff --git a/spec/views/crops/index.html.haml_spec.rb b/spec/views/crops/index.html.haml_spec.rb index 855210826..6360bf20d 100644 --- a/spec/views/crops/index.html.haml_spec.rb +++ b/spec/views/crops/index.html.haml_spec.rb @@ -20,7 +20,12 @@ describe "crops/index" do assert_select "a", :text => "Maize" assert_select "a", :text => "Tomato" end - + + it "counts the number of crops" do + render + rendered.should contain "Displaying 2 crops" + end + context "logged out" do it "doesn't show the new crop link if logged out" do render From 2f36e9a0cc75488feb7f7a3b6fd1f1431cb7c473 Mon Sep 17 00:00:00 2001 From: cephLpod Date: Fri, 14 Dec 2012 16:11:37 -0600 Subject: [PATCH 2/3] Added member count to Members page --- app/views/members/index.html.haml | 3 +++ spec/views/members/index.html.haml_spec.rb | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/app/views/members/index.html.haml b/app/views/members/index.html.haml index 276e44f47..6b79e951a 100644 --- a/app/views/members/index.html.haml +++ b/app/views/members/index.html.haml @@ -1,5 +1,8 @@ = content_for :title, "Growstuff members" +%p + = "Displaying #{@members.length} members" + %ul.thumbnails - @members.each do |m| %li.span2 diff --git a/spec/views/members/index.html.haml_spec.rb b/spec/views/members/index.html.haml_spec.rb index 60ea5d5dc..ab91aa84f 100644 --- a/spec/views/members/index.html.haml_spec.rb +++ b/spec/views/members/index.html.haml_spec.rb @@ -27,4 +27,9 @@ describe "members/index" do rendered.should contain "bob" rendered.should_not contain "bob..." end + + it "counts the number of members" do + rendered.should contain "Displaying 2 members" + end + end From 5a81e90005f4ad7e5d50cd2a04ecaea48383a29c Mon Sep 17 00:00:00 2001 From: cephLpod Date: Fri, 14 Dec 2012 16:16:33 -0600 Subject: [PATCH 3/3] Added update counts to Updates page --- app/views/updates/index.html.haml | 5 ++++- spec/views/updates/index.html.haml_spec.rb | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/views/updates/index.html.haml b/app/views/updates/index.html.haml index 9818890d8..a98eaec2c 100644 --- a/app/views/updates/index.html.haml +++ b/app/views/updates/index.html.haml @@ -1,6 +1,9 @@ = content_for :title, "Recent Growstuff member updates" +%p + = "Displaying #{@updates.length} updates" + - @updates.each do |update| - = render :partial => "single", :locals => { :update => update, :subject => true } + = render :partial => "single", :locals => { :update => update, :subject => true } = link_to 'New Update', new_update_path diff --git a/spec/views/updates/index.html.haml_spec.rb b/spec/views/updates/index.html.haml_spec.rb index 591b53d1c..9be107d9e 100644 --- a/spec/views/updates/index.html.haml_spec.rb +++ b/spec/views/updates/index.html.haml_spec.rb @@ -29,4 +29,10 @@ describe "updates/index" do assert_select "div.update>div.update-body", :text => "MyText".to_s, :count => 2 end + + it "counts the number of updates" do + render + rendered.should contain "Displaying 2 updates" + end + end