lml / commontator

A Rails engine for comments
MIT License
353 stars 99 forks source link

2 Questions: pagination and date format #31

Closed sepalaur closed 10 years ago

sepalaur commented 10 years ago

Hi:

I have 2 questions: when I don't use commontator_thread_show at the controller the pagination works fine, but when I use commontator_thread_show I can't change the pages, don't know why,

The second: how can I change the format of the date? (posted at abr 17 2014 at 05:32PM UTC)

Thanks a lot

muerl commented 10 years ago

Re the second one, import the views and change them. (Atleast thats how I solved that problem last night)

Dantemss commented 10 years ago

I'll investigate the pagination issue tonight.

The date is in the locale. Here are the relevant entries:

en:
  commontator: 
    comment: 
      status: 
        created_at: "Posted on %{created_at}."
        updated_at: "Last modified by %{editor_name} on %{updated_at}."
  time: 
    formats: 
      commontator: "%b %d %Y at %I:%M%p %Z"
sepalaur commented 10 years ago

didn't see that, thanks...

sepalaur commented 10 years ago

Also I noticed that when you eliminate some comments, the pagination doesn't work so fine (i.e. 5 comments per page, if I had 6 coments and then eliminated 4, there still are 2 pages, and still says: Show comments (6) instead of Show comments (2)

Dantemss commented 10 years ago

Fixed everything in 4.6.0. There are lots of breaking changes in the config file, so I suggest regenerating it. Let me know if anything is wrong.

Also, the locale has a few different entries and a lot of views changed, if you customized those.

sepalaur commented 10 years ago

Now the paginations works fine, but I get the error:

undefined method `full_name' for nil:NilClass Extracted source (around line #51):

48: 49: 50: <%= t "commontator.thread.status.#{thread.is_closed? ? 'closed' : 'open'}", 51: :closer_name => Commontator.commontator_name(thread.closer) %> 52: 53: 54: <% if thread.config.comment_order == :l %> Trace of template inclusion: app/views/commontator/shared/_thread.html.erb, app/views/players/show.html.erb

When I try to use user.name in the initializers

Dantemss commented 10 years ago

Don't have full_name anywhere in the repo to the best of my knowledge. Maybe it's your user_name_proc erroring out? If it is, try this:

config.user_name_proc = lambda { |user| user.try(:full_name) || 'Anonymous' }
sepalaur commented 10 years ago

config.user_name_proc = lambda { |user| user.full_name }

works if I comment the line: https://github.com/lml/commontator/blob/master/app/views/commontator/threads/_show.html.erb#L51

Otherwise it gives me the error I said

Dantemss commented 10 years ago

Hm good point. I'll change this to not pass a nil user unnecessarily if closer is nil.

In the meantime, try the proc I suggested, as it handles nil users.

sepalaur commented 10 years ago

ok, thanks!

Dantemss commented 10 years ago

OK 4.6.1 no longer calls your user_name_proc with a nil user when the thread is open (I still recommend dealing with nil users in your user_name_proc). Closing this.