Class: Stream::Tag

Inherits:
Base
  • Object
show all
Defined in:
lib/stream/tag.rb

Overview

Copyright © 2010-2011, Diaspora Inc. This file is

licensed under the Affero General Public License version 3 or later.  See
the COPYRIGHT file.

Constant Summary

Constants inherited from Base

Base::TYPES_OF_POST_IN_STREAM

Instance Attribute Summary collapse

Attributes inherited from Base

#max_time, #order, #publisher, #user

Instance Method Summary collapse

Methods inherited from Base

#aspect, #aspect_ids, #aspects, #can_comment?, #contacts_link, #contacts_title, #for_all_aspects?, #link, #people, #post_from_group, #stream_posts, #title

Constructor Details

#initialize(user, tag_name, opts = {}) ⇒ Tag


8
9
10
11
12
13
# File 'lib/stream/tag.rb', line 8

def initialize(user, tag_name, opts={})
  self.tag_name = tag_name
  self.people_page = opts[:page] || 1
  self.people_per_page = 15
  super(user, opts)
end

Instance Attribute Details

#people_pageObject

Returns the value of attribute people_page


6
7
8
# File 'lib/stream/tag.rb', line 6

def people_page
  @people_page
end

#people_per_pageObject

Returns the value of attribute people_per_page


6
7
8
# File 'lib/stream/tag.rb', line 6

def people_per_page
  @people_per_page
end

#tag_nameObject

Returns the value of attribute tag_name


6
7
8
# File 'lib/stream/tag.rb', line 6

def tag_name
  @tag_name
end

Instance Method Details

#display_tag_nameObject


19
20
21
# File 'lib/stream/tag.rb', line 19

def display_tag_name
  @display_tag_name ||= "##{tag_name}"
end

#postsObject


31
32
33
# File 'lib/stream/tag.rb', line 31

def posts
  @posts ||= construct_post_query
end

#tagObject


15
16
17
# File 'lib/stream/tag.rb', line 15

def tag
  @tag ||= ActsAsTaggableOn::Tag.named(tag_name).first
end

#tagged_peopleObject


23
24
25
# File 'lib/stream/tag.rb', line 23

def tagged_people
  @people ||= ::Person.profile_tagged_with(tag_name).paginate(:page => people_page, :per_page => people_per_page)
end

#tagged_people_countObject


27
28
29
# File 'lib/stream/tag.rb', line 27

def tagged_people_count
  @people_count ||= ::Person.profile_tagged_with(tag_name).count
end