homeland 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -16,7 +16,7 @@ module Homeland
16
16
  # GET /topics
17
17
  # GET /topics.xml
18
18
  def index
19
- @topics = Topic.last_actived.limit(10)
19
+ @topics = Topic.last_actived.limit(10).includes(:user)
20
20
  @sections = Section.all
21
21
 
22
22
  end
@@ -29,21 +29,13 @@ module Homeland
29
29
 
30
30
  def node
31
31
  @node = Node.find(params[:id])
32
- @topics = @node.topics.last_actived.paginate(:page => params[:page],:per_page => 50)
32
+ @topics = @node.topics.last_actived.includes(:user).paginate(:page => params[:page],:per_page => 50)
33
33
 
34
34
  render :action => "index"
35
35
  end
36
36
 
37
37
  def recent
38
- @topics = Topic.recent.limit(50)
39
-
40
- render :action => "index"
41
- end
42
-
43
- def search
44
- result = Redis::Search.query("Topic", params[:key], :limit => 500)
45
- ids = result.collect { |r| r["id"] }
46
- @topics = Topic.find(ids).paginate(:page => params[:page], :per_page => 20)
38
+ @topics = Topic.recent.limit(50).includes(:user)
47
39
 
48
40
  render :action => "index"
49
41
  end
@@ -51,8 +43,7 @@ module Homeland
51
43
  def show
52
44
  @topic = Topic.find(params[:id])
53
45
  @node = @topic.node
54
- @replies = @topic.replies.all
55
-
46
+ @replies = @topic.replies.all.includes(:user)
56
47
  end
57
48
 
58
49
  # GET /topics/new
@@ -1,4 +1,4 @@
1
- # coding: utf-8
1
+ # coding: utf-8
2
2
  module Homeland
3
3
  module ApplicationHelper
4
4
  def owner?(item)
@@ -6,22 +6,22 @@ module Homeland
6
6
  return if current_user.blank?
7
7
  item.user_id == current_user.id
8
8
  end
9
-
9
+
10
10
  def timeago(time, options = {})
11
11
  options[:class] ||= "timeago"
12
12
  content_tag(:abbr, time.to_s, options.merge(:title => time.getutc.iso8601)) if time
13
13
  end
14
-
14
+
15
15
  def user_name_tag(user,options = {})
16
16
  return "" if user.blank?
17
17
  link_to_if(Homeland.user_path_method, user.name, [main_app, user])
18
18
  end
19
-
19
+
20
20
  def user_avatar_tag(user)
21
21
  return "" if user.blank?
22
22
  img = image_tag(user.try(Homeland.user_avatar_method.to_sym))
23
23
  link_to_if(Homeland.user_path_method, raw(img), [main_app, user])
24
24
  end
25
-
25
+
26
26
  end
27
27
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: homeland
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-28 00:00:00.000000000 Z
12
+ date: 2012-06-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails