add a people count on tag page

This commit is contained in:
danielgrippi 2011-03-16 17:27:19 -07:00
parent abbf949fe1
commit a85b5bb70f
4 changed files with 15 additions and 5 deletions

View file

@ -24,6 +24,7 @@ class PostsController < ApplicationController
profiles = Profile.tagged_with(params[:tag]).where(:searchable => true).select('profiles.id, profiles.person_id') profiles = Profile.tagged_with(params[:tag]).where(:searchable => true).select('profiles.id, profiles.person_id')
@people = Person.where(:id => profiles.map{|p| p.person_id}).limit(15) @people = Person.where(:id => profiles.map{|p| p.person_id}).limit(15)
@people_count = Person.where(:id => profiles.map{|p| p.person_id}).count
@fakes = PostsFake.new(@posts) @fakes = PostsFake.new(@posts)
@commenting_disabled = true @commenting_disabled = true
@ -40,11 +41,11 @@ class PostsController < ApplicationController
I18n.locale = @person.owner.language I18n.locale = @person.owner.language
render "posts/#{@post.class.to_s.underscore}", :layout => true render "posts/#{@post.class.to_s.underscore}", :layout => true
else else
flash[:error] = "that post does not exsist!" flash[:error] = "that post does not exist!"
redirect_to root_url redirect_to root_url
end end
else else
flash[:error] = "that post does not exsist!" flash[:error] = "that post does not exist!"
redirect_to root_url redirect_to root_url
end end
end end

View file

@ -31,8 +31,6 @@
%h4 %h4
= new_request_link(@request_count) = new_request_link(@request_count)
%hr
- if @invites > 0 - if @invites > 0
.section.invite_friends .section.invite_friends
%h4= t('shared.invitations.invite_your_friends') %h4= t('shared.invitations.invite_your_friends')

View file

@ -33,7 +33,13 @@
.prepend-2.span-7.last .prepend-2.span-7.last
%h3 %h3
= t('.people_tagged_with', :tag => "##{params[:tag]}") = @people_count
%span{:style => "font-weight:normal"}
- if @people_count == 1
= t('.person')
- else
= t('.people')
.side_stream.stream .side_stream.stream
- for person in @people - for person in @people
.stream_element{:id => person.id} .stream_element{:id => person.id}
@ -43,3 +49,6 @@
=person_link(person) =person_link(person)
.info .info
= person.diaspora_handle = person.diaspora_handle
- if @people_count > 15
\...

View file

@ -404,6 +404,8 @@ en:
posts_tagged_with: "Posts tagged with #%{tag}" posts_tagged_with: "Posts tagged with #%{tag}"
nobody_talking: "Nobody is talking about %{tag} yet." nobody_talking: "Nobody is talking about %{tag} yet."
people_tagged_with: "People tagged with %{tag}" people_tagged_with: "People tagged with %{tag}"
people: "people"
person: "person"
profiles: profiles:
edit: edit: