Merge pull request #221 from pozorvlak/logged-out

Show community features on logged-in homepage.
This commit is contained in:
Skud
2013-06-04 05:56:03 -07:00
3 changed files with 10 additions and 33 deletions

View File

@@ -12,12 +12,8 @@ class HomeController < ApplicationController
# customise what we show on the homepage based on whether you're
# logged in or not.
@member = current_member
@plantings = current_member ?
current_member.plantings.limit(10) :
Planting.limit(10)
@posts = current_member ?
current_member.posts.limit(10) :
Post.limit(10)
@plantings = Planting.limit(15)
@posts = Post.limit(10)
respond_to do |format|
format.html # index.html.haml

View File

@@ -36,15 +36,6 @@
- if current_member == current_member && !current_member.is_paid?
= link_to "Upgrade and Support Growstuff", shop_path, :class => 'btn btn-primary'
.row
.span6
%h2 Your recent plantings
= render :partial => 'shared/recent_plantings'
.span6
%h2 Your recent posts
= render :partial => 'shared/recent_posts'
- else
.visible-desktop.visible-tablet
.hero-unit
@@ -52,17 +43,17 @@
.visible-phone
= render :partial => 'blurb'
- if @interesting_members
- if @interesting_members.present?
%h2 Some of our members
%ul.thumbnails
- @interesting_members.each do |m|
%li.span2
= render :partial => "members/thumbnail", :locals => { :member => m }
.row
.span6
%h2 Recent plantings
= render :partial => 'shared/recent_plantings'
.span6
%h2 Recent posts
= render :partial => 'shared/recent_posts'
.row
.span6
%h2 Recent plantings
= render :partial => 'shared/recent_plantings'
.span6
%h2 Recent posts
= render :partial => 'shared/recent_posts'

View File

@@ -62,16 +62,6 @@ describe 'home/index.html.haml', :type => "view" do
assert_select "a[href=#{url_for(@member.gardens.first)}]", "Garden"
end
it 'lists plantings' do
rendered.should contain "Your recent plantings"
assert_select "a[href=#{url_for(@planting)}]"
end
it 'lists posts' do
rendered.should contain "Your recent posts"
assert_select "a[href=#{url_for(@post)}]"
end
it 'shows account type' do
rendered.should contain "Free account"
end