paginate blog comments; fix length/site on AR objects
This commit is contained in:
@@ -9,6 +9,7 @@ class BlogpostsController < ApplicationController
|
|||||||
|
|
||||||
def show
|
def show
|
||||||
@comment = Comment.new(blogpost: @post)
|
@comment = Comment.new(blogpost: @post)
|
||||||
|
@comments = @post.comments.page(params[:page])
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class UsersController < ApplicationController
|
|||||||
@users = User.where.not(id: User.first.id) #Remove first user
|
@users = User.where.not(id: User.first.id) #Remove first user
|
||||||
end
|
end
|
||||||
@users = @users.order("role_id desc", "confirmed desc", :name)
|
@users = @users.order("role_id desc", "confirmed desc", :name)
|
||||||
@count = @users.length
|
@count = @users.size
|
||||||
@users = @users.page(params[:page]).per(100)
|
@users = @users.page(params[:page]).per(100)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -17,9 +17,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="comments">
|
<div id="comments">
|
||||||
<h3><%= "#{pluralize(@post.comments.length, 'comment')}." %></h3>
|
<h3><%= "#{pluralize(@post.comments.size, 'comment')}." %></h3>
|
||||||
<% @post.comments.each do |c| %>
|
<% @comments.each do |c| %>
|
||||||
<%= render "comments/comment", c: c %>
|
<%= render "comments/comment", c: c %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<%= paginate @comments %>
|
||||||
<%= render "comments/new" %>
|
<%= render "comments/new" %>
|
||||||
</div>
|
</div>
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="replies">
|
<div id="replies">
|
||||||
<h3><%= "#{pluralize(@thread.replies.length, 'reply')}." %></h3>
|
<h3><%= "#{pluralize(@thread.replies.size, 'reply')}." %></h3>
|
||||||
<% @replies.each do |reply| %>
|
<% @replies.each do |reply| %>
|
||||||
<%= render partial: "threadreplies/reply", locals: {reply: reply} %>
|
<%= render partial: "threadreplies/reply", locals: {reply: reply} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<% users = User.seen(2.minutes) %>
|
<% users = User.seen(2.minutes) %>
|
||||||
<div id="footer">
|
<div id="footer">
|
||||||
<div id="online-users">
|
<div id="online-users">
|
||||||
<p>Users seen within the last two minutes: <%= users.length %></p>
|
<p>Users seen within the last two minutes: <%= users.size %></p>
|
||||||
<% users.each do |u| %>
|
<% users.each do |u| %>
|
||||||
<%= render partial: "users/username", locals: { user: u } %>
|
<%= render partial: "users/username", locals: { user: u } %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
Reference in New Issue
Block a user