限制向用户显示的评论数量的好方法是什么,直到他们选择查看全部? [英] What is good way to limit the amount of comments shown to a user until they choose to view all?

查看:89
本文介绍了限制向用户显示的评论数量的好方法是什么,直到他们选择查看全部?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,模板中的每个循环都显示注释的位置。假设用户对他们发布的微博有50条评论。将显示一个显示50条评论的长列表。

Currently I have an each loop in the template for where the comments are display. Say a user has 50 comments to a micropost they have posted. A long list showing 50 comments will be displayed.

为了节省页面空间,我决定将每条微博的评论限制为2-3。如果用户希望查看更多内容,可以单击查看更多或查看全部。我想知道服务器如何应对如果有10,000条评论和用户点击查看全部这就是为什么我可以选择实施查看更多然后再显示50条评论

To save space on the page I've decided I'd like to limit comments shown to 2-3 per micropost. If a user wishes to view more they can click "view more" or "view all". I'm wondering how a server would cope if there were like 10,000 comments and a user clicked "view all" which is why I may choose to implement "view more" then have like 50 more comments shown"

无论如何,我想知道一种很好的方法来限制向用户显示的评论数量,直到他们选择全部查看?

如果我去jquery / js路由并且这样做只有2-3条最新消息被显示,其他消息仍然被加载回来结束它们不会是更好的选择如何在轨道上的红宝石中控制这个怎么样?

If I go the jquery/js route and make it so only the 2-3 most recent messages are shown the others would have still been loaded back end wouldn't they so wouldn't a better option be to control this in ruby on rails some how?

我真的很喜欢一些很好的解决方案/信息来做到这一点。

I'd really like some nice solutions/info on the best way to do this.

您需要的任何其他信息我很乐意提供。

Any further info you need I'd be happy to provide.

谢谢
亲切的问候

Thanks Kind regards

推荐答案

你可以像Facebook一样:

You can do like Facebook:


  • 仅显示2 / 3条评论。只从后端加载2/3条评论。

  • 当用户cli时cks显示更多,它显示了50多个。它通过AJAX加载它们。因此,在后端,您只会收到除了三个第一次获得50条评论之类的请求。

  • 显示另一个显示更多链接。它将加载50个其他评论,除了53个第一。

在Facebook上,您不能一次加载超过50条评论。我想你也应该这样做。

On Facebook, you can't load more than 50 comments at once. I think you should do the same.

这篇关于限制向用户显示的评论数量的好方法是什么,直到他们选择查看全部?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆