diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index e6cec16a3..1aeb9a56c 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb @@ -1,6 +1,7 @@ # Copyright (c) 2010-2011, Diaspora Inc. This file is # licensed under the Affero General Public License version 3 or later. See # the COPYRIGHT file. +require File.join(Rails.root, 'app', 'models', 'acts_as_taggable_on_tag') class TagsController < ApplicationController skip_before_filter :which_action_and_user @@ -47,6 +48,8 @@ class TagsController < ApplicationController def show params[:name].downcase! @aspect = :tag + @tag = ActsAsTaggableOn::Tag.find_by_name(params[:name]) + @tag_follow_count = @tag.followed_count if current_user @posts = StatusMessage.owned_or_visible_by_user(current_user) @@ -74,5 +77,4 @@ class TagsController < ApplicationController end @tag_followed end - end diff --git a/app/models/acts_as_taggable_on_tag.rb b/app/models/acts_as_taggable_on_tag.rb new file mode 100644 index 000000000..8417f772a --- /dev/null +++ b/app/models/acts_as_taggable_on_tag.rb @@ -0,0 +1,5 @@ +class ActsAsTaggableOn::Tag + def followed_count + @followed_count ||= TagFollowing.where(:tag_id => self.id).count + end +end diff --git a/app/views/featured_users/_user.html.haml b/app/views/featured_users/_user.html.haml index f2cc5ff44..32ed238f9 100644 --- a/app/views/featured_users/_user.html.haml +++ b/app/views/featured_users/_user.html.haml @@ -5,7 +5,7 @@ .tags - person.profile.tags.each do |tag| - = link_to "##{tag}", tag_path(tag) + = link_to "##{tag}", tag_path(:name => tag.name) .add_user_to_aspect = render :partial => 'people/relationship_action', diff --git a/app/views/tags/show.haml b/app/views/tags/show.haml index c9590762c..3db8e4c54 100644 --- a/app/views/tags/show.haml +++ b/app/views/tags/show.haml @@ -57,6 +57,9 @@ = button_to t('.following', :tag => params[:name]), tag_tag_followings_path(:name => params[:name]), :method => :delete, :class => 'button red_on_hover tag_following in_aspects take_action' %h2 = "##{params[:name]}" + %small + = t('.followed_by') + = t('people', :count => @tag_follow_count) - if current_user = render 'shared/publisher', :selected_aspects => all_aspects.map{|a| a.id}, :aspect_ids => all_aspects.map{|a| a.id}, :for_all_aspects => true, :aspect => all_aspects.first diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index 5665e1cea..4f27b2637 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -804,7 +804,7 @@ en: follow: "Follow #%{tag}" following: "Following #%{tag}" stop_following: "Stop Following #%{tag}" - + followed_by: 'followed by' tag_followings: create: success: "Successfully following: #%{name}" diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 8fc08f19e..185dd14b9 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -32,6 +32,10 @@ h1, h2, h3, h4 :margin :bottom 5px + small + :font-size small + :color #999 + h1 :color #111