lml / commontator Goto Github PK
View Code? Open in Web Editor NEWA Rails engine for comments
License: MIT License
A Rails engine for comments
License: MIT License
Like kkdoo@debc76b but compatible with Rails 3.1 too.
Any plans to add a pagination feature? If not I'm going to take a look at doing this myself in a fork.
Line 16 of shared/_thread.html.erb
adds numbers and strings resulting in TypeError: String can't be coerced into Fixnum
subscription.unread + '/' + thread.comments.count
Currently there is no options for an Avatar. It's defaulted to use gravitar. I think there should be an option for a normal image that falls back to gravitar.
Is there a check that hides, or skip comments when the original owner or the comment editor is removed from the system?
I'm not sure I understand the installation instructions. I want the comments to appear on my commentable's show page. In my controller I have:
@note = Note.publishable.find(params[:id])
@comments = commontator_thread_show(@note)
Then in my view I have:
= commontator_thread(@comments)
But I get an error: "undefined method `thread' for true:TrueClass". (When I just put a link to the comments, it works fine.)
I have the gem running fine, but when I try to use: commontator_thread_show at the controller, I get the error:
Missing partial players/reply, application/reply with {:locale=>[:es], :formats=>[:html], :handlers=>[:erb, :builder, :coffee, :jbuilder, :axlsx, :wxlsx]}. Searched in:
Extracted source (around line #59):
56: <% end %>
57:
58: <% if thread.config.comment_order != :l %>
59: <%= render :partial => 'reply', :locals => {:thread => thread, :user => user} %>
60: <% end %>
Can you help me?
Is it allowable to make user reply on comments ?
and how ?
I can only edit the last comment that was posted. Is there any way for all comments to be edited (assuming that the current user is the one that created the comment)?
I've updated my gem and made the necessary modification. However I get an error when I try to view a page where there is comments and votes.
here is the error message:
Could not find table 'votes'
Problem comes from this line in the _votes.html.erb
<% vote = comment.get_vote_by(user) %>
my Githup repo here: https://github.com/cyzanfar/Photoshare
I just installed and I followed all of the instructions, but I'm getting this error. Here is the trace: app/controllers/posts_controller.rb:19:in `index'
here is my code that I added manually:
class PostsController < ApplicationController
def index
@posts = Post.includes(:user).all.sort_by &:created_at
@posts.reverse!
commontator_thread_show(@post)
end
def show
@post = Post.find(params[:id])
commontator_thread_show(@post)
end
Post and user models have acts_as_commontable and acts_as_commontator respectively.
my view (index.html.erb):
<%= render "global/new_post_form" %>
<% @posts.each do |post| %>
<%= post.user.name %>
<%= post.post_content %>
<%= commontator_thread(@post) %>
<% end %>
Thanks for any help!
with rails-4.0.1 with Devise and Cancan installed when try define config method on commontator.rb line 8.
Why i can not see the issue i posted here ?
How can it be possible to have communication here for this gem ?
Another great gem, auto_html parses text into links. Generally, its stored in the model of the text you wish to parse.
auto_html comes with a helper method that can be called from a view: <%= auto_html('url') {conditions} %>
Installing commontator alongside auto_html causes rails to throw a no-method error for auto_html. Removing commontator instantly fixes the error.
Is commontator using auto_html or any similar keywords that could be shared in scope?
I'm getting 4 test failures from a git clone.
Hi,
I have just installed your gem on an existing Rails app with a post model and a user.
The database has already some posts. And I guess no thread is created for existing post.
Is there a migration to create threads for existing models ?
Thanks
Hello, when I click on make a new comment, a form pops as usual. However, whenever I go to submit a new comment it says "comment could not be posted because the comment is a duplicate of another comment." Then when I go back to look the comment saves for some reason, but when i click on show comment it doesn't load.
I have a current_user with a username however its always showing up as Anonymous. I checked the commontator.rb file and noticed it has a default set to Anonymous however there isn't a way to change what field its look for on my current_user. Is there an easy way to do this?
I added a "label" field to the commontator comments. Now I want to filter the comments displayed by using a form to select the label. Could you please give me some directions on the best way to do that?
Thanks a lot
Any thoughts on implementing ancestry for nested comments? That would tip the scales and make this even more powerful out of the box than it already is.
Hi, I got this error. Im using rails 4.
Showing /Users/administrador/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/commontator-2.0.1/app/views/commontator/threads/_show.html.erb where line #39 raised:
uninitialized constant Commontator::Thread::Comment
Extracted source (around line #39):
Sometimes when I try to post a comment I get the following message:
"This comment could not be posted because of the following error:
Body has already been posted"
However, my comment still ends up being posted. Any ideas what is causing the error? Thanks!
I added the acts_as_votable
gem and changed the initializer configuration to config.comment_voting = :ld
Now when I want to show comments I get an Error undefined local variable or method``votes'
The problem seems to appear on here:
<% vote = comment.get_vote_by(user) %>
Do you have any idea why I get this error message?
Thanks!
i got this error :
GET http://localhost:3000/commontator/threads/1/comments/new 403 (Forbidden)
when i click 'new comment'
Can we have a model which acts_as_commentable
and each comment again acts_as_commentable
.
Hi,
I've installed the gem according to your instructions, including the acts_as_votable (+migrations) on my Rails 4.1.4 app. I have a model User that has acts_as_commontator. I have a model Recipe that has acts_as_commontable. On my view for RecipesController#show (that doesn't require a signed in user, but I've tested both ways anyway) I have <%= commontator_thread(@recipe) %>. After restarting the webserver, when trying to show a recipe I get the abovementioned error, linking to commontator (4.7.2) app/views/commontator/shared/_thread.html.erb.
On my server I see:
Rendered recipes/_step.html.erb (9.3ms)
Commontator::Thread Load (1.3ms) SELECT "commontator_threads".* FROM "commontator_threads" WHERE "commontator_threads"."commontable_id" = $1 AND "commontator_threads"."commontable_type" = $2 LIMIT 1 [["commontable_id", 7], ["commontable_type", "Recipe"]]
Recipe Load (0.5ms) SELECT "recipes".* FROM "recipes" WHERE "recipes"."id" = $1 LIMIT 1 [["id", 7]]
Commontator::Subscription Load (0.4ms) SELECT "commontator_subscriptions".* FROM "commontator_subscriptions" WHERE "commontator_subscriptions"."subscriber_id" = $1 AND "commontator_subscriptions"."subscriber_type" = $2 AND "commontator_subscriptions"."thread_id" = 1 ORDER BY "commontator_subscriptions"."id" ASC LIMIT 1 [["subscriber_id", 2], ["subscriber_type", "User"]]
(0.3ms) SELECT COUNT(*) FROM "commontator_comments" WHERE "commontator_comments"."thread_id" = $1 [["thread_id", 1]]
Rendered /Users/anon/.rvm/gems/ruby-2.1.2@app/gems/commontator-4.7.2/app/views/commontator/shared/_thread.html.erb (44.5ms)
Rendered recipes/show.html.erb within layouts/application (76.9ms)
Completed 500 Internal Server Error in 88ms
Any ideas? What other information can I provide you with to help find what could be the problem?
I had an issue that sounded similar to #47, but without the javascript error. If I changed config.new_comment_style
to :t
, it worked as expected.
I found out that the form was rendered, but hidden. It seems to me that this is because in app/views/commontator/threads/_reply.html.erb
, @new_comment
has not been set, even though commontator_set_new_comment
has been called via set_thread
due to the before_filter
in CommentsController
. I'm not sure whether @new_comment
is in a scope that should be visible to the form but I confirmed that it is nil in the form, hence the form being hidden.
It is also unclear to me what happens to the @comment
created in the new action of the CommentsController, so there seems to be some disconnect there.
Unfortunately I can't check this in a clean clone of your repo due to:
Bundler::GemspecError: Could not read gem at /Users/my_user/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/cache/actionview-4.1.8.gem. It may be corrupted.
An error occurred while installing actionview (4.1.8), and Bundler cannot continue.
Make sure that `gem install actionview -v '4.1.8'` succeeds before bundling.
Not sure what to do about that.
Hope this is helpful.
it just reload the page when click "new comment" without the form !
Hello, the error is:
Cannot modify association 'Movie#subscriptions' because the source reflection class 'Subscription' is associated to 'Commontator::Thread' via :has_many.
I think there is some model rails parameters (like has_many or belongs_to) to write on model(s) that are "commentable", but i'm not sure which can be.
undefined method `current_user' for #ProductsController:0xc73cce0
using the method:
def show
commontator_thread_show(@Product)
end
stops in
config/initializers/commontator.rb:15:in `block (2 levels) in <top (required)>'
the line
config.current_user_proc = lambda { |controller| controller.current_user }
How are threads created?
Hello gem creator,
I am having some issue here figuring out how to delete the comment completely after selecting the "delete" link. As for now, when I delete the comment it is still shown in my view as "comment deleted by ..." and I would like it to be completely deleted so that it doesn't show as a deleted comment in my view. I couldn't find anything in the documentation that deals with that. Any help?
thanks!
Hi,
I am wondering how to use Public activity to track the activity in commontator? I need to place the track command to the model of this commontator but I cannot find the commentator model anywhere.
Thank you very much
Love the gem.
But currently there is no option to show the 'add comment form' automatically when the page loads. Always have to click 'New Comment' to fetch the form, would love it if there was a config option to do this.
At the moment after digging around in the files I've had to do a botch job of copying the HTML there and displaying it on the page without commontator running it.
Mysql2::Error: BLOB/TEXT column 'body' can't have a default value.
:D
this happen.
Maybe due to the Devise and Cancan gem presence (or i don't know why).
Maybe same as an other issue read 10 days ago.. but not sure.
last version of Commontator updated.
After adding acts_as_votable
to my Gemfile, creating votes migration, restarting the server, following exceptions got fired from _votes.html.erb:
votes.where
throwsBasically it works perfectly fine when a user is logged in. However when I log out and go to a page with the commentator_thread(@pin) then it breaks with this message.
NoMethodError in PinsController#show
undefined method `is_commontator' for nil:NilClass
The controller currently is as follows
def show
respond_with(@pin)
commontator_thread_show(@pin)
end
And the view is as follows:
<div class="panel-body">
<%= commontator_thread(@pin) %>
</div>
It's pretty basic. My guess was that it requires a current_user to not be nil so my alternative to fixing it was to to just put an if statement to only show the comments if they are logged in but what if I want it to always be visible?
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
Hello,
i followed the "readme.md" on github gem page of commontator, but i think i can not understand this error (i'm a newbie on rails).
So... I'm on rails-4.0.1 with the commontator-4.2.
Maybe this can be an error from Devise or Cancan gem in association with commontator ? But i can not understand.
So... first, after install commontator, when try to go again on rails server (webrick), i had some error from ./config/initializer/commontator.rb on lines for config declaration (lignes: 8, 23, 32, 36, 77, 122, 135). For pass through, i had to make # for comment them out.
maybe it is not a bug, but i see nothing about this on google or stackoverflow. Could you provide some help or information about that, or can it be a bug from commontator ?
thanks.
(PS: when doing the code indicate after "development" indication... this erase all inside tables created before. Because... no update happen but create goes onside the other existed and erase all content tables. So... maybe it can be important for newbies to indicate this happen)
Sorry... i not understand the readme.rd file. When read #12 bug report, i understand.
The problemn was due tu the (commentable) who is in fact: the name of the variable define for the class controller of the designed with comments inside...
Again... i'm sorry for not been able to understand this.
Thanks for your great work.
i don't know why, but it is not possible to delete an entry due to some association/relationship with commontator.
Please, could you have an idea for resolve the problem ?
I have used this gem for my appliaction and its configured fine.
I have posts and on that each post comments will be given by users.These posts will be created by admin[rails_admin gem].
While creating new post by admin it is giving me following error:
ActionController::UrlGenerationError at /post/new
No route matches {:action=>"show", :controller=>"rails_admin/main", :id=>nil, :model_name=>"commontator~thread"}
Please help me on this?
Get rid of comment_name, verbs and timestamp format in config file. Use I18n instead.
Running commontator and it looks like the commontator controllers are finding my app's application controller instead of the commontator one.
maybe need to add require_dependency 'commontator/application_controller'
at the top of the controller files?
specifically my app was complaining that it couldn't find the get_thread
method called in a before_filter
before the CommentsController
's new
action.
When a user up vote a comment from 0 to +1 and then tries to up vote the same comment again, the view changes from +1 to 0. Same for down vote. Down vote the comment once (0 to -1), down vote the same comment again (-1 to 0).
I would like to allow users to only vote on a comment once whether up voted or down voted.
There are many many cases where current_user could return false instead of nil (Devise, Sorcery etc) do this. In the commontator_thread_show(commontable) method this line
raise SecurityTransgression unless (user.nil? || user.is_commontator)
breaks. Mainly because false.is_commontator breaks.
Hi,
I'm having a problem ordering the comments "earliest first". The gem does respects ordering by highest voted first in my app. Whenever I use config.comment_order = :ve (or :e), the comments with the same quantity of votes are still ordered with the most recently updated comment first. After going through the code, checking the method ordered_comments in https://github.com/lml/commontator/blob/master/app/models/commontator/thread.rb, I don't see:
a) code for handling :e within the case block;
b) a default ordering scope.
This means that when comment_order is either :e or :ve, the comments (with the same amount of votes for :ve) are going to presented in whatever order the database fetches them.
This leads me to believe that the gem, especially when config.comment_order = :e, is relying on the default ordering of the database, which I believe is a bad practice.
I'm using PostgreSQL on a Mac btw.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.